Gdbserver: execute target shell commands

For example. !ls

will execute the command ls

in gdb itself, but how to do it on the remote side?

It should be simple, but I can't figure it out. In the documentation , something like target remote | ls

or target remote | !ls

should work, but it's either wrong or I don't understand something: a command like this makes gdb try to close the current session and start debugging the ls

binary.

I also found the one mentioned monitor cmd

but it monitor !ls

just brings up the post Unknown monitor command

.

+4


source to share


1 answer


! ls > /tmp/ls.txt

      



All the commands you try with ! cmd

will work, but you won't be able to get the output because gdbserver can't redirect the stream correctly.
Just open a new remote connection to see the result of redirecting your remote GDB command to a file like in the previous example.

0


source







All Articles