User forums > General (but related to Code::Blocks)
Set Next Statement (Debugging)
Ceniza:
There's a patch proposed for KDevelop that shows how to do it here.
Basically, the idea is to use two instructions:
tbreak filename:line
jump filename:line
I just tried with a very simple test file similar to yours and it works just fine.
It's probably not even that hard to add to the debugger plugin, plus a button in the toolbar and a menu entry. What's missing is an icon. Visual Studio uses a blue arrow. We could use a 50% red one instead :wink:
Adding drag&drop would be... I don't know. I haven't fiddled with that myself, neither have I toyed much with Scintilla.
BTW, now that I was testing that, wasn't there a proposal to have a field or a dockable window (with the field) for the "Send user command to debugger"? It's not like it's going to be the most used feature either, but it would be nice to have it too :D
Patches, as usual, are more than welcomed. If I have some more time today I may even give it a try.
Jenna:
--- Quote from: Ceniza on February 08, 2009, 11:36:18 am ---It's probably not even that hard to add to the debugger plugin, plus a button in the toolbar and a menu entry. What's missing is an icon. Visual Studio uses a blue arrow. We could use a 50% red one instead :wink:
--- End quote ---
It could also be implemented without a marker like "run to cursor". It can be called "jump to cursor".
We should be aware, that jumping can be dangerous:
--- Quote ---The jump command does not change the current stack frame, or the stack
pointer, or the contents of any memory location or any register other than the
program counter. If line linespec is in a different function from the one cur-
rently executing, the results may be bizarre if the two functions expect different
patterns of arguments or of local variables. For this reason, the jump command
requests confirmation if the specified line is not in the function currently exe-
cuting. However, even bizarre results are predictable if you are well acquainted
with the machine-language code of your program.
--- End quote ---
(quote from gdb-docs)
We need to parse the output of gdb and open a Yes-No-Messagebox if gdb requests confirmation.
Ceniza:
I just saw the message when trying to jump to another function. Having to interact like that with the debugger sucks.
About being dangerous... of course. It's like messing with the registers or the memory. In fact, it's messing with a register.
It doesn't really matter much if it's implemented the same way as "run to cursor" and calling it "jump to cursor". What's going to be nasty is having to parse GDB's output for yet another message.
thomas:
--- Quote from: jens on February 08, 2009, 01:03:18 pm ---We need to parse the output of gdb and open a Yes-No-Messagebox if gdb requests confirmation.
--- End quote ---
Oh please don't. Those stupid messageboxes all over are so darn annoying.
See, if someone jumps from an arbitrary location in the program to another arbitrary location, this is bound to yield unpredictable results. Every programmer should know that, since it's obvious, and if someone doesn't know, he shouldn't be programming. This is like editing memory pages of a running process in a hex editor... it may work fine, but it's an incredibly stupid thing to do, and if it blows off your right arm, then it's your own fault :)
So either the IDE should not have such a function at all, or it should require you to explicitely enable the button in the settings (with a warning, if you will). However, it should not warn you every single time you press the button, because the behaviour is so obviously undefined that you have to be able to figure yourself.
Jenna:
--- Quote from: thomas on February 08, 2009, 01:33:37 pm ---
--- Quote from: jens on February 08, 2009, 01:03:18 pm ---We need to parse the output of gdb and open a Yes-No-Messagebox if gdb requests confirmation.
--- End quote ---
Oh please don't. Those stupid messageboxes all over are so darn annoying.
See, if someone jumps from an arbitrary location in the program to another arbitrary location, this is bound to yield unpredictable results. Every programmer should know that, since it's obvious, and if someone doesn't know, he shouldn't be programming. This is like editing memory pages of a running process in a hex editor... it may work fine, but it's an incredibly stupid thing to do, and if it blows off your right arm, then it's your own fault :)
So either the IDE should not have such a function at all, or it should require you to explicitely enable the button in the settings (with a warning, if you will). However, it should not warn you every single time you press the button, because the behaviour is so obviously undefined that you have to be able to figure yourself.
--- End quote ---
You are right, that the user is responsible for what he is doing.
And if such a feature is used often it's really annoying to click away such a dialog box all the times.
But explicitley enabling this button in the setings, is something I don't like either, because it's not really intuitive.
But what's abaout an annoying dialog if it is used.
Than the user can decide if he wants to be warned the next time.
By the way, we set "confirm off", when we start gdb, so we wouldn't get this warning message in any cases.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version