1130803Smarcel/* Frame unwinder for frames with DWARF Call Frame Information. 2130803Smarcel 3130803Smarcel Copyright 2003, 2004 Free Software Foundation, Inc. 4130803Smarcel 5130803Smarcel Contributed by Mark Kettenis. 6130803Smarcel 7130803Smarcel This file is part of GDB. 8130803Smarcel 9130803Smarcel This program is free software; you can redistribute it and/or modify 10130803Smarcel it under the terms of the GNU General Public License as published by 11130803Smarcel the Free Software Foundation; either version 2 of the License, or 12130803Smarcel (at your option) any later version. 13130803Smarcel 14130803Smarcel This program is distributed in the hope that it will be useful, 15130803Smarcel but WITHOUT ANY WARRANTY; without even the implied warranty of 16130803Smarcel MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17130803Smarcel GNU General Public License for more details. 18130803Smarcel 19130803Smarcel You should have received a copy of the GNU General Public License 20130803Smarcel along with this program; if not, write to the Free Software 21130803Smarcel Foundation, Inc., 59 Temple Place - Suite 330, 22130803Smarcel Boston, MA 02111-1307, USA. */ 23130803Smarcel 24130803Smarcel#ifndef DWARF2_FRAME_H 25130803Smarcel#define DWARF2_FRAME_H 1 26130803Smarcel 27130803Smarcelstruct gdbarch; 28130803Smarcelstruct objfile; 29130803Smarcelstruct frame_info; 30130803Smarcel 31130803Smarcel/* Register rule. */ 32130803Smarcel 33130803Smarcelenum dwarf2_frame_reg_rule 34130803Smarcel{ 35130803Smarcel /* Make certain that 0 maps onto the correct enum value; the 36130803Smarcel corresponding structure is being initialized using memset zero. 37130803Smarcel This indicates that CFI didn't provide any information at all 38130803Smarcel about a register, leaving how to obtain its value totally 39130803Smarcel unspecified. */ 40130803Smarcel DWARF2_FRAME_REG_UNSPECIFIED = 0, 41130803Smarcel 42130803Smarcel /* The term "undefined" comes from the DWARF2 CFI spec which this 43130803Smarcel code is moddeling; it indicates that the register's value is 44130803Smarcel "undefined". GCC uses the less formal term "unsaved". Its 45130803Smarcel definition is a combination of REG_UNDEFINED and REG_UNSPECIFIED. 46130803Smarcel The failure to differentiate the two helps explain a few problems 47130803Smarcel with the CFI generated by GCC. */ 48130803Smarcel DWARF2_FRAME_REG_UNDEFINED, 49130803Smarcel DWARF2_FRAME_REG_SAVED_OFFSET, 50130803Smarcel DWARF2_FRAME_REG_SAVED_REG, 51130803Smarcel DWARF2_FRAME_REG_SAVED_EXP, 52130803Smarcel DWARF2_FRAME_REG_SAME_VALUE, 53130803Smarcel 54130803Smarcel /* These aren't defined by the DWARF2 CFI specification, but are 55130803Smarcel used internally by GDB. */ 56130803Smarcel DWARF2_FRAME_REG_RA, /* Return Address. */ 57130803Smarcel DWARF2_FRAME_REG_CFA /* Call Frame Address. */ 58130803Smarcel}; 59130803Smarcel 60130803Smarcel/* Register state. */ 61130803Smarcel 62130803Smarcelstruct dwarf2_frame_state_reg 63130803Smarcel{ 64130803Smarcel /* Each register save state can be described in terms of a CFA slot, 65130803Smarcel another register, or a location expression. */ 66130803Smarcel union { 67130803Smarcel LONGEST offset; 68130803Smarcel ULONGEST reg; 69130803Smarcel unsigned char *exp; 70130803Smarcel } loc; 71130803Smarcel ULONGEST exp_len; 72130803Smarcel enum dwarf2_frame_reg_rule how; 73130803Smarcel}; 74130803Smarcel 75130803Smarcel/* Set the architecture-specific register state initialization 76130803Smarcel function for GDBARCH to INIT_REG. */ 77130803Smarcel 78130803Smarcelextern void dwarf2_frame_set_init_reg (struct gdbarch *gdbarch, 79130803Smarcel void (*init_reg) (struct gdbarch *, int, 80130803Smarcel struct dwarf2_frame_state_reg *)); 81130803Smarcel 82130803Smarcel/* Return the frame unwind methods for the function that contains PC, 83130803Smarcel or NULL if it can't be handled by DWARF CFI frame unwinder. */ 84130803Smarcel 85130803Smarcelextern const struct frame_unwind * 86130803Smarcel dwarf2_frame_sniffer (struct frame_info *next_frame); 87130803Smarcel 88130803Smarcel/* Return the frame base methods for the function that contains PC, or 89130803Smarcel NULL if it can't be handled by the DWARF CFI frame unwinder. */ 90130803Smarcel 91130803Smarcelextern const struct frame_base * 92130803Smarcel dwarf2_frame_base_sniffer (struct frame_info *next_frame); 93130803Smarcel 94130803Smarcel/* Register the DWARF CFI for OBJFILE. */ 95130803Smarcel 96130803Smarcelvoid dwarf2_frame_build_info (struct objfile *objfile); 97130803Smarcel 98130803Smarcel#endif /* dwarf2-frame.h */ 99