This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 135721 - Allow to attach gdb to any process
Summary: Allow to attach gdb to any process
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Debugger (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Egor Ushakov
URL:
Keywords:
Depends on: 125513
Blocks: 159525
  Show dependency tree
 
Reported: 2008-05-23 16:59 UTC by _ zeled
Modified: 2009-06-25 10:59 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
Patch to relax GDB restrictions on process attachment (26.53 KB, text/plain)
2008-05-23 17:00 UTC, _ zeled
Details

Note You need to log in before you can comment on or make changes to this bug.
Description _ zeled 2008-05-23 16:59:24 UTC
It could be interesting to attach GDB to a running process which is not created using a C/C++ NetBeans project.
For example, I would like to attach GDB to JAVA process from my JAVA project in order to debug its JNI code.
GdbAttachPanel is far too restrictive to do that because it does not list processes which are not bound to a TTY (on my
Linux platform at least).
More over, GdbDebugger does not allow to attach to a process which is not carrying a MakeConfiguration in a NetBeans
project lookup.

The patch which follow relax these restrictions by adding 3 radio buttons to GdbAttachPanel (list processes bound to
TTY,  created by current user, or all processes). Along with filter combobox, it is rather easy to select running JAVA
process launched by a NetBeans JAVA project (filter on "jre/bin/java" for example).
GdbDebugger.attach() method has also been modified in order to create a dummy MakeConfiguration if none is provided by
the project lookup (which is the case when attaching to jre/bin/java). Too restrictive tests were also removed every now
and then to be able to complete GDB attachment.
Along with patch attached to issue #135715 and GDB 6.8 installed, I can fully debug by JNI code.

Best regards.
Eric.
Comment 1 _ zeled 2008-05-23 17:00:15 UTC
Created attachment 61856 [details]
Patch to relax GDB restrictions on process attachment
Comment 2 _ gordonp 2008-05-23 17:16:34 UTC
This is really a duplicate of 125513. I'm not closing as a duplicate because
I'll want to take a look at your attachment when I implement 125513.
Comment 3 Alexander Pepin 2008-05-27 12:20:21 UTC
This seems to be a duplicate of both 87677 and 125513 which are planned to be implemented in 6.5 
Comment 4 Quality Engineering 2008-08-09 03:42:52 UTC
Integrated into 'main-golden', available in build *200808090201* on http://bits.netbeans.org/dev/nightly/
Changeset: http://hg.netbeans.org/main/rev/131629edf547
User: Gordon Prieur <gordonp@netbeans.org>
Log: Attach to dynamic libraries (IZs #87677, #125513, #135721 and #125176). Preliminary work
making it work on Solaris (although not heavily tested).
Comment 5 Vladimir Kvashin 2008-10-24 17:20:10 UTC
I wouldn't agree this one is a duplicate.
Now when IDE is attaching, it checks, whether the application it's going to attach corresponds the IDE project.
As I understand, this IZ reads that it should be possible to attach to any process - without such check.
Comment 6 _ gordonp 2008-10-25 00:31:55 UTC
> As I understand, this IZ reads that it should be possible to attach to any process - without such check.

While I agree that it should attach to any process, gdb cannot find sources if I don't require
a project (with sources). When I tested the attach feature without a project, I didn't have
*any* process control because gdb couldn't find any symbols or sources.

This could change in a future gdb release (it could also change depending on gcc/g++ and/or
compile-time flags). I know dbx on Solaris doesn't have this limitation. Its also possible that
gdb on some platforms may do this correctly.

Comment 7 Egor Ushakov 2009-03-27 16:32:33 UTC
fixed in:
http://hg.netbeans.org/cnd-main/rev/4cb665859300

now we can attach to any process, warning message about incorrect executable does not finish the debugger session