当我尝试调试核心文件时出现以下错误。如何解决这个问题。就在几天前,它工作正常。我尝试使用 root 权限运行“/sbin/ldconfig”。代码编译为:
g++ -fPIC -ggdb
我的可执行文件是 32 位二进制文件:
$ file appl
ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked
(uses shared libs), not stripped.
user@ubu:/mnt/hgfs/share$ gdb appl core.11_416
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 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 "i686-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /mnt/hgfs/share/appl...done.
warning: Couldn't find general-purpose registers in core file.
warning: Could not load shared library symbols for 9 libraries, e.g. /lib/libdl.so.2.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?
Core was generated by `appl'.
warning: Couldn't find general-purpose registers in core file.
#0 <unavailable> in ?? ()
(gdb) i shared
From To Syms Read Shared Object Library
No /lib/libdl.so.2
No /opt/lib/libappl.so
No /lib/librt.so.1
No /usr/lib/libstdc++.so.6
No /lib/libm.so.6
No /lib/libgcc_s.so.1
No /lib/libc.so.6
No /lib/libpthread.so.0
No /lib/ld-linux.so.3
(gdb)
(gdb) show solib-search-path
The search path for loading non-absolute shared library symbol files is .
(gdb) show sysroot
The current system root is "".
(gdb)
(gdb) show archi
The target architecture is set automatically (currently i386)
我正在使用运行 ubuntu 12.04 的 VMware
user@ubu:~$ uname -a
Linux ubu 3.2.0-36-generic #57-Ubuntu SMP Tue Jan 8 21:41:24 UTC 2013 i686 i686 i386 GNU/Linux
user@ubu:~$
编辑:2013 年 3 月 20 日
@SCOTT:感谢您的回复。我会试试这个。相同的设置早些时候工作正常,我能够使用 GDB 进行调试。一旦我做了“apt-get update”,从那以后GDB就抱怨上述错误。我可以看出的一个区别是在 GDB 工作时版本显示的早期:
This GDB was configured as "i486-linux-gnu".
现在更新后的版本显示:
This GDB was configured as "i686-linux-gnu"
这就是我能看到或理解的所有差异。
我使用的 ARM 工具链没有提供 GDB。g++ 是为 Intel 编译的。我现在也使用相同的 g++ 来构建可执行文件。
$ file g++
g++: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.2.5, stripped
我使用的提供的交叉编译器可执行文件如下。但是当我收到这个错误时,我只使用了位于“/usr/bin/gdb”的普通 gdb(安装在 Ubuntu 上)命令:
user@ubu:/opt/cs/bin$ ls
arm-none-linux-gnueabi-g++
arm-none-linux-gnueabi-gdb
... etc ...
我在这里使用了错误的 GDB。如果它是错误的 GDB,为什么它现在可以更早地工作,为什么不呢?我是否应该使用这个 arm-none-linux-gnueabi-GDB 来调试 ARM 交叉编译的应用程序,该应用程序是使用以下代码编译的:
arm-none-linux-gnueabi-g++ appl.cpp -o appl
user@ubu:~$ which gdb
/usr/bin/gdb