When stepping over a call to glFramebufferTexture2D, GDB ends up at a totally unrelated location.
This only happens when a valid GL context is active. Testing on a eVGA nVidia GeForce 570 GTX HD, with drivers v.301.42, although it happened on many other driver versions. Not sure if this happens with non-nVidia cards.
This problem started happening from GCC 7.2.
Tested with various MinGW GDB / GCC combinations:
Ran into problems mixing various GDB/GCC versions, where breakpoints won't even hit (Testing through Ecere IDE GDB integration).
GDB 7.1 does not seem to hit any breakpoint.
Here's the full table of results:
gdb 6.8 + gcc 4.4.0: works fine gdb 6.8 + gcc 4.6.2: breakpoints doesn't even hit gdb 7.0 + gcc 4.4.0: works fine gdb 7.0 + gcc 4.6.2: works fine gdb 7.1 + gcc 4.4.0: breakpoints doesn't even hit gdb 7.1 + gcc 4.6.2: breakpoints doesn't even hit gdb 7.2 + gcc 4.6.2: broken \(stepping over brings to bad line\) gdb 7.2 + gcc 4.4.0: broken \(stepping over brings to bad line\) gdb 7.3 + gcc 4.6.2: broken \(stepping over brings to bad line\) gdb 7.3 + gcc 4.4.0: broken \(stepping over brings to bad line\) gdb 7.4 + gcc 4.4.0: broken \(stepping over brings to bad line\) gdb 7.4 + gcc 4.6.2: broken \(stepping over brings to bad line\)
This bug report supersedes #3304426 where I was saying gdb 6.8 doesn't work with GCC 4.5.0+
I'll be sticking with GDB 7.0 (which luckily works with newer GCCs) until this is resolved.
See sample attached code which demonstrates the problem (using Ecere ( http://ecere.com/ ) to set up the OpenGL context and GLee ( http://elf-stone.com/getfile.php?title=GleeSrcTar ) to resolve glFramebufferTexture2D). Please use your favorite way to set up an OpenGL context if you don't wish to install Ecere .
You put a breakpoint on line 15, hit F10 (Step Over), and you end up with this call stack:
0 inside ??, C:\Windows\SysWOW64\nvoglv32.dll
1 inside __ecereMethod___ecereNameSpace__ecere__gui__Window_LoadGraphics, C:\Program Files (x86)\ECERE SDK\bin\ecere.dll
2 inside __ecereMethod___ecereNameSpace__ecere__gui__Window_Create, C:\Program Files (x86)\ECERE SDK\bin\ecere.dll
3 inside __ecereMethod___ecereNameSpace__ecere__gui__GuiApplication_Main, C:\Program Files (x86)\ECERE SDK\bin\ecere.dll
4 WinMain Function, obj\debug.win32\gdbGLTest.main.ec:101
Thanks!
-Jerome
Sorry it should read "This problem started happening from ***GDB*** 7.2".
Are your libraries and programs you want to debug compiled without optimization, -O0 with GCC/G++? If not, what you describe is a direct result of optimization.
Hi Earnie. Thanks for getting back to me quickly!
All my code is compiled with debug information and no optimization.
As we discussed before, -O0 is default for GCC. I'm specifying -g, and no -O.
I can place breakpoints and step over most function calls in my code.
I can even step over other OpenGL calls fine.
glFramebufferTexture2D in particular is problematic with 7.1+, but works with 7.0
There might have been other few specific calls over which I had trouble, I can't recall.
Regards,
Jerome
Since this appears to be a problem with GDB you'll need to file a bug report with them. Please update this issue with the GDB bug id.