Skip to content

Instantly share code, notes, and snippets.

@chen3feng
Last active June 7, 2024 06:47
Show Gist options
  • Save chen3feng/ac113d6de54c89ed6f3fa27a475d533e to your computer and use it in GitHub Desktop.
Save chen3feng/ac113d6de54c89ed6f3fa27a475d533e to your computer and use it in GitHub Desktop.
GDB Disassembled code filter
#!/bin/bash
sed -E -e "s/^(=>)?\s+0x[a-z0-9]+\s+//g" -e "s/(<\+[0-9]+>:\s+)(\w+\s+)0x[0-9a-f]+ </\1\2</g" "$@"
@chen3feng
Copy link
Author

chen3feng commented Jun 7, 2024

Remove absolute address from gdb disassembly code.

Convert code from like this

   0x000000000ac65032 <+242>:   mov    %rax,%rbx
   0x000000000ac65035 <+245>:   lea    0x8(%rsp),%rdi
   0x000000000ac6503a <+250>:   call   0x5545160 <FString::~FString()>

to like this

 <+242>:   mov    %rax,%rbx
 <+245>:   lea    0x8(%rsp),%rdi
 <+250>:   call   <FString::~FString()>

So you can easily compare generated code from different binary files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment