Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Debug Problem - No symbol table is loaded. Use the "file" command.
icon5.gif  Debug Problem - No symbol table is loaded. Use the "file" command. [message #1021210] Tue, 19 March 2013 17:08 Go to next message
Peter Wagner is currently offline Peter Wagner
Messages: 4
Registered: March 2013
Junior Member
Hello everyone!

I have difficulties, debugging a shared library in Eclipse (Nsight Eclipse Edition to be more precise).
The situation is a bit complex:
I'm working on a shared library. Compilation is done externally (with -g Option). This shared library is used by a 3rd party application which is executed by a python script.

To visualize the situation:
python script ------executing------> application -----accessing------> shared library object

The shared library object has a symbol table (i checked it with nm libwhatever.so).

In order to debug, I use a "C/C++ Attach to Application" Debug configuration. (I tried to specify the path to the shared library object in Debugger->Shared Librarys , but it didn't work, "Load shared library objects automatically" is active btw.)

When starting debugging, I do the following:
- Press Debug
- Press "New..." in the Select Process window
- Select /usr/bin/python and press ok
gdb tells me (for each breakpoint): No symbol table is loaded. Use the "file" command.
- Press F8 to start python
- Enter execfile("/path/to/3rdpartyapplication/start.py") in the python interactive console
- The 3rd party application starts now
- If I try to set a breakpoint now, gdb tells me again: No symbol table is loaded. Use the "file" command.

I'm not quite sure where this problem is coming from. Doesn't eclipse know which shared library object is used for debugging (as I said, I have to compile the shared library outside of eclipse, but the so-file is in the root directory of the project)? And if not, how can I tell eclipse? It seems to me as if eclipse doesn't tell gdb where to get the symbol table from...

I tried to replicate the situation with a small executable file which is using a very simple shared library object. I compiled both of them outside of eclipse and debugging worked fine in eclipse.

I'm not an expert in debugging and therefore I hope you can help me.

Thanks in advance!
Peter
Re: Debug Problem - No symbol table is loaded. Use the "file" command. [message #1021595 is a reply to message #1021210] Wed, 20 March 2013 11:15 Go to previous messageGo to next message
Peter Wagner is currently offline Peter Wagner
Messages: 4
Registered: March 2013
Junior Member
I think I'm getting closer to the core of the problem. The debugger is only attached to the python process and not to it's child process (the application that is using my shared library object)
It would be possible to start the application directly without the python-script, but in this case I need to start the application with an argument and I can't see how this can be done with eclipse.

Unfortunately in my case it's not possible to start the application outside of eclipse and attach dbg to it in Eclipse, as I'm using Ubuntu and get the following error message:
Quote:
Error in final launch sequence
Failed to execute MI command:
-target-attach 8696
Error message from debugger back end:
ptrace: Operation not permitted.
ptrace: Operation not permitted.

I'm not a root user and I can't login as root to change those restrictions.

Any ideas? Is it possible to tell eclipse/gdb to start an application with arguments somehow?

[Updated on: Wed, 20 March 2013 11:16]

Report message to a moderator

Re: Debug Problem - No symbol table is loaded. Use the "file" command. [message #1021637 is a reply to message #1021595] Wed, 20 March 2013 12:45 Go to previous messageGo to next message
Axel Mueller is currently offline Axel Mueller
Messages: 1952
Registered: July 2009
Senior Member
Quote:
but in this case I need to start the application with an argument and I can't see how this can be done with eclipse

http://help.eclipse.org/juno/topic/org.eclipse.cdt.doc.user/tasks/cdt_t_run_arg.htm



Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: Debug Problem - No symbol table is loaded. Use the "file" command. [message #1021806 is a reply to message #1021637] Wed, 20 March 2013 18:02 Go to previous messageGo to next message
Peter Wagner is currently offline Peter Wagner
Messages: 4
Registered: March 2013
Junior Member
Thanks for the help!

It's working for a minimal example at the moment and I hope it will be working for the big application, too.
First Eclipse didn't jump to the corresponding place, when gdb paused at a breakpoint, but somehow it seems to work now.

To get the "big application" running, it would be great to let gdb only load the symbol table of my shared library (otherwise the application is getting reaaally slow). Is there a way to do this? Or do I manually have to input "sharedlibrary mylib" after the application loaded my shared library? That would be really annoying. Hope there's a solution to this problem Smile
Re: Debug Problem - No symbol table is loaded. Use the "file" command. [message #1022756 is a reply to message #1021210] Fri, 22 March 2013 13:21 Go to previous message
Peter Wagner is currently offline Peter Wagner
Messages: 4
Registered: March 2013
Junior Member
Just an update in case someone with similar issues finds this thread:

Finally it's working! And here's how i did it. (Be careful, I did this with nsight, I'm not sure if it's all the same with regular Eclipse CDT)

In Debug Configurations I created a new C/C++ Application launch configuration.
I left the field "Project" empty and disabled auto build.

On the tab Arguments I did NOT enter the program arguments (it didn't work properly in my case, but there's another way to do this, see below)

On the tab Environment I selected all environment variables. I don't know why, but nsight starts cuda-gdb without any environment variables. Nsight doesn't even find cuda-gdb itself because $PATH is not defined when starting "Debug" (although nsight "knows" the environment variables, i checked this with a terminal plugin).

This brings us to the next tab Debugger: you have to input the full path to cuda-gdb.
On the sub-tab "Shared Libraries" you should uncheck "Load shared library symbols automatically" if you don't want cuda-gdb to load the symbols from all libraries automatically (this slowed down the application dramatically!). In my case
I did not have to define directories to shared libraries. Nsight does not tell cuda-gdb to load the symbols you select on the list btw. I still don't know if the "Select From List" has any effect at all.

On the tab Source i did not enter anything, but I think it should work. Instead I entered the source lookup paths in the ".cuda-gdbinit"-file. This file should be placed in the working directory (see "Arguments"-tab).


The .cuda-gdbinit file is called by cuda-gdb, but not right at beginning as you can see in the gdb traces.
If anyone is interested: Nsight starts cuda-gdb like this:
cuda-gdb --interpreter mi2 --nx


As I don't need the debug symbols of the application, i wrote the following in my cuda-gdbinit file:
define file
  exec-file $arg0
end

I set the application arguments with:
set args -foo

I defined the source directories with
directory /path/to/source
directory /path/to/another/source

I also defined a command which loads the symbols from my libraries
define sl
  sharedlibrary libmylib.so
  sharedlibrary libmylib2.so
  continue
end


All I have to do now, is press "Debug", wait for the application to load my libraries, suspend the application and call the sl command. Unfortunately I did not find a way to tell cuda-gdb to load the symbols from specific libraries automatically. Neither "catch load" nor python is implemented in the cuda-gdb.

This brings me to one question I still have:
Does anyone know, how to tell cuda-gdb to load symbols only from specific shared libraries automatically, without the use of "catch load" and python?

[Updated on: Fri, 22 March 2013 13:26]

Report message to a moderator

Previous Topic:Add Include working without a selection?
Next Topic:"Member declaration not found" but "Open declaration" is fine!
Goto Forum:
  


Current Time: Sat Sep 20 20:16:08 GMT 2014

Powered by FUDForum. Page generated in 0.01629 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software