1130803Smarcel/* Traditional frame unwind support, for GDB the GNU Debugger. 2130803Smarcel 3130803Smarcel Copyright 2003 Free Software Foundation, Inc. 4130803Smarcel 5130803Smarcel This file is part of GDB. 6130803Smarcel 7130803Smarcel This program is free software; you can redistribute it and/or modify 8130803Smarcel it under the terms of the GNU General Public License as published by 9130803Smarcel the Free Software Foundation; either version 2 of the License, or 10130803Smarcel (at your option) any later version. 11130803Smarcel 12130803Smarcel This program is distributed in the hope that it will be useful, 13130803Smarcel but WITHOUT ANY WARRANTY; without even the implied warranty of 14130803Smarcel MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15130803Smarcel GNU General Public License for more details. 16130803Smarcel 17130803Smarcel You should have received a copy of the GNU General Public License 18130803Smarcel along with this program; if not, write to the Free Software 19130803Smarcel Foundation, Inc., 59 Temple Place - Suite 330, 20130803Smarcel Boston, MA 02111-1307, USA. */ 21130803Smarcel 22130803Smarcel#ifndef TRAD_FRAME_H 23130803Smarcel#define TRAD_FRAME_H 24130803Smarcel 25130803Smarcelstruct frame_info; 26130803Smarcel 27130803Smarcel/* A traditional saved regs table, indexed by REGNUM, encoding where 28130803Smarcel the value of REGNUM for the previous frame can be found in this 29130803Smarcel frame. 30130803Smarcel 31130803Smarcel The table is initialized with an identity encoding (ADDR == -1, 32130803Smarcel REALREG == REGNUM) indicating that the value of REGNUM in the 33130803Smarcel previous frame can be found in register REGNUM (== REALREG) in this 34130803Smarcel frame. 35130803Smarcel 36130803Smarcel The initial encoding can then be changed: 37130803Smarcel 38130803Smarcel Modify ADDR (REALREG >= 0, ADDR != -1) to indicate that the value 39130803Smarcel of register REGNUM in the previous frame can be found in memory at 40130803Smarcel ADDR in this frame (addr_p, !realreg_p, !value_p). 41130803Smarcel 42130803Smarcel Modify REALREG (REALREG >= 0, ADDR == -1) to indicate that the 43130803Smarcel value of register REGNUM in the previous frame is found in register 44130803Smarcel REALREG in this frame (!addr_p, realreg_p, !value_p). 45130803Smarcel 46130803Smarcel Call trad_frame_set_value (REALREG == -1) to indicate that the 47130803Smarcel value of register REGNUM in the previous frame is found in ADDR 48130803Smarcel (!addr_p, !realreg_p, value_p). 49130803Smarcel 50130803Smarcel Call trad_frame_set_unknown (REALREG == -2) to indicate that the 51130803Smarcel register's value is not known. */ 52130803Smarcel 53130803Smarcelstruct trad_frame_saved_reg 54130803Smarcel{ 55130803Smarcel LONGEST addr; /* A CORE_ADDR fits in a longest. */ 56130803Smarcel int realreg; 57130803Smarcel}; 58130803Smarcel 59130803Smarcel/* Encode REGNUM value in the trad-frame. */ 60130803Smarcelvoid trad_frame_set_value (struct trad_frame_saved_reg this_saved_regs[], 61130803Smarcel int regnum, LONGEST val); 62130803Smarcel 63130803Smarcel/* Mark REGNUM as unknown. */ 64130803Smarcelvoid trad_frame_set_unknown (struct trad_frame_saved_reg this_saved_regs[], 65130803Smarcel int regnum); 66130803Smarcel 67130803Smarcel/* Convenience functions, return non-zero if the register has been 68130803Smarcel encoded as specified. */ 69130803Smarcelint trad_frame_value_p (struct trad_frame_saved_reg this_saved_regs[], 70130803Smarcel int regnum); 71130803Smarcelint trad_frame_addr_p (struct trad_frame_saved_reg this_saved_regs[], 72130803Smarcel int regnum); 73130803Smarcelint trad_frame_realreg_p (struct trad_frame_saved_reg this_saved_regs[], 74130803Smarcel int regnum); 75130803Smarcel 76130803Smarcel 77130803Smarcel/* Return a freshly allocated (and initialized) trad_frame array. */ 78130803Smarcelstruct trad_frame_saved_reg *trad_frame_alloc_saved_regs (struct frame_info *next_frame); 79130803Smarcel 80130803Smarcel/* Given the trad_frame info, return the location of the specified 81130803Smarcel register. */ 82130803Smarcelvoid trad_frame_prev_register (struct frame_info *next_frame, 83130803Smarcel struct trad_frame_saved_reg this_saved_regs[], 84130803Smarcel int regnum, int *optimizedp, 85130803Smarcel enum lval_type *lvalp, CORE_ADDR *addrp, 86130803Smarcel int *realregp, void *bufferp); 87130803Smarcel 88130803Smarcel#endif 89