教授gdb从核心文件中了解微线程 [英] Teaching gdb to understand micro-threads from core files
问题描述
我正在开发一个使用(定制的)微线程解决方案的大型程序。它有时发生,我需要调试崩溃。在这种时候,能够从一个微线程切换到另一个微线程是有用的。
I am working on a huge program that employs a (custom built) micro-threading solution. It sometimes happens that I need debug a crash. During such times, it is useful to be able to switch from one micro-thread to another.
如果我在进行实时调试,我可以替换所有的寄存器到那些来自微线程上下文。我写了一个宏来做这件事,它的工作原理很好。
If I'm doing live debugging, I can replace all of the registers to those that came from the micro-thread context. I have written a macro to do just that, and it works really well.
问题是,我不能更改寄存器值,如果我做事后调试从核心文件)。在这种情况下,我无法告诉GDB改变其当前帧的概念,因为在这种情况下所有寄存器都被认为是只读的。
The problem is that I cannot change the register values if I am doing post-mortem debugging (from a core file). In such a case, I have no way to tell GDB to change its concept of what the current frame is, as all registers are considered read-only in that case.
有没有办法告诉GDB我的自定义上下文管理?
Is there a way to tell GDB about my custom context management?
Shachar
推荐答案
在gdb中没有一个简单的内置方法。
There's not a simple, built-in way to do this in gdb.
我认为最简单的方法是编写一个gdbserver版本读取您的核心文件,并将您的微线程作为真正的线程呈现给gdb。有至少一个gdbserver,可以读取核心文件已经,所以也许这不是疯狂的困难。但是,我不能肯定地说。
I think probably the simplest way would be to write a version of gdbserver that can read your core files and that presents your micro-threads to gdb as real threads. There's been at least one gdbserver out there that can read core files already, so maybe it isn't crazily hard. However, I couldn't really say for sure.
这篇关于教授gdb从核心文件中了解微线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!