gpt4 book ai didi

c - 为什么我用gdb调试的时候是 "No symbol file now"?

转载 作者:太空宇宙 更新时间:2023-11-04 02:09:07 26 4
gpt4 key购买 nike

Makefile 是:

 objects = disk.o super.o inode.o namei.o open.o main.o

test : $(objects)
cc -g -Wall -O2 -o test $(objects)

disk.o : fs.h disk.h
cc -g -Wall -O2 -c disk.c

namei.o : fs.h
cc -g -Wall -O2 -c namei.c

open.o : fs.h
cc -g -Wall -O2 -c open.c

super.o : fs.h
cc -g -Wall -O2 -c super.c

inode.o : fs.h
cc -g -Wall -O2 -c inode.c

main.o : fs.h disk.h sched.h
cc -g -Wall -O2 -c main.c

.PHONY : clean
clean:
rm edit $(objects)

我使用“-g”,但是当我用 gdb 调试它时:

gdb test

消息是:

Reading symbols from /root/lx/filesystem/lx_filesystem/test...(no debugging symbols found)...done.
(gdb) file
No executable file now.
No symbol file now.

这是为什么?
谢谢

最佳答案

您需要确认二进制文件中是否有调试符号。在 Linux 上,您可以运行

file test
这应该告诉你这些符号是否被剥离了。或者试试
nm -C test
查看测试二进制文件中包含的符号列表。如果您看到类似
nm: test: no symbols
的内容那就是问题所在。如果它们没有被剥离,那么你的调试符号可能不是 gdb 风格的(参见 this question )。

关于c - 为什么我用gdb调试的时候是 "No symbol file now"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16830862/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com