Author Topic: GDB having problems setting breakpoints.  (Read 15508 times)

Offline zalzane

  • Single posting newcomer
  • *
  • Posts: 7
GDB having problems setting breakpoints.
« on: June 09, 2011, 11:11:08 pm »
So what I do is set a breakpoint inside this one constructor, and go to start debug. The full debug console then spews out this info:

Code
PATH=.;G:\Infinita\SDL-1.2.14\include;G:\Infinita\SDL-1.2.14\lib;O:\CodeBlocks\MinGW\bin;E:\Windows\system32;E:\Windows;E:\Windows\System32\Wbem;E:\Windows\System32\WindowsPowerShell\v1.0\
Command-line: O:\CodeBlocks\MinGW\bin\gdb.exe -nx -fullname  -quiet -args bin/Debug/Infinita.exe
Working dir : G:\Infinita\
> set prompt >>>>>>cb_gdb:
Reading symbols from G:\Infinita/bin/Debug/Infinita.exe...done.
(gdb) >>>>>>cb_gdb:
> show version
GNU gdb (GDB) 7.2
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-mingw32".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
>>>>>>cb_gdb:
> set confirm off
>>>>>>cb_gdb:
> set width 0
>>>>>>cb_gdb:
> set height 0
>>>>>>cb_gdb:
> set breakpoint pending on
>>>>>>cb_gdb:
> set print asm-demangle on
>>>>>>cb_gdb:
> set unwindonsignal on
>>>>>>cb_gdb:
> set debugevents on
>>>>>>cb_gdb:
> set new-console on
>>>>>>cb_gdb:
> set disassembly-flavor att
>>>>>>cb_gdb:
> catch throw
Catchpoint 1 (throw)
>>>>>>cb_gdb:
> source O:\CodeBlocks\share\codeblocks/scripts/stl-views-1.0.3.gdb
>>>>>>cb_gdb:
> directory G:/Infinita/
>>>>>>cb_gdb:
> tbreak "G:/Infinita/fileIO.h:39"
warning: (Internal error: pc 0x6b in read in psymtab, but not in symtab.)
warning: (Internal error: pc 0x6b in read in psymtab, but not in symtab.)
warning: (Internal error: pc 0x6b in read in psymtab, but not in symtab.)
warning: (Internal error: pc 0x6b in read in psymtab, but not in symtab.)
Temporary breakpoint 2 at 0x4219ff: file G:/Infinita/fileIO.h, line 39. (2 locations)
>>>>>>cb_gdb:
> run
gdb: windows_init_thread_list
[New Thread 4124.0x1590]
warning: (Internal error: pc 0x6b in read in psymtab, but not in symtab.)
warning: (Internal error: pc 0x6b in read in psymtab, but not in symtab.)
warning: (Internal error: pc 0x6b in read in psymtab, but not in symtab.)
warning: (Internal error: pc 0x6b in read in psymtab, but not in symtab.)
warning: (Internal error: pc 0x6b in read in psymtab, but not in symtab.)
warning: (Internal error: pc 0x6b in read in psymtab, but not in symtab.)
Warning:
Cannot insert breakpoint 2.
Error accessing memory address 0x6b: Input/output error.
>>>>>>cb_gdb:
> set debugevents off
>>>>>>cb_gdb:
> next
Warning:
Cannot insert breakpoint 2.
Error accessing memory address 0x6b: Input/output error.
Single stepping until exit from function ntdll!NtAccessCheck,
which has no line number information.
>>>>>>cb_gdb:
> next
Warning:
Cannot insert breakpoint 2.
Error accessing memory address 0x6b: Input/output error.
Single stepping until exit from function ntdll!NtAccessCheck,
which has no line number information.
>>>>>>cb_gdb:
> whatis method
No symbol "method" in current context.
>>>>>>cb_gdb:
> output method
No symbol "method" in current context.
>>>>>>cb_gdb:
> output method
No symbol "method" in current context.
>>>>>>cb_gdb:
> output method
No symbol "method" in current context.
>>>>>>cb_gdb:
> next
Warning:
Cannot insert breakpoint 2.
Error accessing memory address 0x6b: Input/output error.
Single stepping until exit from function ntdll!NtAccessCheck,
which has no line number information.
>>>>>>cb_gdb:

Now I've gone around and googled this for a bit, and apparently it has something to do with bad debugging symbols. I am unable to set breakpoints anywhere before the constructor in question, and if I set a breakpoint in the function directly after the constructor, the debugger will actually stop at the function *after* that function, making the constructor and the function after it impossible to debug. I'm sure the error is not in my code, as I have isolated the file and successfully debugged it in a separate project. Any input on what may be causing this issue?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: GDB having problems setting breakpoints.
« Reply #1 on: June 09, 2011, 11:40:55 pm »
Have you read this: http://wiki.codeblocks.org/index.php?title=Debugging_with_Code::Blocks
Keep in mind that newer GDB's work better with newer GCC's.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline zalzane

  • Single posting newcomer
  • *
  • Posts: 7
Re: GDB having problems setting breakpoints.
« Reply #2 on: June 10, 2011, 12:21:08 am »
After reading the wiki, I had a revelation as to what the cause of the problem may be, and was able to solve it, thank you.

For googlers: the issue seems to be that the file in question was a header file that had no associated c++ source file because I had implemented the class's functions in the header file itself. That made the compiler freak out and generate a precompiled header file for that header file. For some reason, any changes made to the original header file would not commit correctly, and the header would not recompile. The compiler noticed this problem, and threw out the debugging symbols for that file because it assumed them to be corrupt. This was fixed by deleting the .gch file and creating a c++ file for the header, and moving the function implementations into that file.