0

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:

  • creating a test program that prints pwd
  • pwdx on the process
  • pwd on the Eclipse Debugger Console

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.

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985

1 Answers1

2

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.

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985