aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/binary
diff options
context:
space:
mode:
authorJohannes Stoelp <johannes.stoelp@gmail.com>2024-01-23 00:41:11 +0100
committerJohannes Stoelp <johannes.stoelp@gmail.com>2024-01-23 00:41:11 +0100
commit70631e160dcbaf6b43d33654d52ca96655509534 (patch)
treec672208711b3542c22f442ca925f5b688d9c06ab /src/binary
parent7199cf6515f9545f345b37a402293fc13bbb5a47 (diff)
downloadnotes-70631e160dcbaf6b43d33654d52ca96655509534.tar.gz
notes-70631e160dcbaf6b43d33654d52ca96655509534.zip
objdump: disasm specific sym, visualize jumps
Diffstat (limited to 'src/binary')
-rw-r--r--src/binary/objdump.md27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/binary/objdump.md b/src/binary/objdump.md
index a76a327..6f17cb5 100644
--- a/src/binary/objdump.md
+++ b/src/binary/objdump.md
@@ -2,13 +2,15 @@
```markdown
objdump [opts] <elf>
- -M intel use intil syntax
- -d disassemble text section
- -D disassemble all sections
- -S mix disassembly with source code
- -C demangle
- -j <section> display info for section
- --[no-]show-raw-insn [dont] show object code next to disassembly
+ -M intel use intil syntax
+ -d disassemble text section
+ -D disassemble all sections
+ --disassemble=<sym> disassemble symbol <sym>
+ -S mix disassembly with source code
+ -C demangle
+ -j <section> display info for section
+ --[no-]show-raw-insn [dont] show object code next to disassembly
+ --visualize-jumps[=color] visualize jumps with ascii art, optionally color arrows
```
## Disassemble section
@@ -54,3 +56,14 @@ objcopy -O binary --only-section .text test test-bin
# Disassemble raw binary.
objdump -D -b binary -m i386:x86-64 test-bin
```
+
+## Example: disassemble specific symbol
+```bash
+# Disassemble main().
+objdump --disassemble=main <bin>
+# Disassemble 'foo::bar()' (mangled).
+objdump --disassemble=_ZN3foo3barEvr <bin>
+
+# Disassemble 'foo::bar()' (demangled), requires -C
+objdump -C --disassemble=foo::bar <bin>
+```