C++ 如何在没有 gdbserver 的情况下使用 Eclipse CDT 进行远程调试?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/81194/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to do remote debugging with Eclipse CDT without gdbserver?
提问by Michael Harding
We're using the Eclipse CDT 5 C++ IDE on Windows to develop a C++ application on a remote AIX host.
我们在 Windows 上使用 Eclipse CDT 5 C++ IDE 在远程 AIX 主机上开发 C++ 应用程序。
Eclipse CDT has the ability to perform remote debugging using gdbserver. Unfortunately, gdbserver is not supported on AIX.
Eclipse CDT 能够使用 gdbserver 执行远程调试。不幸的是,AIX 不支持 gdbserver。
Is anyone familiar with a way to debug remotely using Eclipse CDT without gdbserver? Perhaps using an SSH shell connection to gdb?
有没有人熟悉使用 Eclipse CDT 进行远程调试而不使用 gdbserver 的方法?也许使用 SSH shell 连接到 gdb?
回答by Michael Harding
finally I got gdb run remotly anyhow now. At the Bug-symbol on the taskbar I took Debug Configurations - GDB Hardware Debugging.
无论如何,我终于让 gdb 远程运行了。在任务栏上的错误符号上,我选择了调试配置 - GDB 硬件调试。
In Main C/C++ Applications I set the full path on the Samba share of the executable (X:\abin\vlmi9506
). I also set a linked folder on X:\abin
in the project. Then I modified my batch-script in GDB Setup. It's not directly calling gdb in the plink-session but a unix-shell-script, which opens gdb. By this I have the possibility to set some unix environment-variables for the program before doing debug. The call in my batch:
在 Main C/C++ Applications 中,我在可执行文件 ( X:\abin\vlmi9506
)的 Samba 共享上设置了完整路径。我还在项目中设置了一个链接文件夹X:\abin
。然后我在 GDB 设置中修改了我的批处理脚本。它不是在 plink-session 中直接调用 gdb,而是一个 unix-shell-script,它打开 gdb。通过这种方式,我可以在调试之前为程序设置一些 unix 环境变量。我的批次中的调用:
plink.exe prevoax1 -l suttera -pw XXXXX -i /proj/user/dev/suttera/vl/9506/test/vlmi9506ddd.run 20155 dev o m
In the unix script I started gdb with the command line params from eclipse, that I found in my former tryals. The call in the shell command looks like this:
在 unix 脚本中,我使用 eclipse 中的命令行参数启动了 gdb,这是我在以前的尝试中找到的。shell 命令中的调用如下所示:
gdb -nw -i mi -cd=$LVarPathExec $LVarPathExec/vlmi9506
Then IBM just gives gdb 6.0 for AIX. I found version 6.8 in the net at http://www.perzl.org/aix/index.php?n=Main.Gdb. Our Admin installed it.
然后 IBM 只是为 AIX 提供了 gdb 6.0。我在http://www.perzl.org/aix/index.php?n=Main.Gdb的网上找到了 6.8 版。我们的管理员安装了它。
I can now step through the program and watch variables. I even can write gdb-commands directly in the console-view. yabadabadooooooo
我现在可以单步执行程序并观察变量。我什至可以直接在控制台视图中编写 gdb 命令。yabadabadooooooo
Hope that helps to others as well. Can not tell, what was really the winner-action. But each answer gives more new questions. Now I got 3 of them.
希望对其他人也有帮助。说不出来,什么才是真正的胜利者行动。但每个答案都会提出更多新问题。现在我得到了其中的 3 个。
- When I start the debug config I have to click restart in the toolbar to come really in the main procedure. Is it possible to come directly in main without restarting?
- On AIX our programs are first preprocessed for embedded sql. The preprocessed c-source is put in another directory. When I duble-click the line to set a breakpoint, I get the warning "unresolved breakpoint" and in the gdb-console I see, that the break is set to the preprocessed source which is wrong. Is it possible to set the breakpoints on the right source?
- We are using CICS on AIX. With the xldb-Debugger and the CDCN-command of CICS we manage that debugging is started, when we come in our programs. Is it possible to get that remotely (in plink) with gdb-eclipse as well?
- 当我开始调试配置时,我必须单击工具栏中的重新启动才能真正进入主程序。可以不重启直接进入main吗?
- 在 AIX 上,我们的程序首先针对嵌入式 sql 进行预处理。预处理后的 c-source 放在另一个目录中。当我双击该行设置断点时,我收到警告“未解决的断点”,并且在 gdb-console 中我看到,中断设置为错误的预处理源。是否可以在正确的源上设置断点?
- 我们在 AIX 上使用 CICS。使用 xldb-Debugger 和 CICS 的 CDCN-command 我们管理调试开始,当我们进入我们的程序时。是否也可以使用 gdb-eclipse 远程(在 plink 中)获得它?
回答by Nick Bastin
I wouldn't normally take a shot in the dark on a question I can't really test the answer to, but since this one has sat around for a day, I'll give it a shot. It seems from looking at:
我通常不会在黑暗中尝试我无法真正测试答案的问题,但是由于这个问题已经坐了一天,我会试一试。从看来:
http://wiki.eclipse.org/TM_and_RSE_FAQ#How_can_I_do_Remote_Debugging_with_CDT.3F
http://wiki.eclipse.org/TM_and_RSE_FAQ#How_can_I_do_Remote_Debugging_with_CDT.3F
...that even if the CDT has changed since that wiki page was made, you should still be able to change the debug command to:
...即使 CDT 自创建该 wiki 页面以来发生了变化,您仍然应该能够将调试命令更改为:
ssh remotehost gdb
ssh 远程主机 gdb
instead of using TM which uses gdbserver. This will probably be slightly slower than the TM remote debugging since that actually uses a local gdb, but on the other hand this way you won't have to NFS or SMB mount your source code to make it available to the local debugger (and if you're on a LAN it probably won't matter anyhow).
而不是使用使用 gdbserver 的 TM。这可能比 TM 远程调试稍慢,因为它实际上使用本地 gdb,但另一方面,您不必通过 NFS 或 SMB 挂载源代码以使其可用于本地调试器(如果您在 LAN 上,无论如何都可能无关紧要)。
There's also a reference TCF implementation for linux, which you may or may not have any luck recompiling for AIX, but it allows for remote debugging if gdbserver is otherwise not available:
还有一个适用于 linux 的参考 TCF 实现,您可能有也可能没有运气为 AIX 重新编译,但是如果 gdbserver 不可用,它允许远程调试:
回答by Nick Bastin
tried also to remotly debug an aix-appl with windows eclipse-cdt-gdb. Got blocked at the end with unix/windows path-problems. Maybe my result can help u a little further - maybe you already got it work. I'm interested in your comment. asked on eclipse news portal- following the answer of martin oberhuber (thanks again) tried dsp dd (also blocked with path problem) and set an request in eclipse bugzilla.
还尝试使用 windows eclipse-cdt-gdb 远程调试 aix-appl。最后被 unix/windows 路径问题阻止了。也许我的结果可以进一步帮助你 - 也许你已经得到了它。我对你的评论很感兴趣。在 eclipse 新闻门户上询问-按照 martin oberhuber 的回答(再次感谢)尝试了 dsp dd(也因路径问题而阻塞)并在 eclipse bugzilla 中设置了一个请求。
here the link to news: http://www.eclipse.org/newsportal/article.php?id=406&group=eclipse.dsdp.tmHere my bugzilla: https://bugs.eclipse.org/bugs/show_bug.cgi?id=252758
这里是新闻链接:http: //www.eclipse.org/newsportal/article.php?id =406 &group =eclipse.dsdp.tm 这是我的 bugzilla:https: //bugs.eclipse.org/bugs/show_bug.cgi ?id=252758
At the moment we still debug localy with xldb but I am trying ddd-gdb at the moment. At least locally gdb is running.
目前我们仍然使用 xldb 调试本地,但我目前正在尝试 ddd-gdb。至少本地 gdb 正在运行。