iPad上的gdb无法转储内存

4

我正在尝试查看运行在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) 

然而,当我尝试转储其中一个内存区域时:
(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 非常棒,你在设备上使用了调试器(而且无论如何,这可能会在我未来遇到的问题中发生,所以知道一个可能的解决方案是很有帮助的)。 - user529758
1个回答

5
啊,显然随 Cydia 一起发布的 GDB 版本 无法在 iOS 5 上使用。以下是适用于我个人的说明:

GNU Debugger (gdb) 被用来分析 iOS 应用程序的运行时行为。在最近的 iOS 版本中,直接从 Cydia 下载的 GNU Debugger 已经损坏并且无法正常工作。按照 Pod 2g 的博客文章也没有帮助到我。

为了解决这个问题,在 Cydia 源中添加 http://cydia.radare.org 并下载最新的 GNU Debugger (build 1708)。GDB build 1708 可以在 iOS 5.x 上工作。


非常感谢您。我认为Pod2G的指示无法奏效的原因是第一代iPad是一个armv6设备,而他从Xcode中提取的版本的gdb仅编译了armv7支持。 - Ben Kreeger

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接