Search code examples
c++eclipsedebuggingdebug-symbolsns2

Debugging symbols present, but eclipse does not associate them with source code


I am working on modifying a rather large program (NS2 network simulator), and it would be nice to be able to debug it with Eclipse. I configured the makefiles ( add -g to CFLAGS ) to make gcc generate the debugging symbols, and they are indeed generated, but Eclipse refuses to actually find the code associated with those symbols. I imported the HUGE folder of source code using the "Makefile Project with Existing Code", and when I hit "debug" it runs the program. When I tell the debugger to stop, it often stops in a method I recognize, but when i click on the method's name, it says "source not available" even though the source file where the method is defined is actually open in another tab. I do have all the sources imported into the project. Am I missing something in the make configuration?

^long confusing explanation, I know... see screenshot, : http://imageshack.us/photo/my-images/651/zzz1fu.jpg/

Note that IPKTAgent::deBurst() from the above screenshot is declared in integrated_agent.h -- that is the file I have open in the other tab.

also, when I expand the entry for the executable I'm debugging in the project explorer, it only lists some of the files it is composed of. What gives? (see screenshot, there should be more files on the list, the ones I'm working with are missing). screenshot: http://imageshack.us/photo/my-images/96/zzz2z.jpg/


Solution

  • Just tested it. Works for me. The only issue was that I forgot to add -O0 option to disable optimization; it can be an issue in your case too.

    What I can suggest:

    • Try to disable optimization
    • Check that compiler options you use are really applied. You use CFLAGS, but I see c++ in tags, so it is possible that you should use CXXFLAGS (it can depend on build tools you use)
    • IPKTAgent::deBurst() is declared in integrated_agent.h. But where is it implemented? Check that it is implemented in header and/or you can access to the source file where it is implemented.
    • Check that you can debug your executable with gdb
    • Try to create simple automake/autoconf based project and check that you are able debug it in gdb and eclipse. You should be able.