我正在尝试使用GNU汇编器学习ARM汇编语言编程。我已经在我的PC上设置了QEmu,并且有一个Debian ARM-HF chroot环境。
如果我汇编和链接我的测试程序:
.text
.global _start
_start:
mov r0, #6
bx lr
随着:
as test.s -o test.o
ld test.o -o test
然后将文件加载到gdb中,并在_start上设置断点:
root@Latitude-E6420:/root# gdb test GNU gdb (GDB) 7.6.1 (Debian 7.6.1-1) Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "arm-linux-gnueabihf". For bug reporting instructions, please see: ... Reading symbols from /root/test...(no debugging symbols found)...done. (gdb) break _start Breakpoint 1 at 0x8054 (gdb)
如何逐步执行代码,显示汇编源代码和监视寄存器? 我尝试了一些基本命令,但它们没有起作用:
(gdb) break _start Breakpoint 1 at 0x8054 (gdb) info regi 当前程序没有寄存器。 (gdb) stepi 程序没有运行。 (gdb) disas 未选择帧。 (gdb) r Starting program: /root/test qemu: Unsupported syscall: 26 qemu: uncaught target signal 11 (Segmentation fault) - core dumped qemu: Unsupported syscall: 26 During startup program terminated with signal SIGSEGV, Segmentation fault. (gdb)