This commit is contained in:
2019-03-11 19:00:28 +01:00
parent af09b2566f
commit 12d5388c54
3 changed files with 6 additions and 12 deletions

View File

@@ -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)

View File

@@ -14,4 +14,6 @@ ld <object-files> -o <executable-name> # Default
gcc <object-files> -o <executable-name> # When using C library functions 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/).

View File

@@ -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