2011-07-21 8 views
6

私はファイルを埋め込みSH3 Linuxデバイスから、クロスコンパイラ環境(sh3-linux-gdb)をgdbのホストlinuxから入手しました。クロスgdbを使用してクロスターゲットマシンのコアファイルを調べる方法

$ sh3-linux-gdb ./myprogram ./core 
GNU gdb 6.3 
Copyright 2004 Free Software Foundation, Inc. 
... 
This GDB was configured as "--host=i386-pc-linux-gnu --target=sh3-linux"... 
GDB can't read core files on this machine. 
(gdb) 

は、なぜそれがコアファイルを読み取ることができません。

は、しかし、私はgdbでコアファイルをロードする問題がありますか? コア・ファイルをターゲット・システムからクロスgdbに読み取る方法はありますか?

ターゲットマシン(SH3-linux)にgdbserverがありますが、gdb自体はありません。 gdbserversh3-linux-gdbのターゲットマシンのプロセスのランタイムデバッグができるので、sh3-linux-gdbを正しくコンパイルする必要があります。

EDIT: readelfがダンプが要求された

[build]$ sh3-linux-readelf -a core 
ELF Header: 
    Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
    Class:        ELF32 
    Data:        2's complement, little endian 
    Version:       1 (current) 
    OS/ABI:       UNIX - System V 
    ABI Version:      0 
    Type:        CORE (Core file) 
    Machine:       Renesas/SuperH SH 
    Version:       0x1 
    Entry point address:    0x0 
    Start of program headers:   52 (bytes into file) 
    Start of section headers:   0 (bytes into file) 
    Flags:        0x0 
    Size of this header:    52 (bytes) 
    Size of program headers:   32 (bytes) 
    Number of program headers:   51 
    Size of section headers:   0 (bytes) 
    Number of section headers:   0 
    Section header string table index: 0 

There are no sections in this file. 

There are no sections in this file. 

Program Headers: 
    Type   Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align 
    NOTE   0x000694 0x00000000 0x00000000 0x00200 0x00000  0 
    LOAD   0x001000 0x00400000 0x00000000 0x00000 0x01000 R E 0x1000 
    ----- several boring lines removed ----- 
    LOAD   0x05a000 0x29952000 0x00000000 0x01000 0x01000 RW 0x1000 
    LOAD   0x05b000 0x7be48000 0x00000000 0x15000 0x15000 RWE 0x1000 

There is no dynamic section in this file. 

There are no relocations in this file. 

There are no unwind sections in this file. 

No version information found in this file. 

Notes at offset 0x00000694 with length 0x00000200: 
    Owner   Data size  Description 
    CORE   0x000000a8  NT_PRSTATUS (prstatus structure) 
    CORE   0x0000007c  NT_PRPSINFO (prpsinfo structure) 
    CORE   0x000000a0  NT_AUXV (auxiliary vector) 
[build]$ 

EDIT2:--coreオプション付き同じ問題:

$ sh3-linux-gdb ./myprogram --core=./core 
GNU gdb 6.3 
Copyright 2004 Free Software Foundation, Inc. 
GDB is free software, covered by the GNU General Public License, and you are 
welcome to change it and/or distribute copies of it under certain conditions. 
Type "show copying" to see the conditions. 
There is absolutely no warranty for GDB. Type "show warranty" for details. 
This GDB was configured as "--host=i386-pc-linux-gnu --target=sh3-linux"...RUN GDB INIT 
GDB can't read core files on this machine. 
(gdb) 
+1

これを試してくださいhttp://bsdimp.blogspot.com/2007/11/quick-thumbnail-to-cross-debugging-core.html – osgx

+0

いいえ、それは役に立ちません。 solib-absolute-prefixトリックでも同じ問題が発生します。 – SKi

+0

出力または 'readelf -a core'を投稿できますか? – osgx

答えて

-1

を直接GDBで、あなたのアプリケーションをデバッグすることはできませんしかし、gdbサーバーで。あなたがしなければならない最初の事は(あなたがこのパッケージが既にインストールされていることをあなたの質問で述べた)ターゲット・システムでgdbserverを呼び出すことです:

gdbserver AAA.BBB.CCC.DDD:port ./myprogram 

それは、ターゲットマシンがIPアドレスにアクセス可能であることを前提としています: AAA.BBB.CCC.DDD:port。一度、あなたはそれを行っている、あなたは、ターゲットのリモートサーバーを指定することで、開発マシンでGDBを呼び出すことができます。ターゲットリモートサーバのIPアドレスは、gdbserverを同じであることを

% gdb ./myprogram 
    % [...] 
    (gdb) target remote AAA.BBB.CCC.DDD:port 

注意。

+1

これは私の問題の答えではありません。私はgdbserverを使うことができますが、それは問題ではありませんでした。問題は、コアファイルを開くことです。 – SKi

1

それは古いGDB http://sourceware.org/bugzilla/show_bug.cgi?id=9542のバグかもしれhttp://forums.freescale.com/t5/68K-ColdFire-reg-Microprocessors/GDB-can-t-read-core-files/td-p/70181

sh3-linux-gdb ./myprogram --core=./core 

に応じて試してみてください - そう(7)あまりにも新しいGDBを試してみてください。

コアがサポートされていない形式でダンプされている可能性もあります。ターゲットのOS、バージョンは何ですか?

出力またはreadelf -a coreを転記できますか?

+0

対象OS:Linuxバージョン2.6.25.9(gccバージョン3.4.5 20060103(3.4.5-10.1a)) – SKi

+0

--coreオプションは役に立ちませんでした。そしてgdbのバージョン6.8以降は役に立たなかった。古いバグはまだ開いているようです。私はバグが最も考えられる理由で、この答えを受け入れるつもりです。 – SKi

+0

これはバグではありません。コアファイル形式とgdbのコア形式パーサーの組み合わせはサポートされていません。 gdbserverを使用しているときは、もう一方のコードはアクティブであり、ホストgdbに必要なコアの解析は行われません。 – osgx

関連する問題