目前,我正努力在可信的Tahr中调试openjdk。我已经安装了opejdk-7-jdk和openjdk-7-dbg。当我发布gdb java时,我看到它正确地读取符号,但是当我要求列出它抱怨main.c找不到的代码时。我设法让调试在CentOS中工作,我可以列出文件main.c,但是我想让它在Ubuntu上工作,因为它是我的主要发行版。
原始产出:
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
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 "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from java...Reading symbols from /usr/lib/debug//usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java...done.
done.
(gdb) l
85 ../../../../src/share/bin/main.c: No such file or directory.
(gdb) 我需要做些额外的事情来把主设备放在可以找到的地方吗?
发布于 2014-11-26 00:07:32
您应该修改gdb使用的source path来查找源文件。
根据gdb手册的说法:
可执行程序有时不记录编译源文件的目录,只记录名称。即使这样,目录也可以在编译和调试会话之间移动。GDB有一个目录列表来搜索源文件;这称为源路径。
您首先需要知道源文件在系统上的位置:
locate main.c而不是使用dir dirname命令来:
将目录dirname添加到源路径的前面。这个命令可以给出几个目录名,在MS-DOS和MS中,用‘:’(‘;’‘分隔开,其中’:‘通常显示为绝对文件名的一部分)或空格。您可以指定一个已经在源路径中的目录;这会将其向前移动,因此GDB会更快地搜索它。
仔细阅读gdb手册上面的链接,以了解如何使用此source path。
https://askubuntu.com/questions/553743
复制相似问题