Bug 422586 - [remote] No indication that gdbserver has died if we are not attached to a process
Summary: [remote] No indication that gdbserver has died if we are not attached to a pr...
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: 8.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 8.3.0   Edit
Assignee: Marc Khouzam CLA
QA Contact: Marc Khouzam CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-26 10:44 EST by Marc Khouzam CLA
Modified: 2014-01-08 11:06 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Khouzam CLA 2013-11-26 10:44:28 EST
If I do a remote attach session and then kill gdbserver before attaching to a process, the CDT session continues and becomes kind of local.

To see the problem:
1- start gdbserver on a different machine than here eclipse runs: gdbserver --multi :9999
2- start a remote attach session to that gdbserver on the remote host
4- press the connect button and notice what is running on the remote
5- press cancel (do not attach)
6- kill gdbserver
=> nothing is seen in eclipse except a very discrete "Remote connection closed" in the gdb console
7- press the connect button and notice that now, the list of processes is from the host and not the remote target!  GDB is doing some local debugging!

If we kill gdbserver when we are attached to a process, the entire session dies.  Maybe we should do the same thing in this case.
Comment 1 Marc Khouzam CLA 2014-01-03 15:56:33 EST
I suggest that we simply terminate the debug session if we loose the connection to the target.  Since there is no way to re-connect to a target in a running session, the user will need to start a new session anyway.  Terminating the current session will make it clear that debugging is no longer working.

I'll post a patch.
Comment 2 Marc Khouzam CLA 2014-01-06 06:42:43 EST
I posted a patch to gerrit:
https://git.eclipse.org/r/20286

The solution looks for "Remote connection closed" or "Ending remote debugging" in an out-of-band message, or as an error result to a command.  When such strings are seen we know we lost the remote connection and we terminate the session.

I've tested all-stop and non-stop for GDB >= 7.0.

A different error message is given for GDB 6.8 which is not covered by this solution.  However, this patch does not make this worse for 6.8, so I think it is fine.  I don't want to spend time on very old GDB versions.
Comment 3 Marc Khouzam CLA 2014-01-08 11:06:43 EST
Committed to master from Gerrit.