code-debug icon indicating copy to clipboard operation
code-debug copied to clipboard

Run gdb commands before connection

Open Gaswigue opened this issue 8 years ago • 8 comments

With Renesas RX gdb (embedded system - remote GdbServer). We need to provide gdb commands before to make the connection.

For example "-gdb-set non-stop on" and only after we can use "target extended-remote :*****".

I find a way to workaround this issue.

First remove this 3 lines of mi2.js (222-224) on 0.17.0 this.sendCommand("gdb-set target-async on"), this.sendCommand("environment-directory "" + escape(cwd) + """), this.sendCommand("target-select remote " + target)

And set all needed commands in "autorun" argument in launch.json.

A way to solve this issues is maybe to provide a new arguments as "autorun" but to be triggered before.

Otherwise, it's a really good piece of extension !

Gaswigue avatar Mar 05 '17 20:03 Gaswigue

Hm making those commands more configurable sounds like a good idea

WebFreak001 avatar Mar 05 '17 22:03 WebFreak001

I can code this feature if needed. But how do you want I implement it ? the "before-connection-autorun" argument is good for you ?

Gaswigue avatar Mar 06 '17 10:03 Gaswigue

Yes, as config value with the default of ["gdb-set target-async on", "environment-directory \"$(cwd)\"", "target-select remote $(target)"]. For the variables just use a simple replace and only allow cwd and target for now. If you find other good candidates for variables, you are free to implement them as well though

WebFreak001 avatar Mar 06 '17 11:03 WebFreak001

if you include them in the package.json you need to escape the string like this I think: https://github.com/WebFreak001/code-debug/blob/master/package.json#L305

WebFreak001 avatar Mar 08 '17 18:03 WebFreak001

And yes you need them both in the package.json as well as in the js code by checking for undefined. The package.json default one is the auto completion the user will receive, your code needs to have a value that will replace the value

WebFreak001 avatar Mar 08 '17 18:03 WebFreak001

Are there any plans to integrate this into master? @Gaswigue Are you now able to directly debug RX processors out of vs-code? I'm trying to get this running for days now.

spir6s avatar Jan 07 '19 14:01 spir6s

Just moving to vscode and am blown away by all the features. This extension is excellent, and I appreciate all the work to make it happen! My old debugger worked in non-stop mode, and it would be great if we could not only have that mode, but have it be optional! I see the patch has been around for a while, is there a reason it's not in master? Or is there a way to use a .gdbinit file as a workaround? Thanks again!

dlshutch avatar Aug 01 '20 15:08 dlshutch

Or is there a way to use a .gdbinit file as a workaround?

Yes, if your setup uses a .gdbinit file (depend on the GDB configuration, commonly "in the folder", "in home folder" in system folder) then this will still be used.

You can also explicit request a "pre-connection script loading" by adding "debugger_args": ["-ix", "yourscript"] to the launch configuration.

GitMensch avatar Mar 07 '22 21:03 GitMensch