2012-01-23 12 views
24

私が取り組んでいるプロジェクトのELFファイルレイアウトについて知る必要があり、私はこれらのツールの存在に気付きました。 すべてのLinuxディストリビューションにreadelfとobjdumpの両方が含まれているのはなぜですか?これらのツールはお互いを補完しますか?私はいつ別のものを使うのが好きですか? binutilsの/ readelf.cからreadelfとobjdump:なぜどちらも必要です

答えて

35

/* The difference between readelf and objdump: 

    Both programs are capabale of displaying the contents of ELF format files, 
    so why does the binutils project have two file dumpers ? 

    The reason is that objdump sees an ELF file through a BFD filter of the 
    world; if BFD has a bug where, say, it disagrees about a machine constant 
    in e_flags, then the odds are good that it will remain internally 
    consistent. The linker sees it the BFD way, objdump sees it the BFD way, 
    GAS sees it the BFD way. There was need for a tool to go find out what 
    the file actually says. 

    This is why the readelf program does not link against the BFD library - it 
    exists as an independent program to help verify the correct working of BFD. 

    There is also the case that readelf can provide more information about an 
    ELF file than is provided by objdump. In particular it can display DWARF 
    debugging information which (at the moment) objdump cannot. */ 
+12

objdump' '真であるために使用されるDWARF'デバッグ情報をダンプすることができない'についてのコメントが、およそ2005 –

+1

I以来、真されていません'readelf'はアーキテクチャに依存しないメモを追加したいと考えています。あなたのアプリケーションを適切に 'objdump 'するには、ARMバイナリのARM' objdump'、X86バイナリのための 'objdump 'など、適切なツールチェーンから適切な' objdump'を持たなければなりません。 –

関連する問題