gdb/tramp-frame.h - gdb

Data types defined

Macros defined

Source code

  1. /* Signal trampoline unwinder.

  2.    Copyright (C) 2004-2015 Free Software Foundation, Inc.

  3.    This file is part of GDB.

  4.    This program is free software; you can redistribute it and/or modify
  5.    it under the terms of the GNU General Public License as published by
  6.    the Free Software Foundation; either version 3 of the License, or
  7.    (at your option) any later version.

  8.    This program is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11.    GNU General Public License for more details.

  12.    You should have received a copy of the GNU General Public License
  13.    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

  14. #ifndef TRAMP_FRAME_H
  15. #define TRAMP_FRAME_H

  16. #include "frame.h"                /* For "enum frame_type".  */

  17. struct trad_frame;
  18. struct frame_info;
  19. struct trad_frame_cache;

  20. /* A trampoline consists of a small sequence of instructions placed at
  21.    an unspecified location in the inferior's address space.  The only
  22.    identifying attribute of the trampoline's address is that it does
  23.    not fall inside an object file's section.

  24.    The only way to identify a trampoline is to perform a brute force
  25.    examination of the instructions at and around the PC.

  26.    This module provides a convenient interface for performing that
  27.    operation.  */

  28. /* A trampoline descriptor.  */

  29. /* Magic instruction that to mark the end of the signal trampoline
  30.    instruction sequence.  */
  31. #define TRAMP_SENTINEL_INSN ((LONGEST) -1)

  32. struct tramp_frame
  33. {
  34.   /* The trampoline's type, some a signal trampolines, some are normal
  35.      call-frame trampolines (aka thunks).  */
  36.   enum frame_type frame_type;
  37.   /* The trampoline's entire instruction sequence.  It consists of a
  38.      bytes/mask pair.  Search for this in the inferior at or around
  39.      the frame's PC.  It is assumed that the PC is INSN_SIZE aligned,
  40.      and that each element of TRAMP contains one INSN_SIZE
  41.      instruction.  It is also assumed that INSN[0] contains the first
  42.      instruction of the trampoline and hence the address of the
  43.      instruction matching INSN[0] is the trampoline's "func" address.
  44.      The instruction sequence is terminated by
  45.      TRAMP_SENTINEL_INSN.  */
  46.   int insn_size;
  47.   struct
  48.   {
  49.     ULONGEST bytes;
  50.     ULONGEST mask;
  51.   } insn[48];
  52.   /* Initialize a trad-frame cache corresponding to the tramp-frame.
  53.      FUNC is the address of the instruction TRAMP[0] in memory.  */
  54.   void (*init) (const struct tramp_frame *self,
  55.                 struct frame_info *this_frame,
  56.                 struct trad_frame_cache *this_cache,
  57.                 CORE_ADDR func);
  58.   /* Return non-zero if the tramp-frame is valid for the PC requested.
  59.      Adjust the PC to point to the address to check the instruction
  60.      sequence against if required.  If this is NULL, then the tramp-frame
  61.      is valid for any PC.  */
  62.   int (*validate) (const struct tramp_frame *self,
  63.                    struct frame_info *this_frame,
  64.                    CORE_ADDR *pc);
  65. };

  66. void tramp_frame_prepend_unwinder (struct gdbarch *gdbarch,
  67.                                    const struct tramp_frame *tramp);

  68. #endif