在Eclipse CDT中使用gdbserver Automatic Launcher进行远程调试时,如何设置程序的当前工作目录?

编程入门 行业动态 更新时间:2024-10-08 07:39:14
本文介绍了在Eclipse CDT中使用gdbserver Automatic Launcher进行远程调试时,如何设置程序的当前工作目录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我试图通过调试配置>参数>工作目录对其进行更改,但这仅更改了主机gdb的位置。

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:

  • 创建一个打印 pwd
  • 的测试程序
  • pwdx 在进程上
  • pwd 在Eclipse调试器控制台上
  • creating a test program that prints pwd
  • pwdx on the process
  • pwd on the Eclipse Debugger Console

使用CLI时 gdb 和 gdbserver ,我们注意到程序的 pwd 始终与启动 gdbserver 的位置相同,主机上的 pwd 和 cd 命令仅更改主机设置。

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.

自动启动器通过SSH进入目标并为我们启动 gdbserver ,这将自动执行重新运行过程:使用Eclipse CDT / RSE /远程调试C ++应用程序/ RDT

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。

Eclipse 4.7.0.

推荐答案

我能找到的最好方法是:

The best method I could find was to go:

  • 调试配置
  • Main
  • 在应用程序之前执行的命令
  • cd / directory / that / I / want
  • 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?

或者,您也可以使用手动启动器,在其中启动 gdbserver 手动定位到目标。然后只需 cd 到要运行的目录即可。

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.

更多推荐

在Eclipse CDT中使用gdbserver Automatic Launcher进行远程调试时,如何设置程序的当前工作目录?

本文发布于:2023-11-24 14:17:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1625552.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何设置   目录   程序   工作   CDT

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!