Home > Backend Development > C++ > body text

How to Extract Assembly Code from a Binary Executable in Linux?

Barbara Streisand
Release: 2024-10-31 08:49:30
Original
890 people have browsed it

How to Extract Assembly Code from a Binary Executable in Linux?

Obtaining Assembly Code from a Binary Executable in Linux

To extract assembly code from a binary executable in Linux, disassembling tools are typically employed. While the GNU Compiler Collection (GCC) does not directly offer a disassembly functionality, the objdump utility from the same development environment provides the necessary capability.

To disassemble a binary executable using objdump, follow these steps:

<code class="Bash">$ objdump -d /path/to/binary</code>
Copy after login

This command will generate a disassembly of the executable, displaying assembly instructions similar to the following:

080483b4 <main>:
 80483b4:   8d 4c 24 04             lea    0x4(%esp),%ecx
 80483b8:   83 e4 f0                and    xfffffff0,%esp
 80483bb:   ff 71 fc                pushl  -0x4(%ecx)
 80483be:   55                      push   %ebp
 80483bf:   89 e5                   mov    %esp,%ebp
 80483c1:   51                      push   %ecx
 80483c2:   b8 00 00 00 00          mov    x0,%eax
 80483c7:   59                      pop    %ecx
 80483c8:   5d                      pop    %ebp
 80483c9:   8d 61 fc                lea    -0x4(%ecx),%esp
 80483cc:   c3                      ret    
 80483cd:   90                      nop
 80483ce:   90                      nop
 80483cf:   90                      nop
Copy after login

The above is the detailed content of How to Extract Assembly Code from a Binary Executable in Linux?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template