Bug 270967

Summary: Run command in the script makes kdevelop stuck
Product: [Applications] kdevelop Reporter: leon pollak <leonp>
Component: CPP DebuggerAssignee: kdevelop-bugs-null
Status: RESOLVED FIXED    
Severity: normal CC: niko.sams
Priority: NOR    
Version: git master   
Target Milestone: 4.2.0   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description leon pollak 2011-04-14 18:05:29 UTC
Version:           git master (using KDE 4.5.5) 
OS:                Linux

The bug was explained and located by Volodya Prus. below is his mail. But the code is still not corrected:
YES!!!!
It worked!
I commented the 'else' line and it started to work as required.

Volodya,
Thousands of thanks!

On Saturday January 22 2011, Vladimir Prus wrote:
> On Saturday, January 22, 2011 13:28:10 Leon Pollak wrote:
> > Volodya,
> > Excuse me, please, for tediousness - but please, only one sentence ...:-)
> > 
> > When, at what point are saved breakpoints inserted from kdevelop into
> > gdb? The rest I'll try to understand by myself...
> 
> Leon,
> 
> breakpoints are inserted in BreakpointController::sendMaybeAll, called from
> BreakpointController::slotEvent when it sees connected_to_program
> event.
> 
> That event, in turn, is raised in DebugSession::startProgram -- except that
> it's not raised in the branch that is taked when gdb startup script is
> specified.
> 
> It seems like the best solution is to lift
> 
>         queueCmd(new GDBCommand(GDBMI::FileExecAndSymbols, executable,
> this, &DebugSession::handleFileExecAndSymbols, true));
>         raiseEvent(connected_to_program);
> 
> code out of 'if' condition, so that it's always executed.
> 
> Hope this helps. I would like to be more helpful, but I've just got home
> after a nearly 24-hours travel, so would not be able to do much myself
> until at least Tuesday.
> 
> - Volodya


Reproducible: Didn't try
Comment 1 Niko Sams 2011-06-11 16:48:31 UTC
Please test this patch, does it fix the problem for you?

diff --git debuggers/gdb/debugsession.cpp debuggers/gdb/debugsession.cpp
index 32534e7..59528c2 100644
--- debuggers/gdb/debugsession.cpp
+++ debuggers/gdb/debugsession.cpp
@@ -1078,6 +1078,8 @@ bool DebugSession::startProgram(KDevelop::ILaunchConfiguration* cfg)
         queueCmd(new GDBCommand(GDBMI::NonMI, "source " + config_runGdbScript_.toLocalFile()));
 
         // Note: script could contain "run" or "continue"
+
+        raiseEvent(connected_to_program);
     }
     else
     {
Comment 2 Niko Sams 2011-07-02 10:41:38 UTC
Git commit 1dfdc080a39f570eb1298a9d0128d3e623063467 by Niko Sams.
Committed on 02/07/2011 at 12:28.
Pushed by nsams into branch 'master'.

Fix inserting breakpoints for remote debugging

the breakpoints are sent on connected_to_program event, which was not
raised when a gdb script was used

BUG: 270967

M  +3    -0    debuggers/gdb/debugsession.cpp     
M  +80   -0    debuggers/gdb/unittests/gdbtest.cpp     
M  +2    -0    debuggers/gdb/unittests/gdbtest.h     

http://commits.kde.org/kdevelop/1dfdc080a39f570eb1298a9d0128d3e623063467