GDB (API)
/home/stan/gdb/src/gdb/dwarf2-frame.h
Go to the documentation of this file.
00001 /* Frame unwinder for frames with DWARF Call Frame Information.
00002 
00003    Copyright (C) 2003-2013 Free Software Foundation, Inc.
00004 
00005    Contributed by Mark Kettenis.
00006 
00007    This file is part of GDB.
00008 
00009    This program is free software; you can redistribute it and/or modify
00010    it under the terms of the GNU General Public License as published by
00011    the Free Software Foundation; either version 3 of the License, or
00012    (at your option) any later version.
00013 
00014    This program is distributed in the hope that it will be useful,
00015    but WITHOUT ANY WARRANTY; without even the implied warranty of
00016    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017    GNU General Public License for more details.
00018 
00019    You should have received a copy of the GNU General Public License
00020    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00021 
00022 #ifndef DWARF2_FRAME_H
00023 #define DWARF2_FRAME_H 1
00024 
00025 struct gdbarch;
00026 struct objfile;
00027 struct frame_info;
00028 struct dwarf2_per_cu_data;
00029 struct agent_expr;
00030 struct axs_value;
00031 
00032 /* Register rule.  */
00033 
00034 enum dwarf2_frame_reg_rule
00035 {
00036   /* Make certain that 0 maps onto the correct enum value; the
00037      corresponding structure is being initialized using memset zero.
00038      This indicates that CFI didn't provide any information at all
00039      about a register, leaving how to obtain its value totally
00040      unspecified.  */
00041   DWARF2_FRAME_REG_UNSPECIFIED = 0,
00042 
00043   /* The term "undefined" comes from the DWARF2 CFI spec which this
00044      code is moddeling; it indicates that the register's value is
00045      "undefined".  GCC uses the less formal term "unsaved".  Its
00046      definition is a combination of REG_UNDEFINED and REG_UNSPECIFIED.
00047      The failure to differentiate the two helps explain a few problems
00048      with the CFI generated by GCC.  */
00049   DWARF2_FRAME_REG_UNDEFINED,
00050   DWARF2_FRAME_REG_SAVED_OFFSET,
00051   DWARF2_FRAME_REG_SAVED_REG,
00052   DWARF2_FRAME_REG_SAVED_EXP,
00053   DWARF2_FRAME_REG_SAME_VALUE,
00054 
00055   /* These are defined in Dwarf3.  */
00056   DWARF2_FRAME_REG_SAVED_VAL_OFFSET,
00057   DWARF2_FRAME_REG_SAVED_VAL_EXP,
00058 
00059   /* These aren't defined by the DWARF2 CFI specification, but are
00060      used internally by GDB.  */
00061   DWARF2_FRAME_REG_FN,          /* Call a registered function.  */
00062   DWARF2_FRAME_REG_RA,          /* Return Address.  */
00063   DWARF2_FRAME_REG_RA_OFFSET,   /* Return Address with offset.  */
00064   DWARF2_FRAME_REG_CFA,         /* Call Frame Address.  */
00065   DWARF2_FRAME_REG_CFA_OFFSET   /* Call Frame Address with offset.  */
00066 };
00067 
00068 /* Register state.  */
00069 
00070 struct dwarf2_frame_state_reg
00071 {
00072   /* Each register save state can be described in terms of a CFA slot,
00073      another register, or a location expression.  */
00074   union {
00075     LONGEST offset;
00076     ULONGEST reg;
00077     const gdb_byte *exp;
00078     struct value *(*fn) (struct frame_info *this_frame, void **this_cache,
00079                          int regnum);
00080   } loc;
00081   ULONGEST exp_len;
00082   enum dwarf2_frame_reg_rule how;
00083 };
00084 
00085 /* Set the architecture-specific register state initialization
00086    function for GDBARCH to INIT_REG.  */
00087 
00088 extern void dwarf2_frame_set_init_reg (struct gdbarch *gdbarch,
00089                                        void (*init_reg) (struct gdbarch *, int,
00090                                              struct dwarf2_frame_state_reg *,
00091                                              struct frame_info *));
00092 
00093 /* Set the architecture-specific signal trampoline recognition
00094    function for GDBARCH to SIGNAL_FRAME_P.  */
00095 
00096 extern void
00097   dwarf2_frame_set_signal_frame_p (struct gdbarch *gdbarch,
00098                                    int (*signal_frame_p) (struct gdbarch *,
00099                                                           struct frame_info *));
00100 
00101 /* Set the architecture-specific adjustment of .eh_frame and .debug_frame
00102    register numbers.  */
00103 
00104 extern void
00105   dwarf2_frame_set_adjust_regnum (struct gdbarch *gdbarch,
00106                                   int (*adjust_regnum) (struct gdbarch *,
00107                                                         int, int));
00108 
00109 /* Append the DWARF-2 frame unwinders to GDBARCH's list.  */
00110 
00111 void dwarf2_append_unwinders (struct gdbarch *gdbarch);
00112 
00113 /* Return the frame base methods for the function that contains PC, or
00114    NULL if it can't be handled by the DWARF CFI frame unwinder.  */
00115 
00116 extern const struct frame_base *
00117   dwarf2_frame_base_sniffer (struct frame_info *this_frame);
00118 
00119 /* Compute the DWARF CFA for a frame.  */
00120 
00121 CORE_ADDR dwarf2_frame_cfa (struct frame_info *this_frame);
00122 
00123 /* Update the agent expression EXPR with code to compute the CFA for a
00124    frame at PC.  GDBARCH is the architecture of the function at PC.
00125    This function may call dwarf2_compile_expr_to_ax; DATA is passed
00126    through to that function if needed.  */
00127 
00128 extern void dwarf2_compile_cfa_to_ax (struct agent_expr *expr,
00129                                       struct axs_value *loc,
00130                                       struct gdbarch *gdbarch,
00131                                       CORE_ADDR pc,
00132                                       struct dwarf2_per_cu_data *data);
00133 
00134 #endif /* dwarf2-frame.h */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines