💾 Archived View for g.codelearn.me › 2018-02-24-gdb-oneliners.gmi captured on 2023-06-16 at 16:23:03. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-01-29)

-=-=-=-=-=-=-

GDB oneliners

Recently I wanted to print disassembled main funciton of the program to the file so I can read it in my Emacs, but it turned out I can't simply redirect the GDB output to the file with `disassemble main > main.asm` command in gdb command line.

But there is `-ex` option exists in gdb command so we can execute some gdb commands right after gdb is initialized.

Looks like this:

gdb <file> -ex 'disassemble main' -ex 'quit' > main.asm