From 70a61254396f4f4c3d39125cda58b7bbddd2c8dd Mon Sep 17 00:00:00 2001 From: John Szakmeister Date: Thu, 6 Jun 2013 22:54:57 -0400 Subject: [PATCH] Attempt to detect the correct processor type under Snow Leopard's gdb. Unfortunately, gdb under Snow Leopard doesn't give a useful doublet. So let's go the extra step and grab the osabi and use it to determine what processor we're using and the size. --- .gdb/detect-target.sh | 11 +++++++++++ .gdb/setup.gdb | 1 + 2 files changed, 12 insertions(+) diff --git a/.gdb/detect-target.sh b/.gdb/detect-target.sh index 2960528..75cfbda 100755 --- a/.gdb/detect-target.sh +++ b/.gdb/detect-target.sh @@ -5,6 +5,9 @@ TARGET_DOUBLET=$(grep 'file type' /tmp/gdb_info_target | cut -d ' ' -f 4 | uniq | tr -d '\n') +OSABI=$(grep 'currently ' /tmp/gdb_info_target | + sed 's/.*currently "\([^"]*\)".*/\1/' | + tr -d '\n') GDB_FILE="/tmp/gdb_target_arch.gdb" rm -f "$GDB_FILE" @@ -23,4 +26,12 @@ case "$TARGET_DOUBLET" in echo "set \$MIPS = 1" >> $GDB_FILE; echo "set \$64BITS = 1" >> $GDB_FILE; ;; + mach-o-*) + if test "$OSABI" == "Darwin64"; then + echo "set \$X86_64 = 1" >> $GDB_FILE; + echo "set \$64BITS = 1" >> $GDB_FILE; + elif test "$OSABI" == "Darwin"; then + echo "set \$X86 = 1" >> $GDB_FILE; + fi + ;; esac diff --git a/.gdb/setup.gdb b/.gdb/setup.gdb index d27d073..eccbd56 100644 --- a/.gdb/setup.gdb +++ b/.gdb/setup.gdb @@ -12,6 +12,7 @@ define setup-detect-target set logging on set pagination off info target + show osabi set pagination on set logging off set logging redirect off