在x86 Linux上调试SIGBUS [英] Debugging SIGBUS on x86 Linux

查看:220
本文介绍了在x86 Linux上调试SIGBUS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Linux中的通用x86用户空间应用程序中,什么可能导致SIGBUS(总线错误)?所有在网上找到的讨论都是关于内存对齐错误的,这是我理解的并不适用于x86的。



(我的代码是运行在 Geode ,以防有任何相关的特定于处理器的怪癖。 )

解决方案

如果您打开未对齐的访问陷阱,您可以从未对齐的访问获取SIGBUS,但通常情况下x86。如果有某种错误,您也可以从访问内存映射设备获取它。



最好的办法是使用调试器来识别故障指令(SIGBUS是同步的),并试图看看它正在做什么。


What can cause SIGBUS (bus error) on a generic x86 userland application in Linux? All of the discussion I've been able to find online is regarding memory alignment errors, which from what I understand doesn't really apply to x86.

(My code is running on a Geode, in case there are any relevant processor-specific quirks there.)

解决方案

You can get a SIGBUS from an unaligned access if you turn on the unaligned access trap, but normally that's off on an x86. You can also get it from accessing a memory mapped device if there's an error of some kind.

Your best bet is using a debugger to identify the faulting instruction (SIGBUS is synchronous), and trying to see what it was trying to do.

这篇关于在x86 Linux上调试SIGBUS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