gdb/dwarf2-frame.h - gdb

Data types defined

Macros defined

Source code

  1. /* Frame unwinder for frames with DWARF Call Frame Information.

  2.    Copyright (C) 2003-2015 Free Software Foundation, Inc.

  3.    Contributed by Mark Kettenis.

  4.    This file is part of GDB.

  5.    This program is free software; you can redistribute it and/or modify
  6.    it under the terms of the GNU General Public License as published by
  7.    the Free Software Foundation; either version 3 of the License, or
  8.    (at your option) any later version.

  9.    This program is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.    GNU General Public License for more details.

  13.    You should have received a copy of the GNU General Public License
  14.    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

  15. #ifndef DWARF2_FRAME_H
  16. #define DWARF2_FRAME_H 1

  17. struct gdbarch;
  18. struct objfile;
  19. struct frame_info;
  20. struct dwarf2_per_cu_data;
  21. struct agent_expr;
  22. struct axs_value;

  23. /* Register rule.  */

  24. enum dwarf2_frame_reg_rule
  25. {
  26.   /* Make certain that 0 maps onto the correct enum value; the
  27.      corresponding structure is being initialized using memset zero.
  28.      This indicates that CFI didn't provide any information at all
  29.      about a register, leaving how to obtain its value totally
  30.      unspecified.  */
  31.   DWARF2_FRAME_REG_UNSPECIFIED = 0,

  32.   /* The term "undefined" comes from the DWARF2 CFI spec which this
  33.      code is moddeling; it indicates that the register's value is
  34.      "undefined".  GCC uses the less formal term "unsaved".  Its
  35.      definition is a combination of REG_UNDEFINED and REG_UNSPECIFIED.
  36.      The failure to differentiate the two helps explain a few problems
  37.      with the CFI generated by GCC.  */
  38.   DWARF2_FRAME_REG_UNDEFINED,
  39.   DWARF2_FRAME_REG_SAVED_OFFSET,
  40.   DWARF2_FRAME_REG_SAVED_REG,
  41.   DWARF2_FRAME_REG_SAVED_EXP,
  42.   DWARF2_FRAME_REG_SAME_VALUE,

  43.   /* These are defined in Dwarf3.  */
  44.   DWARF2_FRAME_REG_SAVED_VAL_OFFSET,
  45.   DWARF2_FRAME_REG_SAVED_VAL_EXP,

  46.   /* These aren't defined by the DWARF2 CFI specification, but are
  47.      used internally by GDB.  */
  48.   DWARF2_FRAME_REG_FN,                /* Call a registered function.  */
  49.   DWARF2_FRAME_REG_RA,                /* Return Address.  */
  50.   DWARF2_FRAME_REG_RA_OFFSET,        /* Return Address with offset.  */
  51.   DWARF2_FRAME_REG_CFA,                /* Call Frame Address.  */
  52.   DWARF2_FRAME_REG_CFA_OFFSET        /* Call Frame Address with offset.  */
  53. };

  54. /* Register state.  */

  55. struct dwarf2_frame_state_reg
  56. {
  57.   /* Each register save state can be described in terms of a CFA slot,
  58.      another register, or a location expression.  */
  59.   union {
  60.     LONGEST offset;
  61.     ULONGEST reg;
  62.     const gdb_byte *exp;
  63.     struct value *(*fn) (struct frame_info *this_frame, void **this_cache,
  64.                          int regnum);
  65.   } loc;
  66.   ULONGEST exp_len;
  67.   enum dwarf2_frame_reg_rule how;
  68. };

  69. /* Set the architecture-specific register state initialization
  70.    function for GDBARCH to INIT_REG.  */

  71. extern void dwarf2_frame_set_init_reg (struct gdbarch *gdbarch,
  72.                                        void (*init_reg) (struct gdbarch *, int,
  73.                                              struct dwarf2_frame_state_reg *,
  74.                                              struct frame_info *));

  75. /* Set the architecture-specific signal trampoline recognition
  76.    function for GDBARCH to SIGNAL_FRAME_P.  */

  77. extern void
  78.   dwarf2_frame_set_signal_frame_p (struct gdbarch *gdbarch,
  79.                                    int (*signal_frame_p) (struct gdbarch *,
  80.                                                           struct frame_info *));

  81. /* Set the architecture-specific adjustment of .eh_frame and .debug_frame
  82.    register numbers.  */

  83. extern void
  84.   dwarf2_frame_set_adjust_regnum (struct gdbarch *gdbarch,
  85.                                   int (*adjust_regnum) (struct gdbarch *,
  86.                                                         int, int));

  87. /* Append the DWARF-2 frame unwinders to GDBARCH's list.  */

  88. void dwarf2_append_unwinders (struct gdbarch *gdbarch);

  89. /* Return the frame base methods for the function that contains PC, or
  90.    NULL if it can't be handled by the DWARF CFI frame unwinder.  */

  91. extern const struct frame_base *
  92.   dwarf2_frame_base_sniffer (struct frame_info *this_frame);

  93. /* Compute the DWARF CFA for a frame.  */

  94. CORE_ADDR dwarf2_frame_cfa (struct frame_info *this_frame);

  95. /* Find the CFA information for PC.

  96.    Return 1 if a register is used for the CFA, or 0 if another
  97.    expression is used.  Throw an exception on error.

  98.    GDBARCH is the architecture to use.
  99.    DATA is the per-CU data.

  100.    REGNUM_OUT is an out parameter that is set to the register number.
  101.    OFFSET_OUT is the offset to use from this register.
  102.    These are only filled in when 1 is returned.

  103.    TEXT_OFFSET_OUT, CFA_START_OUT, and CFA_END_OUT describe the CFA
  104.    in other cases.  These are only used when 0 is returned.  */

  105. extern int dwarf2_fetch_cfa_info (struct gdbarch *gdbarch, CORE_ADDR pc,
  106.                                   struct dwarf2_per_cu_data *data,
  107.                                   int *regnum_out, LONGEST *offset_out,
  108.                                   CORE_ADDR *text_offset_out,
  109.                                   const gdb_byte **cfa_start_out,
  110.                                   const gdb_byte **cfa_end_out);

  111. #endif /* dwarf2-frame.h */