PDA

View Full Version : debug



dkdd
May 2nd, 2011, 18:14
Hey!

I have a question. I was able to import the KeeperFX project into Eclipse CDT and then clean/build. I can create both builds standard and debug. I can also run the project from eclipse. But the problem appears when i try to debug the project. I setup breakpoints (lets say in main.cpp) in 'int main' but when i run in debug mode the execution does not stop in breakpoints. (if i create a simple helloworld program i can debug it!). So what's the problem? Should i be using debug SDL libs? Or is there any other trick?

oh, one more thing. If i check the checkbox 'stop in main' (in debug run settings), the program halts on 'main' but it says it can not find source code for main.cpp. (file paths are correct...)

mefistotelis
May 2nd, 2011, 21:18
The version which is named "debug" version doesn't really have any debugging symbols - that's why you can't debug it. I named it 'debug' version because it logs a lot of information into LOG file.

To use debugger, you have to compile sources with "-g" flag. Edit Makefile and add the " -g" at end of the line:

debug: DBGFLAGS = -DBFDEBUG_LEVEL=10

Then you will have a version with debug symbols (after doing "make debug").

dkdd
May 3rd, 2011, 08:56
hehe, i thought there was something wrong with the "debug" build... thanks! will try it in the evening

dkdd
May 3rd, 2011, 18:14
ok, now the debuging works sortof. debuger halts on breakpoint but stepping through the code behaves very oddly, like if i press 'step over' sometimes it does step to the next line and other times it jumps 1 (or more) line(s) above or skips a line below (a valid code line, not variable declaration), or jumps out of the function. am i still missing some flags or is this the best i'll get with dkfx?

mefistotelis
May 3rd, 2011, 18:20
Ahh right... You must also disable code optimizations (change "-O3" with "-O0") in Makefile.

dkdd
May 3rd, 2011, 20:34
excelent, works like a charm now. thanks!