fbpx
Wikipedia

objdump

objdump is a command-line program for displaying various information about object files on Unix-like operating systems. For instance, it can be used as a disassembler to view an executable in assembly form. It is part of the GNU Binutils for fine-grained control over executables and other binary data. objdump uses the BFD library to read the contents of object files. Similar utilities are Borland TDUMP, Microsoft DUMPBIN and readelf.

Note that on certain platforms (e.g. macOS), the objdump binary may actually be a link to llvm's objdump, with different command-line options and behavior.[citation needed]

Example edit

For example,

$ objdump -D -M intel file.bin | grep main.: -A20 

This performs disassembly on the file «file.bin», with the assembly code shown in Intel syntax. We then redirect it to grep, which searches the main function and displays 20 lines of its code.

Example output:

 4004ed<main>:  4004ed:55   push rbp  4004ee:48 89 e5  mov rbp,rsp  4004f1:c7 45 ec 00 00 00 00 mov DWORD PTR [rbp-0x14],0x0  4004f8:c7 45 f0 01 00 00 00 mov DWORD PTR [rbp-0x10],0x1  4004ff:c7 45 f4 02 00 00 00 mov DWORD PTR [rbp-0xc],0x2  400506:c7 45 f8 03 00 00 00 mov DWORD PTR [rbp-0x8],0x3  40050d:c7 45 fc 04 00 00 00 mov DWORD PTR [rbp-0x4],0x4  400514:c7 45 ec 00 00 00 00 mov DWORD PTR [rbp-0x14],0x0  40051b:eb 13   jmp 400530 <main+0x43>  40051d:8b 05 15 0b 20 00  mov eax,DWORD PTR [rip+0x200b15] # 601038 <globalA>  400523:83 e8 01  sub eax,0x1  400526:89 05 0c 0b 20 00  mov DWORD PTR [rip+0x200b0c],eax # 601038 <globalA>  40052c:83 45 ec 01  add DWORD PTR [rbp-0x14],0x1  400530:8b 05 02 0b 20 00  mov eax,DWORD PTR [rip+0x200b02] # 601038 <globalA>  400536:39 45 ec  cmp DWORD PTR [rbp-0x14],eax  400539:7c e2   jl 40051d <main+0x30>  40053b:5d   pop rbp  40053c:c3   ret   40053d:0f 1f 00  nop DWORD PTR [rax] 

See also edit

References edit

External links edit

  • objdump(1) – Linux User Commands Manual
  • readelf(1) – Linux User Commands Manual
  • Binutils::Objdump - Perl interface to objdump


objdump, this, article, does, cite, sources, please, help, improve, this, article, adding, citations, reliable, sources, unsourced, material, challenged, removed, find, sources, objdump, news, newspapers, books, scholar, jstor, april, 2024, learn, when, remove. This article does not cite any sources Please help improve this article by adding citations to reliable sources Unsourced material may be challenged and removed Find sources Objdump news newspapers books scholar JSTOR April 2024 Learn how and when to remove this message objdump is a command line program for displaying various information about object files on Unix like operating systems For instance it can be used as a disassembler to view an executable in assembly form It is part of the GNU Binutils for fine grained control over executables and other binary data objdump uses the BFD library to read the contents of object files Similar utilities are Borland TDUMP Microsoft DUMPBIN and readelf objdumpOperating systemUnix and Unix likeTypeCommandLicenseGNU GPL Note that on certain platforms e g macOS the objdump binary may actually be a link to llvm s objdump with different command line options and behavior citation needed Contents 1 Example 2 See also 3 References 4 External linksExample editFor example objdump D M intel file bin grep main A20 This performs disassembly on the file file bin with the assembly code shown in Intel syntax We then redirect it to grep which searches the main function and displays 20 lines of its code Example output 4004ed lt main gt 4004ed 55 push rbp 4004ee 48 89 e5 mov rbp rsp 4004f1 c7 45 ec 00 00 00 00 mov DWORD PTR rbp 0x14 0x0 4004f8 c7 45 f0 01 00 00 00 mov DWORD PTR rbp 0x10 0x1 4004ff c7 45 f4 02 00 00 00 mov DWORD PTR rbp 0xc 0x2 400506 c7 45 f8 03 00 00 00 mov DWORD PTR rbp 0x8 0x3 40050d c7 45 fc 04 00 00 00 mov DWORD PTR rbp 0x4 0x4 400514 c7 45 ec 00 00 00 00 mov DWORD PTR rbp 0x14 0x0 40051b eb 13 jmp 400530 lt main 0x43 gt 40051d 8b 05 15 0b 20 00 mov eax DWORD PTR rip 0x200b15 601038 lt globalA gt 400523 83 e8 01 sub eax 0x1 400526 89 05 0c 0b 20 00 mov DWORD PTR rip 0x200b0c eax 601038 lt globalA gt 40052c 83 45 ec 01 add DWORD PTR rbp 0x14 0x1 400530 8b 05 02 0b 20 00 mov eax DWORD PTR rip 0x200b02 601038 lt globalA gt 400536 39 45 ec cmp DWORD PTR rbp 0x14 eax 400539 7c e2 jl 40051 d lt main 0x30 gt 40053b 5d pop rbp 40053c c3 ret 40053d 0f 1f 00 nop DWORD PTR rax See also edit nbsp Computer programming portal GNU BinutilsReferences editExternal links editobjdump 1 Linux User Commands Manual readelf 1 Linux User Commands Manual Binutils Objdump Perl interface to objdump nbsp This Unix related article is a stub You can help Wikipedia by expanding it vte Retrieved from https en wikipedia org w index php title Objdump amp oldid 1221265490, wikipedia, wiki, book, books, library,

article

, read, download, free, free download, mp3, video, mp4, 3gp, jpg, jpeg, gif, png, picture, music, song, movie, book, game, games.