GDB
-
gdb 사용해서 C 디버깅하기언어/C 2020. 1. 21. 16:17
C를 개발하는데 디버깅 안할 수는 없다. vim을 이용해 gcc로 C 개발을 시작했고, 드디어 디버깅이 필요한 시점이 왔다. 1. 디버깅 시작 gdb ./main 실행파일을 gdb로 연다. output: GNU gdb (Ubuntu 8.1-0ubuntu3.1) 8.1.0.20180409-git Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying"..
-
gdb에서 fopen 함수 디버깅시 step을 사용했을 때 에러언어/C 2020. 1. 21. 16:14
gdb를 이용해 step 명령어를 사용해 디버깅시 fopen에서 파일을 찾을 수 없다며 에러가 나는 것을 확인하였다. Breakpoint 1, main () at main.c:24 24 file_sp.err_sp = fopen("out/han/SP/error.csv", "wt"); // save error of estimating secondary path (gdb) s _IO_new_fopen (filename=0x555555556383 "out/han/SP/error.csv", mode=0x555555556380 "wt") at iofopen.c:88 88 iofopen.c: 그런 파일이나 디렉터리가 없습니다. 찾아보니 step과 next 명령어의 차이점에서 나타나는 문제였는데 영어로는 설명이 이렇다..