Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 340601 - Detaching from a process needs to stop a running program
Summary: Detaching from a process needs to stop a running program
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-03-21 14:54 EDT by Marc Khouzam CLA
Modified: 2011-05-02 13:45 EDT (History)
4 users (show)

See Also:
marc.khouzam: review? (ling.5.wang)


Attachments
Fix (2.90 KB, patch)
2011-04-03 21:45 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-03-21 14:54:15 EDT
This bug came up in Andrew's eclipseCon demo.  Sorry Andrew!

When we terminate an application using the terminate button, we first check if the program is running and interrupt it so it gets properly terminated.

We have to do the same thing when using the Disconnect button.  This needs to be done in IProcesses.detachDebuggerFromProcess().  Because we currently don't do that, if the user uses the Disconnect button while the program is running (in all-stop mode), the detach command will not get to GDB and the user thinks the command does not work.

Note that this is not a problem in non-stop because we can always send commands to GDB in that case.
Comment 1 Andrew Overholt CLA 2011-03-22 14:56:19 EDT
Thanks for catching this and knowing where the bug was, Mark :)
Comment 2 Marc Khouzam CLA 2011-04-03 21:45:28 EDT
Created attachment 192430 [details]
Fix

This fix interrupts the target before doing a detach from the process when in all-stop mode.

This will not work properly for multi-process because we don't restart the target after we have detached from the one process.  But all-stop does not work properly with multi-process yet anyway.  I will open a separate bug about it.

Committed to HEAD.
Comment 3 Marc Khouzam CLA 2011-04-03 21:48:07 EDT
Fixed.

Ling, can you review?  It is an extension of your solution of interrupting the target when doing a terminate.
Comment 4 Marc Khouzam CLA 2011-04-03 21:54:09 EDT
I have opened Bug 341735 to deal with the multi-process issue.
Comment 6 Ling Wang CLA 2011-05-02 13:45:06 EDT
(In reply to comment #3)
> Fixed.
> 
> Ling, can you review?  It is an extension of your solution of interrupting the
> target when doing a terminate.

Marc, I'm very sorry this fell through cracks as I've been busy with other stuff.

One issue I see in your fix is it does not take into account possible failure of the interrupt. Maybe we could use backend.interruptAndWait() with proper timeout, and report failure through the request monitor so that user can also get a feedback that Disconnect fails.