GDB (API)
/home/stan/gdb/src/gdb/tramp-frame.h
Go to the documentation of this file.
00001 /* Signal trampoline unwinder.
00002 
00003    Copyright (C) 2004-2013 Free Software Foundation, Inc.
00004 
00005    This file is part of GDB.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 3 of the License, or
00010    (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00019 
00020 #ifndef TRAMP_FRAME_H
00021 #define TRAMP_FRAME_H
00022 
00023 #include "frame.h"              /* For "enum frame_type".  */
00024 
00025 struct trad_frame;
00026 struct frame_info;
00027 struct trad_frame_cache;
00028 
00029 /* A trampoline consists of a small sequence of instructions placed at
00030    an unspecified location in the inferior's address space.  The only
00031    identifying attribute of the trampoline's address is that it does
00032    not fall inside an object file's section.
00033 
00034    The only way to identify a trampoline is to perform a brute force
00035    examination of the instructions at and around the PC.
00036 
00037    This module provides a convenient interface for performing that
00038    operation.  */
00039 
00040 /* A trampoline descriptor.  */
00041 
00042 /* Magic instruction that to mark the end of the signal trampoline
00043    instruction sequence.  */
00044 #define TRAMP_SENTINEL_INSN ((LONGEST) -1)
00045 
00046 struct tramp_frame
00047 {
00048   /* The trampoline's type, some a signal trampolines, some are normal
00049      call-frame trampolines (aka thunks).  */
00050   enum frame_type frame_type;
00051   /* The trampoline's entire instruction sequence.  It consists of a
00052      bytes/mask pair.  Search for this in the inferior at or around
00053      the frame's PC.  It is assumed that the PC is INSN_SIZE aligned,
00054      and that each element of TRAMP contains one INSN_SIZE
00055      instruction.  It is also assumed that INSN[0] contains the first
00056      instruction of the trampoline and hence the address of the
00057      instruction matching INSN[0] is the trampoline's "func" address.
00058      The instruction sequence is terminated by
00059      TRAMP_SENTINEL_INSN.  */
00060   int insn_size;
00061   struct
00062   {
00063     ULONGEST bytes;
00064     ULONGEST mask;
00065   } insn[48];
00066   /* Initialize a trad-frame cache corresponding to the tramp-frame.
00067      FUNC is the address of the instruction TRAMP[0] in memory.  */
00068   void (*init) (const struct tramp_frame *self,
00069                 struct frame_info *this_frame,
00070                 struct trad_frame_cache *this_cache,
00071                 CORE_ADDR func);
00072 };
00073 
00074 void tramp_frame_prepend_unwinder (struct gdbarch *gdbarch,
00075                                    const struct tramp_frame *tramp);
00076 
00077 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines