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:
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
b _start
It will add breakpoint 1 Then add again if necessary
b *_start+4
It will add breakpoint 2 And so on until end of program.
Run the program by just simply
run
It will run breakpoint 1
Okay now to show current memory value just simply
x /5i _start
It will show first 5 memory value in instruction format from _start.
0x4000b0 <_start>:
mov x0, #0x1 // #1
=> 0x4000b4 <_start+4>: ldr x1, 0x4000d0 <_start+32>
0x4000b8 <_start+8>: ldr x2, 0x4000d8 <_start+40>
0x4000bc <_start+12>:
mov x8, #0x40 // #64
0x4000c0 <_start+16>: svc #0x0
=>
marks mean current breakpoint
To show current register just type
i r
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.