iPad で実行されているアプリのメモリを調べようとしています。アプリの pid を取得し、 でプロセスにアタッチできますgdb
。
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)
ただし、メモリ領域の 1 つをダンプしようとすると:
(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を終了すると、その時点でアプリもクラッシュします。
ここですべてを正しく行っているようです...なぜエラーが発生するのですか? そして、それを機能させるにはどうすればよいでしょうか?
私は第 1 世代の iPad で iOS 5.1.1 を実行しています。