有一种简单的源代码“世界.cpp”,而“bazel”则以这种方式建造:
$ bazel build --cxxopt=-std=c++11 -c dbg --strip=never //examples/hello_world:hello_world
so I can debug it like this, and everything is going well, the source code symbols can display:
$ gdb bazel-bin/examples/hello_world/hello_world
Reading symbols from bazel-bin/examples/hello_world/hello_world...done.
(gdb) b main
Breakpoint 1 at 0x51e9: file examples/hello_world/main.cpp, line 46.
(gdb) r
Starting program: /home/wss/.cache/bazel/_bazel_wss/4110822ab2eb09dee5980f588bc10e42/execroot/com_minieye_aiplorer/bazel-out/k8-dbg/bin/examples/hello_world/hello_world
Breakpoint 1, main (argc=1, argv=0x7fffffffe1c8) at examples/hello_world/main.cpp:46
warning: Source file is more recent than executable.
46 std::cout << "WITH LINUX~~~" << std::endl;
(gdb) l
41 return 0;
42 }
43
44 int main(int argc, char *argv[]) {
45 #ifdef WITH_LINUX_PC
46 std::cout << "WITH LINUX~~~" << std::endl;
47 #endif
48 if (jsonHandle(argc, argv) < 0) {
49 return -1;
50 }
但是,当我去拜策-宾/谢普勒/盖洛-世界时,它就显示:
$ cd bazel-bin/examples/hello_world/
$ gdb hello_world
(gdb) b main
Breakpoint 1 at 0x51e9: file examples/hello_world/main.cpp, line 46.
(gdb) l
32 examples/hello_world/main.cpp: No such file or directory
(gdb) l
32 in examples/hello_world/main.cpp
谁能告诉我什么? 如果我想直接根据可执行的双位目录进行ug击,如何做?
======================================
And the same problem is, I build the code of hello-world with cross-comipler toolchains, and scp the executable binary to the target ARM core device, and the log is below:
Reading symbols from hello_world...
(gdb) b main
Breakpoint 1 at 0x40497c
(gdb) l
1 ../sysdeps/aarch64/start.S: No such file or directory.
(gdb) n
The program is not being run.
(gdb) r
Starting program: /app/algo/apa/bin/hello_world
Python Exception <class NameError > Installation error: gdb._execute_unwinders function is missing:
Breakpoint 1, 0x000000000040497c in main ()
(gdb) l
1 in ../sysdeps/aarch64/start.S
(gdb) n
So, how to debug the program under a embedded enviorment? It still cannot display the source code.