2013-02-25 86 views
4

我試圖查看在iPad上運行的應用程序的內存。我有應用程序的pid,我可以附加到gdb的過程。gdb在iPad上無法轉儲內存

iPad:~/dev root# gdb -p 3839 
GNU gdb 6.3.50.20050815-cvs (Fri May 20 08:08:42 UTC 2011) 
Copyright 2004 Free Software Foundation, Inc. 
GDB is free software, covered by the GNU General Public License, and you are 
welcome to change it and/or distribute copies of it under certain conditions. 
Type "show copying" to see the conditions. 
There is absolutely no warranty for GDB. Type "show warranty" for details. 
This GDB was configured as "--host=arm-apple-darwin9 --target=". 
/private/var/root/dev/3839: No such file or directory 
Attaching to process 3839. 
0x35824004 in ??() 
(gdb) 

然而,當我試圖dump內存區域之一:

(gdb) info mach-regions 
Region from 0x22000 to 0x24000 (---, max r-x; copy, private, not-reserved) 
    ... from 0x24000 to 0x269000 (---, max r-x; copy, private, not-reserved) 
[...] 
    ... from 0x267a000 to 0x267b000 (---, max rwx; copy, private, not-reserved) 
    ... from 0x267b000 to 0x267c000 (---, max rwx; copy, private, not-reserved) 
    ... from 0x267c000 to 0x267d000 (---, max rwx; copy, private, not-reserved) 
    ... from 0x267d000 to 0x267f000 (---, max rwx; copy, private, not-reserved) 
    ... from 0x267f000 to 0x2680000 (---, max rwx; copy, private, not-reserved) 
[...] 
(gdb) dump binary memory output.bin 0x267c000 0x267d000 

我得到這個錯誤:

gdb stack crawl at point of internal error: 
0 gdb         0x00170e74 internal_vproblem + 124 
1 gdb         0x0016dd68 internal_verror + 52 
2 gdb         0x0016dd94 align_down + 0 
3 gdb         0x0016def8 gdb_check_fatal + 36 
4 gdb         0x001eba9c mach_xfer_memory + 588 
5 gdb         0x000c7ca8 default_xfer_partial + 256 
6 gdb         0x000ca04c target_xfer_partial + 1004 
7 gdb         0x000ca404 target_read_partial + 56 
8 gdb         0x000ca488 target_read + 120 
9 gdb         0x000ca674 target_read_memory + 68 
10 gdb         0x00003f5c dump_memory_to_file + 276 
11 gdb         0x0016c804 execute_command + 1160 
12 gdb         0x000aba88 command_handler + 228 
13 gdb         0x000acd94 command_line_handler + 768 
14 gdb         0x002236b4 rl_callback_read_char + 160 
../../gdb-1518/src/gdb/macosx/macosx-nat-mutils.c:772: internal-error: assertion failure in function "mach_xfer_memory": r_end >= cur_memaddr 

A problem internal to GDB has been detected, 
further debugging may prove unreliable. 
Quit this debugging session? (y or n) y 

此時應用程序崩潰爲好,一旦我退出gdb。

看來我正在做的一切正確,在這裏......爲什麼錯誤發生?如何才能使其工作?

我在第一代iPad上運行iOS 5.1.1。

+1

+1(反正這可能發生在我身上的未來,所以它有助於瞭解一個可能的解決方案)。 – 2013-02-25 21:09:50

回答

5

啊顯然是Cydia doesn't work on iOS 5附帶的GDB版本。這些指令爲我工作:爲是真棒,使用該設備上的調試器

GNU Debugger (gdb) is used to analyze the run time behavior of an iOS application. In recent iOS versions, GNU Debugger directly downloaded from the Cydia is broken and not functioning properly. Following the Pod 2g blog post also did not help me.

To get rid of this problem, add http://cydia.radare.org to cydia source and download the latest GNU Debugger (build 1708). GDB build 1708 is working for iOS 5.x.

+0

爲此感謝萬億。我認爲Pod2G的說明不起作用的原因是因爲第一代iPad是armv6設備,而他從Xcode中提取的'gdb'版本僅在armv7支持下編譯。 – 2013-05-03 21:00:39