GDB (API)
/home/stan/gdb/src/gdb/linespec.h
Go to the documentation of this file.
00001 /* Header for GDB line completion.
00002    Copyright (C) 2000-2013 Free Software Foundation, Inc.
00003 
00004    This program is free software; you can redistribute it and/or modify
00005    it under the terms of the GNU General Public License as published by
00006    the Free Software Foundation; either version 3 of the License, or
00007    (at your option) any later version.
00008 
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012    GNU General Public License for more details.
00013 
00014    You should have received a copy of the GNU General Public License
00015    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00016 
00017 #if !defined (LINESPEC_H)
00018 #define LINESPEC_H 1
00019 
00020 struct symtab;
00021 
00022 #include "vec.h"
00023 
00024 /* Flags to pass to decode_line_1 and decode_line_full.  */
00025 
00026 enum decode_line_flags
00027   {
00028     /* Set this flag if you want the resulting SALs to describe the
00029        first line of indicated functions.  */
00030     DECODE_LINE_FUNFIRSTLINE = 1,
00031 
00032     /* Set this flag if you want "list mode".  In this mode, a
00033        FILE:LINE linespec will always return a result, and such
00034        linespecs will not be expanded to all matches.  */
00035     DECODE_LINE_LIST_MODE = 2
00036   };
00037 
00038 /* decode_line_full returns a vector of these.  */
00039 
00040 struct linespec_sals
00041 {
00042   /* This is the linespec corresponding to the sals contained in this
00043      object.  It can be passed as the FILTER argument to future calls
00044      to decode_line_full.  This is freed by
00045      destroy_linespec_result.  */
00046   char *canonical;
00047 
00048   /* Sals.  The 'sals' field is destroyed by
00049      destroy_linespec_result.  */
00050   struct symtabs_and_lines sals;
00051 };
00052 
00053 typedef struct linespec_sals linespec_sals;
00054 DEF_VEC_O (linespec_sals);
00055 
00056 /* An instance of this may be filled in by decode_line_1.  The caller
00057    must call init_linespec_result to initialize it and
00058    destroy_linespec_result to destroy it.  The caller must make copies
00059    of any data that it needs to keep.  */
00060 
00061 struct linespec_result
00062 {
00063   /* If non-zero, the linespec should be displayed to the user.  This
00064      is used by "unusual" linespecs where the ordinary `info break'
00065      display mechanism would do the wrong thing.  */
00066   int special_display;
00067 
00068   /* If non-zero, the linespec result should be considered to be a
00069      "pre-expanded" multi-location linespec.  A pre-expanded linespec
00070      holds all matching locations in a single linespec_sals
00071      object.  */
00072   int pre_expanded;
00073 
00074   /* If PRE_EXPANDED is non-zero, this is set to the linespec entered
00075      by the user.  This will be freed by destroy_linespec_result.  */
00076   char *addr_string;
00077 
00078   /* The sals.  The vector will be freed by
00079      destroy_linespec_result.  */
00080   VEC (linespec_sals) *sals;
00081 };
00082 
00083 /* Initialize a linespec_result.  */
00084 
00085 extern void init_linespec_result (struct linespec_result *);
00086 
00087 /* Destroy a linespec_result.  */
00088 
00089 extern void destroy_linespec_result (struct linespec_result *);
00090 
00091 /* Return a cleanup that destroys a linespec_result.  */
00092 
00093 extern struct cleanup *
00094         make_cleanup_destroy_linespec_result (struct linespec_result *);
00095 
00096 /* Decode a linespec using the provided default symtab and line.  */
00097 
00098 extern struct symtabs_and_lines
00099         decode_line_1 (char **argptr, int flags,
00100                        struct symtab *default_symtab, int default_line);
00101 
00102 /* Parse *ARGPTR as a linespec and return results.  This is the "full"
00103    interface to this module, which handles multiple results
00104    properly.
00105 
00106    For FLAGS, see decode_line_flags.  DECODE_LINE_LIST_MODE is not
00107    valid for this function.
00108 
00109    DEFAULT_SYMTAB and DEFAULT_LINE describe the default location.
00110    DEFAULT_SYMTAB can be NULL, in which case the current symtab and
00111    line are used.
00112 
00113    CANONICAL is where the results are stored.  It must not be NULL.
00114 
00115    SELECT_MODE must be one of the multiple_symbols_* constants, or
00116    NULL.  It determines how multiple results will be handled.  If
00117    NULL, the appropriate CLI value will be used.
00118 
00119    FILTER can either be NULL or a string holding a canonical name.
00120    This is only valid when SELECT_MODE is multiple_symbols_all.
00121 
00122    Multiple results are handled differently depending on the
00123    arguments:
00124 
00125    . With multiple_symbols_cancel, an exception is thrown.
00126 
00127    . With multiple_symbols_ask, a menu is presented to the user.  The
00128    user may select none, in which case an exception is thrown; or all,
00129    which is handled like multiple_symbols_all, below.  Otherwise,
00130    CANONICAL->SALS will have one entry for each name the user chose.
00131 
00132    . With multiple_symbols_all, CANONICAL->SALS will have a single
00133    entry describing all the matching locations.  If FILTER is
00134    non-NULL, then only locations whose canonical name is equal (in the
00135    strcmp sense) to FILTER will be returned; all others will be
00136    filtered out.  */
00137 
00138 extern void decode_line_full (char **argptr, int flags,
00139                               struct symtab *default_symtab, int default_line,
00140                               struct linespec_result *canonical,
00141                               const char *select_mode,
00142                               const char *filter);
00143 
00144 /* Given a string, return the line specified by it, using the current
00145    source symtab and line as defaults.
00146    This is for commands like "list" and "breakpoint".  */
00147 
00148 extern struct symtabs_and_lines decode_line_with_current_source (char *, int);
00149 
00150 /* Given a string, return the line specified by it, using the last displayed
00151    codepoint's values as defaults, or nothing if they aren't valid.  */
00152 
00153 extern struct symtabs_and_lines decode_line_with_last_displayed (char *, int);
00154 
00155 #endif /* defined (LINESPEC_H) */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines