Skip to content

Commit 79b589d

Browse files
author
reverser
committed
Add commands header and loadcmds to dump mach-o header using otool.
1 parent 5563237 commit 79b589d

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

gdbinit

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# DESCRIPTION: A user-friendly gdb configuration file, for x86/x86_64 and ARM platforms.
44
#
5-
# REVISION : 8.0.4 (08/05/2013)
5+
# REVISION : 8.0.5 (18/08/2013)
66
#
77
# CONTRIBUTORS: mammon_, elaine, pusillus, mong, zhang le, l0kit,
88
# truthix the cyberpunk, fG!, gln
@@ -30,6 +30,10 @@
3030
#
3131
# CHANGELOG: (older changes at the end of the file)
3232
#
33+
# Version 8.0.5 (18/08/2013)
34+
# - Add commands header and loadcmds to dump Mach-O header information
35+
# - Other fixes and additions from previous commits
36+
#
3337
# Version 8.0.4 (08/05/2013)
3438
# - Detect automatically 32 or 64 bits archs using sizeof(void*).
3539
# Thanks to Tyilo for the simple but very effective idea!
@@ -3676,6 +3680,31 @@ define resetkdp
36763680
set $KDP64BITS = -1
36773681
end
36783682

3683+
define header
3684+
if $argc != 0
3685+
dump memory /tmp/gdbinit_header_dump $arg0 $arg0 + 4096
3686+
shell /usr/bin/otool -h /tmp/gdbinit_header_dump
3687+
shell /bin/rm -f /tmp/gdbinit_header_dump
3688+
end
3689+
end
3690+
document header
3691+
Syntax: header MACHO_HEADER_START_ADDRESS
3692+
| Dump the Mach-O header located at given address
3693+
end
3694+
3695+
define loadcmds
3696+
if $argc != 0
3697+
# this size should be good enough for most binaries
3698+
dump memory /tmp/gdbinit_header_dump $arg0 $arg0 + 4096 * 10
3699+
shell /usr/bin/otool -l /tmp/gdbinit_header_dump
3700+
shell /bin/rm -f /tmp/gdbinit_header_dump
3701+
end
3702+
end
3703+
document loadcmds
3704+
Syntax: loadcmds MACHO_HEADER_START_ADDRESS
3705+
| Dump the Mach-O load commands
3706+
end
3707+
36793708
#EOF
36803709

36813710
# Older change logs:

0 commit comments

Comments
 (0)