This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Target Dependent Backtrace Termination
- From: "Robert Norton" <rnorton at broadcom dot com>
- To: gdb at sourceware dot org
- Date: Tue, 12 Jun 2007 02:23:11 -0700
- Subject: Target Dependent Backtrace Termination
Hi,
Our target specifies in the ABI that frames should form a null
terminated back chain something like:
Address Contents
x: 0
... \ Frame of thread's
y: x / entry function
... \ Frame of thread's
z: y / level 1 function
...
So in principal it's not too hard for my target dependent code (i.e.
unwind_this_id) to tell when a backtrace should not proceed any further.
The problem I have is in trying to communicate this to the rest of GDB.
My first approach was to detect when unwind_this_id is passed a
next_frame which is the outermost frame and not return the frame_id in
this case, indicating failure. Unfortunately this caused the backtrace
to go one too far! Looking at some other ports it seems that the
solution is to return the null frame id for the outermost frame thus
causing get_prev_frame_1 to return null and terminating the backtrace.
But this means that the outermost frame doesn't haven't a valid frame
id! Won't this cause problems? Am I missing something rather
fundamental?
From what I can see all of the checks on frame validity in
get_prev_frame* are performed on this_frame which, in the case of the
outermost frame, is a valid frame and yet we want it to return null for
the previous frame of the outermost frame. How can this work? Perhaps I
am confused on the meanings of 'this', 'prev' and 'next' (though I
thought I had this nailed down by now)?
Robert
P.S. Sorry if this is a duplicate post, my last one didn't seem to get
through.