Commit | Line | Data |
---|---|---|
4ea4748e | 1 | /* Signal trampoline unwinder. |
d2259dd3 | 2 | |
b811d2c2 | 3 | Copyright (C) 2004-2020 Free Software Foundation, Inc. |
d2259dd3 AC |
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 | |
a9762ec7 | 9 | the Free Software Foundation; either version 3 of the License, or |
d2259dd3 AC |
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 | |
a9762ec7 | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
d2259dd3 AC |
19 | |
20 | #ifndef TRAMP_FRAME_H | |
21 | #define TRAMP_FRAME_H | |
22 | ||
2cd8546d AC |
23 | #include "frame.h" /* For "enum frame_type". */ |
24 | ||
d2259dd3 AC |
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 | ||
938f5214 | 37 | This module provides a convenient interface for performing that |
d2259dd3 AC |
38 | operation. */ |
39 | ||
40 | /* A trampoline descriptor. */ | |
41 | ||
1196bfda AC |
42 | /* Magic instruction that to mark the end of the signal trampoline |
43 | instruction sequence. */ | |
7bc02706 | 44 | #define TRAMP_SENTINEL_INSN ULONGEST_MAX |
1196bfda | 45 | |
d2259dd3 AC |
46 | struct tramp_frame |
47 | { | |
2cd8546d AC |
48 | /* The trampoline's type, some a signal trampolines, some are normal |
49 | call-frame trampolines (aka thunks). */ | |
50 | enum frame_type frame_type; | |
51 | /* The trampoline's entire instruction sequence. It consists of a | |
52 | bytes/mask pair. Search for this in the inferior at or around | |
53 | the frame's PC. It is assumed that the PC is INSN_SIZE aligned, | |
54 | and that each element of TRAMP contains one INSN_SIZE | |
55 | instruction. It is also assumed that INSN[0] contains the first | |
56 | instruction of the trampoline and hence the address of the | |
57 | instruction matching INSN[0] is the trampoline's "func" address. | |
58 | The instruction sequence is terminated by | |
1196bfda | 59 | TRAMP_SENTINEL_INSN. */ |
d2259dd3 | 60 | int insn_size; |
2cd8546d AC |
61 | struct |
62 | { | |
63 | ULONGEST bytes; | |
64 | ULONGEST mask; | |
70f13f6b | 65 | } insn[48]; |
d2259dd3 AC |
66 | /* Initialize a trad-frame cache corresponding to the tramp-frame. |
67 | FUNC is the address of the instruction TRAMP[0] in memory. */ | |
68 | void (*init) (const struct tramp_frame *self, | |
25492ce3 | 69 | struct frame_info *this_frame, |
d2259dd3 AC |
70 | struct trad_frame_cache *this_cache, |
71 | CORE_ADDR func); | |
858339f2 MR |
72 | /* Return non-zero if the tramp-frame is valid for the PC requested. |
73 | Adjust the PC to point to the address to check the instruction | |
74 | sequence against if required. If this is NULL, then the tramp-frame | |
75 | is valid for any PC. */ | |
76 | int (*validate) (const struct tramp_frame *self, | |
77 | struct frame_info *this_frame, | |
78 | CORE_ADDR *pc); | |
d2259dd3 AC |
79 | }; |
80 | ||
fb2be677 AC |
81 | void tramp_frame_prepend_unwinder (struct gdbarch *gdbarch, |
82 | const struct tramp_frame *tramp); | |
d2259dd3 AC |
83 | |
84 | #endif |