1 |
227 |
jeremybenn |
/* Signal trampoline unwinder.
|
2 |
|
|
|
3 |
|
|
Copyright (C) 2004, 2005, 2007, 2008, 2009, 2010
|
4 |
|
|
Free Software Foundation, Inc.
|
5 |
|
|
|
6 |
|
|
This file is part of GDB.
|
7 |
|
|
|
8 |
|
|
This program is free software; you can redistribute it and/or modify
|
9 |
|
|
it under the terms of the GNU General Public License as published by
|
10 |
|
|
the Free Software Foundation; either version 3 of the License, or
|
11 |
|
|
(at your option) any later version.
|
12 |
|
|
|
13 |
|
|
This program is distributed in the hope that it will be useful,
|
14 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
|
|
GNU General Public License for more details.
|
17 |
|
|
|
18 |
|
|
You should have received a copy of the GNU General Public License
|
19 |
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
20 |
|
|
|
21 |
|
|
#ifndef TRAMP_FRAME_H
|
22 |
|
|
#define TRAMP_FRAME_H
|
23 |
|
|
|
24 |
|
|
#include "frame.h" /* For "enum frame_type". */
|
25 |
|
|
|
26 |
|
|
struct trad_frame;
|
27 |
|
|
struct frame_info;
|
28 |
|
|
struct trad_frame_cache;
|
29 |
|
|
|
30 |
|
|
/* A trampoline consists of a small sequence of instructions placed at
|
31 |
|
|
an unspecified location in the inferior's address space. The only
|
32 |
|
|
identifying attribute of the trampoline's address is that it does
|
33 |
|
|
not fall inside an object file's section.
|
34 |
|
|
|
35 |
|
|
The only way to identify a trampoline is to perform a brute force
|
36 |
|
|
examination of the instructions at and around the PC.
|
37 |
|
|
|
38 |
|
|
This module provides a convenient interface for performing that
|
39 |
|
|
operation. */
|
40 |
|
|
|
41 |
|
|
/* A trampoline descriptor. */
|
42 |
|
|
|
43 |
|
|
/* Magic instruction that to mark the end of the signal trampoline
|
44 |
|
|
instruction sequence. */
|
45 |
|
|
#define TRAMP_SENTINEL_INSN ((LONGEST) -1)
|
46 |
|
|
|
47 |
|
|
struct tramp_frame
|
48 |
|
|
{
|
49 |
|
|
/* The trampoline's type, some a signal trampolines, some are normal
|
50 |
|
|
call-frame trampolines (aka thunks). */
|
51 |
|
|
enum frame_type frame_type;
|
52 |
|
|
/* The trampoline's entire instruction sequence. It consists of a
|
53 |
|
|
bytes/mask pair. Search for this in the inferior at or around
|
54 |
|
|
the frame's PC. It is assumed that the PC is INSN_SIZE aligned,
|
55 |
|
|
and that each element of TRAMP contains one INSN_SIZE
|
56 |
|
|
instruction. It is also assumed that INSN[0] contains the first
|
57 |
|
|
instruction of the trampoline and hence the address of the
|
58 |
|
|
instruction matching INSN[0] is the trampoline's "func" address.
|
59 |
|
|
The instruction sequence is terminated by
|
60 |
|
|
TRAMP_SENTINEL_INSN. */
|
61 |
|
|
int insn_size;
|
62 |
|
|
struct
|
63 |
|
|
{
|
64 |
|
|
ULONGEST bytes;
|
65 |
|
|
ULONGEST mask;
|
66 |
|
|
} insn[48];
|
67 |
|
|
/* Initialize a trad-frame cache corresponding to the tramp-frame.
|
68 |
|
|
FUNC is the address of the instruction TRAMP[0] in memory. */
|
69 |
|
|
void (*init) (const struct tramp_frame *self,
|
70 |
|
|
struct frame_info *this_frame,
|
71 |
|
|
struct trad_frame_cache *this_cache,
|
72 |
|
|
CORE_ADDR func);
|
73 |
|
|
};
|
74 |
|
|
|
75 |
|
|
void tramp_frame_prepend_unwinder (struct gdbarch *gdbarch,
|
76 |
|
|
const struct tramp_frame *tramp);
|
77 |
|
|
|
78 |
|
|
#endif
|