可以在 ISR 中使用断点吗?

发布于 2024-07-09 16:47:29 字数 27 浏览 8 评论 0原文

断点可以用在中断服务程序(ISR)中吗?

Can breakpoints be used in interrupt service routines (ISRs)?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

℉絮湮 2024-07-16 16:47:29

是的 - 在模拟器中

否则,不行。 这很难实现,而且无论如何都是一个坏主意。 ISR(通常)应该与硬件一起工作,当您在每条指令之间留出半秒的间隙时,硬件很容易表现出截然不同的行为。

相反,设置某种日志系统。

ISR 还会不礼貌地从其他进程中“窃取”CPU,因此许多操作系统建议让 ISR 保持极短,并且仅执行严格必要的操作(例如处理任何紧急硬件的东西,并安排一个将正确处理事件的任务)。 因此理论上,ISR 应该非常简单,不需要调试。

如果问题出在硬件行为上,请按照我的建议使用某种日志记录。 如果硬件并不介意指令之间的较长时间间隔,那么您可以在用户空间中编写大部分驱动程序 - 并且您可以对此使用调试器!

Yes - in an emulator.

Otherwise, no. It's difficult to pull off, and a bad idea in any case. ISRs are (usually) supposed to work with the hardware, and hardware can easily behave very differently when you leave a gap of half a second between each instruction.

Set up some sort of logging system instead.

ISRs also ungracefully "steal" the CPU from other processes, so many operating systems recommend keeping your ISRs extremely short and doing only what is strictly necessary (such as dealing with any urgent hardware stuff, and scheduling a task that will deal with the event properly). So in theory, ISRs should be so simple that they don't need to be debugged.

If it's hardware behaviour that's the problem, use some sort of logging instead, as I've suggested. If the hardware doesn't really mind long gaps of time between instructions, then you could just write most of the driver in user space - and you can use a debugger on that!

洒一地阳光 2024-07-16 16:47:29

根据您的平台,您可以通过访问处理器的调试端口(通常使用 JTAG 接口)来完成此操作。 请记住,您正在彻底改变与该方法的计时有关的所有内容,因此您的调试会话可能毫无用处。 但话又说回来,很多错误都可以通过这种方式捕获。 还要注意基于 MMU 的内存映射,因为 JTAG 调试器通常不会考虑它们。

Depending on your platform, you can do this by accessing the debug port of your processor, typically using the JTAG interface. Keep in mind that you're drastically changing everything that has to do with timing with that method, so your debug session may be useless. But then again, many bugs can be caught this way. Also mind MMU based memory mappings, as JTAG debuggers often don't take them into account.

绿萝 2024-07-16 16:47:29

在 Windows 中,附加了内核调试器,您确实可以放置断点在中断处理程序中。

In Windows, with a kernel debugger attached, you can indeed place breakpoints in interrupt handlers.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文