gdb/trad-frame.h - gdb

Data types defined

Macros defined

Source code

  1. /* Traditional frame unwind support, for GDB the GNU Debugger.

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

  3.    This file is part of GDB.

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

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

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

  14. #ifndef TRAD_FRAME_H
  15. #define TRAD_FRAME_H

  16. #include "frame.h"                /* For "struct frame_id".  */

  17. struct frame_info;
  18. struct trad_frame_cache;

  19. /* A simple, or traditional frame cache.

  20.    The entire cache is populated in a single pass and then generic
  21.    routines are used to extract the various cache values.  */

  22. struct trad_frame_cache *trad_frame_cache_zalloc (struct frame_info *);

  23. /* This frame's ID.  */
  24. void trad_frame_set_id (struct trad_frame_cache *this_trad_cache,
  25.                         struct frame_id this_id);
  26. void trad_frame_get_id (struct trad_frame_cache *this_trad_cache,
  27.                         struct frame_id *this_id);
  28. void trad_frame_set_this_base (struct trad_frame_cache *this_trad_cache,
  29.                                CORE_ADDR this_base);
  30. CORE_ADDR trad_frame_get_this_base (struct trad_frame_cache *this_trad_cache);

  31. void trad_frame_set_reg_realreg (struct trad_frame_cache *this_trad_cache,
  32.                                  int regnum, int realreg);
  33. void trad_frame_set_reg_addr (struct trad_frame_cache *this_trad_cache,
  34.                               int regnum, CORE_ADDR addr);
  35. void trad_frame_set_reg_value (struct trad_frame_cache *this_cache,
  36.                                int regnum, LONGEST val);

  37. struct value *trad_frame_get_register (struct trad_frame_cache *this_trad_cache,
  38.                                        struct frame_info *this_frame,
  39.                                        int regnum);

  40. /* A traditional saved regs table, indexed by REGNUM, encoding where
  41.    the value of REGNUM for the previous frame can be found in this
  42.    frame.

  43.    The table is initialized with an identity encoding (ADDR == -1,
  44.    REALREG == REGNUM) indicating that the value of REGNUM in the
  45.    previous frame can be found in register REGNUM (== REALREG) in this
  46.    frame.

  47.    The initial encoding can then be changed:

  48.    Modify ADDR (REALREG >= 0, ADDR != -1) to indicate that the value
  49.    of register REGNUM in the previous frame can be found in memory at
  50.    ADDR in this frame (addr_p, !realreg_p, !value_p).

  51.    Modify REALREG (REALREG >= 0, ADDR == -1) to indicate that the
  52.    value of register REGNUM in the previous frame is found in register
  53.    REALREG in this frame (!addr_p, realreg_p, !value_p).

  54.    Call trad_frame_set_value (REALREG == -1) to indicate that the
  55.    value of register REGNUM in the previous frame is found in ADDR
  56.    (!addr_p, !realreg_p, value_p).

  57.    Call trad_frame_set_unknown (REALREG == -2) to indicate that the
  58.    register's value is not known.  */

  59. struct trad_frame_saved_reg
  60. {
  61.   LONGEST addr; /* A CORE_ADDR fits in a longest.  */
  62.   int realreg;
  63. };

  64. /* Encode REGNUM value in the trad-frame.  */
  65. void trad_frame_set_value (struct trad_frame_saved_reg this_saved_regs[],
  66.                            int regnum, LONGEST val);

  67. /* Mark REGNUM as unknown.  */
  68. void trad_frame_set_unknown (struct trad_frame_saved_reg this_saved_regs[],
  69.                              int regnum);

  70. /* Convenience functions, return non-zero if the register has been
  71.    encoded as specified.  */
  72. int trad_frame_value_p (struct trad_frame_saved_reg this_saved_regs[],
  73.                         int regnum);
  74. int trad_frame_addr_p (struct trad_frame_saved_reg this_saved_regs[],
  75.                        int regnum);
  76. int trad_frame_realreg_p (struct trad_frame_saved_reg this_saved_regs[],
  77.                           int regnum);


  78. /* Return a freshly allocated (and initialized) trad_frame array.  */
  79. struct trad_frame_saved_reg *trad_frame_alloc_saved_regs (struct frame_info *);

  80. /* Given the trad_frame info, return the location of the specified
  81.    register.  */
  82. struct value *trad_frame_get_prev_register (struct frame_info *this_frame,
  83.                                             struct trad_frame_saved_reg this_saved_regs[],
  84.                                             int regnum);

  85. #endif