Tuuna Computer Science

gdb 정리글 & libc source code debugging 본문

system hacking

gdb 정리글 & libc source code debugging

GuTTe 2020. 1. 3. 18:52

 

gdb 꿀팁

Segmentation fault가 뜰때까지 실행하기

 

file <exe>
set pagination off
set breakpoint pending on
break exit
commands
run
end
run

스크립트 파일 작성하고

 

gdb -x <script filename> <execute filename> 하면 segmentation fault가 난곳에서 멈춤

 

source code보면서 glibc 디버깅 하기

 

sudo apt install libc6-dbg 
sudo apt isntall glibc-source 
cd /usr/src/glibc
tar glibc-2.23.tar.xz #glibc version will be change depend on your system environment
#now you can debugging with libc source code 
gdb <binary>
(gdb)dir /usr/src/glibc/glibc-2.23/malloc

 

<reference>

https://stackoverflow.com/questions/29955609/include-source-code-of-malloc-c-in-gdb

 

Comments