2004-03-23 Andrew Cagney <cagney@redhat.com>
[external/binutils.git] / gdb / tramp-frame.h
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 struct tramp_frame
43 {
44   /* The trampoline's entire instruction sequence.  Search for this in
45      the inferior at or around the frame's PC.  It is assumed that the
46      PC is INSN_SIZE aligned, and that each element of TRAMP contains
47      one INSN_SIZE instruction.  It is also assumed that TRAMP[0]
48      contains the first instruction of the trampoline and hence the
49      address of the instruction matching TRAMP[0] is the trampoline's
50      "func" address.  */
51   int insn_size;
52   ULONGEST insn[8];
53   /* Initialize a trad-frame cache corresponding to the tramp-frame.
54      FUNC is the address of the instruction TRAMP[0] in memory.  */
55   void (*init) (const struct tramp_frame *self,
56                 struct frame_info *next_frame,
57                 struct trad_frame_cache *this_cache,
58                 CORE_ADDR func);
59 };
60
61 void tramp_frame_append (struct gdbarch *gdbarch,
62                          const struct tramp_frame *tramp);
63
64 #endif