显示寄存器的当前价值。 (Aarch64 Android组装调试)
我想看看我程序中所有寄存器内部发生了什么。
我有此代码在AARCH64 Linux上正常工作,可作为静态可执行文件。
.data
msg:
.ascii "Hello World\n"
len = . - msg
.text
.globl _start
_start:
mov x0, #0x1
ldr x1, =msg
ldr x2, =len
mov x8, #0x40
svc #0x0
mov x0, #0x0
mov x8, #0x5d
svc #0x0
并使用此命令(在Android上的Termux中)编译并运行它。
as hello.s -o hello.o
ld hello.o -o hello
./hello
与8086处理器应用程序(EMU8086)的仿真不同,我可以逐步看到该模拟器内部的CPU获取,解码和执行以及当前寄存器值的当前内存值及其地址是什么。
在这个真实的组件(不是仿真)中,我什至看不到地址中的内存值是什么。
我正在考虑使用GDB
。但是我认为我需要示例如何使用它。
至少我想查看:
- 所有寄存器的当前价值。
- 记忆中程序地址的当前值。
- 标志寄存器
I want see what's happening inside of all registers from my program.
I have this code that works fine on AArch64 Linux as a static executable.
.data
msg:
.ascii "Hello World\n"
len = . - msg
.text
.globl _start
_start:
mov x0, #0x1
ldr x1, =msg
ldr x2, =len
mov x8, #0x40
svc #0x0
mov x0, #0x0
mov x8, #0x5d
svc #0x0
And compile and run it with this command (in Termux on Android).
as hello.s -o hello.o
ld hello.o -o hello
./hello
Unlike in emulation of 8086 processor application (emu8086), I can see step by step how CPU fetching, decoding, and executing inside of that emulator also what is current register value also current memory value and its addresses.
In this real assembly (not emulation), I even can't see what is memory value in addresses.
I was thinking about to use gdb
. But I think I need example how to use it.
At least I want see:
- Current value of all registers.
- Current value of program address in memory.
- Flag register
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
到目前为止,我一直在修补
gdb
,在这里我学到的东西
认为该程序仍然像我的帖子一样。
要启动调试只是简单地
gdb ./hello
然后它将显示GDB解释器
它将添加断点1
然后在必要时再次添加,
它将添加断点2
依此类推,直到程序结束为止。
简单地运行程序
将运行Brakepoint 1
现在可以显示当前的内存值,简单地
显示出从_start中以指令格式显示前5个内存值。
=>
标记是指当前断点以显示当前寄存器,只是键入
然后键入
n
以删除下一个断点。好的,到目前为止,它负担了足够的USIG GDB,我希望有最简单的方法可以通过步骤+4添加特定地址的断点到结束地址。
另外,我仍然没有弄清楚如何查看标志寄存器。
我仍然期望如果
GDB
在一个显示/屏幕中显示当前寄存器值,当前内存值和当前标志寄存器值。当我下一个断点时,屏幕将自动化,我也希望它会添加_start,_start+4等的断点。So far I was tinkering
gdb
And here what I learned
Suppose the program still same like my post.
To start debug just simply
gdb ./hello
Then it will show up gdb interpreter
It will add breakpoint 1
Then add again if necessary
It will add breakpoint 2
And so on until end of program.
Run the program by just simply
It will run breakpoint 1
Okay now to show current memory value just simply
It will show first 5 memory value in instruction format from _start.
=>
marks mean current breakpointTo show current register just type
Then type
n
to exexute next breakpoint.Okay so far it's burdening enough usig gdb, I wish there's easiest way to add breakpoint from specific address to end address with step +4.
Also I still didnt figure out how to see flag register.
I'm still expecting if
gdb
show current register value, current memory value, and current flag register value in one display/screen. and when I next breakpoint the screen will autoupdate ,Also I expecting it's adding breakpoint from _start, _start+4, and so on.. without add manually one by one like above