【问题标题】:gdb call to malloc fails (iOS)gdb 调用 malloc 失败 (iOS)
【发布时间】: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:/

标签: ios gdb call


【解决方案1】:

GDB 似乎正在尝试访问未映射的内存区域,这是 malloc 调用返回的地址。尝试附加到已知的应用程序/进程并查看 malloc 调用是否有效。

您尝试过 1821 版吗? 可从CrackLords Repository 获得,将其添加到 cydia 以获取此版本 或者您也可以按照这些说明自行签名A working GNU Debugger on iOS >= 4.3

【讨论】:

    猜你喜欢
    • 2017-02-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-12
    • 1970-01-01
    • 2012-08-25
    相关资源
    最近更新 更多