Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 343752 - Restart no longer works with GDB >= 7.0
Summary: Restart no longer works with GDB >= 7.0
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: 2011-04-25 13:09 EDT by Marc Khouzam CLA
Modified: 2011-05-06 19:19 EDT (History)
2 users (show)

See Also:
pawel.1.piech: review+


Attachments
Fix (2.57 KB, patch)
2011-04-30 14:20 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 Marc Khouzam CLA 2011-04-25 13:09:53 EDT
While fixing Bug 338319, I seem to have broken the Restart feature for GDB >= 7.0.

The reason seems to be that starting with GDB 7.0, when we restart a process, we get a =thread-group-exited event, which is translated to an IExitedEvent for a container, which will make use kill GDB, assuming the option to "kill gdb when the last inferior is gone" has been chosen.
Comment 1 Marc Khouzam CLA 2011-04-30 14:20:43 EDT
Created attachment 194428 [details]
Fix

Previously, this used to work because we only killed GDB if the inferior was marked as Terminated, which was done when getting an *stopped,reason="exited-normally" or the like from GDB.  We are no longer making use of that event.

So, what GDB does is the following.  When a process terminates, it sends an =thread-group-exited event, even if the process will be restarted.  However, the *stopped,reason="exited-normally" is only sent by GDB if the process terminates and will _not_ be restarted.  That seems to be the only way GDB informs us of the restart case.

So, one solution would be to not only trigger off an IExitedDMEvent but also on an MIInferiorExitEvent/MIInferiorSignalExitEvent to know that a process has exited and will not restart.  In that case it will be safe to kill GDB.  However, this approach is very dependent on this weird use of GDB events, which may even change in the future.

Instead, we can simply keep an internal flag to know that we are doing a restart.  This is what this simple patch does.

Committed to HEAD.
Comment 2 Marc Khouzam CLA 2011-04-30 14:23:08 EDT
Fixed.

Pawel, can you review?
Comment 3 CDT Genie CLA 2011-04-30 15:23:01 EDT
*** cdt cvs genie on behalf of mkhouzam ***
Bug 343752: Restart no longer works with GDB >= 7.0

[*] GDBProcesses_7_0.java 1.48 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java?root=Tools_Project&r1=1.47&r2=1.48
Comment 4 Pawel Piech CLA 2011-05-06 19:19:47 EDT
Seems logical to me.