首页 文章

LLDB:通过控制台为malloc_error_break设置断点

提问于
浏览
8

我在我的代码中遇到了一些与malloc相关的问题:

malloc: *** error for object 0x103401e28: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug

我尝试过这样的事情:

(lldb) breakpoint set malloc_error_break
error: invalid combination of options for the given command

如何使用终端设置此断点?我在网上搜索过,只找到了涉及Xcode的结果 .

1 回答

  • 11

    如果您熟悉gdb,那么这个小作弊表可能会有所帮助:

    http://lldb.llvm.org/lldb-gdb.html

    也:

    (lldb) help break set
    

    将为您提供有关在lldb中设置断点的大量信息 .

    在这种情况下:

    (lldb) br set --name malloc_error_break
    (lldb) br set -n malloc_error_break
    

    要么:

    (lldb) b malloc_error_break
    

    第一个示例使用 breakpoint set 这是一个"true" lldb命令 - 它使用标志选项和值来区分您尝试执行的操作 . b 是一个合成命令,它尝试粗略地重新创建gdb断点语法 .

相关问题