Editing source while debugging

Vladimir Prus ghost at cs.msu.su
Sat Dec 30 22:56:23 UTC 2006

I start to wonder what's the right thing to do if a user modifies a file while debugging.
In Java (Eclipse), the IDE tries to modify the running application with the new code, but
it's not possible for C++/gcc/gdb.

There's concrete problem. You have breakpoint set in KDevelop (and in gdb) and
foo.cpp:10. You add a line on top of the file. Kate moves the breakpoint marker
to foo.cpp:11. For the next debugger run, the gdb breakpoint will be set at foo.cpp:11,
but what to do for *this* debug session.

	1. Moving gdb breakpoint to foo.cpp:11 is not a good idea. As line
	11 in old foo.cpp, that's compiled into the currently debugged application,
	is not the same line as line 11 in new foo.cpp.
	2. If we don't move gdb breakpoint, and gdb stops on it, it will report
	line 10, while the actual code being executed is now at line 11.

It seems that after breakpoint is moved, debugging the application does not make
sense any more. Should we perhaps mark moved breakpoints in some way, disable
them, and enable only for the next debugger run?

- Volodya

More information about the KDevelop-devel mailing list