summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--md/writeup/using_gdb.md31
1 files changed, 31 insertions, 0 deletions
diff --git a/md/writeup/using_gdb.md b/md/writeup/using_gdb.md
index 3346e41..5a91a48 100644
--- a/md/writeup/using_gdb.md
+++ b/md/writeup/using_gdb.md
@@ -87,6 +87,13 @@ print value in hex
```
+### ARM
+
+print value of memmory using register
+
+```bash
+x/10x $sp
+```
## Print memory
@@ -141,6 +148,30 @@ set print pretty on
(gdb) next
```
+## Show source code
+### Show current instruction
+```bash
+=> 0x801a0 <mbox_call+80>: ldr w1, [x2]
+(gdb) x/i $pc
+```
+
+### Show n number of instructions
+
+```bash
+(gdb) x/10i $pc
+=> 0x801a0 <mbox_call+80>: ldr w1, [x2]
+ 0x801a4 <mbox_call+84>: tbnz w1, #30, 0x801a0 <mbox_call+80>
+ 0x801a8 <mbox_call+88>: ldr w1, [x3]
+ 0x801ac <mbox_call+92>: cmp w0, w1
+ 0x801b0 <mbox_call+96>: b.ne 0x801a0 <mbox_call+80> // b.any
+ 0x801b4 <mbox_call+100>: ldp x19, x20, [sp, #16]
+ 0x801b8 <mbox_call+104>: ldp x29, x30, [sp], #32
+ 0x801bc <mbox_call+108>: ret
+ 0x801c0 <pl011_init>: sub sp, sp, #0x10
+ 0x801c4 <pl011_init+4>: mov w0, #0x3344 // #13124
+```
+
+
### Links
1. [http://althing.cs.dartmouth.edu/secref/resources/plt-got.txt](http://althing.cs.dartmouth.edu/secref/resources/plt-got.txt)