When the debugged program stops, GDB is able to analyze its call
stack (see Stack frames). The
represents a frame in the stack. A
<gdb:frame> object is only valid
while its corresponding frame exists in the inferior’s stack. If you try
to use an invalid frame object, GDB will throw a
gdb:invalid-object exception (see Guile Exception Handling).
<gdb:frame> objects can be compared for equality with the
equal? function, like:
(gdb) guile (equal? (newest-frame) (selected-frame)) #t
The following frame-related procedures are provided by the
#t if object is a
#t if frame is valid,
#f if not.
A frame object can become invalid if the frame it refers to doesn’t
exist anymore in the inferior. All
<gdb:frame> procedures will throw
an exception if the frame is invalid at the time the procedure is called.
Return the function name of frame, or
#f if it can’t be
<gdb:architecture> object corresponding to frame’s
architecture. See Architectures In Guile.
Return the type of frame. The value can be one of:
An ordinary stack frame.
A fake stack frame that was created by GDB when performing an inferior function call.
A frame representing an inlined function. The function was inlined
NORMAL_FRAME that is older than this one.
A frame representing a tail call. See Tail Call Frames.
A signal trampoline frame. This is the frame created by the OS when it calls into a signal handler.
A fake stack frame representing a cross-architecture call.
This is like
NORMAL_FRAME, but it is only used for the
Return an integer representing the reason why it’s not possible to find
more frames toward the outermost frame. Use
unwind-stop-reason-string to convert the value returned by this
function to a string. The value can be one of:
No particular reason (older frames should be available).
The previous frame’s analyzer returns an invalid result.
This frame is the outermost.
Cannot unwind further, because that would require knowing the values of registers or memory that have not been collected.
This frame ID looks like it ought to belong to a NEXT frame, but we got it for a PREV frame. Normally, this is a sign of unwinder failure. It could also indicate stack corruption.
This frame has the same ID as the previous one. That means that unwinding further would almost certainly give us another frame with exactly the same ID, so break the chain. Normally, this is a sign of unwinder failure. It could also indicate stack corruption.
The frame unwinder did not find any saved PC, but we needed one to unwind further.
The frame unwinder caused an error while trying to access memory.
Any stop reason greater or equal to this value indicates some kind of error. This special value facilitates writing code that tests for errors in unwinding in a way that will work correctly even if the list of the other values is modified in future GDB versions. Using it, you could write:
(define reason (frame-unwind-stop-readon (selected-frame))) (define reason-str (unwind-stop-reason-string reason)) (if (>= reason FRAME_UNWIND_FIRST_ERROR) (format #t "An error occured: ~s\n" reason-str))
Return the frame’s resume address.
Return the frame’s code block as a
See Blocks In Guile.
Return the symbol for the function corresponding to this frame
<gdb:symbol> object, or
#f if there isn’t one.
See Symbols In Guile.
Return the frame that called frame.
Return the frame called by frame.
Return the frame’s
<gdb:sal> (symtab and line) object.
See Symbol Tables In Guile.
Return the value of register in frame. register should be a string, like ‘pc’.
Return the value of variable in frame. If the optional
argument block is provided, search for the variable from that
block; otherwise start at the frame’s current block (which is
determined by the frame’s current program counter). The
variable must be given as a string or a
object, and block must be a
Set frame to be the selected frame. See Examining the Stack.
Return the selected frame object. See Selecting a Frame.
Return the newest frame object for the selected thread.
Return a string explaining the reason why GDB stopped unwinding
frames, as expressed by the given reason code (an integer, see the
frame-unwind-stop-reason procedure above in this section).