Bug 318053 - [remote debug] Add "Attach to running process" mode
Summary: [remote debug] Add "Attach to running process" mode
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-debug-dsf-gdb (show other bugs)
Version: 7.0   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-25 17:39 EDT by Anna Dushistova CLA
Modified: 2020-09-04 15:18 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Anna Dushistova CLA 2010-06-25 17:39:18 EDT
With RSE, we have information on the running processes on the remote host as well as capability to launch commands remotely. This should allow us to perform the attach to remote process. I want to have this done for DSF first.
Comment 1 Marc Khouzam CLA 2010-06-25 21:58:28 EDT
Currently, with GDB 7.0 and higher, we can already attach to a remote process.  The user is first given a list of all processes, and she can choose which one to attach to.

What we don't do is start gdbserver ourselves.  Is that what you would like to do with RSE?  Is there something more you are suggesting we could do?
Comment 2 Anna Dushistova CLA 2010-06-26 04:04:04 EDT
(In reply to comment #1)
> Currently, with GDB 7.0 and higher, we can already attach to a remote process. 
> The user is first given a list of all processes, and she can choose which one
> to attach to.

That's interesting, I haven't seen that possibility. Which tab is it in?

> What we don't do is start gdbserver ourselves.  Is that what you would like to
> do with RSE?  

Yes, just like with the current remote launch. Actually I was thinking of calling "gdbserver --attach host:port <pid of process>" and then using the same code we already have for remote launch. And getting PID either from RSE or typed in manually. But I'd like to be in line with what you have now for this mode.
Any suggestions are welcomed.

>Is there something more you are suggesting we could do?

We also can contribute an action/command "Attach" to the RSE process, that will open up a prepopulated launch configuration dialog.
Comment 3 Marc Khouzam CLA 2010-06-28 09:12:54 EDT
(In reply to comment #2)
> (In reply to comment #1)
> > Currently, with GDB 7.0 and higher, we can already attach to a remote process. 
> > The user is first given a list of all processes, and she can choose which one
> > to attach to.
> 
> That's interesting, I haven't seen that possibility. Which tab is it in?

First start gdbserver 7.0 on the target machine like this
gdbserver --multi :9999

This makes gdbserver listen to a connection on port 9999 and will allow to debug any process.

Then choose the "C/C++ attach to application" and in the debugger tab choose the 'gdbserver' debugger.  Set the connection properly in that tab also.  You will get a launch with no process attached.  You can then click on the attach button in the debug view (green one) and you will get a list of processes you can attach too on the remote machine.

Note that you should use GDB 7.0 only as things are broken 
with GDB 7.1 (bug 311965)

> > What we don't do is start gdbserver ourselves.  Is that what you would like to
> > do with RSE?  
> 
> Yes, just like with the current remote launch. Actually I was thinking of
> calling "gdbserver --attach host:port <pid of process>" and then using the same
> code we already have for remote launch. And getting PID either from RSE or
> typed in manually. But I'd like to be in line with what you have now for this
> mode.
> Any suggestions are welcomed.

We didn't use that approach because we didn't have the remote process list.  Using the --multi option of gdbserver allows us to first connect and then get the remote process list.

> >Is there something more you are suggesting we could do?
> 
> We also can contribute an action/command "Attach" to the RSE process, that will
> open up a prepopulated launch configuration dialog.

That sounds interesting.  However, I'm wondering if it will be confusing for the user to have two concepts:
1- a launch for which you must choose the process after it has started
2- a launch for which you must choose the process before

I do like the idea of the user choosing a process and just say "Attach".  Maybe having the two is ok...

Can you try the existing one and let me know what you think?