gdb/frame-base.h - gdb

Data types defined

Macros defined

Source code

  1. /* Definitions for a frame base, for GDB, the GNU debugger.

  2.    Copyright (C) 2003-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. #if !defined (FRAME_BASE_H)
  15. #define FRAME_BASE_H 1

  16. struct frame_info;
  17. struct frame_id;
  18. struct frame_unwind;
  19. struct frame_base;
  20. struct gdbarch;
  21. struct regcache;

  22. /* Assuming the frame chain: (outer) prev <-> this <-> next (inner);
  23.    and that this is a `normal frame'; use THIS frame, and implicitly
  24.    the NEXT frame's register unwind method, to determine the address
  25.    of THIS frame's `base'.

  26.    The exact meaning of `base' is highly dependant on the type of the
  27.    debug info.  It is assumed that dwarf2, stabs, ... will each
  28.    provide their own methods.

  29.    A typical implmentation will return the same value for base,
  30.    locals-base and args-base.  That value, however, will likely be
  31.    different to the frame ID's stack address.  */

  32. /* A generic base address.  */

  33. typedef CORE_ADDR (frame_this_base_ftype) (struct frame_info *this_frame,
  34.                                            void **this_base_cache);

  35. /* The base address of the frame's local variables.  */

  36. typedef CORE_ADDR (frame_this_locals_ftype) (struct frame_info *this_frame,
  37.                                              void **this_base_cache);

  38. /* The base address of the frame's arguments / parameters.  */

  39. typedef CORE_ADDR (frame_this_args_ftype) (struct frame_info *this_frame,
  40.                                            void **this_base_cache);

  41. struct frame_base
  42. {
  43.   /* If non-NULL, a low-level unwinder that shares its implementation
  44.      with this high-level frame-base method.  */
  45.   const struct frame_unwind *unwind;
  46.   frame_this_base_ftype *this_base;
  47.   frame_this_locals_ftype *this_locals;
  48.   frame_this_args_ftype *this_args;
  49. };

  50. /* Given THIS frame, return the frame base methods for THIS frame,
  51.    or NULL if it can't handle THIS frame.  */

  52. typedef const struct frame_base *(frame_base_sniffer_ftype) (struct frame_info *this_frame);

  53. /* Append a frame base sniffer to the list.  The sniffers are polled
  54.    in the order that they are appended.  */

  55. extern void frame_base_append_sniffer (struct gdbarch *gdbarch,
  56.                                        frame_base_sniffer_ftype *sniffer);

  57. /* Set the default frame base.  If all else fails, this one is
  58.    returned.  If this isn't set, the default is to use legacy code
  59.    that uses things like the frame ID's base (ulgh!).  */

  60. extern void frame_base_set_default (struct gdbarch *gdbarch,
  61.                                     const struct frame_base *def);

  62. /* Iterate through the list of frame base handlers until one returns
  63.    an implementation.  */

  64. extern const struct frame_base *frame_base_find_by_frame (struct frame_info *this_frame);

  65. #endif