raddebugger icon indicating copy to clipboard operation
raddebugger copied to clipboard

Add support for setting environment variables in a target.

Open jjzanin-SMS opened this issue 1 year ago • 8 comments

It is useful to be able to specify environment variables for a target so that the program being debugged is launched under that environment. Something similar (if not exactly) like what Visual Studio has with the "Environment" and "Merge Environment" settings under "Debugging" in the project settings.

jjzanin-SMS avatar Jan 19 '24 16:01 jjzanin-SMS

+1 I also use it to have _NO_DEBUG_HEAP=1, not sure it is here by default or not.

GloriousPtr avatar Jan 19 '24 16:01 GloriousPtr

It feels like this is more useful when we have remote debugging, right? I mean, you start the debugger with a batch file or whatever anyway, so you can just add some "set=" to the front, and then hey, you can check that script in too.

Certainly for remote debugging you need something like this, but for the current local stuff, this seems like it's better done in a script...?

jeffrbig2 avatar Jan 19 '24 19:01 jeffrbig2

Yeah it makes sense, I have no other use case as of now!

GloriousPtr avatar Jan 19 '24 20:01 GloriousPtr

OK, we'll add it to the to-do section under remote debugging. Thanks!

jeffrbig2 avatar Jan 19 '24 20:01 jeffrbig2

Yep, targeting my batch file that sets up the environment as opposed to targeting the executable works fine. It didn't occur to me to try that :-)

jjzanin-SMS avatar Jan 19 '24 20:01 jjzanin-SMS

Certainly for remote debugging you need something like this, but for the current local stuff, this seems like it's better done in a script...?

I think it makes sense to include in the debugger. I'd like a nice little GUI that lets be define a variety of targets. Each target can have an exe, cmd args, working directory, and environment variables.

I don't really want to have 10 different batch files for launching raddbg.exe in 10 different permutations. And if I'm bouncing between two or three I don't want to try and remember which instance of raddbg.exe was launched with which environment variables.

A batch file is a functional work around so it is "nice to have" rather than "blocking".

(fwiw I despise environment variables but Linux people hate me and want me to suffer so they rely on them extensively. and I often deal with Linuxy projects on Windows. grumble grumble.)

forrestsmithfb avatar Jan 22 '24 19:01 forrestsmithfb

For multi-target debugging I could see need to set different env vars for different targets. Even when running everything locally.

mmozeiko avatar Jan 22 '24 19:01 mmozeiko

For my current case, I already had a batch file that set up the environment variables and then called the executable. In Visual Studio I set up the same environment variables and the target was the executable. In raddbg I could target the batch file itself and debug from there. Single-stepping lands you in cmd.exe, so you have to put a breakpoint in your program.

jjzanin-SMS avatar Jan 22 '24 20:01 jjzanin-SMS