2

コアファイルをデバッグしようとすると、以下のエラーが発生します。この問題を解決する方法。ほんの数日前、それはうまく機能していました。ルートプロビレッジで「/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)

私はubuntu12.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-getupdate」を実行すると、それ以降、GDBは上記のエラーを訴えています。私が理解できる違いの1つは、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
4

2 に答える 2

1

間違った gdb を使用しています。Linaro ARM ツールチェーンのtarball を取得し、展開して実行します。

$ gcc-linaro-arm-linux-gnueabihf-4.7-2013.02-01-20130221_linux/bin/arm-linux-gnueabihf-gdb appl  core.11_416
<...>
This GDB was configured as "--host=i686-build_pc-linux-gnu --target=arm-linux-gnueabihf".
<...>

使用している gdb に「この GDB は " i686-linux-gnu " として構成されました」と表示されることに注意してください。「--host=i686-build_pc-linux-gnu --target=arm-linux-gnueabihf」 (またはターゲット内の同様の ARM Linux トリプレット)を示すものが必要です。

通常、arm-linux-gnueabihfをターゲットとする gcc とi686-linux-gnu をターゲットとする gdbを混同することはありません。これは、コンパイラ、リンカー、およびデバッガのコマンドがすべて同じプレフィックス、つまりarm-linux-gnueabihf-{gcc, gdb,ld,gas}など。どのようにして特定の gcc と gdb の組み合わせになったのですか?

于 2013-03-09T11:51:25.020 に答える