본문 바로가기

Programming/Linux Tip

[gdb] handle gdb error "single stepping until exit ... from function which has no line number information"

I meet gdb error.

GDB print this error instead of print current line of source code.

GDB 를 사용하는 중 소스코드가 안보이고 아래와 같은 애러가 발생하였습니다.



single stepping until exit ... from function which has no line number information


so I introduce a cool solution to you.

이것에 대한 해법을 적어보도록 하겠습니다.



I already add '-g' option on my Makefile. and I add '-ggdb -O0' option regarding googleing result.

but main cause is GDB version.

If you use up-to-date GCC, you have to use the latest GDB.

구글링을 해서 -g 옵션과 -ggdb -O0 옵견까지 추가해 보았습니다.

하지만 이것들은 원인이 아니었고, 주된 요인은 GDB version 문제였습니다.


Unfortunately, version of GDB installed using apt-get is 6.8 and it doesn't make GDB update more.

and this GDB version is too low using with my GCC-4.5.3.

apt-get 으로 설치한 GDB 의 최신버전은 6.8 이었습니다.

그리고 이 버전은 제가 사용하는 4.5.3 버전의 GCC 와 사용하기에는 너무 낮은 버전 입니다.



So, We have to get the latest GDB version and then update.

따라서 GDB 의 최신 버전을 찾고 업데이트를 해 보겠습니다.


Get the latest version on below site.

아래 사이트에서 최신 GDB 버전을 얻을 수 있습니다.


http://www.gnu.org/software/gdb/download/


In my case, GDB 7.7 is available and download this.

and than un-compress download file.

지금 제가 보는 시기에는 GDB 7.7 이 최신버전이고 다운로드 가능합니다.

다운로드후 압축을 해제 합니다.


tar zxvf gdb-7.7.tar.gz


Go in to un-compressed directory and build and install

압축을 푼 gdb-7.7 디렉토리로 진입하여 build 와 install 을 합니다.


cd ./gdb-7.7

./configure

make

make install


If you want to know more details, you should read 'README file' in gdb-7.7 directory.

좀 더 자세한 설치 정보를 원한다면, 폴더내에 README 문서를 읽으면 됩니다.


now I can see new gdb work

새로운 gdb 가 잘동작하는 것을 볼 수 있습니다.




and GDB work well without errors !!

실제 디버깅을 해 보면 애러없이 잘 동작합니다.