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

我与影子孤独终老i 提交于 2019-12-08 03:00:28

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/45149858/how-to-modify-the-environment-variables-and-working-directory-of-gdbserver-mul

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!