Setting breakpoints with Kdevelop

Asked by manolo

I just installed Kdevelop 3.4.0 (using KDE 3.5.6) on my Ubunty Feist Fawn 7.04. I'm unable to debug my program. It compiles with no errors and executes with no errors. I need to check some variables value so I set some breakpoints in "for" loops, just on a "function call" line and so on. Unfortunately it doesn't seem to stop to breakpoints. When launching the debugger from Debug -> Start I can only see some messages in the bottom bar of the workbench, namely "Executing program" and then "Exited normally".

I have the same kind of problem with KDbg. That is, it seems not to stop to breakpoints.

So I think it can be a "makefile" problem. That's it http://pastebin.ca/502352
Someone said that makefile is not good to compile for gdb since "that makefile doesn't compile the sources, the -g and -O0 flags need to be used when creating the .o files from the source."

How to solve my problem?
Thanks in advance.

Regards.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu kdevelop Edit question
Assignee:
No assignee Edit question
Solved by:
manolo
Solved:
Last query:
Last reply:
Revision history for this message
Cesare Tirabassi (norsetto) said :
#1

I've never used Kdevelop, but when I debug my programs I insert the breakpoints DURING the debugging session (after I start gdb).
Perhaps Kdevelop is not able to do that automatically, so here also you have to define them during the debug session?

Revision history for this message
manolo (mac-man2005) said :
#2

Hi.

I'd be very pleased to get preciser informations about your proposal. I'm not so expert in makefiles and debugging. Anyway it seems you discard the hypotesis that the makefile I attached is not good.

Thanks for your reply.

Revision history for this message
Cesare Tirabassi (norsetto) said :
#3

Well Manolo, I'm not an expert either. The makefile is clearly not hand written but it does its job, the object files are created with debugging information.
Now, you won't be able to do anything with the -c in CFLAGS but I guess thats Kdevelop job (as well as when to make dependancies).
You see, I don't know Kdevelop but I guess that it is just a front end to the "real" stuff (gcc, gdb etc.).
When I do my debugging, I compile with gcc -g, then I run gdb on the executable. Before running the executable with gdb I set my breakpoints etc., then I run it with the "run" command, examine variables, etc. etc.
My guess is that in Kdevelop you should repeat the same sequence of events:

1) Compilation with debugging support (you are already doing this)
2) Start your executable with the debugger
3) Setting your breakpoints etc.
4) Running the executable through the debugger

From your description it seems that you swap 3) and 2). Now, if Kdevelop is not smart enough that it is actually passing your settings to gdb this would explain why its not working.

Revision history for this message
Best manolo (mac-man2005) said :
#4

Grazie Cesare :)

It seems the problem was just that -c flag!!!