Skip to content

Commit

Permalink
Add commands header and loadcmds to dump mach-o header using otool.
Browse files Browse the repository at this point in the history
  • Loading branch information
reverser committed Aug 18, 2013
1 parent 5563237 commit 79b589d
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion gdbinit
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# DESCRIPTION: A user-friendly gdb configuration file, for x86/x86_64 and ARM platforms.
#
# REVISION : 8.0.4 (08/05/2013)
# REVISION : 8.0.5 (18/08/2013)
#
# CONTRIBUTORS: mammon_, elaine, pusillus, mong, zhang le, l0kit,
# truthix the cyberpunk, fG!, gln
Expand Down Expand Up @@ -30,6 +30,10 @@
#
# CHANGELOG: (older changes at the end of the file)
#
# Version 8.0.5 (18/08/2013)
# - Add commands header and loadcmds to dump Mach-O header information
# - Other fixes and additions from previous commits
#
# Version 8.0.4 (08/05/2013)
# - Detect automatically 32 or 64 bits archs using sizeof(void*).
# Thanks to Tyilo for the simple but very effective idea!
Expand Down Expand Up @@ -3676,6 +3680,31 @@ define resetkdp
set $KDP64BITS = -1
end

define header
if $argc != 0
dump memory /tmp/gdbinit_header_dump $arg0 $arg0 + 4096
shell /usr/bin/otool -h /tmp/gdbinit_header_dump
shell /bin/rm -f /tmp/gdbinit_header_dump
end
end
document header
Syntax: header MACHO_HEADER_START_ADDRESS
| Dump the Mach-O header located at given address
end

define loadcmds
if $argc != 0
# this size should be good enough for most binaries
dump memory /tmp/gdbinit_header_dump $arg0 $arg0 + 4096 * 10
shell /usr/bin/otool -l /tmp/gdbinit_header_dump
shell /bin/rm -f /tmp/gdbinit_header_dump
end
end
document loadcmds
Syntax: loadcmds MACHO_HEADER_START_ADDRESS
| Dump the Mach-O load commands
end

#EOF

# Older change logs:
Expand Down

0 comments on commit 79b589d

Please sign in to comment.