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 191812 - NB does not allow debugging shared objects
Summary: NB does not allow debugging shared objects
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Debugger (show other bugs)
Version: 7.0
Hardware: PC Linux
: P2 normal (vote)
Assignee: Egor Ushakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-10 16:58 UTC by tbrunhoff
Modified: 2011-01-27 18:03 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
screenshot of the error in a newer version of the ide (133.12 KB, image/png)
2011-01-18 22:07 UTC, tbrunhoff
Details
gdb helper (660 bytes, application/x-sh)
2011-01-18 22:21 UTC, tbrunhoff
Details
gdb helper (16 bytes, application/octet-stream)
2011-01-18 22:22 UTC, tbrunhoff
Details
gdb log (2.86 KB, text/plain)
2011-01-19 23:27 UTC, tbrunhoff
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tbrunhoff 2010-11-10 16:58:03 UTC
In my particular project I have
 - a library built into an .so
 - a swig-generated python layer to provide access to the code in the library
Under GDB I just:
    gdb /usr/bin/python
    run ommovie.py

... and I can set breakpoints, step etc. Similar steps can be taken in VS 2010.

From the project I set up (project with existing source code), I cannot see a way to specify a binary to run (/usr/bin/python).

I've seen the project to build a shared library, but that's to build one from scratch.... the code already exists. Perhaps there's a simple solution that I can't see. Please help.
Comment 1 Egor Ushakov 2010-12-02 13:56:51 UTC
probably a duplicate of bug 124556, please reopen if not.

*** This bug has been marked as a duplicate of bug 124556 ***
Comment 2 tbrunhoff 2010-12-02 14:04:05 UTC
I agree. Its a dup.
Comment 3 tbrunhoff 2011-01-13 22:32:48 UTC
After some discussion, this is not a dup of bug 124556 because it merely said that run/debug were inactive for libraries. No longer true in 7.0.

The condition listed above remains. In particular:
 - if the "run command" in the "run" paragraph under project properties is set to a binary without symbols (e.g. /usr/bin/python), netbeans/gdb complains about "main" not being defined. This should not be an issue, because gdb sees when a shared library is loaded later and can set breakpoints then.
 - The closest I have come in starting up /usr/bin/python under netbeans appears to require that (a) I make the process sleep early on so I can (b) hit the pause button on netbeans. This gets me into python, and sometimes I hit a stack track I recognize, but netbeans seems unaware of the source code.
 - I can also start it up from a shell (and sleep) and then attach to it from within NB, but it still does not know about the sources.

With gdb alone, on the other hand, its a bit clunky, but it has no trouble with debugging and/or breakpoints. The setup involves the following:

    * gdb /usr/bin/python
    * run <tinyscript.py>
      the tiny script loads the module I want to debug and then exits. This is enough for gdb to see the symbols being loaded and allows me to...
    * <set various breakpoints>
    * run <scriptpy>

And things work well from there.
Comment 4 tbrunhoff 2011-01-13 22:33:32 UTC
Debugging is key to development: upping to P2.
Comment 5 Egor Ushakov 2011-01-14 13:44:05 UTC
could you please attach gdb-log of the session, I see where the problem is, just need to be sure, thanks!
Comment 6 Egor Ushakov 2011-01-14 14:57:06 UTC
with the fix of bug 193764 this bug may also be fixed, please verify
Comment 7 tbrunhoff 2011-01-18 22:07:01 UTC
Created attachment 105121 [details]
screenshot of the error in a newer version of the ide

With the new release (below), it still starts up the same way and gets nowhere. Here is a screenshot of the ide after starting the debugger. Note that it seems to be aware of the .so file, but my only option is to stop or restart the task. The debug external terminal never gets any output.

Product Version: NetBeans IDE Dev (Build 201101180000)
Java: 1.6.0_18; Java HotSpot(TM) 64-Bit Server VM 16.0-b13
System: Linux version 2.6.35.10-74.fc14.x86_64 running on amd64; UTF-8; en_US (nb)
Userdir: /home/toddb/.netbeans/dev
Comment 8 tbrunhoff 2011-01-18 22:21:06 UTC
Created attachment 105122 [details]
gdb helper
Comment 9 tbrunhoff 2011-01-18 22:22:16 UTC
Created attachment 105123 [details]
gdb helper
Comment 10 tbrunhoff 2011-01-18 22:23:37 UTC
I'm not sure why, but there are no gdb logs on my system. The command
  - find / -mount -name gdb-cmds\
produced nothing. Could this be part of the problem? However, if I look in /tmp
while the debugger is running, I can see the help scripts (attached above)
Comment 11 Egor Ushakov 2011-01-19 10:54:54 UTC
gdb log is no longer saved into a file, you can just copy paste it from debugger console (main menu/windows/debugger/debugger console)
Comment 12 tbrunhoff 2011-01-19 23:27:04 UTC
Created attachment 105180 [details]
gdb log

Attached is the current gdb log. Note that nothing happens after the error message about no "main" being defined.

Note also that this is a "project from existing sources" with the run command defined to be /usr/bin/python.
Comment 13 Egor Ushakov 2011-01-20 15:13:18 UTC
as a workaround try to start debugging with "step into" (from project context menu)
Comment 14 Egor Ushakov 2011-01-20 15:23:56 UTC
from the log I can see that python is not used as exec file for gdb, .so library is used instead, so it is not trying to run python at all, investigating...
Comment 15 Egor Ushakov 2011-01-20 15:31:25 UTC
What do you enter into the library run field?
I tried with simple library project and enter executable that uses it and it works fine. Please specify your project settings:
run, arguments, etc.
Comment 16 tbrunhoff 2011-01-20 16:14:26 UTC
> What do you enter into the library run field?

That's not available to me. The source code base I work on is a commercial embedded product with a 12 year history and about 1.5M lines of code. One part of that is a shared object built from about 0.5M lines of that code. The NB options include a dynamic library, and I have tried that option, but I have to lie to NB about the library and then add my existing sources. Once I do that, I cannot get enough control over the compile process (another bug I suppose) to generate the dynamic library the way I need to.

So instead I have used "project with existing sources", as I described above. In that case, the "run command" can be specified as /usr/bin/python.

I'm sure you have fixed the problem within the scope of the "dynamic libary" project. Unfortunately, I can't seem to get there from here.

Do you know of any recipes for creating a "dynamic library from existing sources" in NB? If not, perhaps we should close this bug.
Comment 17 Egor Ushakov 2011-01-21 10:43:06 UTC
aah, now I see :)
fixed in:
http://hg.netbeans.org/cnd-main/rev/43dcc19949a2
now we should always take file for debug from run command.
Comment 18 Quality Engineering 2011-01-22 06:18:04 UTC
Integrated into 'main-golden', will be available in build *201101220001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/43dcc19949a2
User: Egor Ushakov <gorrus@netbeans.org>
Log: fixed #191812 (NB does not allow debugging shared objects)