Expose Frame Type and Stop Reason in python Unwinder API

Andrew Wock via Gdb <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <CAACtx1aThXELFEmbE3H=gjNqmBvGNwBiUka2u4ziyj_ji9psWA@mail.gmail.com>
Hello,

Recently I wrote a kernel trapframe unwinder using the python API, and
I was able to successfully extract the registers from the trapframe.
However, sometimes gdb would throw the "previous frame inner to this
frame" error on me.  This is because unwinding a trapframe sometimes
results in unwinding to a different stack.

The way this is fixed in the internal unwinder API is that there are
special frame types such as SIGTRAMP_FRAME which don't get checked for
that error.

Additionally, some trapframes unwind into userspace.  In those cases
I'd like to be able to stop the backtrace by setting a stop reason.
More broadly this would be useful for any case where a user wants to
stop the stacktrace at a certain point for whatever their use case is.

I'm interested in moving forward and writing a patch for this.

One implementation detail I noticed that complicates this
implementation is that all python unwinders are internally modeled as
a single C unwinder in py-unwind.c:974.  I believe that in order to
support a frame type feature, each unwinder will need to be modeled as
an independent C unwinder.

I am proposing this here to get community feedback on whether this
feature should be supported.

Thanks,
Andrew Wock
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.