gdb 远程qemu-arm调试
2014-06-17 17:11
615 查看
把 c 编译成 arm 指令的可执行文件
/usr/bin/arm-linux-gnueabi-g++ hello.cpp
直接运行报错,因为 host 是 linux x86
$ ./a.out
-bash: ./a.out: cannot execute binary file
需要用 qemu-arm 来运行, 结果是期望的
qemu-arm -L /usr/arm-linux-gnueabi/ a.out
hello world
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault (core dumped)
进行远程调试(关键是增加 -g 参数,指定端口为1235)
qemu-arm -g 1235 -L /usr/arm-linux-gnueabi/ a.out
执行用 linux-x86 的 gdb 并不能打印 symbol
怀疑要使用 arm 的 gdb
参见 http://mazhijing.blog.51cto.com/215535/40759, 编译了 arm 的gdb, 执行后定位到 crash()
结论:
难道说 arm 的 gdbserver, 就只能用 arm 的 gdb?
/usr/bin/arm-linux-gnueabi-g++ hello.cpp
cat hello.cpp #include <stdio.h> void crash(){ char *a=0; *a=0; } int main() { printf("hello world\n"); crash(); printf("after crash\n"); }
直接运行报错,因为 host 是 linux x86
$ ./a.out
-bash: ./a.out: cannot execute binary file
需要用 qemu-arm 来运行, 结果是期望的
qemu-arm -L /usr/arm-linux-gnueabi/ a.out
hello world
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault (core dumped)
进行远程调试(关键是增加 -g 参数,指定端口为1235)
qemu-arm -g 1235 -L /usr/arm-linux-gnueabi/ a.out
执行用 linux-x86 的 gdb 并不能打印 symbol
(gdb) target remote :1235 Remote debugging using :1235 (gdb) c Continuing. Program received signal SIGSEGV, Segmentation fault. 0x00000000 in ?? () (gdb) bt #0 0x00000000 in ?? () Cannot access memory at address 0x0 (gdb) file /home/payne/hello/a.out A program is being debugged already. Are you sure you want to change the file? (y or n) y Reading symbols from /home/payne/hello/a.out...(no debugging symbols found)...done. (gdb) bt #0 0x00000000 in ?? () Cannot access memory at address 0x0 (gdb)
怀疑要使用 arm 的 gdb
参见 http://mazhijing.blog.51cto.com/215535/40759, 编译了 arm 的gdb, 执行后定位到 crash()
qemu-arm -L /usr/arm-linux-gnueabi/ ./gdb (gdb) target remote :1235 Remote debugging using :1235 warning: Can not parse XML target description; XML support was disabled at compile time 0x40801c40 in ?? () (gdb) file /home/payne/hello/a.out A program is being debugged already. Are you sure you want to change the file? (y or n) y Reading symbols from /home/payne/hello/a.out...(no debugging symbols found)...done. (gdb) c Continuing. Program received signal SIGSEGV, Segmentation fault. 0x0000841e in crash() () (gdb)
结论:
难道说 arm 的 gdbserver, 就只能用 arm 的 gdb?
相关文章推荐
- gdb 远程qemu-arm调试
- 编译arm-linux-gdb和远程调试arm板程序
- 手把手教你使用eclipse+qemu+gdb来单步调试ARM内核【学习笔记】
- qtcretor通过gdb和gdbserver远程调试arm程序
- 基于Eclipse的arm-linux的远程GDB调试
- arm-linux-gdb+gdbserver环境搭建以及远程调试
- arm-linux-gdb+gdbserver环境搭建以及远程调试
- gdb远程调试arm+linux上的应用程序
- arm-linux-gdb+gdbserver环境搭建以及远程调试 及调试core文件
- 在ubuntu10.04成功移植gdbserver及gdbserver使用介绍(用于CCSV5.2远程调试ARM CORTEX-A8程序)
- Eclipse-cdt 配合 gdbserver 进行 arm 程序远程调试 下
- Eclipse-cdt 配合 gdbserver 进行 arm 程序远程调试 上
- arm-linux-gdb+gdbserver环境搭建以及远程调试 及调试core文件
- 编译arm-linux-gdb和远程调试arm板程序
- Insight 和 gdbserver 搭建ARM远程调试环境
- gdb qemu调试linux kernel并修改远程连接的bug
- 编译arm-linux-gdb和远程调试arm板程序
- arm-linux-gdb(宿主机)+gdbserver(目标机)远程调试
- 在ubuntu10.04成功移植gdbserver及gdbserver使用介绍(用于CCSV5.2远程调试ARM CORTEX-A8程序)
- 嵌入式开发远程调试arm-linux-gdb的移植