2012-01-23 27 views
24

Çalıştığım bir projenin ELF dosya düzenini öğrenmem gerekiyor ve bu araçların varlığını fark ettim. Neden tüm Linux dağıtımları hem kendi hem de objdump içerir? Bu araçlar birbirini tamamlıyor mu? Ne zaman diğerini tercih ederim? binutils gelenreadelf vs. objdump: neden her ikisi de ihtiyaç duyuyoruz

cevap

35

/readelf.c:

/* 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' 'gerçek olamayacak kullanılan DWARF' debug bilgi dökümü mümkün değil' hakkında yorum, ancak yaklaşık 2005 –

+1

I beri gerçek olmamıştır ayrıca bir not eklemek ister, 'kendini' mimariden bağımsızdır. Uygulamanızı uygun bir şekilde 'objdump' yerine, ilgili bir takım zincirinden uygun bir 'objdump' 'a sahip olmanız, yani ARM ikili objektifler için ARM 'objdump', X86 ikili dosyaları için x86' objdump' vb. –

İlgili konular