| Debug Problem - No symbol table is loaded. Use the "file" command. [message #1021210]
||Tue, 19 March 2013 17:08
| Peter Wagner
Registered: March 2013
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!
|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
| Peter Wagner
Registered: March 2013
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:
I set the application arguments with:
I defined the source directories with
I also defined a command which loads the symbols from my libraries
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
Powered by FUDForum
. Page generated in 0.03126 seconds