SymbolicateCrash没有创建正确的去符号文件

时间:2011-09-29 07:05:53

标签: iphone objective-c ios symbolicatecrash

我在客户端的计算机上创建了用于构建的dSYM文件。客户端在构建中崩溃了,现在我试图通过终端中的简单跟随命令使用symbolicatecrash来解码符号:

symbolicatecrash myapp_iPod-Touch.crash myapp.app.dSYM > test.txt

但它没有创建任何有意义的de-symboled文件。并且它在终端中给出了以下错误:

Can't understand the output from otool

然后我在以下链接中找到了解决方案: iPhone SDK 3.0 and symbolicatecrash not getting along? 但它仍然没有将确切的内存位置去符号化到导致崩溃的确切代码行。

然后我也试了一些其他的选择: 以下是另一种选择但不起作用:

symbolicatecrash.sh -A -v [crashlog-filename] MyApp.dSYM

供参考:http://apptech.next-munich.com/2010/01/symbolicatecrash.html

帮助我的最佳选择是atos命令获取崩溃的确切代码行号但是我想要系统的symbolicatecrash来创建转储。

注意:当我在我的机器中创建构建并且desymbolicate(我的机器创建)构建我的机器中的崩溃日志时,它创建了非常好的转储文件(显示确切的内存位置VS代码行负责崩溃)。

1 个答案:

答案 0 :(得分:0)

如果你有崩溃的DSYM文件,那么你可以使用这个:

#!/bin/bash

if [[ $# < 2 ]]
then
echo "Usage: $0 [-arch <arch> (defaults to whatever is specified in the crashlog-   file] <dSYM-file> <crashlog-file>"
exit 1
fi

#Get the architecture either from the params or from the crashlog itself
ARCH_PARAMS=''
if [[ "${1}" == '-arch' ]]
then
ARCH_PARAMS="-arch ${2}"
shift 2
else
ARCHITECTURE=$(cat "${2}" | grep -A1 "Binary Images:" | grep 0x | sed -E -n 's/.*(armv[6-9]).*/\1/p')
if [ -n "${ARCHITECTURE}" ]
then
    ARCH_PARAMS="-arch ${ARCHITECTURE}"
else
    echo "Couldn't determine architecture based on the crashlog. Please specify it by calling $0 -arch <arch> <dSYM-file> <crashlog-file>"
    exit
fi
fi
echo "Assuming architecture:" ${ARCHITECTURE}

#Store the other params
SYMBOL_FILE="${1}"
CRASHLOG="${2}"

#Get the identifier out of the crashlog
IDENTIFIER=$(cat "${CRASHLOG}" | egrep -o "^Identifier:[[:space:]]*.*$" | sed 's/^Identifier:[[:space:]]*\(.*\)$/\1/')
echo "Identifier:" $IDENTIFIER
echo
echo

#Iterate through the crashlog files, find the ones that belong to the $IDENTIFIER, sed the address out of those files, symbolicate them with atos and finally replace them back into those line again. Print all other lines untouched.
while read line
do
SYMBOL=$(echo $line | sed -E -n "s/.*(${IDENTIFIER}[[:space:]]*)(0x[[:alnum:]]*).*/\2/p" | atos -o "${SYMBOL_FILE}/Contents/Resources/DWARF/${IDENTIFIER}"     ${ARCH_PARAMS})
if [ -n "$SYMBOL" ]
then
    echo $line | sed -E "s/(${IDENTIFIER}[[:space:]]*)(0x[[:alnum:]]*)(.*)/\1\2 ${SYMBOL}/"
else
    echo $line
fi
done < "${CRASHLOG}"