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.
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.
Created attachment 61856 [details] Patch to relax GDB restrictions on process attachment
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.
This seems to be a duplicate of both 87677 and 125513 which are planned to be implemented in 6.5
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).
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.
> 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.
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