Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ptp-user] SDM with Python?

Hi Derek,

The short answer is no, the SDM does not support attaching to a process.

It would be great to add this feature, as quite a few people have asked for it over the years. Unfortunately the reason it hasn't been added before is that it is not trivial. This is because the SDM is meant for debugging a parallel program, and for these types of programs, processes may be located on different nodes of a distributed system, so locating and attaching to these is tricky to say the least.

Your case may be a bit simpler, since I think you just want to attach to a single process, and you know the location of the system the process is running on.

I think you'd need to do something like the following:

1. Modify the SDM to allow attaching to a process. This would involve adding an attach command that takes the executable location and process id that you want to attach to as arguments. Since the SDM is already running on the same host as the process you want to attach to, you should just be able to pass these arguments to the gdb attach command (the SDM uses gdb under the covers).

2. Provide a new launch type and launch delegate that supports attaching. The trick would be finding the process id of the process you want to attach to. I guess you could just provide a text box that lets you type in the PID, but it would be nicer to run a command on the remote system and let the user pick from a list.

3. You'd also need to modify the debugger frontend (the Eclipse part) to support the new attach mode, since it currently assume you're launching under the control of a debugger.

I'd be happy to provide more details if you'd like to take a shot at getting it working.

Regarding your question about debugging a Python process, I think you'd need to ask the PyDev people about this.

Regards,
Greg

On Mar 18, 2013, at 10:04 PM, Derek Wood <derek.a.wood@xxxxxxxxx> wrote:

> I have a programming project that uses GNURadio and I would like to use the Eclipse integrated debugger on it.  The GNURadio framework is built using two languages: Python/C++.  I have been able to do this by running Eclipse locally on the development machine, but not remotely.  Roughly 90% of the project that I recently joined is written in C++ and about 10% is in Python.  To execute my application, I run a python script that imports my C++ shared libraries.  The C++ shared libraries during compiling use SWIG to help with the import process (SWIG helps with things like converting data types between the two languages).
> 
> When using the Eclipse integrated debugger on the local machine, I use PyDev to start the python script with a breakpoint.  With the process paused, I attach to the running process.  I can set a breakpoint in the C++ code and then release the Python breakpoint.  Although not very slick, this allows me to step around in Python and C++.
> 
> I'm looking into using Eclipse from a remote machine.  If this wasn't complicated enough, I was hoping to go use Eclipse on Windows and execute the code on Linux.  I hear I may be able to use gdbserver and a SED hack to get the file paths between the two OS's to work out.
> 
> But I was hoping I could use PTP and SDM as the file paths part seems to be solved here.
> 
> So my questions are:
> 1) Can I use SDM to attach to a remote process?
> 2) Can I conveniently launch a remote Python process from Eclipse and have it attach to that process (perhaps even paused at the very beginning)?
> 
> If not, I am interested in helping out with the development effort for this if needed.
> 
> Thanks,
> 
> Derek
> _______________________________________________
> ptp-user mailing list
> ptp-user@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/ptp-user



Back to the top