| 1 | /* Traditional frame unwind support, for GDB the GNU Debugger. |
| 2 | |
| 3 | Copyright 2003 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 TRAD_FRAME_H |
| 23 | #define TRAD_FRAME_H |
| 24 | |
| 25 | struct frame_info; |
| 26 | |
| 27 | /* A traditional saved regs table, indexed by REGNUM, encoding where |
| 28 | the value of REGNUM for the previous frame can be found in this |
| 29 | frame. |
| 30 | |
| 31 | The table is initialized with an identity encoding (ADDR == -1, |
| 32 | REALREG == REGNUM) indicating that the value of REGNUM in the |
| 33 | previous frame can be found in register REGNUM (== REALREG) in this |
| 34 | frame. |
| 35 | |
| 36 | The initial encoding can then be changed: |
| 37 | |
| 38 | Modify ADDR (REALREG >= 0, ADDR != -1) to indicate that the value |
| 39 | of register REGNUM in the previous frame can be found in memory at |
| 40 | ADDR in this frame (addr_p, !realreg_p, !value_p). |
| 41 | |
| 42 | Modify REALREG (REALREG >= 0, ADDR == -1) to indicate that the |
| 43 | value of register REGNUM in the previous frame is found in register |
| 44 | REALREG in this frame (!addr_p, realreg_p, !value_p). |
| 45 | |
| 46 | Call trad_frame_set_value (REALREG == -1) to indicate that the |
| 47 | value of register REGNUM in the previous frame is found in ADDR |
| 48 | (!addr_p, !realreg_p, value_p). |
| 49 | |
| 50 | Call trad_frame_set_unknown (REALREG == -2) to indicate that the |
| 51 | register's value is not known. */ |
| 52 | |
| 53 | struct trad_frame_saved_reg |
| 54 | { |
| 55 | LONGEST addr; /* A CORE_ADDR fits in a longest. */ |
| 56 | int realreg; |
| 57 | }; |
| 58 | |
| 59 | /* Encode REGNUM value in the trad-frame. */ |
| 60 | void trad_frame_set_value (struct trad_frame_saved_reg this_saved_regs[], |
| 61 | int regnum, LONGEST val); |
| 62 | |
| 63 | /* Mark REGNUM as unknown. */ |
| 64 | void trad_frame_set_unknown (struct trad_frame_saved_reg this_saved_regs[], |
| 65 | int regnum); |
| 66 | |
| 67 | /* Convenience functions, return non-zero if the register has been |
| 68 | encoded as specified. */ |
| 69 | int trad_frame_value_p (struct trad_frame_saved_reg this_saved_regs[], |
| 70 | int regnum); |
| 71 | int trad_frame_addr_p (struct trad_frame_saved_reg this_saved_regs[], |
| 72 | int regnum); |
| 73 | int trad_frame_realreg_p (struct trad_frame_saved_reg this_saved_regs[], |
| 74 | int regnum); |
| 75 | |
| 76 | |
| 77 | /* Return a freshly allocated (and initialized) trad_frame array. */ |
| 78 | struct trad_frame_saved_reg *trad_frame_alloc_saved_regs (struct frame_info *next_frame); |
| 79 | |
| 80 | /* Given the trad_frame info, return the location of the specified |
| 81 | register. */ |
| 82 | void trad_frame_prev_register (struct frame_info *next_frame, |
| 83 | struct trad_frame_saved_reg this_saved_regs[], |
| 84 | int regnum, int *optimizedp, |
| 85 | enum lval_type *lvalp, CORE_ADDR *addrp, |
| 86 | int *realregp, void *bufferp); |
| 87 | |
| 88 | #endif |