为什么我从 gdbserver 获得"not in executable format: Success",但在 gdb 中一切正常?

Why do I get "not in executable format: Success" from gdbserver, but everything works fine in gdb?

本文关键字:gdb 但在 Success gdbserver 获得 not format executable in 为什么      更新时间:2023-10-16

尝试在linux上运行可执行文件(ubuntu 16.04(时,我可以在 gdb下运行可执行文件:

gdb ./bazel-bin/drake/systems/sensors/rgbd_camera_test

但是,如果我尝试在gdbserver下运行可执行文件并连接,这是一个不同的故事:

tty1$ gdbserver localhost:9999 ./bazel-bin/drake/systems/sensors/rgbd_camera_test
tty2$ gdb
(gdb) target remote localhost:9999
Remote debugging using localhost:9999
Reading ${BAZEL_ROOT}/bazel-out/clang-3.9-linux-dbg/bin/drake/systems/sensors/rgbd_camera_test from remote target...
warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
"target:${BAZEL_ROOT}/bazel-out/clang-3.9-linux-dbg/bin/drake/systems/sensors/rgbd_camera_test": not in executable format: Success

我使用clang-3.9使用bazel(0.4.5(。如果使用:

,我会得到相同的结果
bazel run --run_under=gdb //drake/systems/sensors:rgbd_camera_test`

--run_under 'gdbserver localhost:9999'

问题是我的二进制规模太大,无法进行远程传输。我通过阅读gdb的上述提示来意识到这一点,以在gdb中调用set sysroot。使用此功能,我可以使用gdbserver进行调试。

请注意,如果您只进行本地调试,则可以将其添加到您的~/.gdbinit中。在我的情况下,我使用gdbserver在与Clion进行调试时(有时直接调试似乎不起作用...(

相关文章: