When I compile same code with g++ with -o2 flag I can backtrace successfully without any Bogus adresses. Like;
0x08156079 in CItem::GetValue (this=0x3adb0f00, idx=0) at item.cpp:957
0x081b123c in quest::item_has_flag (L=0x3af9bdc0) at questlua_item.cpp:155
0x08363cba in luaD_precall (L=0x3af9bdc0, func=0x3b1cedd8) at ldo.c:249
0x0836ba86 in luaV_execute (L=0x3af9bdc0) at lvm.c:637
0x08363fad in resume (L=0x3af9bdc0, ud=0xffffa164) at ldo.c:337
0x0836393b in luaD_protectedparser (L=0x3af9bdc0, z=0x8363f80, bin=-24220)
....
But I need to use g++48 (with c++11) for better performance and other reasons... So, when I do same thing with -o3 optimize flag and g++48 I can't get any file names etc. Like;
#0 0x28a56f3c in ?? ()
No symbol table info available.
#1 0x00000032 in ?? ()
No symbol table info available.
#2 0xbfbf9838 in ?? ()
No symbol table info available.
#3 0x28a4ea3a in ?? ()
No symbol table info available.
#4 0x00000032 in ?? ()
No symbol table info available.
#5 0x00000004 in ?? ()
No symbol table info available.
#6 0x00000001 in ?? ()
No symbol table info available.
#7 0x28a70694 in ?? ()
No symbol table info available.
#8 0xbfbf969c in ?? ()
No symbol table info available.
#9 0x28a6b06c in ?? ()
No symbol table info available.
Which flags I must not use for debugging? (-fno-omit-frame-pointer) Which flags should I use for debugging? And reason... I'm not a SO expert.
With gcc 4.8 you can use -Og switch, to enable all optimizations that do not interfere with debugging.
Also make sure you enabled debug info (-g switch). If you updated your compiler to newer release, you should also update the debugger. Another thing you may try is to make sure gcc generates debug info in compatible format (try -gdwarf-2 or similar).
User contributions licensed under CC BY-SA 3.0