Remove m_has_locator
[external/binutils.git] / gdb / frame-unwind.h
index 35eeebf..9543ddd 100644 (file)
@@ -1,6 +1,6 @@
 /* Definitions for a frame unwinder, for GDB, the GNU debugger.
 
 /* Definitions for a frame unwinder, for GDB, the GNU debugger.
 
-   Copyright (C) 2003, 2004, 2007, 2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 
    This file is part of GDB.
 
@@ -32,8 +32,8 @@ struct value;
 
 /* The following unwind functions assume a chain of frames forming the
    sequence: (outer) prev <-> this <-> next (inner).  All the
 
 /* The following unwind functions assume a chain of frames forming the
    sequence: (outer) prev <-> this <-> next (inner).  All the
-   functions are called with the next frame's `struct frame_info'
-   and this frame's prologue cache.
+   functions are called with this frame's `struct frame_info' and
+   prologue cache.
 
    THIS frame's register values can be obtained by unwinding NEXT
    frame's registers (a recursive operation).
 
    THIS frame's register values can be obtained by unwinding NEXT
    frame's registers (a recursive operation).
@@ -44,12 +44,18 @@ struct value;
 
 /* Given THIS frame, take a whiff of its registers (namely
    the PC and attributes) and if SELF is the applicable unwinder,
 
 /* Given THIS frame, take a whiff of its registers (namely
    the PC and attributes) and if SELF is the applicable unwinder,
-   return non-zero.  Possibly also initialize THIS_PROLOGUE_CACHE.  */
+   return non-zero.  Possibly also initialize THIS_PROLOGUE_CACHE; but
+   only if returning 1.  Initializing THIS_PROLOGUE_CACHE in other
+   cases (0 return) is invalid.  In case of exception, the caller has
+   to set *THIS_PROLOGUE_CACHE to NULL.  */
 
 typedef int (frame_sniffer_ftype) (const struct frame_unwind *self,
                                   struct frame_info *this_frame,
                                   void **this_prologue_cache);
 
 
 typedef int (frame_sniffer_ftype) (const struct frame_unwind *self,
                                   struct frame_info *this_frame,
                                   void **this_prologue_cache);
 
+typedef enum unwind_stop_reason (frame_unwind_stop_reason_ftype)
+  (struct frame_info *this_frame, void **this_prologue_cache);
+
 /* A default frame sniffer which always accepts the frame.  Used by
    fallback prologue unwinders.  */
 
 /* A default frame sniffer which always accepts the frame.  Used by
    fallback prologue unwinders.  */
 
@@ -57,6 +63,25 @@ int default_frame_sniffer (const struct frame_unwind *self,
                           struct frame_info *this_frame,
                           void **this_prologue_cache);
 
                           struct frame_info *this_frame,
                           void **this_prologue_cache);
 
