gdb: internal error setting breakpoints
My program is compiled with the -g
flag. I am having the following problem:
1) I have set a breakpoint in a function that is in a header file.
The breakpo开发者_C百科int works. Now, when I go two level up, it is supposed to take me to a C file (Sizer.C:505). It does, but I get loads of warnings:
warning: (Internal error: pc 0xff6323 in read in psymtab, but not in symtab.)
warning: (Internal error: pc 0xff6324 in read in psymtab, but not in symtab.)
warning: (Internal error: pc 0xff6323 in read in psymtab, but not in symtab.)
warning: (Internal error: pc 0xff6323 in read in psymtab, but not in symtab.)
#2 0x0000000000ff6324 in SizePacketImpl<ZValue>::begin_x (this=warning: (Internal error: pc 0xff6323 in read in psymtab, but not in symtab.)
0x4888a88, bi=warning: (Internal error: pc 0xff6323 in read in psymtab, but not in symtab.)
0x56e6968) at Sizer.C:505
505 ASSERTo(...some parameters ....);
warning: (Internal error: pc 0xff6323 in read in psymtab, but not in symtab.)
2) If I NOW (after going two level up when program is in the break state) try to directly set breakpoint in Sizer.C
(gdb) break Sizer.C:504
warning: (Internal error: pc 0xff6323 in read in psymtab, but not in symtab.)
Breakpoint 3 at 0xff1bc7: file Sizer.C, line 504.
warning: (Internal error: pc 0xff6323 in read in psymtab, but not in symtab.)
The program does not stop at the breakpoint at all.
3) Just for completeness' sake: If I set breakpoint in Sizer.C before the program has run, I do not get the warnings, but the program still does not break.
I want to set breakpoints in Sizer.C. How can I debug and fix this issue?
This seems to be a bug in gdb. Check this page: http://sourceware.org/ml/gdb-patches/2003-01/msg00074.html for more details. What's the version of gdb that you are using? try to upgrade to the latest version and try again. Upgrading should fix you problem.
[Update]
I also found this link: http://sourceware.org/ml/gdb/2006-06/msg00123.html
Here a workaround is mentioned. try commenting the code as mentioned.
if (low == 0 && (bfd_get_file_flags (obfd) & HAS_RELOC) == 0) > return 0;
精彩评论