| 1 | /* Signal trampoline unwinder, for GDB the GNU Debugger. |
| 2 | |
| 3 | Copyright 2004 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 TRAMP_FRAME_H |
| 23 | #define TRAMP_FRAME_H |
| 24 | |
| 25 | struct trad_frame; |
| 26 | struct frame_info; |
| 27 | struct trad_frame_cache; |
| 28 | |
| 29 | /* A trampoline consists of a small sequence of instructions placed at |
| 30 | an unspecified location in the inferior's address space. The only |
| 31 | identifying attribute of the trampoline's address is that it does |
| 32 | not fall inside an object file's section. |
| 33 | |
| 34 | The only way to identify a trampoline is to perform a brute force |
| 35 | examination of the instructions at and around the PC. |
| 36 | |
| 37 | This module provides a convent interface for performing that |
| 38 | operation. */ |
| 39 | |
| 40 | /* A trampoline descriptor. */ |
| 41 | |
| 42 | /* Magic instruction that to mark the end of the signal trampoline |
| 43 | instruction sequence. */ |
| 44 | #define TRAMP_SENTINEL_INSN ((LONGEST) -1) |
| 45 | |
| 46 | struct tramp_frame |
| 47 | { |
| 48 | /* The trampoline's entire instruction sequence. Search for this in |
| 49 | the inferior at or around the frame's PC. It is assumed that the |
| 50 | PC is INSN_SIZE aligned, and that each element of TRAMP contains |
| 51 | one INSN_SIZE instruction. It is also assumed that TRAMP[0] |
| 52 | contains the first instruction of the trampoline and hence the |
| 53 | address of the instruction matching TRAMP[0] is the trampoline's |
| 54 | "func" address. The instruction sequence shall be terminated by |
| 55 | TRAMP_SENTINEL_INSN. */ |
| 56 | int insn_size; |
| 57 | ULONGEST insn[8]; |
| 58 | /* Initialize a trad-frame cache corresponding to the tramp-frame. |
| 59 | FUNC is the address of the instruction TRAMP[0] in memory. */ |
| 60 | void (*init) (const struct tramp_frame *self, |
| 61 | struct frame_info *next_frame, |
| 62 | struct trad_frame_cache *this_cache, |
| 63 | CORE_ADDR func); |
| 64 | }; |
| 65 | |
| 66 | void tramp_frame_prepend_unwinder (struct gdbarch *gdbarch, |
| 67 | const struct tramp_frame *tramp); |
| 68 | |
| 69 | #endif |