免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
123下一页
最近访问板块 发新帖
查看: 2921 | 回复: 28
打印 上一主题 下一主题

请教 使用gdb时出现的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2004-09-03 14:43 |只看该作者 |倒序浏览
我的程序分别放在工作目录的 src pub TestDriver目录下。
我在工作目录下,使用automake生成了main。main.cpp放在TestDriver目录下。
另外main.cpp中引用了cppunit的库。
make 什么的都没问题,运行也没问题。可是用gdb来debug时,就有问题了。
  
我在使用gdb时,使用 --directory命令引用了源码的目录,但是在调试时,
gdb报错如下:


  1. gdb --directory=src:pub:TestDriver:.deps:. main
  2. GNU gdb 4.18 (FreeBSD)
  3. Copyright 1998 Free Software Foundation, Inc.
  4. GDB is free software, covered by the GNU General Public License, and you are
  5. welcome to change it and/or distribute copies of it under certain conditions.
  6. Type "show copying" to see the conditions.
  7. There is absolutely no warranty for GDB.  Type "show warranty" for details.
  8. This GDB was configured as "i386-unknown-freebsd"...Deprecated bfd_read called at /usr/src/gnu/usr.bin/binutils/gdb/../../../../contrib/gdb/gdb/dwarf2read.c line 3049 in dwarf2_read_section


  9. Dwarf Error: Cannot handle DW_FORM_strp in DWARF reader.

  10. (gdb) b main
  11. No symbol table is loaded.  Use the "file" command.
  12. (gdb) quit
  13. mike@cvs:/samba_mike/UnixProj/QmailSync/QmailSyncSrv>; gdb --directory=src:pub:TestDriver:.deps:. main
  14. GNU gdb 4.18 (FreeBSD)
  15. Copyright 1998 Free Software Foundation, Inc.
  16. GDB is free software, covered by the GNU General Public License, and you are
  17. welcome to change it and/or distribute copies of it under certain conditions.
  18. Type "show copying" to see the conditions.
  19. There is absolutely no warranty for GDB.  Type "show warranty" for details.
  20. This GDB was configured as "i386-unknown-freebsd"...Deprecated bfd_read called at /usr/src/gnu/usr.bin/binutils/gdb/../../../../contrib/gdb/gdb/dwarf2read.c line 3049 in dwarf2_read_section


  21. Dwarf Error: Cannot handle DW_FORM_strp in DWARF reader.

  22. (gdb) b main
  23. No symbol table is loaded.  Use the "file" command.
复制代码


请问这是怎么回事?应该如何处理?

论坛徽章:
0
2 [报告]
发表于 2004-09-03 15:17 |只看该作者

请教 使用gdb时出现的问题

为什么没有符号表?是编译的选项问题吗?

论坛徽章:
0
3 [报告]
发表于 2004-09-03 15:21 |只看该作者

请教 使用gdb时出现的问题

[quote]原帖由 "albcamus"]为什么没有符号表?是编译的选项问题吗?[/quote 发表:


编译时加过 -g  的选项了。下面是automake生成的编译脚本的片断,可以看到有-g选项在其中。


  1. if g++ -DPACKAGE_NAME=\"FULL-PACKAGE-NAME\" -DPACKAGE_TARNAME=\"full-package-name\" -DPACKAGE_VERSION=\"VERSION\" -DPACKAGE_STRING=\"FULL-PACKAGE-NAME\ VERSION\" -DPACKAGE_BUGREPORT=\"BUG-REPORT-ADDRESS\" -DPACKAGE=\"QmailSyncSrv\" -DVERSION=\"1.0\" -DHAVE_LIBCPPUNIT=1 -DHAVE_DIRENT_H=1 -DSTDC_HEADERS=1 -DHAVE_SYS_WAIT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_UNISTD_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_FCNTL_H=1 -DHAVE_NETDB_H=1 -DHAVE_NETINET_IN_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_IOCTL_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_UNISTD_H=1 -DHAVE__BOOL=1 -DHAVE_STDBOOL_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FORK=1 -DHAVE_VFORK=1 -DHAVE_WORKING_VFORK=1 -DHAVE_WORKING_FORK=1 -DRETSIGTYPE=void -DHAVE_STRFTIME=1 -DHAVE_VPRINTF=1 -DHAVE_BZERO=1 -DHAVE_SOCKET=1 -DHAVE_STRCASECMP=1 -DHAVE_STRERROR=1 -I. -I.   -I/usr/local/include  -g -DTESTDRIVEN -MT TestDirectoryList.o -MD -MP -MF ".deps/TestDirectoryList.Tpo" -c -o TestDirectoryList.o `test -f 'TestDriver/TestDirectoryList.cpp' || echo './'`TestDriver/TestDirectoryList.cpp;  then mv -f ".deps/TestDirectoryList.Tpo" ".deps/TestDirectoryList.Po"; else rm -f ".deps/TestDirectoryList.Tpo"; exit 1; fi
复制代码

论坛徽章:
0
4 [报告]
发表于 2004-09-07 10:31 |只看该作者

请教 使用gdb时出现的问题

up

论坛徽章:
0
5 [报告]
发表于 2004-09-10 17:02 |只看该作者

请教 使用gdb时出现的问题

up

论坛徽章:
0
6 [报告]
发表于 2004-09-13 09:13 |只看该作者

请教 使用gdb时出现的问题

up

论坛徽章:
0
7 [报告]
发表于 2004-09-14 10:06 |只看该作者

请教 使用gdb时出现的问题

up

论坛徽章:
0
8 [报告]
发表于 2004-09-14 12:16 |只看该作者

请教 使用gdb时出现的问题

我没有发现你在gdb中指定载入哪个程序吗?
在gdb命令行只指定了搜索路径

论坛徽章:
0
9 [报告]
发表于 2004-09-14 12:18 |只看该作者

请教 使用gdb时出现的问题

用gdb的file命令指定执行文件

论坛徽章:
0
10 [报告]
发表于 2004-09-15 11:36 |只看该作者

请教 使用gdb时出现的问题

原帖由 "靠自己" 发表:
我没有发现你在gdb中指定载入哪个程序吗?
在gdb命令行只指定了搜索路径


我想指定了搜索路径后,gdb自己会找得到的吧。

比如我如果不分子目录,所以程序文件在当前目录下,因为当前目录默认就是搜索路径,所以就能够找得到。

我的理解对吗、
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP