Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem debugging with Eclipse CDT - Execution and GUI not aligned

I am using Eclipse CDT to debug a C++ project in Ubuntu. The GUI, i.e the small arrow showing the next line of source code to be executed, is not aligned with the actual execution. Specifically, it is about 30 lines below the actual executing line. I'm identifying what the actual line is by examining values of local variables and when they change.

I have tried cleaning the project several times, including manually deleting all compiled object-codes, libraries etc., in hope that it will cause Eclipse to update itself, but it insists on showing the wrong line.

Any help is appreciated.

like image 252
Itamar Katz Avatar asked Aug 15 '11 13:08

Itamar Katz


2 Answers

It seems pretty likely that the source that Eclipse is showing, and the source that was actually used to compile the executable are different versions of the same file.

You can ask GDB (Eclipse has a console window for GDB) what source was actually used to build the executable, and where GDB found the source it is showing (to Eclipse) with info source GDB command. I bet the Compilation directory + Current source file != Located in.

like image 190
Employed Russian Avatar answered Nov 02 '22 19:11

Employed Russian


Check your executable is up to date. For some reason the makefile eclipse generates doesn't include dependencies on static libraries. If you are using static libraries as part of your project, you may need to rebuild them manually.

like image 30
Rob Avatar answered Nov 02 '22 20:11

Rob