How to modify the environment variables and working directory of gdbserver --multi without restarting it?

When I run a program that prints the environment from environ locally with:

./gdb myprintenv

I can change environment variables across runs with:

run
set environment asdf=qwer
run

Is there any way to do that with gdbserver --multi?

I'm running it as:

gdbserver --multi :1234 ./myprintenv

and then locally:

arm-linux-gnueabihf-gdb -ex 'target extended-remote remotehost:1234' ./myprintenv

then the command:

set environment asdf=qwer
run

has no effect.

I can change the variables with:

asdf=qwer gdbserver --multi :1234 ./myprintenv

but that is annoying as it requires the mon exit, go to board, rerun, go to host, reconnect dance.

The same goes for working directory, which you can change with cd locally, but not on the server apparently.

One alternative would be to launch gdbserver with SSH every time without --multi, just like Eclipse does, but that has the downside that it is harder to see stdout: How can I reach STDIN/STDOUT through a gdbserver session

Upvotes: 2

Views: 2464

Answers (1)

Tom Tromey
Tom Tromey

Reputation: 22559

This feature doesn't exist in gdb yet. It's being developed though: https://sourceware.org/ml/gdb-patches/2017-08/msg00000.html

Upvotes: 1

Related Questions