I just spent some time and put together a bunch of user-defined commands to aid debugging with gdb on intel machines. They allow you to do things like print arguments to the current method, print arguments for the method about to be called, print return values, etc. To try them out, download this file, put it in your home folder, and rename it to .gdbinit. Then the next time you run gdb, try running help user-defined to get a synopsis of all new commands. You can ask for help on a specific command for more details as well.

The basis for this was inspired by Daniel Jalkut on the #macsb channel.

Update: I just added a new function getret. Re-download to get the changes.

No Responses to “GDB tools for intel debugging”
  1. What’s the character encoding on that — I’m seeing some “gremlins” when viewing it …

  2. The encoding seems to be UTF-8 from this end, no problems here. If you’re getting weird individual characters (i.e. a strange block in the middle of a word), then it’s generally non-unicode being misinterpreted as unicode. If you see pairs of high-ascii instead of letters, then it’s generally the opposite.

  3. Kevin Ballard says:

    Oh oops, I forgot I had some non-breaking spaces in there (otherwise gdb ignores the blank lines in the doc strings). It’s UTF-8. I’ll fix the file to be ASCII-only instead. Sorry ’bout that.

  4. Nice stuff, Kevin. You’re paving the way for a smooth transition to Intel debugging!

    PS I like this blog’s template, too. The big sectional labels make it really easy to navigate. Blog envy!