summaryrefslogtreecommitdiff
path: root/Userland/disasm.cpp
AgeCommit message (Collapse)Author
2020-12-25LibELF: Remove ELF::Loader and move everyone to ELF::ImageAndreas Kling
This commit gets rid of ELF::Loader entirely since its very ambiguous purpose was actually to load executables for the kernel, and that is now handled by the kernel itself. This patch includes some drive-by cleanup in LibDebug and CrashDaemon enabled by the fact that we no longer need to keep the ref-counted ELF::Loader around.
2020-12-06Userland: Write some '--help' descriptions where appropriateBen Wiederhake
2020-10-24AK: Eradicate the uses of out().asynts
2020-08-17disasm: Use make<X86::ELFSymbolProvider> instead of naked newAndreas Kling
2020-08-16disasm: For ELF inputs, pass an ELFSymbolProvider to disassemblerNico Weber
This lets disasm output contain the symbol names of call and jump destinations: 8048111: e8 88 38 01 00 call 805b99e <__cxa_atexit> ... 8048150: 74 15 je 8048167 <_start+0x4c> The latter (the symbol of the current function with an offset) is arguably more distracting than useful because you usually want to look at the instruction at the absolute offset in this case, but the former is very nice to have. For reasons I do not understand, this cuts the time to run `disasm /bin/id` in half, from ~1s to ~0.5s.
2020-08-14disasm: Print correct offset-relative jumps in ELF file disassemblyNico Weber
2020-08-10disasm: Insert symbol names in disassembly streamNico Weber
The symbol name insertion scheme is different from objdump -d's. Compare the output on Build/Userland/id: * disasm: ... _start (08048305-0804836b): 08048305 push ebp ... 08048366 call 0x0000df56 0804836b o16 nop 0804836d o16 nop 0804836f nop (deregister_tm_clones (08048370-08048370)) 08048370 mov eax, 0x080643e0 ... _ZN2AK8Utf8ViewC1ERKNS_6StringE (0805d9b2-0805d9b7): _ZN2AK8Utf8ViewC2ERKNS_6StringE (0805d9b2-0805d9b7): 0805d9b2 jmp 0x00014ff2 0805d9b7 nop * objdump -d: 08048305 <_start>: 8048305: 55 push %ebp ... 8048366: e8 9b dc 00 00 call 8056006 <exit> 804836b: 66 90 xchg %ax,%ax 804836d: 66 90 xchg %ax,%ax 804836f: 90 nop 08048370 <deregister_tm_clones>: 8048370: b8 e0 43 06 08 mov $0x80643e0,%eax ... 0805d9b2 <_ZN2AK8Utf8ViewC1ERKNS_6StringE>: 805d9b2: e9 eb f6 ff ff jmp 805d0a2 <_ZN2AK10StringViewC1ERKNS_6StringE> 805d9b7: 90 nop Differences: 1. disasm can show multiple symbols that cover the same instructions. I've only seen this happen for C1/C2 (and D1/D2) ctor/dtor pairs, but it could conceivably happen with ICF as well. 2. disasm separates instructions that do not belong to a symbol with a newline, so that nop padding isn't shown as part of a function when it technically isn't. 3. disasm shows symbols that are skipped (due to having size 0) in parenthesis, separated from preceding and following instructions.
2020-08-09disasm: For ELF files, disassemble .text sectionNico Weber
Since disasm is built in lagom, this requires adding LibELF to lagom.
2020-08-06Userland: Use Core::ArgsParser for 'disasm'Linus Groh
2020-07-31Userland: Add missing checks for MappedFile.is_valid()Ben Wiederhake
2020-05-09Userland: Add missing copyright header to disasm.cppLinus Groh
2020-04-11LibX86: Run the instruction decoder in 32-bit mode by defaultAndreas Kling
Let's assume a 32-bit execution environment unless otherwise specified.
2020-04-11LibX86: Add an X86 instruction decoder library + basic disassemblerAndreas Kling
This will be very useful for developer tools like ProfileView, and also for future tools like debuggers and such. :^)