在无法使用 iOS 开发工具和脚本的 linux 环境中,如何在上传到服务器后符号化 ios 崩溃报告。我知道 Apple 使用 atos 和其他一些工具将十六进制地址与 .dYSM 文件一起映射到符号。
我可以将 .dYSM 文件与崩溃报告一起上传到服务器。引用了 QuincyKit,但他们在本地进行符号化。但是其他的像 HockeyApp 和 Critterism 正在远程进行。
请推荐在服务器中执行此操作的可能方法。
在无法使用 iOS 开发工具和脚本的 linux 环境中,如何在上传到服务器后符号化 ios 崩溃报告。我知道 Apple 使用 atos 和其他一些工具将十六进制地址与 .dYSM 文件一起映射到符号。
我可以将 .dYSM 文件与崩溃报告一起上传到服务器。引用了 QuincyKit,但他们在本地进行符号化。但是其他的像 HockeyApp 和 Critterism 正在远程进行。
请推荐在服务器中执行此操作的可能方法。
It is possible. You can take a look at https://github.com/facebook/atosl
I got it working under Linux. (Ubuntu Server) However, it takes some time to get it up and running.
atosl
First, you need to install libdwarf-dev
, dwarfdump
, binutils-dev
and libiberty-dev
.
E.g. on Ubuntu:
$ sudo apt-get install libdwarf-dev dwarfdump binutils-dev libiberty-dev
Download or clone the atosl repo from GitHub:
$ git clone https://github.com/facebook/atosl.git
CD to the atosl dir
$ cd atosl
Create a local config config.mk.local
which contains a flag with the location of your binutil apps. (in Ubuntu by default that's /usr/bin
). If you're not sure, you can find out by executing cat /var/lib/dpkg/info/binutils.list | less
and copy the path of the file objdump
. E.g. if the entry is /usr/bin/objdump
, your path is /usr/bin
.
So in the end, your config.mk.local
should look like this:
LDFLAGS += -L/usr/bin
Compile it:
$ make
Now you can start using it:
$ ./atosl --help
To show how atosl
is used, I'll provide a simple example.
Now let's take a look at a line from the crash log:
13 ErrorApp 0x000ea294 0xe3000 + 29332
To symbolicate this, we will need the load address
, and the runtime address
.
In this example the runtime address
is 0x000ea294
, and the load address
is 0xe3000
.
Now we have everything we need:
$ ./atosl -o [YOUR_dSYM_FILE] -l [LOAD_ADDRESS] [RUNTIME_ADDRESS]
In this example:
$ ./atosl -o ErrorApp.app.dSYM/Contents/Resources/DWARF/ErrorApp -l 0xe3000 0x000ea294
Which returns the symbolicated line:
main (in ErrorApp) (main.m:16)
Your vmaddr
, which usually is 0x00001000
, you can find by looking at the segname __TEXT
Mach-O load command of your binary. In my example, this happens to be different, namely 0x00004000
To find the address
, we need to do some math.
The address
is found by the following formula:
address = vmaddr + ( runtime_address - load_address )
In this example our address is:
0x00004000 + ( 0x000ea294 - 0xe3000 ) = 0xB294
I haven't played around with this that much yet, but for now it seems to give me the results I needed. Maybe it will work for you too.
您需要实现自己的 linux 兼容版本atos
,otool
和dwarfdump
(至少是符号化所需的功能)。Apple 工具不是开源的,只能在 Mac OS X 上运行。
这些服务均未提供可供第三方在非 OS X 系统上使用的解决方案。因此,除了实现在您的 linux 系统上运行所需的功能之外,您唯一的机会是在 Mac 上像 QuincyKit 那样做,请参阅https://github.com/TheRealKerni/QuincyKit/wiki/Remote-symbolication或使用第三方服务。
注意:我是 QuincyKit 的创建者和 HockeyApp 的联合创始人。