Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 241844 - [launch] Attach does not clear RunControl cache
Summary: [launch] Attach does not clear RunControl cache
Status: CLOSED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: 0 DD 1.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: DD 1.1   Edit
Assignee: Pawel Piech CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-23 13:27 EDT by Marc Khouzam CLA
Modified: 2014-01-29 21:49 EST (History)
3 users (show)

See Also:
cdtdoug: iplog-


Attachments
Started and Exited events from IProcesses (11.91 KB, patch)
2008-07-30 22:46 EDT, Marc Khouzam CLA
cdtdoug: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Khouzam CLA 2008-07-23 13:27:53 EDT
I noticed that when running a multi-threaded application to which we attach (local attach launch), the debug view shows a single thread numbered 0 instead of the proper list of threads.

It turns out this is because the threadListIds command is cached with no threads, and the cache is not cleared when we attach.

I think the runControl should listen to InferiorStartedEvent or something like that.
Comment 1 Pawel Piech CLA 2008-07-23 13:42:14 EDT
(In reply to comment #0)
> I think the runControl should listen to InferiorStartedEvent or something like
> that.
Yes.  I think MIProcesses service should issues IRunControl.IStartedDMEvent/IRunControl.IExitedDMEvent whenever a new debug context is created/destroyed as s result of an attach/disconnect or a new process being started with the debugger or exiting.  In 1.0 these events were combined with the inferior started/existed events, which made some sense because the only process being managed was the inferior process.  Now the GDBProcesses/MIProcesses service is going to need to manage the inferior processes, which may or may not have the debugger attached.  Because of this I guess it makes sense to have the option to separate these two events.
Comment 2 Marc Khouzam CLA 2008-07-30 14:21:29 EDT
(In reply to comment #1)
> (In reply to comment #0)
> > I think the runControl should listen to InferiorStartedEvent or something like
> > that.
> Yes.  I think MIProcesses service should issues
> IRunControl.IStartedDMEvent/IRunControl.IExitedDMEvent whenever a new debug
> context is created/destroyed as s result of an attach/disconnect or a new
> process being started with the debugger or exiting. 

I've started to work on this and ran into my first problem.
When detaching from a container, it makes sense, as you point-out, to issue an IExitedEvent.  The IExitedEvent requires an IExecutionDMContext.  However, the current interface for IProcesses.detachDebuggerFromProcess() takes an IProcessDMContext, which cannot provide the needed IExecution (Icontainer).

In truth, it would make sense for IProcesses.detachDebuggerFromProcess() to be passed an IContainer since the debugger should be attached to that process, and therefore, it should have an IContainer associated with it.

So, I suggest making IProcesses.detachDebuggerFromProcess() take an IDMContext and calling with something that has an IContainer as an ancestor.
Comment 3 Pawel Piech CLA 2008-07-30 14:44:56 EDT
(In reply to comment #2)
> So, I suggest making IProcesses.detachDebuggerFromProcess() take an IDMContext
> and calling with something that has an IContainer as an ancestor.
+1, makes sense to me :-)

Comment 4 Marc Khouzam CLA 2008-07-30 22:46:08 EDT
Created attachment 108803 [details]
Started and Exited events from IProcesses

This patch adds the started and exited events when attaching and detaching from a process.  I still left the connect/disconnect actions off for now, until multi-process is further along.

Committed
Comment 5 Marc Khouzam CLA 2008-09-18 15:01:53 EDT
This bug seems fixed to me.  I'm not sure why it was still open.
I think this went into M2 and not M1...

Pawel, can you verify?
Comment 6 Pawel Piech CLA 2008-09-18 18:18:46 EDT
Verified.
Comment 7 Pawel Piech CLA 2008-09-30 18:44:50 EDT
I guess I just forgot to mark it verified last time.
Comment 8 Pawel Piech CLA 2009-01-07 15:57:58 EST
DD 1.1 reelased!