-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Execute GDB commands without typing "-exec" #106
Comments
I know this is not an answer for your question, but you may find this usefull:
|
Given the fact that the debugger GUI in Visual Studio code is still quite primitive and does not provide anything more than the basics, one still has to use native debugger commands in console quite intensely for non-trivial debugging. (really, even if you would have enough features in debug UI to rival Visual Studio debug commands would still be necessary IMO) Having to prefix a native debugger command with -exec is very cumbersome and greatly diminish the speed of ones work. |
The purpose of VSCode Debug Console is to evaluate expressions. In order to allow users to access more advanced features of gdb, we utilized the Debug Console to also communicate with GDB. To allow us to differentiate a GDB command vs an actual expression, we added the |
Alternatively, what about having the concept of different modes in the Debug Console?
There could even be a indicator in the UI to show what mode you are currently in. |
I assume you mean evaluate JS expressions. That all OK when you develop JS and totally inappropriate when you develop native (or really anything else than JS) code of any kind. I would go as far as saying your current design is broken:
I could go on but I think your current design is broken. That window should be context sensitive. i.e when having a native debugger attached it should accept native debugger commands. And all this is one string concatenation away. Please reconsider the design and make it work for the user, and not against him. As it is now, console gdb/lldb takes you further faster than dancing in VS Code. Context is king, and you really do have enough context to make this happen |
It would be nicer if the discriminator was shorter, like Consider that GDB/LLDB match prefixes (e.g. I could live with a single character. |
Frankly, I do not think is about competition, or mimicking it. It is plain and simple: do you support C/C++ debugging or not. Nobody in their right mind wants to type any type of prefixes when doing native debugging. The debugger integration should work for the user , not against it. As it is today C/C++ debugging is gimped into oblivion. When you debug native code you do not care about evaluation of JS/whatever else. Whats even worst is that there are no technical reasons to work as it does, so it must be some headstrong person on this team who insists he must be able to evaluate JS when debugging C++ with gdb, using a broken design and in effect ruining it for everybody but himself |
Does it really evaluate JS?! I think it's supposed to evaluate a C/C++ expression, like the gdb |
well i tried again today , and I was able to evaluate c/cpp expressions . When I tried first time, no, nada, not even $rax. its ok as it is now |
It works in the sense I am now able to directly eval C/C++ expressions , not typing GDB commands . try something like $rax to eval content of rax register or try to dereference a pointer, it should work. Its not perfect , but at least evals native |
@DanPartelly @9527KGG Thanks for continuing the conversation. The We added |
This would be great to resolve as I've also found the need to type {
"key": "ctrl+alt+e",
"command": "editor.action.insertSnippet",
"when": "inDebugRepl",
"args": {
"snippet": "-exec "
}
} That way Ctrl+Alt+e just inserts it for me. |
Wow, this is a very cool workaround. It works for me. Thanks! |
Having prepend all GDB console commands with
Would it be possible to flip it around and by default treat the input as GDB commands, except when the input starts with |
Trying to revive this thread. I also find it extremely annoying to type the characters and I am not satisfied with having to do a work around by maping it to a shortcut. Also, can we get variable autocompletion when pressing tab? Please? |
I would also find this fix to be extremely useful. Some sort of setting we could toggle to directly pipe commands to GDB and not to the VSCode REPL interface. Or allow extensions to override this. |
I think the last suggestion that was easy to implement would be to offer an alternative to would that be sufficient to get around this issue? The setting idea would require more work and probably wouldn't happen as quickly.
I'll see if there is a separate feature request for this and if not, i'll create one. |
Having the ` character as an alternative in the interim would certainly help but I'd still like to see some mode where we could directly talk to the debugger without prefacing commands (whether or not that entails adding a setting for the current debug console to differentiate between evaluating expressions in the target lang/debugger or providing a mechanism for debugging extensions to create and fully control their own console). This is one of the largest pain points for me when using this extension. |
I think this is the way that it is because the debug adapter protocol (DAP henceforth) only supplies a request for evaluating an expression in the debugged language. The debug console is hardwired to use that request and has no clean way to expose alternative command lines, such as the debugger's own CLI. It stands to reason that the A clean solution would need to see the DAP expanded to support exposing alternative CLI inputs, and VS Code's UI expanded with the appropriate widget to input them (Such as a combo selection between an expression or a debugger command in front of the debug adapter input box). |
This comment has been minimized.
This comment has been minimized.
I agree with what @penagos said,the ` character is certainly better than -exec, but it's still infinitely many more characters than not typing anything. Of course, beggars can't be choosers, if the ` character is the only feasible solution I'll be satisfied, but in an ideal world, using the integrated debug mode as one would a regular terminal for GDB would be a dream come true. |
@Makogan In a perfect world we would be able to tell the difference between an Eval request and a repl call within the debug adapter but with the way it was designed, we don't know this at all at the layer where we communicate with gdb. To change the behavior to allow for it to be a direct gdb terminal would require a major refactoring. |
@pieandcakes thanks for adding support for `. Instead of modifying the debug console to directly communicate with GDB would it be just as much work to invert what is classified as a debugger command? I.e. if I toggle invertREPLExec, <command> now maps to the debugger, and -exec <command> is evaluated as a REPL call? I personally never use the debug console to evaluate expressions (in C++). Instead I exclusively use it to interface with GDB. |
Yes, because in the depths of MIEngine it ends up going down the same evaluation path as normal watch windows because by design, this was supposed to be similar to a watch window request. As such, at the protocol level we don't have a good way to issue direct commands to the debugger and since it goes down the same path as a watch window request, there isn't a good way to invert the commands either. I looked into it as i thought it would be an easy item to add a flag and just flip it but because the bottom layer in MIEngine (which converts AD7 to MI) doesn't expose gdb commands to the upper layer (VS Code debug protocol to AD7) we don't have a way to do that today. It would be a major undertaking that we can take as a feature request but not something I can get out quickly as it would require extensive testing across our VS Code and VS surface area. |
I see; in looking at the interface between AD7/VSCode it does appear that the mechanism used to implement -exec requests, as you stated, was to extend the variable evaluation request, so hijacking that request likely isn't trivial. It would be great though if this could be considered on a future release! |
@Lectem Do you know if this is something that VS Code supports and we don't have it implemented? I can do some research when i have time. |
I honestly have no idea, but if it doesn't support it, it should! |
I extended the approach of rlivings39 above a bit by using the multi-comman extension To do this install multi command,
and this to keybindings.json
} Pressing enter to submit a command to gdb will now add -exec to the command prompt in preparation of the next command |
Great! This is the best solution currently. Life is easier. |
Have a related question, how to redo last command in debug console? I am using Mac and the arrow keys do not work. Thanks |
For using ` discriminator in debug console, there is one potential downside. I installed some extension (don't know which one it is for now), which automatically appends another ` after my input (probably it is assumed as string wrapper), then I need 2 other key strokes to delete the auto inserted "`" before typing command for gdb. |
I think we can have an option to switch the debug console between "GDB command mode" and "normal mode", just like what the extension |
Maybe you are typing ` in a json file, such as the |
No he's talking about the debug console. Same for me, 2 ` get added sometimes when you press. |
Simple solutions:
Anyone who thought that Also, when debugging with GDB, you must not steal focus from the command edit box to the current line in the source. We do: (Also, interactive debug usually involves a lot of script execution, and we need to source scripts left and right, directly into GDB.) |
Yes 💯 agreeing to @tfuto . The user experience when debugging currently is horrible... Using |
Why not create a 2nd GDB console for free user input? |
We definitely need a gdb console. 100% |
Is there a way to execute GDB commands without typing "-exec".
I find having to type "-exec" as a prefix to every GDB command cumbersome.
Perhaps a flag in the settings can be added to specify all commands in the GDB prompt to be interpreted as GDB commands only. This way there is no need to prefix GDB commands with "-exec".
The text was updated successfully, but these errors were encountered: