我試圖查看在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(反正這可能發生在我身上的未來,所以它有助於瞭解一個可能的解決方案)。 – 2013-02-25 21:09:50