ios 如何“在 malloc_error_break 中设置断点进行调试”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14045208/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 21:37:52  来源:igfitidea点击:

How to "set a breakpoint in malloc_error_break to debug"

iphoneios

提问by openfrog

I'm getting lots of console outputs like this without my application crashing:

我得到了很多这样的控制台输出,而我的应用程序没有崩溃:

malloc: * error for object 0xc6a3970: pointer being freed was not allocated *set a breakpoint in malloc_error_break to debug

malloc:* 对象 0xc6a3970 的错误:未分配释放的指针 *在 malloc_error_break 中设置断点以进行调试

How can I find out which object or variable is affected?

如何找出受影响的对象或变量?

I tried setting a symbolic breakpoint like this but it never halts:

我尝试设置这样的符号断点,但它永远不会停止:

enter image description here

在此处输入图片说明

回答by Andrew Madsen

Set a breakpoint on malloc_error_break() by opening the Breakpoint Navigator (View->Navigators->Show Breakpoint Navigator or ?7), clicking the plus button in the lower left corner, and selecting "Add Symbolic Breakpoint". In the popup that comes up, enter malloc_error_breakin the Symbol field, then click Done.

通过打开 Breakpoint Navigator(View->Navigators->Show Breakpoint Navigator 或 ?7)在 malloc_error_break() 上设置断点,单击左下角的加号按钮,然后选择“添加符号断点”。在出现的弹出窗口中,malloc_error_break在符号字段中输入,然后单击完成。

EDIT: openfrog added a screenshot and indicated that he's already tried these steps without success afterI posted my answer. With that edit, I'm not sure what to say. I haven't seen that fail to work myself, and indeed I always keep a breakpoint on malloc_error_break set.

编辑:openfrog 添加了一个屏幕截图并表示我发布我的答案他已经尝试了这些步骤但没有成功。有了那个编辑,我不知道该说什么。我还没有看到我自己失败了,实际上我总是在 malloc_error_break 集上保留一个断点。

回答by Vinzzz

In your screenshot, you didn't specify any module: try setting "libsystem_c.dylib"

在您的屏幕截图中,您没有指定任何模块:尝试设置“libsystem_c.dylib”

enter image description here

在此处输入图片说明

I did that, and it works : breakpoint stops here (although the stacktrace often rise from some obscure system lib...)

我这样做了,并且有效:断点在这里停止(尽管堆栈跟踪通常来自一些晦涩的系统库......)

回答by Sébastien

I had the same problem with Xcode. I followed steps you gave and it didn't work. I became crazy because in every forum I saw, all clues for this problem are the one you gave. I finally saw I put a space after the malloc_error_break, I suppressed it and now it works. A dumb problem but if the solution doesn't work, be sure you haven't put any space before and after the malloc_error_break.

我在 Xcode 上遇到了同样的问题。我按照你给的步骤,但没有奏效。我发疯了,因为在我看到的每个论坛中,这个问题的所有线索都是你提供的。我终于看到我在 malloc_error_break 后面放了一个空格,我压制了它,现在它可以工作了。一个愚蠢的问题,但如果解决方案不起作用,请确保您没有在 malloc_error_break 前后放置任何空间。

Hope this message will help..

希望这个消息会有所帮助..

回答by user3843991

I had given permissions I shouldn't have to write in some folders (especially /usr/bin/), and that caused the problem. I fixed it by opening Disk Utility and running 'Repair Disk Permissions' on the Macintosh HD disk.

我已经授予我不应该在某些文件夹(尤其是 /usr/bin/)中写入的权限,这导致了问题。我通过打开磁盘工具并在 Macintosh HD 磁盘上运行“修复磁盘权限”来修复它。

回答by Kris Roofe

I solve it by close safari inspector. Refer to my post. I also found sound sometimes when I run my app for testing, then I open safari with auto inspector on, after this, I do some action in my app then this issue triggered.

我通过关闭 safari 检查员解决它。参考我的帖子。当我运行我的应用程序进行测试时,有时我也会发现声音,然后我打开带有自动检查器的 safari,在此之后,我在我的应用程序中执行了一些操作,然后触发了这个问题。

enter image description here

在此处输入图片说明