Run gdb commands before connection #97#99
Run gdb commands before connection #97#99Gaswigue wants to merge 4 commits intoWebFreak001:masterfrom
Conversation
|
It would be cool if environment-directory and target-select could also be inside the autorunBeforeCmds array. In line 232 where you only have sendCommand right now you would need to add |
|
It cross my mind to do as you say. |
|
If you need any more help or suggestions, just push the code and I can use the github review feature. I think it's important to add this to SSH too, but you don't need to do that, that can be done in a separate PR or commit by me if you don't want to do it |
|
Ssh is not needed for me but I will code the improvement for this use case also. I have some other ideas ;) |
| this.miDebugger = new MI2(args.gdbpath || "gdb", ["-q", "--interpreter=mi2"], args.debugger_args); | ||
| this.initDebugger(); | ||
|
|
||
| private initiliaseDefaultValueArgs(args: CommonRequestArguments, attach: boolean) { |
There was a problem hiding this comment.
private initiliaseDefaultValueArgs(args: CommonRequestArguments, attach: boolean) {
New function to initialize unseted variable.
This avoid the launchRequest/attachRequest copy/past
There was a problem hiding this comment.
The other parts of the program spell it initialize instead of initialise, can you keep it consistent and change it to the american spelling?
| s => {return escape(s); | ||
| }); | ||
|
|
||
| args.autorunBefore = args.autorunBefore.map( |
There was a problem hiding this comment.
args.autorun = args.autorun.map(s => {return escape(s);});
Resolve \ escape in $(workspaceroot) if we use it to load binary from gdb (command load)
There was a problem hiding this comment.
don't use escape for this, it will put a \ before all other \ and " characters, this will manipulate user input and it will break all commands using " or \. I'm not quite sure what you mean with the workspaceroot.
There was a problem hiding this comment.
I have a set of commands to send to gdb after connection
"load ${workspaceRoot}\\bin\\binary.x"
if i don't escape the path is wrong it remove all the \
the final command is
"load c:somedirAsomedirB\bin\binary.x" and not c:\somedirA\somedirB\bin\binary.x
There was a problem hiding this comment.
I try to do
load ".\bin\binary.x" and it work. no need to use workspaceRoot. I can delete if needed this part.
WebFreak001
left a comment
There was a problem hiding this comment.
Looks like a good start, there were different commands depending if they were launch or attach, I need to check what this changes later, the PR shouldn't break any existing debugging configurations (so exactly the same commands should be sent if users don't provide custom commands). For example in lldb it is like that
| "description": "mago commands to be run before connection", | ||
| "default": [ | ||
| "gdb-set target-async on", | ||
| "environment-directory \"$cwd\"", |
There was a problem hiding this comment.
Just having $cwd without the quotes and instead adding the quotes in the replace function would be a better idea I think because it makes the default more clean and it's more obvious to the user because there are no random quotes around it.
| args = args.concat([executable], this.preargs); | ||
| else | ||
| args = this.preargs; | ||
| args = this.preargs; |
There was a problem hiding this comment.
there is a leading whitespace here
| protected launchRequest(response: DebugProtocol.LaunchResponse, args: LaunchRequestArguments): void { | ||
| this.miDebugger = new MI2_Mago(args.magomipath || "mago-mi", ["-q"], args.debugger_args); | ||
| this.initDebugger(); | ||
| private initiliaseDefaultValueArgs(args: CommonRequestArguments, attach: boolean) { |
There was a problem hiding this comment.
Format your changed files with the vscode typescript formatter (alt-shift-f or ctrl-shift-i depending on your platform) please
| autorunBeforeCmds.forEach(command => { | ||
| cmds.push(this.sendCommand(command)); | ||
| }); | ||
| cmds.push(this.sendCommand("file-exec-and-symbols \"" + escape(executable) + "\"")); |
There was a problem hiding this comment.
This is already in the autorunBeforeCmds
|
What is the state of this PR? Is it a draft? Is it abandoned? |
|
It's been a while...
Opinions? |
No description provided.