+/* A default stop_reason callback which always claims the frame is
+   unwindable.  */
+
+enum unwind_stop_reason
+  default_frame_unwind_stop_reason (struct frame_info *this_frame,
+                                   void **this_cache);
+
+/* A default unwind_pc callback that simply unwinds the register identified
+   by GDBARCH_PC_REGNUM.  */
+
+extern CORE_ADDR default_unwind_pc (struct gdbarch *gdbarch,
+                                   struct frame_info *next_frame);
+
+/* A default unwind_sp callback that simply unwinds the register identified
+   by GDBARCH_SP_REGNUM.  */
+
+extern CORE_ADDR default_unwind_sp (struct gdbarch *gdbarch,
+                                   struct frame_info *next_frame);
+
 /* Assuming the frame chain: (outer) prev <-> this <-> next (inner);
    use THIS frame, and through it the NEXT frame's register unwind
    method, to determine the frame ID of THIS frame.
 /* Assuming the frame chain: (outer) prev <-> this <-> next (inner);
    use THIS frame, and through it the NEXT frame's register unwind
    method, to determine the frame ID of THIS frame.
@@ -121,6 +146,13 @@ typedef struct value * (frame_prev_register_ftype)
 typedef void (frame_dealloc_cache_ftype) (struct frame_info *self,
                                          void *this_cache);
 
 typedef void (frame_dealloc_cache_ftype) (struct frame_info *self,
                                          void *this_cache);
 
+/* Assuming the frame chain: (outer) prev <-> this <-> next (inner);
+   use THIS frame, and implicitly the NEXT frame's register unwind
+   method, return PREV frame's architecture.  */
+
+typedef struct gdbarch *(frame_prev_arch_ftype) (struct frame_info *this_frame,
+                                                void **this_prologue_cache);
+
 struct frame_unwind
 {
   /* The frame's type.  Should this instead be a collection of
 struct frame_unwind
 {
   /* The frame's type.  Should this instead be a collection of
@@ -128,21 +160,23 @@ struct frame_unwind
   enum frame_type type;
   /* Should an attribute indicating the frame's address-in-block go
      here?  */
   enum frame_type type;
   /* Should an attribute indicating the frame's address-in-block go
      here?  */
+  frame_unwind_stop_reason_ftype *stop_reason;
   frame_this_id_ftype *this_id;
   frame_prev_register_ftype *prev_register;
   const struct frame_data *unwind_data;
   frame_sniffer_ftype *sniffer;
   frame_dealloc_cache_ftype *dealloc_cache;
   frame_this_id_ftype *this_id;
   frame_prev_register_ftype *prev_register;
   const struct frame_data *unwind_data;
   frame_sniffer_ftype *sniffer;
   frame_dealloc_cache_ftype *dealloc_cache;
+  frame_prev_arch_ftype *prev_arch;
 };
 
 /* Register a frame unwinder, _prepending_ it to the front of the
    search list (so it is sniffed before previously registered
    unwinders).  By using a prepend, later calls can install unwinders
    that override earlier calls.  This allows, for instance, an OSABI
 };
 
 /* Register a frame unwinder, _prepending_ it to the front of the
    search list (so it is sniffed before previously registered
    unwinders).  By using a prepend, later calls can install unwinders
    that override earlier calls.  This allows, for instance, an OSABI
-   to install a more specific sigtramp unwinder that overrides the
+   to install a more specific sigtramp unwinder that overrides the
    traditional brute-force unwinder.  */
    traditional brute-force unwinder.  */
-extern void frame_unwind_prepend_unwinder (struct gdbarch *gdbarch,
-                                          const struct frame_unwind *unwinder);
+extern void frame_unwind_prepend_unwinder (struct gdbarch *,
+                                          const struct frame_unwind *);
 
 /* Add a frame sniffer to the list.  The predicates are polled in the
    order that they are appended.  The initial list contains the dummy
 
 /* Add a frame sniffer to the list.  The predicates are polled in the
    order that they are appended.  The initial list contains the dummy
@@ -151,11 +185,12 @@ extern void frame_unwind_prepend_unwinder (struct gdbarch *gdbarch,
 extern void frame_unwind_append_unwinder (struct gdbarch *gdbarch,
                                          const struct frame_unwind *unwinder);
 
 extern void frame_unwind_append_unwinder (struct gdbarch *gdbarch,
                                          const struct frame_unwind *unwinder);
 
-/* Iterate through sniffers for THIS frame until one returns with an
-   unwinder implementation.  Possibly initialize THIS_CACHE.  */
+/* Iterate through sniffers for THIS_FRAME frame until one returns with an
+   unwinder implementation.  THIS_FRAME->UNWIND must be NULL, it will get set
+   by this function.  Possibly initialize THIS_CACHE.  */
 
 
-extern const struct frame_unwind *frame_unwind_find_by_frame (struct frame_info *this_frame,
-                                                             void **this_cache);
+extern void frame_unwind_find_by_frame (struct frame_info *this_frame,
+                                       void **this_cache);
 
 /* Helper functions for value-based register unwinding.  These return
    a (possibly lazy) value of the appropriate type.  */
 
 /* Helper functions for value-based register unwinding.  These return
    a (possibly lazy) value of the appropriate type.  */