How to set the current working directory of the program when remote debugging with gdbserver Automatic Launcher in Eclipse CDT?

I tried to change it with Debug configurations > Arguments > Working directory, but that only changes the location of the host gdb.

This can be observed by either:

When using CLI gdb and gdbserver, we observe that the pwd of the program is always the same as where gdbserver was launched, and the pwd and cd commands on host only change host settings.

The Automatic Launcher SSHs into the target and launches gdbserver for us, which automates the re-run process: Remote debugging C++ applications with Eclipse CDT/RSE/RDT

Eclipse 4.7.0.

Upvotes: 0

Views: 1995

Answers (1)

The best method I could find was to go:

  • Debug configurations
  • Main
  • Commands to execute before application
  • cd /directory/that/I/want

If you want to set it to the same directory as the executable without duplication, this unsolved question is related: How to set the working directory when running an executable in Eclipse CDT to be the same as the executable?

Alternatively, you could also use the Manual Launcher, in which you launch gdbserver manually on the target. Then just cd to the directory you want before running it.

Upvotes: 2

Related Questions