Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 320839 - If gdb cannot be started for some reason, gdbserver doesn't get killed on target.
Summary: If gdb cannot be started for some reason, gdbserver doesn't get killed on tar...
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: 7.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 8.0   Edit
Assignee: Marc Khouzam CLA
QA Contact: Marc Khouzam CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-25 07:14 EDT by Anna Dushistova CLA
Modified: 2011-05-26 13:23 EDT (History)
4 users (show)

See Also:
marc.khouzam: iplog-
marc.khouzam: review? (ted)


Attachments
proposed solution (11.74 KB, patch)
2011-05-24 12:54 EDT, Anna Dushistova CLA
anna.dushistova: review?
Details | Diff
Another suggestion (2.79 KB, patch)
2011-05-25 16:13 EDT, Marc Khouzam CLA
marc.khouzam: iplog-
Details | Diff
Final fix (2.53 KB, patch)
2011-05-26 13:13 EDT, Marc Khouzam CLA
marc.khouzam: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anna Dushistova CLA 2010-07-25 07:14:48 EDT
Test case:
in the Debugger tab, change gdb to gdb1.
Launch the configuration.
It starts gdbserver, and later fails on starting gdb.
Launch doesn't get created, but gdbserver is still running on the remote host.
Maybe anyone has an idea how to fix this issue properly?
In our current implementation, we just launch gdbserver and our application and forget about them.
Comment 1 Marc Khouzam CLA 2010-07-26 08:52:26 EDT
This could probably also happen for other reason, like if a wrong version of GDB is used and it fails to connect to gdbserver; or maybe GDB will start but something else will fail in the launch before GDB connects to gdbserver.

I think the launch should kill gdbserver using RSE when it shutsdown.
Comment 2 Anna Dushistova CLA 2010-12-01 15:42:16 EST
Mark, do you have any idea maybe how to implement it properly?
Because in the remote launcher we launch the gdbserver and give control to the DSF/CDI CDT launcher and that's it.
Comment 3 Marc Khouzam CLA 2010-12-06 10:34:03 EST
(In reply to comment #2)
> Mark, do you have any idea maybe how to implement it properly?
> Because in the remote launcher we launch the gdbserver and give control to the
> DSF/CDI CDT launcher and that's it.

Can you store the remote pid?  Then you could use RSE to kill it.  But I've never really used RSE much, so I don't know what is possible
Comment 4 Anna Dushistova CLA 2010-12-06 10:36:43 EST
We can create a wrapper around the command and read the PID back,
I just thought maybe you have a better idea.

(In reply to comment #3)
> (In reply to comment #2)
> > Mark, do you have any idea maybe how to implement it properly?
> > Because in the remote launcher we launch the gdbserver and give control to the
> > DSF/CDI CDT launcher and that's it.
> 
> Can you store the remote pid?  Then you could use RSE to kill it.  But I've
> never really used RSE much, so I don't know what is possible
Comment 5 Anna Dushistova CLA 2011-05-24 12:54:20 EDT
Created attachment 196466 [details]
proposed solution

Here is the solution via "ps x". Marc, could you please take a look?
Thanks!
Comment 6 Marc Khouzam CLA 2011-05-25 16:13:00 EDT
Created attachment 196606 [details]
Another suggestion

How about this?  It simply destroys the process created by RSE.  I haven't done detailed tests, but it seems to work for simple tests at least.

I just did it for DSF-GDB as you can see.

What do you think?
Comment 7 Anna Dushistova CLA 2011-05-25 16:38:59 EDT
(In reply to comment #6)
> Created attachment 196606 [details]
> Another suggestion
> 
> How about this?  It simply destroys the process created by RSE.  I haven't done
> detailed tests, but it seems to work for simple tests at least.
> 
> I just did it for DSF-GDB as you can see.
> 
> What do you think?

Works for me, let's go this route.
Comment 8 Marc Khouzam CLA 2011-05-26 13:13:12 EDT
Created attachment 196681 [details]
Final fix

(In reply to comment #6)
> Created attachment 196606 [details]
> Another suggestion
> 
> How about this?  It simply destroys the process created by RSE.  I haven't done
> detailed tests, but it seems to work for simple tests at least.
> 
> I just did it for DSF-GDB as you can see.
> 
> What do you think?

Funny, the solution was already done for CDI.

I committed the attached patch to HEAD.
Comment 9 Marc Khouzam CLA 2011-05-26 13:14:18 EDT
Ted, can you review?
Comment 10 CDT Genie CLA 2011-05-26 13:23:09 EDT
*** cdt cvs genie on behalf of mkhouzam ***
Bug 320839 - If gdb cannot be started for some reason, gdbserver doesn't get killed on target.

[*] RemoteGdbLaunchDelegate.java 1.3 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/cross/org.eclipse.cdt.launch.remote/src/org/eclipse/cdt/launch/remote/launching/RemoteGdbLaunchDelegate.java?root=Tools_Project&r1=1.2&r2=1.3