【发布时间】:2012-12-14 00:01:17
【问题描述】:
我在 iOS 6.0.1 上使用 gdb(来自radare.org 的 1708 版)来调试未知应用程序。出于某种原因,我想分配内存,这应该通过“调用(char *)malloc(size)”来工作。我已经浏览了很多使用此类调用的示例(例如here),但所有这些调用都失败了。
(gdb) call (char*)malloc(4)
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x00000004
0x37af2060 in strcpy ()
The program being debugged was signaled while in a function called from GDB.
GDB has restored the context to what it was before the call.
To change this behavior use "set unwindonsignal off"
Evaluation of the expression containing the function (malloc) will be abandoned.
或 (gdb) print (float) fabs (3.0)
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x40080000
0x37b18040 in T_CString_int64ToString ()
The program being debugged was signaled while in a function called from GDB.
GDB remains in the frame where the signal was received.
To change this behavior use "set unwindonsignal on"
Evaluation of the expression containing the function (T_CString_int64ToString) will be abandoned.
为什么 malloc 会以参数“size”访问内存? Anly 想法如何解决这个问题?还是 gdb 版本根本不适合 iOS 6.X?实际调用似乎有效,但内部函数导致失败(T_CString_int64ToString)。
【问题讨论】:
-
如果你尝试使用 lldb 会发生什么?它没有经过试验和验证,但它可能只适用于这种情况。
-
似乎 lldb 仅通过 MacOS 系统上的 XCode 支持。 (“请注意,LLDB 目前只能在带有 Xcode 的 Mac OS X 上开箱即用地构建”)。我只有一个通过 SSH 运行 gdb 的越狱 iPod:/