QoL
This commit is contained in:
@@ -20,6 +20,7 @@ section .bss
|
|||||||
section .text
|
section .text
|
||||||
_start:
|
_start:
|
||||||
; x64 has the syscall function, in contrast to int in x86 and ARM
|
; x64 has the syscall function, in contrast to int in x86 and ARM
|
||||||
|
; See /usr/include/asm/unistd_64.h for the numbers
|
||||||
|
|
||||||
; Write to stdout
|
; Write to stdout
|
||||||
mov rax, 1
|
mov rax, 1
|
||||||
@@ -44,7 +45,6 @@ _start:
|
|||||||
mov rsi, strBuffer
|
mov rsi, strBuffer
|
||||||
syscall
|
syscall
|
||||||
|
|
||||||
|
|
||||||
; Exit routine
|
; Exit routine
|
||||||
mov rax, 60 ; 60 is the exit routine
|
mov rax, 60 ; 60 is the exit routine
|
||||||
xor rdi, rdi ; our return code (0)
|
xor rdi, rdi ; our return code (0)
|
||||||
|
|||||||
@@ -15,3 +15,5 @@ gcc <object-files> -o <executable-name> # When using C library functions
|
|||||||
```
|
```
|
||||||
|
|
||||||
Based upon the work of [Carmo M de F Barbosa](https://gitlab.com/mcmfb/intro_x86-64)
|
Based upon the work of [Carmo M de F Barbosa](https://gitlab.com/mcmfb/intro_x86-64)
|
||||||
|
|
||||||
|
The Linux system call table and useful links can be found [here](http://blog.rchapman.org/posts/Linux_System_Call_Table_for_x86_64/).
|
||||||
@@ -10,13 +10,5 @@ if [ ! -x "$1" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "I will launch gdbtui soon. Use \"break *<entry-address>\" to debug the program."
|
breakPoint="$(readelf -h $1 | egrep -i "entry" | egrep -o "0x[a-f0-9]+")"
|
||||||
echo "Use \"layout asm\" to use a more assembly friendly layout"
|
gdbtui -q -ex "layout asm" -ex "break *$breakPoint" $1
|
||||||
echo "Use \"si\" to single step each instruction"
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
echo "$(readelf -h $1 | egrep "Entry point")"
|
|
||||||
read -p "Copy the above address and press any key to continue..."
|
|
||||||
|
|
||||||
gdbtui -q $1
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user