💾 Archived View for g.codelearn.me › 2018-02-24-gdb-oneliners.gmi captured on 2023-05-24 at 18:05:32. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-01-29)
-=-=-=-=-=-=-
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