了解 macOS 的分段错误错误
运行我的应用程序时,我收到分段错误,然后弹出一个窗口让我知道:
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0x0000000128108eb3 WP_ForcePowerRun(gentity_s*, forcePowers_t, usercmd_s*) + 4435
0x0000000128107c15 WP_ForcePowersUpdate(gentity_s*, usercmd_s*) + 501
0x0000000128033bc1 ClientThink_real(gentity_s*, usercmd_s*) + 1153
0x0000000128035843 ClientThink(int, usercmd_s*) + 995
0x00000001280bf68a NPC_Think(gentity_s*) + 1786
0x000000012805ef4a G_RunFrame(int) + 1418
0x000000010d28b4d0 SV_Frame(int, float) + 576
0x000000010d266c4c Com_Frame() + 588
0x000000010d2d7525 main + 389
0x00007fff2046af3d start + 1
所以我有两个问题:
- 每个函数右侧的数字是什么,即 +4435、+501 等?
- 有什么方法可以确定发生分段错误的具体行号吗?
When running my application, I receive a segmentation fault then a window pops up letting me know that:
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0x0000000128108eb3 WP_ForcePowerRun(gentity_s*, forcePowers_t, usercmd_s*) + 4435
0x0000000128107c15 WP_ForcePowersUpdate(gentity_s*, usercmd_s*) + 501
0x0000000128033bc1 ClientThink_real(gentity_s*, usercmd_s*) + 1153
0x0000000128035843 ClientThink(int, usercmd_s*) + 995
0x00000001280bf68a NPC_Think(gentity_s*) + 1786
0x000000012805ef4a G_RunFrame(int) + 1418
0x000000010d28b4d0 SV_Frame(int, float) + 576
0x000000010d266c4c Com_Frame() + 588
0x000000010d2d7525 main + 389
0x00007fff2046af3d start + 1
So I have two questions:
- What are the numbers on the right side of each function i.e +4435, +501, etc.?
- Is there any way to determine the specific line number where the segmentation fault is happening?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这些是偏移量,也就是在函数开始后发生错误的字节数。
您可以使用调试符号进行编译并使用 GDB 等调试器。
Those are the offset, aka how many bytes after the beginning of the function the fault happened.
You can compile with debug symbols and use a debugger like GDB.