| 1 | /* Stack unwinding code based on dwarf2 frame info for GDB, the GNU debugger. |
| 2 | Copyright 2001 |
| 3 | Free Software Foundation, Inc. |
| 4 | |
| 5 | This file is part of GDB. |
| 6 | |
| 7 | This program is free software; you can redistribute it and/or modify |
| 8 | it under the terms of the GNU General Public License as published by |
| 9 | the Free Software Foundation; either version 2 of the License, or |
| 10 | (at your option) any later version. |
| 11 | |
| 12 | This program is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | GNU General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU General Public License |
| 18 | along with this program; if not, write to the Free Software |
| 19 | Foundation, Inc., 59 Temple Place - Suite 330, |
| 20 | Boston, MA 02111-1307, USA. */ |
| 21 | |
| 22 | #ifndef DWARF2CFI_H |
| 23 | #define DWARF2CFI_H |
| 24 | |
| 25 | struct context_reg |
| 26 | { |
| 27 | union |
| 28 | { |
| 29 | unsigned int reg; |
| 30 | long offset; |
| 31 | CORE_ADDR addr; |
| 32 | } |
| 33 | loc; |
| 34 | enum |
| 35 | { |
| 36 | REG_CTX_UNSAVED, |
| 37 | REG_CTX_SAVED_OFFSET, |
| 38 | REG_CTX_SAVED_REG, |
| 39 | REG_CTX_SAVED_ADDR, |
| 40 | REG_CTX_VALUE, |
| 41 | } |
| 42 | how; |
| 43 | }; |
| 44 | |
| 45 | /* This is the register and unwind state for a particular frame. */ |
| 46 | struct context |
| 47 | { |
| 48 | struct context_reg *reg; |
| 49 | |
| 50 | CORE_ADDR cfa; |
| 51 | CORE_ADDR ra; |
| 52 | void *lsda; |
| 53 | int args_size; |
| 54 | }; |
| 55 | |
| 56 | /* Return the frame address. */ |
| 57 | CORE_ADDR cfi_read_fp (); |
| 58 | |
| 59 | /* Store the frame address. */ |
| 60 | void cfi_write_fp (CORE_ADDR val); |
| 61 | |
| 62 | /* Restore the machine to the state it had before the current frame |
| 63 | was created. */ |
| 64 | void cfi_pop_frame (struct frame_info *); |
| 65 | |
| 66 | /* Determine the address of the calling function's frame. */ |
| 67 | CORE_ADDR cfi_frame_chain (struct frame_info *fi); |
| 68 | |
| 69 | /* Sets the pc of the frame. */ |
| 70 | CORE_ADDR cfi_init_frame_pc (int fromleaf, struct frame_info *fi); |
| 71 | |
| 72 | /* Initialize unwind context informations of the frame. */ |
| 73 | void cfi_init_extra_frame_info (int fromleaf, struct frame_info *fi); |
| 74 | |
| 75 | /* Obtain return address of the frame. */ |
| 76 | CORE_ADDR cfi_get_ra (struct frame_info *fi); |
| 77 | |
| 78 | /* Find register number REGNUM relative to FRAME and put its |
| 79 | (raw) contents in *RAW_BUFFER. Set *OPTIMIZED if the variable |
| 80 | was optimized out (and thus can't be fetched). If the variable |
| 81 | was fetched from memory, set *ADDRP to where it was fetched from, |
| 82 | otherwise it was fetched from a register. |
| 83 | |
| 84 | The argument RAW_BUFFER must point to aligned memory. */ |
| 85 | void cfi_get_saved_register (char *raw_buffer, |
| 86 | int *optimized, |
| 87 | CORE_ADDR *addrp, |
| 88 | struct frame_info *frame, |
| 89 | int regnum, enum lval_type *lval); |
| 90 | |
| 91 | /* Return the register that the function uses for a frame pointer, |
| 92 | plus any necessary offset to be applied to the register before |
| 93 | any frame pointer offsets. */ |
| 94 | void cfi_virtual_frame_pointer (CORE_ADDR pc, int *frame_regnum, |
| 95 | LONGEST * frame_offset); |
| 96 | |
| 97 | struct context *context_alloc (); |
| 98 | void context_cpy (struct context *dst, struct context *src); |
| 99 | struct frame_state *frame_state_alloc (); |
| 100 | #endif |