1b725ae77Skettenis /* Frame unwinder for frames with DWARF Call Frame Information. 2b725ae77Skettenis 3b725ae77Skettenis Copyright 2003, 2004 Free Software Foundation, Inc. 4b725ae77Skettenis 5b725ae77Skettenis Contributed by Mark Kettenis. 6b725ae77Skettenis 7b725ae77Skettenis This file is part of GDB. 8b725ae77Skettenis 9b725ae77Skettenis This program is free software; you can redistribute it and/or modify 10b725ae77Skettenis it under the terms of the GNU General Public License as published by 11b725ae77Skettenis the Free Software Foundation; either version 2 of the License, or 12b725ae77Skettenis (at your option) any later version. 13b725ae77Skettenis 14b725ae77Skettenis This program is distributed in the hope that it will be useful, 15b725ae77Skettenis but WITHOUT ANY WARRANTY; without even the implied warranty of 16b725ae77Skettenis MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17b725ae77Skettenis GNU General Public License for more details. 18b725ae77Skettenis 19b725ae77Skettenis You should have received a copy of the GNU General Public License 20b725ae77Skettenis along with this program; if not, write to the Free Software 21b725ae77Skettenis Foundation, Inc., 59 Temple Place - Suite 330, 22b725ae77Skettenis Boston, MA 02111-1307, USA. */ 23b725ae77Skettenis 24b725ae77Skettenis #ifndef DWARF2_FRAME_H 25b725ae77Skettenis #define DWARF2_FRAME_H 1 26b725ae77Skettenis 27b725ae77Skettenis struct gdbarch; 28b725ae77Skettenis struct objfile; 29b725ae77Skettenis struct frame_info; 30b725ae77Skettenis 31b725ae77Skettenis /* Register rule. */ 32b725ae77Skettenis 33b725ae77Skettenis enum dwarf2_frame_reg_rule 34b725ae77Skettenis { 35b725ae77Skettenis /* Make certain that 0 maps onto the correct enum value; the 36b725ae77Skettenis corresponding structure is being initialized using memset zero. 37b725ae77Skettenis This indicates that CFI didn't provide any information at all 38b725ae77Skettenis about a register, leaving how to obtain its value totally 39b725ae77Skettenis unspecified. */ 40b725ae77Skettenis DWARF2_FRAME_REG_UNSPECIFIED = 0, 41b725ae77Skettenis 42b725ae77Skettenis /* The term "undefined" comes from the DWARF2 CFI spec which this 43b725ae77Skettenis code is moddeling; it indicates that the register's value is 44b725ae77Skettenis "undefined". GCC uses the less formal term "unsaved". Its 45b725ae77Skettenis definition is a combination of REG_UNDEFINED and REG_UNSPECIFIED. 46b725ae77Skettenis The failure to differentiate the two helps explain a few problems 47b725ae77Skettenis with the CFI generated by GCC. */ 48b725ae77Skettenis DWARF2_FRAME_REG_UNDEFINED, 49b725ae77Skettenis DWARF2_FRAME_REG_SAVED_OFFSET, 50b725ae77Skettenis DWARF2_FRAME_REG_SAVED_REG, 51b725ae77Skettenis DWARF2_FRAME_REG_SAVED_EXP, 52b725ae77Skettenis DWARF2_FRAME_REG_SAME_VALUE, 53*84a83e23Skettenis DWARF2_FRAME_REG_SAVED_VAL_EXP, 54b725ae77Skettenis 55b725ae77Skettenis /* These aren't defined by the DWARF2 CFI specification, but are 56b725ae77Skettenis used internally by GDB. */ 57b725ae77Skettenis DWARF2_FRAME_REG_RA, /* Return Address. */ 58b725ae77Skettenis DWARF2_FRAME_REG_CFA /* Call Frame Address. */ 59b725ae77Skettenis }; 60b725ae77Skettenis 61b725ae77Skettenis /* Register state. */ 62b725ae77Skettenis 63b725ae77Skettenis struct dwarf2_frame_state_reg 64b725ae77Skettenis { 65b725ae77Skettenis /* Each register save state can be described in terms of a CFA slot, 66b725ae77Skettenis another register, or a location expression. */ 67b725ae77Skettenis union { 68b725ae77Skettenis LONGEST offset; 69b725ae77Skettenis ULONGEST reg; 70b725ae77Skettenis unsigned char *exp; 71b725ae77Skettenis } loc; 72b725ae77Skettenis ULONGEST exp_len; 73b725ae77Skettenis enum dwarf2_frame_reg_rule how; 74b725ae77Skettenis }; 75b725ae77Skettenis 76b725ae77Skettenis /* Set the architecture-specific register state initialization 77b725ae77Skettenis function for GDBARCH to INIT_REG. */ 78b725ae77Skettenis 79b725ae77Skettenis extern void dwarf2_frame_set_init_reg (struct gdbarch *gdbarch, 80b725ae77Skettenis void (*init_reg) (struct gdbarch *, int, 81b725ae77Skettenis struct dwarf2_frame_state_reg *)); 82b725ae77Skettenis 83b725ae77Skettenis /* Return the frame unwind methods for the function that contains PC, 84b725ae77Skettenis or NULL if it can't be handled by DWARF CFI frame unwinder. */ 85b725ae77Skettenis 86b725ae77Skettenis extern const struct frame_unwind * 87b725ae77Skettenis dwarf2_frame_sniffer (struct frame_info *next_frame); 88b725ae77Skettenis 89b725ae77Skettenis /* Return the frame base methods for the function that contains PC, or 90b725ae77Skettenis NULL if it can't be handled by the DWARF CFI frame unwinder. */ 91b725ae77Skettenis 92b725ae77Skettenis extern const struct frame_base * 93b725ae77Skettenis dwarf2_frame_base_sniffer (struct frame_info *next_frame); 94b725ae77Skettenis 95b725ae77Skettenis /* Register the DWARF CFI for OBJFILE. */ 96b725ae77Skettenis 97b725ae77Skettenis void dwarf2_frame_build_info (struct objfile *objfile); 98b725ae77Skettenis 99b725ae77Skettenis #endif /* dwarf2-frame.h */ 100