Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development
(crush) debugging with gdb - infinit loop problem
DoMeN:
--- Quote ---http://developer.berlios.de/patch/?func=detailpatch&patch_id=1881&group_id=5358
Fix for Debugger termination crashes
--- End quote ---
I've tested this patch on Debian Etch with C::B nightly 3656 and two of other older versions. It doesn't fix the problem of crushing if program ends. I'm using a modified gdb but I doubt that this makes any difference in this case (but I'm not 100% shore :) ). Was this patch ment for "if program ends with execution and you click on stop button then it won't crush" or for "if program is still executing but is in an infinit loop then it won't crush when stop button is clicked" ? I am debugging firmvare programs so they never stop executing (they go in an infinit loop after return 0; in main function). Could this be causing crushes?
Domen
Pecan:
--- Quote from: DoMeN on March 01, 2007, 04:13:08 pm ---
--- Quote ---http://developer.berlios.de/patch/?func=detailpatch&patch_id=1881&group_id=5358
Fix for Debugger termination crashes
--- End quote ---
I've tested this patch on Debian Etch with C::B nightly 3656 and two of other older versions. It doesn't fix the problem of crushing if program ends. I'm using a modified gdb but I doubt that this makes any difference in this case (but I'm not 100% shore :) ). Was this patch ment for "if program ends with execution and you click on stop button then it won't crush" or for "if program is still executing but is in an infinit loop then it won't crush when stop button is clicked" ? I am debugging firmvare programs so they never stop executing (they go in an infinit loop after return 0; in main function). Could this be causing crushes?
Domen
--- End quote ---
The fix is intended to stop a crash when CB frees its gdb message parser while the parser is still processing output messages.
Your situation may be causing a different crash.
I don't even know how you get the stop button to stop on your example. I had to use killall to get CB to stop the debugger.
There's another bug in debuggergdb that always considers gdb to be in the "stopped" condition when a breakpoint was never set. So it will not stop an infinite loop that never had a breakpoint set.
But, if I set a breakpoint on the "while (1)", start the debugger, get the trap, clear the breakpoint, continue the loop; I can hit the stop button twice to stop the program. It crashes without the fix, but stops ok with the fix.
This is with:
Debugger name and version: GNU gdb 6.4.90-debian
--- Code: ---Breakpoint 1, main (args=1, argv=0xbfa0f424) at /home/pecan/proj/temp/test/main.cpp:8
/home/pecan/proj/temp/test/main.cpp:8:114:beg:0x804839c
>>>>>>cb_gdb:
> info program
Using the running image of child process 1652.
Program stopped at 0x804839c.
It stopped at breakpoint 1.
It stopped at a breakpoint that has since been deleted.
Type "info stack" or "info registers" for more information.
>>>>>>cb_gdb:
> cont
Breakpoint 1, main (args=1, argv=0xbfa0f424) at /home/pecan/proj/temp/test/main.cpp:8
/home/pecan/proj/temp/test/main.cpp:8:114:beg:0x804839c
>>>>>>cb_gdb:
> delete breakpoints 1
>>>>>>cb_gdb:
> cont
Program received signal SIGINT, Interrupt.
main (args=1, argv=0xbfa0f424) at /home/pecan/proj/temp/test/main.cpp:8
/home/pecan/proj/temp/test/main.cpp:8:114:beg:0x804839c
>>>>>>cb_gdb:
> quit
Hangup detected on fd 0
error detected on stdin
ParseOutput() closed m_State.Driver
--- End code ---
Pecan:
--- Quote from: DoMeN on March 01, 2007, 04:13:08 pm ---
--- Quote ---http://developer.berlios.de/patch/?func=detailpatch&patch_id=1881&group_id=5358
Fix for Debugger termination crashes
--- End quote ---
I've tested this patch on Debian Etch with C::B nightly 3656 and two of other older versions. It doesn't fix the problem of crushing if program ends. I'm using a modified gdb but I doubt that this makes any difference in this case (but I'm not 100% shore :) ). Was this patch ment for "if program ends with execution and you click on stop button then it won't crush" or for "if program is still executing but is in an infinit loop then it won't crush when stop button is clicked" ? I am debugging firmvare programs so they never stop executing (they go in an infinit loop after return 0; in main function). Could this be causing crushes?
Domen
--- End quote ---
--- Quote from: DoMeN on March 01, 2007, 04:13:08 pm ---I've tested this patch on Debian Etch with C::B nightly 3656 and two of other older versions.
--- End quote ---
What do you main by "Nightly". The patch is meant for SVN sources. You cannot apply a patch to a Nightly. They're binary.
The fix is intended to stop a crash when the stop button is hit while the program is executing an I/O operation or in a loop, CB frees its gdb message parser while the parser is still processing gdb output messages.
Your situation may be causing a different crash.
I don't even know how you get the stop button to stop on your loop example. I had to use killall to stop the debuggee because CB would not stop the debugger.
There's another bug in debuggergdb that always considers gdb to be in the "stopped" condition when a breakpoint was never set. So the stop button will not stop an infinite loop that never had a breakpoint set.
But, if I set a breakpoint on the "while (1)", start the debugger, get the trap, clear the breakpoint, continue the loop; I can hit the stop button twice to stop the program. It crashes without the fix, but stops ok with the fix.
This is with:
Debugger name and version: GNU gdb 6.4.90-debian
--- Code: ---Breakpoint 1, main (args=1, argv=0xbfa0f424) at /home/pecan/proj/temp/test/main.cpp:8
/home/pecan/proj/temp/test/main.cpp:8:114:beg:0x804839c
>>>>>>cb_gdb:
> info program
Using the running image of child process 1652.
Program stopped at 0x804839c.
It stopped at breakpoint 1.
It stopped at a breakpoint that has since been deleted.
Type "info stack" or "info registers" for more information.
>>>>>>cb_gdb:
> cont
Breakpoint 1, main (args=1, argv=0xbfa0f424) at /home/pecan/proj/temp/test/main.cpp:8
/home/pecan/proj/temp/test/main.cpp:8:114:beg:0x804839c
>>>>>>cb_gdb:
> delete breakpoints 1
>>>>>>cb_gdb:
> cont
Program received signal SIGINT, Interrupt.
main (args=1, argv=0xbfa0f424) at /home/pecan/proj/temp/test/main.cpp:8
/home/pecan/proj/temp/test/main.cpp:8:114:beg:0x804839c
>>>>>>cb_gdb:
> quit
Hangup detected on fd 0
error detected on stdin
ParseOutput() closed m_State.Driver
--- End code ---
DoMeN:
Sorry :D Ment svn sources.
DoMeN:
I experience a crush in debuggergdb.cpp: void DebuggerGDB::Stop() in this line -> wxKill(pid, wxSIGINT);
Is this a wxWidgets function or is it a c::b function? I can't find its body so I gues this is wxWidgets stuff. How can I debug this?
r. Domen
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version