Bug 97795 - bad crash will break debugger
Summary: bad crash will break debugger
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: CPP Debugger (show other bugs)
Version: 3.1.91
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
: 109546 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-01-24 15:34 UTC by Gav Wood
Modified: 2005-09-07 13:01 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gav Wood 2005-01-24 15:34:51 UTC
Version:           3.1.91 (using KDE 3.3.91 (beta1), Gentoo)
Compiler:          gcc version 3.4.3 (Gentoo Linux 3.4.3, ssp-3.4.3-0, pie-8.7.6.6)
OS:                Linux (i686) release 2.6.9-gentoo-r1

a bad crash in a debugged program (where e.g. the frame stack is corrupted) will result in an unusable debugger.

after such a situation, the debugger will start and stop as usual, but the program is not executed. none of the buttons are greyed out while it is "running".

restarting kdevelop appears to be the only way to reset the behaviour.
Comment 1 Jens Dagerbo 2005-02-09 09:15:24 UTC
Could you give some more details what is actually happening in gdb? Is the debugger fully stopped between attempts? Do you have a testcase, an example of how to reproduce this problem?

Also, please try the beta 2.. there was a debugger change some time ago, that could possibly fix this behaviour. I just can't remember when it went in...
Comment 2 Nicolas Castagne 2005-04-12 13:52:47 UTC
Still happen with Kdevelop 3.2.0 and KDE 3.3.2 , installed on RedHat. 
Seems to be a dupplicate of bug http://bugs.kde.org/show_bug.cgi?id=90459 . 

Here are details of what I oveserved.
Once my program has received a SIGSEV (segmentation fault) signal du ring debugging (a pop up window is displayed), I am **often** no more able to run the program within the debugger again. 
 
The gdb console prints out only : 
/bin/sh -c /home/castagne/DEVELOPPEMENT/genesiscore/debug/libtool gdb /home/castagne/DEVELOPPEMENT/genesiscore/debug/src/genesiscore -fullname -nx -quiet
(gdb) set edit off 
(gdb) set confirm off 
*** Warning: inferring the mode of operation is deprecated.
*** Future versions of Libtool will require -mode=MODE be specified.
Using host libthread_db library "/lib/tls/libthread_db.so.1".
(gdb) 
(gdb)

When entering a command for gdb in the gdb console input, nothing happens. 
The stack and disassemble windows are empty. 

Sometimes, the status bar (bottom of Kdev window) diplays "No program found". 
 
 
In order to debug the program again, a **usually correct** solution is to : 
 - stop explicitely the debugger 
 - remove all watches and breakpoints 
 - quit KDevelop 
 - rerun KDevelop. 
(well... sometimes this solution does not work, and I clean and rebuild the project). 
 
In case it could help, my program : 
 - is writen in C++ 
 - uses subprojects (and .a libraries) 
 - is linked against libwxBase and libpthread 
 - is ran in an external window 
 
 
See details in the forum : http://www.kdevelop.org/phorum5/read.php?2,27325,27325#msg-27325 
Comment 3 arne anka 2005-07-05 16:23:37 UTC
just want to add, that the same happens to me.
Comment 4 Jens Dagerbo 2005-07-24 12:02:28 UTC
*** Bug 109546 has been marked as a duplicate of this bug. ***
Comment 5 Vladimir Prus 2005-08-01 10:47:10 UTC
Can anybody provide a *minimal complete testcase* that reproduces this behaviour? I can get KDevelop in unusable state if gdb itself crashes (which I'll look at), but this bug seems to be about when program, not gdb, crashes.
Comment 6 Vladimir Prus 2005-09-07 13:00:57 UTC
SVN commit 458143 by vprus:

Prevent debugger from becoming unusable if gdb crashes.

When debugger issues any command, it wraps it in two markers, say:

   set prompt \032V
   set variable foo = bar

causes gdb to reply with
  \032V <output from the command> \032V

This allows the debugger to find output that correspond to any given command.
In the above example, if "set variable" command crashes the debugger, the
internal buffer for gdb output will contains just "\032V". That buffer was not
cleared, so after restart KDevelop would try to find the second \032V,
and never succeed. It looked like debugger is running, but user could not
enter any commands and all debugger actions did not work.

CCBUG: 97795


 M  +7 -0      gdbcontroller.cpp  


--- branches/KDE/3.5/kdevelop/languages/cpp/debugger/gdbcontroller.cpp #458142:458143
@@ -1458,6 +1458,13 @@
     delete dbgProcess_;    dbgProcess_ = 0;
     delete tty_;           tty_ = 0;
 
+    // The gdb output buffer might contain start marker of some
+    // previously issued command that crashed gdb (so there's no end marker)
+    // If we don't clear this, then after restart, we'll be trying to search
+    // for the end marker of the command issued in previous gdb session,
+    // and never succeed. 
+    gdbOutputLen_ = 0;
+
     state_ = s_dbgNotStarted | s_appNotStarted | s_silent;
     emit dbgStatus (i18n("Debugger stopped"), state_);
 }
Comment 7 Vladimir Prus 2005-09-07 13:01:58 UTC
The above commit fixes the only problem I know about. I assume it's exactly the same as reported here, so if anybody knows of any other case, reopen the bug.