gdb/linespec.h - gdb

Global variables defined

Data types defined

Macros defined

Source code

  1. /* Header for GDB line completion.
  2.    Copyright (C) 2000-2015 Free Software Foundation, Inc.

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

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

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

  13. #if !defined (LINESPEC_H)
  14. #define LINESPEC_H 1

  15. struct symtab;

  16. #include "vec.h"

  17. /* Flags to pass to decode_line_1 and decode_line_full.  */

  18. enum decode_line_flags
  19.   {
  20.     /* Set this flag if you want the resulting SALs to describe the
  21.        first line of indicated functions.  */
  22.     DECODE_LINE_FUNFIRSTLINE = 1,

  23.     /* Set this flag if you want "list mode".  In this mode, a
  24.        FILE:LINE linespec will always return a result, and such
  25.        linespecs will not be expanded to all matches.  */
  26.     DECODE_LINE_LIST_MODE = 2
  27.   };

  28. /* decode_line_full returns a vector of these.  */

  29. struct linespec_sals
  30. {
  31.   /* This is the linespec corresponding to the sals contained in this
  32.      object.  It can be passed as the FILTER argument to future calls
  33.      to decode_line_full.  This is freed by
  34.      destroy_linespec_result.  */
  35.   char *canonical;

  36.   /* Sals.  The 'sals' field is destroyed by
  37.      destroy_linespec_result.  */
  38.   struct symtabs_and_lines sals;
  39. };

  40. typedef struct linespec_sals linespec_sals;
  41. DEF_VEC_O (linespec_sals);

  42. /* An instance of this may be filled in by decode_line_1.  The caller
  43.    must call init_linespec_result to initialize it and
  44.    destroy_linespec_result to destroy it.  The caller must make copies
  45.    of any data that it needs to keep.  */

  46. struct linespec_result
  47. {
  48.   /* If non-zero, the linespec should be displayed to the user.  This
  49.      is used by "unusual" linespecs where the ordinary `info break'
  50.      display mechanism would do the wrong thing.  */
  51.   int special_display;

  52.   /* If non-zero, the linespec result should be considered to be a
  53.      "pre-expanded" multi-location linespecA pre-expanded linespec
  54.      holds all matching locations in a single linespec_sals
  55.      object.  */
  56.   int pre_expanded;

  57.   /* If PRE_EXPANDED is non-zero, this is set to the linespec entered
  58.      by the user.  This will be freed by destroy_linespec_result.  */
  59.   char *addr_string;

  60.   /* The sals.  The vector will be freed by
  61.      destroy_linespec_result.  */
  62.   VEC (linespec_sals) *sals;
  63. };

  64. /* Initialize a linespec_result.  */

  65. extern void init_linespec_result (struct linespec_result *);

  66. /* Destroy a linespec_result.  */

  67. extern void destroy_linespec_result (struct linespec_result *);

  68. /* Return a cleanup that destroys a linespec_result.  */

  69. extern struct cleanup *
  70.         make_cleanup_destroy_linespec_result (struct linespec_result *);

  71. /* Decode a linespec using the provided default symtab and line.  */

  72. extern struct symtabs_and_lines
  73.         decode_line_1 (char **argptr, int flags,
  74.                        struct symtab *default_symtab, int default_line);

  75. /* Parse *ARGPTR as a linespec and return results.  This is the "full"
  76.    interface to this module, which handles multiple results
  77.    properly.

  78.    For FLAGS, see decode_line_flags.  DECODE_LINE_LIST_MODE is not
  79.    valid for this function.

  80.    DEFAULT_SYMTAB and DEFAULT_LINE describe the default location.
  81.    DEFAULT_SYMTAB can be NULL, in which case the current symtab and
  82.    line are used.

  83.    CANONICAL is where the results are stored.  It must not be NULL.

  84.    SELECT_MODE must be one of the multiple_symbols_* constants, or
  85.    NULL.  It determines how multiple results will be handled.  If
  86.    NULL, the appropriate CLI value will be used.

  87.    FILTER can either be NULL or a string holding a canonical name.
  88.    This is only valid when SELECT_MODE is multiple_symbols_all.

  89.    Multiple results are handled differently depending on the
  90.    arguments:

  91.    . With multiple_symbols_cancel, an exception is thrown.

  92.    . With multiple_symbols_ask, a menu is presented to the user.  The
  93.    user may select none, in which case an exception is thrown; or all,
  94.    which is handled like multiple_symbols_all, below.  Otherwise,
  95.    CANONICAL->SALS will have one entry for each name the user chose.

  96.    . With multiple_symbols_all, CANONICAL->SALS will have a single
  97.    entry describing all the matching locations.  If FILTER is
  98.    non-NULL, then only locations whose canonical name is equal (in the
  99.    strcmp sense) to FILTER will be returned; all others will be
  100.    filtered out.  */

  101. extern void decode_line_full (char **argptr, int flags,
  102.                               struct symtab *default_symtab, int default_line,
  103.                               struct linespec_result *canonical,
  104.                               const char *select_mode,
  105.                               const char *filter);

  106. /* Given a string, return the line specified by it, using the current
  107.    source symtab and line as defaults.
  108.    This is for commands like "list" and "breakpoint".  */

  109. extern struct symtabs_and_lines decode_line_with_current_source (char *, int);

  110. /* Given a string, return the line specified by it, using the last displayed
  111.    codepoint's values as defaults, or nothing if they aren't valid.  */

  112. extern struct symtabs_and_lines decode_line_with_last_displayed (char *, int);

  113. #endif /* defined (LINESPEC_H) */