[Linux]리눅스에서 컴파일 후 디버깅 하기
Programming/Linux

[Linux]리눅스에서 컴파일 후 디버깅 하기

리눅스에서 컴파일 후 디버깅 하는 방법을 다뤘습니다.

 

https://linuxize.com/post/how-to-install-gcc-compiler-on-ubuntu-18-04/

 

https://u.osu.edu/cstutorials/2018/09/28/how-to-debug-c-program-using-gdb-in-6-simple-steps/

 

How to Debug C Program using gdb in 6 Simple Steps

This Tutorial is taken from here In this article, let us discuss how to debug a c program using gdb debugger in 6 simple steps. Write a sample C program with errors for debugging purpose To learn C program debugging, let us create the following C program t

u.osu.edu

 

gcc 설치후 gdb를 가지고 디버깅을 할 수 있습니다.

 

 

sudo apt update

 

sudo apt install build-essential

 

 

sudo apt-get install manpages-dev

 

gcc -version

 

 

vi hello.c로 c파일을 만들어 봅시다.

만들고 나서 

 

gcc hello.c -o hello

 

./hello

 

Hello World! 가 실행이 되는 모습을 확인할 수 있습니다.

 

gdb로 들어가보면

 

 

바이너리 파일을 만듭니다.

 

cc hello.c

ls

a.out 가 만들어진 모습

 

gdb a.out