GDB (xrefs)
/tmp/gdb-7.10/gdb/linespec.h
Go to the documentation of this file.
1 /* Header for GDB line completion.
2  Copyright (C) 2000-2015 Free Software Foundation, Inc.
3 
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 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>. */
16 
17 #if !defined (LINESPEC_H)
18 #define LINESPEC_H 1
19 
20 struct symtab;
21 
22 #include "vec.h"
23 
24 /* Flags to pass to decode_line_1 and decode_line_full. */
25 
27  {
28  /* Set this flag if you want the resulting SALs to describe the
29  first line of indicated functions. */
31 
32  /* Set this flag if you want "list mode". In this mode, a
33  FILE:LINE linespec will always return a result, and such
34  linespecs will not be expanded to all matches. */
36  };
37 
38 /* decode_line_full returns a vector of these. */
39 
41 {
42  /* This is the linespec corresponding to the sals contained in this
43  object. It can be passed as the FILTER argument to future calls
44  to decode_line_full. This is freed by
45  destroy_linespec_result. */
46  char *canonical;
47 
48  /* Sals. The 'sals' field is destroyed by
49  destroy_linespec_result. */
51 };
52 
55 
56 /* An instance of this may be filled in by decode_line_1. The caller
57  must call init_linespec_result to initialize it and
58  destroy_linespec_result to destroy it. The caller must make copies
59  of any data that it needs to keep. */
60 
62 {
63  /* If non-zero, the linespec should be displayed to the user. This
64  is used by "unusual" linespecs where the ordinary `info break'
65  display mechanism would do the wrong thing. */
67 
68  /* If non-zero, the linespec result should be considered to be a
69  "pre-expanded" multi-location linespec. A pre-expanded linespec
70  holds all matching locations in a single linespec_sals
71  object. */
73 
74  /* If PRE_EXPANDED is non-zero, this is set to the linespec entered
75  by the user. This will be freed by destroy_linespec_result. */
76  char *addr_string;
77 
78  /* The sals. The vector will be freed by
79  destroy_linespec_result. */
80  VEC (linespec_sals) *sals;
81 };
82 
83 /* Initialize a linespec_result. */
84 
85 extern void init_linespec_result (struct linespec_result *);
86 
87 /* Destroy a linespec_result. */
88 
89 extern void destroy_linespec_result (struct linespec_result *);
90 
91 /* Return a cleanup that destroys a linespec_result. */
92 
93 extern struct cleanup *
95 
96 /* Decode a linespec using the provided default symtab and line. */
97 
98 extern struct symtabs_and_lines
99  decode_line_1 (char **argptr, int flags,
100  struct symtab *default_symtab, int default_line);
101 
102 /* Parse *ARGPTR as a linespec and return results. This is the "full"
103  interface to this module, which handles multiple results
104  properly.
105 
106  For FLAGS, see decode_line_flags. DECODE_LINE_LIST_MODE is not
107  valid for this function.
108 
109  DEFAULT_SYMTAB and DEFAULT_LINE describe the default location.
110  DEFAULT_SYMTAB can be NULL, in which case the current symtab and
111  line are used.
112 
113  CANONICAL is where the results are stored. It must not be NULL.
114 
115  SELECT_MODE must be one of the multiple_symbols_* constants, or
116  NULL. It determines how multiple results will be handled. If
117  NULL, the appropriate CLI value will be used.
118 
119  FILTER can either be NULL or a string holding a canonical name.
120  This is only valid when SELECT_MODE is multiple_symbols_all.
121 
122  Multiple results are handled differently depending on the
123  arguments:
124 
125  . With multiple_symbols_cancel, an exception is thrown.
126 
127  . With multiple_symbols_ask, a menu is presented to the user. The
128  user may select none, in which case an exception is thrown; or all,
129  which is handled like multiple_symbols_all, below. Otherwise,
130  CANONICAL->SALS will have one entry for each name the user chose.
131 
132  . With multiple_symbols_all, CANONICAL->SALS will have a single
133  entry describing all the matching locations. If FILTER is
134  non-NULL, then only locations whose canonical name is equal (in the
135  strcmp sense) to FILTER will be returned; all others will be
136  filtered out. */
137 
138 extern void decode_line_full (char **argptr, int flags,
139  struct symtab *default_symtab, int default_line,
140  struct linespec_result *canonical,
141  const char *select_mode,
142  const char *filter);
143 
144 /* Given a string, return the line specified by it, using the current
145  source symtab and line as defaults.
146  This is for commands like "list" and "breakpoint". */
147 
149 
150 /* Given a string, return the line specified by it, using the last displayed
151  codepoint's values as defaults, or nothing if they aren't valid. */
152 
154 
155 /* Does P represent one of the keywords? If so, return
156  the keyword. If not, return NULL. */
157 
158 extern const char *linespec_lexer_lex_keyword (const char *p);
159 #endif /* defined (LINESPEC_H) */
void decode_line_full(char **argptr, int flags, struct symtab *default_symtab, int default_line, struct linespec_result *canonical, const char *select_mode, const char *filter)
Definition: linespec.c:2441
void init_linespec_result(struct linespec_result *)
Definition: linespec.c:3772
VEC(linespec_sals)*sals
DEF_VEC_O(linespec_sals)
struct symtabs_and_lines sals
Definition: linespec.h:50
mach_port_t kern_return_t mach_port_t msgports mach_port_t kern_return_t pid_t pid mach_port_t kern_return_t mach_port_t task mach_port_t kern_return_t int flags
Definition: gnu-nat.c:1885
const char * linespec_lexer_lex_keyword(const char *p)
Definition: linespec.c:420
char * addr_string
Definition: linespec.h:76
int pre_expanded
Definition: linespec.h:72
Definition: symtab.h:925
decode_line_flags
Definition: linespec.h:26
struct symtabs_and_lines decode_line_with_last_displayed(char *, int)
Definition: linespec.c:2566
const char const char int
Definition: command.h:229
char * canonical
Definition: linespec.h:46
void destroy_linespec_result(struct linespec_result *)
Definition: linespec.c:3780
struct symtabs_and_lines decode_line_with_current_source(char *, int)
Definition: linespec.c:2543
int special_display
Definition: linespec.h:66
struct cleanup * make_cleanup_destroy_linespec_result(struct linespec_result *)
Definition: linespec.c:3805
struct symtabs_and_lines decode_line_1(char **argptr, int flags, struct symtab *default_symtab, int default_line)
Definition: linespec.c:2518