GDB (API)
/home/stan/gdb/src/gdb/trad-frame.h
Go to the documentation of this file.
00001 /* Traditional frame unwind support, for GDB the GNU Debugger.
00002 
00003    Copyright (C) 2003-2013 Free Software Foundation, Inc.
00004 
00005    This file is part of GDB.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 3 of the License, or
00010    (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00019 
00020 #ifndef TRAD_FRAME_H
00021 #define TRAD_FRAME_H
00022 
00023 #include "frame.h"              /* For "struct frame_id".  */
00024 
00025 struct frame_info;
00026 struct trad_frame_cache;
00027 
00028 /* A simple, or traditional frame cache.
00029 
00030    The entire cache is populated in a single pass and then generic
00031    routines are used to extract the various cache values.  */
00032 
00033 struct trad_frame_cache *trad_frame_cache_zalloc (struct frame_info *);
00034 
00035 /* This frame's ID.  */
00036 void trad_frame_set_id (struct trad_frame_cache *this_trad_cache,
00037                         struct frame_id this_id);
00038 void trad_frame_get_id (struct trad_frame_cache *this_trad_cache,
00039                         struct frame_id *this_id);
00040 void trad_frame_set_this_base (struct trad_frame_cache *this_trad_cache,
00041                                CORE_ADDR this_base);
00042 CORE_ADDR trad_frame_get_this_base (struct trad_frame_cache *this_trad_cache);
00043 
00044 void trad_frame_set_reg_realreg (struct trad_frame_cache *this_trad_cache,
00045                                  int regnum, int realreg);
00046 void trad_frame_set_reg_unknown (struct trad_frame_cache *this_trad_cache,
00047                                  int regnum, CORE_ADDR addr);
00048 void trad_frame_set_reg_addr (struct trad_frame_cache *this_trad_cache,
00049                               int regnum, CORE_ADDR addr);
00050 void trad_frame_set_reg_value (struct trad_frame_cache *this_cache,
00051                                int regnum, LONGEST val);
00052 
00053 struct value *trad_frame_get_register (struct trad_frame_cache *this_trad_cache,
00054                                        struct frame_info *this_frame,
00055                                        int regnum);
00056 
00057 /* A traditional saved regs table, indexed by REGNUM, encoding where
00058    the value of REGNUM for the previous frame can be found in this
00059    frame.
00060 
00061    The table is initialized with an identity encoding (ADDR == -1,
00062    REALREG == REGNUM) indicating that the value of REGNUM in the
00063    previous frame can be found in register REGNUM (== REALREG) in this
00064    frame.
00065 
00066    The initial encoding can then be changed:
00067 
00068    Modify ADDR (REALREG >= 0, ADDR != -1) to indicate that the value
00069    of register REGNUM in the previous frame can be found in memory at
00070    ADDR in this frame (addr_p, !realreg_p, !value_p).
00071 
00072    Modify REALREG (REALREG >= 0, ADDR == -1) to indicate that the
00073    value of register REGNUM in the previous frame is found in register
00074    REALREG in this frame (!addr_p, realreg_p, !value_p).
00075 
00076    Call trad_frame_set_value (REALREG == -1) to indicate that the
00077    value of register REGNUM in the previous frame is found in ADDR
00078    (!addr_p, !realreg_p, value_p).
00079 
00080    Call trad_frame_set_unknown (REALREG == -2) to indicate that the
00081    register's value is not known.  */
00082 
00083 struct trad_frame_saved_reg
00084 {
00085   LONGEST addr; /* A CORE_ADDR fits in a longest.  */
00086   int realreg;
00087 };
00088 
00089 /* Encode REGNUM value in the trad-frame.  */
00090 void trad_frame_set_value (struct trad_frame_saved_reg this_saved_regs[],
00091                            int regnum, LONGEST val);
00092 
00093 /* Mark REGNUM as unknown.  */
00094 void trad_frame_set_unknown (struct trad_frame_saved_reg this_saved_regs[],
00095                              int regnum);
00096 
00097 /* Convenience functions, return non-zero if the register has been
00098    encoded as specified.  */
00099 int trad_frame_value_p (struct trad_frame_saved_reg this_saved_regs[],
00100                         int regnum);
00101 int trad_frame_addr_p (struct trad_frame_saved_reg this_saved_regs[],
00102                        int regnum);
00103 int trad_frame_realreg_p (struct trad_frame_saved_reg this_saved_regs[],
00104                           int regnum);
00105 
00106 
00107 /* Return a freshly allocated (and initialized) trad_frame array.  */
00108 struct trad_frame_saved_reg *trad_frame_alloc_saved_regs (struct frame_info *);
00109 
00110 /* Given the trad_frame info, return the location of the specified
00111    register.  */
00112 struct value *trad_frame_get_prev_register (struct frame_info *this_frame,
00113                                             struct trad_frame_saved_reg this_saved_regs[],
00114                                             int regnum);
00115 
00116 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines