gdb加了-g仍然(no debugging symbols found)

想用gdb对程序进行调试,之前的时候就想用gdb的,结果发现加了-g也还是不行,显示如下:
GNU gdb 6.8
Copyright (C) 2008 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"
and "show warranty" for details.
This GDB was configured as "arm-hisiv100nptl-linux"...
(no debugging symbols found)
因为当时时间紧迫,就没来得及去找原因,今天找了下原因

一般来说,如果加了-g仍然找不到符号,要么是只是在.o文件生成可执行文件的时候加的-g,而在.c生成.o文件时忘记加了,要么是把可执行文件strip了,可是我查找我的Makefile,这两种可能都不是。写了小的测试程序,发现是可以gdb的,怀疑还是我Makefile的flag写的不对,查找,发现有个-s的选项,查资料发现,原来是它把我的符号给去掉了,去掉-s,ok,done

本文转自:

https://blog.csdn.net/gzxx2007sddx/article/details/40393353

你可能感兴趣的:(linuxC编程,Linux系统相关)