Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 345751

Summary: [console] Inferior console does not get removed after a restart with GDB 7.0 and 7.1
Product: [Tools] CDT Reporter: Marc Khouzam <marc.khouzam>
Component: cdt-debug-dsf-gdbAssignee: Marc Khouzam <marc.khouzam>
Status: RESOLVED FIXED QA Contact: Marc Khouzam <marc.khouzam>
Severity: normal    
Priority: P3 CC: cdtdoug, pawel.1.piech
Version: 8.0Flags: marc.khouzam: review? (malaperle)
Target Milestone: 8.0   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Fix
marc.khouzam: iplog-
Update to follow bug 345749 marc.khouzam: iplog-

Description Marc Khouzam CLA 2011-05-13 11:57:01 EDT
When doing a restart operation with GDB 7.1, I see two inferior consoles, with the first one being marked as <terminated>.

With other version of GDB, that old console is properly removed.
Comment 1 Marc Khouzam CLA 2011-05-13 13:27:26 EDT
This happens for GDB 7.0 as well
Comment 2 Marc Khouzam CLA 2011-05-13 14:12:41 EDT
Created attachment 195616 [details]
Fix

The problem is because GDB 7.0 and 7.1 use the pid of the process as the groupId.  When we restart a process, we would look for the inferior that has the groupId==pid as an attribute.  For 7.0 and 7.1, that value was not known when we created the console, and is "", so we don't find it.

ConsolePageParticipant was already handling this properly by making a special check for an empty groupId, which indicates that we are not in the multi-process case, so we can remove that inferior directly.

Another issue that came up after I fixed the first one, is that, for 7.0 and 7.1,  after the restart, the new inferior would be tagged with the old groupId==pid, which was wrong, since the new instance of the process is going to have a new pid.

The attach patch takes care of both cases.

Committed to HEAD.
Comment 3 Marc Khouzam CLA 2011-05-13 14:15:45 EDT
Marc-Andre, can you review?  More console stuff.  Hopefully the comments in the patch are good enough to explain the reasoning.
Comment 4 CDT Genie CLA 2011-05-13 14:23:05 EDT
*** cdt cvs genie on behalf of mkhouzam ***
Bug 345751: Inferior console does not get removed after a restart with GDB 7.0 and 7.1

[*] StartOrRestartProcessSequence_7_0.java 1.11 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_0.java?root=Tools_Project&r1=1.10&r2=1.11
Comment 5 Marc Khouzam CLA 2011-05-13 18:18:34 EDT
I'm cancelling the review for now so I don't waste anyone's time.

Looking at Bug 345749 I now understand that I was not thorough enough when dealing with Restarts, when I made the change for multi-process.  Therefore the solution to this current bug may change by the time Bug 345749 is fixed.

I'll ask for a review when both bugs are fixed and the Restart case is properly handled.
Comment 6 Marc Khouzam CLA 2011-05-14 22:50:55 EDT
Created attachment 195657 [details]
Update to follow bug 345749

The fix can be simplified now that Bug 345749 has improved the situation.

Previously, for a restart, StartOrRestartProcessSequence_7_0 would have the container of the original process, so we had to be careful about using the right groupId.  Now, thanks to the fix of bug 345749, the container of the process that will be running after the restart is passed in to StartOrRestartProcessSequence_7_0, so the groupId has already been chosen properly.

Committed to HEAD.
Comment 7 Marc Khouzam CLA 2011-05-14 22:53:46 EDT
Marc-Andre, can you review this simpler fix?  Note that both patches have been committed, with the second updating the first.
Comment 8 CDT Genie CLA 2011-05-14 23:23:07 EDT
*** cdt cvs genie on behalf of mkhouzam ***
Bug 345751: Inferior console does not get removed after a restart with GDB 7.0 and 7.1.  Cleanup after the fix to bug 345749

[*] StartOrRestartProcessSequence_7_0.java 1.12 http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/StartOrRestartProcessSequence_7_0.java?root=Tools_Project&r1=1.11&r2=1.12