[wingide-users] pid of the debugged process
support at wingware.com
Thu Jun 26 08:21:16 MDT 2008
Luc Bourhis wrote:
> I wish to write a script which would attach gdb to the python process
> that Wing debugs. At the moment, I have to manually enter the pid that
> appears in Wing's status bar as debugging starts into gdb. I'd like to
> automate that but I can't find a scripting way to get at that pid.
The following example script shows how to get the process id:
app = wingapi.gApplication
dbg = app.GetDebugger()
rs = dbg.GetCurrentRunState()
print "PROCESS ID", rs.fRunState._fActiveInfo.spawned_process.GetPid()
Note that spawned_process will be None if there is no debug process,
so you'ld want to check that first.
I'll add a method to the runstate to return this -- the last line above
is "reaching through" the API and thus not guaranteed to remain supported
(tho pretty unlikely to change too).
Thanks for pointing out this omission in the API.
Wingware | Python IDE
Advancing Software Development
More information about the wingide-users