Home | History | Annotate | Line # | Download | only in gdb
trad-frame.h revision 1.8
      1  1.1  christos /* Traditional frame unwind support, for GDB the GNU Debugger.
      2  1.1  christos 
      3  1.8  christos    Copyright (C) 2003-2019 Free Software Foundation, Inc.
      4  1.1  christos 
      5  1.1  christos    This file is part of GDB.
      6  1.1  christos 
      7  1.1  christos    This program is free software; you can redistribute it and/or modify
      8  1.1  christos    it under the terms of the GNU General Public License as published by
      9  1.1  christos    the Free Software Foundation; either version 3 of the License, or
     10  1.1  christos    (at your option) any later version.
     11  1.1  christos 
     12  1.1  christos    This program is distributed in the hope that it will be useful,
     13  1.1  christos    but WITHOUT ANY WARRANTY; without even the implied warranty of
     14  1.1  christos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15  1.1  christos    GNU General Public License for more details.
     16  1.1  christos 
     17  1.1  christos    You should have received a copy of the GNU General Public License
     18  1.1  christos    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
     19  1.1  christos 
     20  1.1  christos #ifndef TRAD_FRAME_H
     21  1.1  christos #define TRAD_FRAME_H
     22  1.1  christos 
     23  1.1  christos #include "frame.h"		/* For "struct frame_id".  */
     24  1.1  christos 
     25  1.1  christos struct frame_info;
     26  1.8  christos struct regcache_map_entry;
     27  1.1  christos struct trad_frame_cache;
     28  1.1  christos 
     29  1.1  christos /* A simple, or traditional frame cache.
     30  1.1  christos 
     31  1.1  christos    The entire cache is populated in a single pass and then generic
     32  1.1  christos    routines are used to extract the various cache values.  */
     33  1.1  christos 
     34  1.1  christos struct trad_frame_cache *trad_frame_cache_zalloc (struct frame_info *);
     35  1.1  christos 
     36  1.1  christos /* This frame's ID.  */
     37  1.1  christos void trad_frame_set_id (struct trad_frame_cache *this_trad_cache,
     38  1.1  christos 			struct frame_id this_id);
     39  1.1  christos void trad_frame_get_id (struct trad_frame_cache *this_trad_cache,
     40  1.1  christos 			struct frame_id *this_id);
     41  1.1  christos void trad_frame_set_this_base (struct trad_frame_cache *this_trad_cache,
     42  1.1  christos 			       CORE_ADDR this_base);
     43  1.1  christos CORE_ADDR trad_frame_get_this_base (struct trad_frame_cache *this_trad_cache);
     44  1.1  christos 
     45  1.1  christos void trad_frame_set_reg_realreg (struct trad_frame_cache *this_trad_cache,
     46  1.1  christos 				 int regnum, int realreg);
     47  1.1  christos void trad_frame_set_reg_addr (struct trad_frame_cache *this_trad_cache,
     48  1.1  christos 			      int regnum, CORE_ADDR addr);
     49  1.8  christos void trad_frame_set_reg_regmap (struct trad_frame_cache *this_trad_cache,
     50  1.8  christos 				const struct regcache_map_entry *regmap,
     51  1.8  christos 				CORE_ADDR addr, size_t size);
     52  1.1  christos void trad_frame_set_reg_value (struct trad_frame_cache *this_cache,
     53  1.1  christos 			       int regnum, LONGEST val);
     54  1.1  christos 
     55  1.1  christos struct value *trad_frame_get_register (struct trad_frame_cache *this_trad_cache,
     56  1.1  christos 				       struct frame_info *this_frame,
     57  1.1  christos 				       int regnum);
     58  1.1  christos 
     59  1.1  christos /* A traditional saved regs table, indexed by REGNUM, encoding where
     60  1.1  christos    the value of REGNUM for the previous frame can be found in this
     61  1.1  christos    frame.
     62  1.1  christos 
     63  1.1  christos    The table is initialized with an identity encoding (ADDR == -1,
     64  1.1  christos    REALREG == REGNUM) indicating that the value of REGNUM in the
     65  1.1  christos    previous frame can be found in register REGNUM (== REALREG) in this
     66  1.1  christos    frame.
     67  1.1  christos 
     68  1.1  christos    The initial encoding can then be changed:
     69  1.1  christos 
     70  1.1  christos    Modify ADDR (REALREG >= 0, ADDR != -1) to indicate that the value
     71  1.1  christos    of register REGNUM in the previous frame can be found in memory at
     72  1.1  christos    ADDR in this frame (addr_p, !realreg_p, !value_p).
     73  1.1  christos 
     74  1.1  christos    Modify REALREG (REALREG >= 0, ADDR == -1) to indicate that the
     75  1.1  christos    value of register REGNUM in the previous frame is found in register
     76  1.1  christos    REALREG in this frame (!addr_p, realreg_p, !value_p).
     77  1.1  christos 
     78  1.1  christos    Call trad_frame_set_value (REALREG == -1) to indicate that the
     79  1.1  christos    value of register REGNUM in the previous frame is found in ADDR
     80  1.1  christos    (!addr_p, !realreg_p, value_p).
     81  1.1  christos 
     82  1.1  christos    Call trad_frame_set_unknown (REALREG == -2) to indicate that the
     83  1.1  christos    register's value is not known.  */
     84  1.1  christos 
     85  1.1  christos struct trad_frame_saved_reg
     86  1.1  christos {
     87  1.1  christos   LONGEST addr; /* A CORE_ADDR fits in a longest.  */
     88  1.1  christos   int realreg;
     89  1.1  christos };
     90  1.1  christos 
     91  1.1  christos /* Encode REGNUM value in the trad-frame.  */
     92  1.1  christos void trad_frame_set_value (struct trad_frame_saved_reg this_saved_regs[],
     93  1.1  christos 			   int regnum, LONGEST val);
     94  1.1  christos 
     95  1.8  christos /* Encode REGNUM is in REALREG in the trad-frame.  */
     96  1.8  christos void trad_frame_set_realreg (struct trad_frame_saved_reg this_saved_regs[],
     97  1.8  christos 			     int regnum, int realreg);
     98  1.8  christos 
     99  1.8  christos /* Encode REGNUM is at address ADDR in the trad-frame.  */
    100  1.8  christos void trad_frame_set_addr (struct trad_frame_saved_reg this_trad_cache[],
    101  1.8  christos 			  int regnum, CORE_ADDR addr);
    102  1.8  christos 
    103  1.1  christos /* Mark REGNUM as unknown.  */
    104  1.1  christos void trad_frame_set_unknown (struct trad_frame_saved_reg this_saved_regs[],
    105  1.1  christos 			     int regnum);
    106  1.1  christos 
    107  1.1  christos /* Convenience functions, return non-zero if the register has been
    108  1.1  christos    encoded as specified.  */
    109  1.1  christos int trad_frame_value_p (struct trad_frame_saved_reg this_saved_regs[],
    110  1.1  christos 			int regnum);
    111  1.1  christos int trad_frame_addr_p (struct trad_frame_saved_reg this_saved_regs[],
    112  1.1  christos 		       int regnum);
    113  1.1  christos int trad_frame_realreg_p (struct trad_frame_saved_reg this_saved_regs[],
    114  1.1  christos 			  int regnum);
    115  1.1  christos 
    116  1.1  christos 
    117  1.1  christos /* Return a freshly allocated (and initialized) trad_frame array.  */
    118  1.1  christos struct trad_frame_saved_reg *trad_frame_alloc_saved_regs (struct frame_info *);
    119  1.7  christos struct trad_frame_saved_reg *trad_frame_alloc_saved_regs (struct gdbarch *);
    120  1.1  christos 
    121  1.1  christos /* Given the trad_frame info, return the location of the specified
    122  1.1  christos    register.  */
    123  1.1  christos struct value *trad_frame_get_prev_register (struct frame_info *this_frame,
    124  1.1  christos 					    struct trad_frame_saved_reg this_saved_regs[],
    125  1.1  christos 					    int regnum);
    126  1.1  christos 
    127  1.1  christos #endif
    128