Gdbinit v7.1.6

While searching the web for some gdb patches I stumbled upon this fix to ‘assemble’ function from gdbinit by Tavis Ormandy (good work!). I modified it a little bit to work with Mac OS X.
This function allows you to assemble directly (using nasm, Intel format) to running program or just output the correspondent opcodes for your assembly input. Type ‘help assemble’ 🙂 Very useful to get the opcodes you need to patch the binary.

The other small fix is to rename ‘thread’ function to ‘threads’. That was making it impossible to move between program threads.

That’s all for now 🙂 Have fun!

Ah… grab version 7.1.6 here: gdbinit-v7.1.6

The latest version can always be found here.

7 thoughts on “Gdbinit v7.1.6

  1. Hey,

    Thanks so much for your blog…very interesting. I have been cracking for some time, but have always wanted a way of logging routines called. It seems the trace_run command seems very interesting but I can’t get it to work!

    In Terminal, the .gdbinit file works fine. I have tried numerous ways: gdb , then trace_run, then r for run in GDB but the output file there is nothing. I have also tried in Terminal: ‘GDB’. Then exec-file then trace_run. I have even tried loading the binary first, then in GDB attach then trace_run but no joy. Would you be able to give an example line of code that works for trace_run? I’d appreciate it soooooo much!


  2. This is what I have tried: GDB. exec-file , trace_run. r – No output. I have also tried: GDB. Run application. Back to Terminal. attach e.g. 949. Terminal freezes for ages. I’ve also tried: GDB. trace_run but no joy.


  3. Hello,

    Never tried that command 🙂 Not sure if it’s portable to Mac OS X version. Remember the original gdbinit is coming from Linux world. I will give it some try and see if I can get it working.
    I’m finishing a very long tutorial and after that I will check it 🙂


  4. I don’t know if I’m the only one here, but the modified version of assemble in gdbinit didn’t work (error msg : “/tmp/16148:1: error: label or instruction expected at start of line”). I dumped the file created by the script, it looked like that :
    -e BITS 32\n-E mov eax, 0x0

    Looks like the echo options were not interpreted… I found a workaround (don’t ask me why it works !) : replace the call to echo “/bin/echo -e blabla” by “echo -e blabla”. Now you can use this wonderful macro.

    1. Hi !

      Thanks for the reminder ! I knew it wasn’t working anymore and it was in my todo list ! I will give it a try and understand why it’s not working… /bin/echo does exist. Something with Leopard changed things 🙂


Leave a Reply

Your email address will not be published. Required fields are marked *