This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Why do we have two ways of finding sniffers?


Looking at frame-unwind.c and frame-unwind.h, it seems like there are
two mostly equivalent ways to register frame unwinding methods.  Why
do we have two ways, instead of just one?  The comments in
frame-unwind.h don't really explain why it's helpful.

The only function that scans the list of unwinders is
frame_unwind_by_frame: it takes a NEXT frame, and returns a 'struct
frame_unwind *' if it can find one.

It works by walking the NEXT frame's gdbarch's list of frame
unwinders.  Each entry in the list is one of two possible kinds:

- If the entry points to a frame_unwind_sniffer_ftype function, that
  takes the next frame's frame_info; if it likes it, then it returns a
  'struct frame_unwind *' to use for this frame.

- If the entry points to a 'struct frame_unwind' object, that contains
  its own sniffer, which takes a pointer to the 'struct frame_unwind',
  the next frame's frame_info, and a prologue cache, and just returns
  a boolean indicating whether this is an appropriate frame_unwind for
  it.

I don't understand why we need both alternatives.  Shouldn't it be
sufficient to simply have each entry in the list point to a function
that expects the next frame's frame_info and a prologue cache, and
returns a 'struct frame_unwind *' or zero?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]