* tracepoint.c (scope_info): Update.

* symtab.c (decode_line_spec): Update.
	* python/python.c (gdbpy_decode_line): Update.
	* linespec.h (decode_line_1): Update.
	* linespec.c (decode_line_1): Remove 'not_found_ptr' argument.
	(decode_compound, find_method, symtab_from_filename)
	(decode_variable): Likewise.
	* cli/cli-cmds.c (edit_command): Update.
	(list_command): Update.
	* breakpoint.c (parse_breakpoint_sals): Remove 'not_found_ptr'
	argument.
	(create_breakpoint): Update.
	(until_break_command): Update.
	(addr_string_to_sals): Update.
	(decode_line_spec_1): Update.
This commit is contained in:
Tom Tromey 2011-04-04 17:41:07 +00:00
parent a3293649cd
commit 58438ac187
8 changed files with 61 additions and 82 deletions

View File

@ -1,3 +1,21 @@
2011-04-04 Tom Tromey <tromey@redhat.com>
* tracepoint.c (scope_info): Update.
* symtab.c (decode_line_spec): Update.
* python/python.c (gdbpy_decode_line): Update.
* linespec.h (decode_line_1): Update.
* linespec.c (decode_line_1): Remove 'not_found_ptr' argument.
(decode_compound, find_method, symtab_from_filename)
(decode_variable): Likewise.
* cli/cli-cmds.c (edit_command): Update.
(list_command): Update.
* breakpoint.c (parse_breakpoint_sals): Remove 'not_found_ptr'
argument.
(create_breakpoint): Update.
(until_break_command): Update.
(addr_string_to_sals): Update.
(decode_line_spec_1): Update.
2011-04-04 Tom Tromey <tromey@redhat.com>
* breakpoint.c (struct captured_parse_breakpoint_args): Remove.

View File

@ -7645,8 +7645,7 @@ create_breakpoints_sal (struct gdbarch *gdbarch,
static void
parse_breakpoint_sals (char **address,
struct symtabs_and_lines *sals,
struct linespec_result *canonical,
int *not_found_ptr)
struct linespec_result *canonical)
{
char *addr_start = *address;
@ -7698,11 +7697,10 @@ parse_breakpoint_sals (char **address,
|| ((strchr ("+-", (*address)[0]) != NULL)
&& ((*address)[1] != '['))))
*sals = decode_line_1 (address, 1, default_breakpoint_symtab,
default_breakpoint_line, canonical,
not_found_ptr);
default_breakpoint_line, canonical);
else
*sals = decode_line_1 (address, 1, (struct symtab *) NULL, 0,
canonical, not_found_ptr);
canonical);
}
/* For any SAL that didn't have a canonical string, fill one in. */
if (sals->nelts > 0 && canonical->canonical == NULL)
@ -7911,7 +7909,6 @@ create_breakpoint (struct gdbarch *gdbarch,
struct cleanup *bkpt_chain = NULL;
int i;
int pending = 0;
int not_found = 0;
int task = 0;
int prev_bkpt_count = breakpoint_count;
@ -7934,7 +7931,7 @@ create_breakpoint (struct gdbarch *gdbarch,
TRY_CATCH (e, RETURN_MASK_ALL)
{
parse_breakpoint_sals (&arg, &sals, &canonical, &not_found);
parse_breakpoint_sals (&arg, &sals, &canonical);
}
/* If caller is interested in rc value from parse, set value. */
@ -8545,7 +8542,7 @@ break_range_command (char *arg, int from_tty)
while (*arg == ' ' || *arg == '\t')
arg++;
parse_breakpoint_sals (&arg, &sals_start, &canonical_start, NULL);
parse_breakpoint_sals (&arg, &sals_start, &canonical_start);
sal_start = sals_start.sals[0];
addr_string_start = canonical_start.canonical[0];
@ -8579,7 +8576,7 @@ break_range_command (char *arg, int from_tty)
range. This makes it possible to have ranges like "foo.c:27, +14",
where +14 means 14 lines from the start location. */
sals_end = decode_line_1 (&arg, 1, sal_start.symtab, sal_start.line,
&canonical_end, NULL);
&canonical_end);
/* canonical_end can be NULL if it was of the form "*0xdeadbeef". */
if (canonical_end.canonical == NULL)
@ -9282,9 +9279,9 @@ until_break_command (char *arg, int from_tty, int anywhere)
if (default_breakpoint_valid)
sals = decode_line_1 (&arg, 1, default_breakpoint_symtab,
default_breakpoint_line, NULL, NULL);
default_breakpoint_line, NULL);
else
sals = decode_line_1 (&arg, 1, (struct symtab *) NULL, 0, NULL, NULL);
sals = decode_line_1 (&arg, 1, (struct symtab *) NULL, 0, NULL);
if (sals.nelts != 1)
error (_("Couldn't get information on specified line."));
@ -10934,7 +10931,7 @@ static struct symtabs_and_lines
addr_string_to_sals (struct breakpoint *b, char *addr_string, int *found)
{
char *s;
int marker_spec, not_found;
int marker_spec;
struct symtabs_and_lines sals = {0};
struct gdb_exception e;
@ -10955,8 +10952,7 @@ addr_string_to_sals (struct breakpoint *b, char *addr_string, int *found)
error (_("marker %s not found"), b->static_trace_marker_id);
}
else
sals = decode_line_1 (&s, 1, (struct symtab *) NULL, 0,
NULL, &not_found);
sals = decode_line_1 (&s, 1, (struct symtab *) NULL, 0, NULL);
}
if (e.reason < 0)
{
@ -10968,7 +10964,7 @@ addr_string_to_sals (struct breakpoint *b, char *addr_string, int *found)
state, then user already saw the message about that
breakpoint being disabled, and don't want to see more
errors. */
if (not_found
if (e.error == NOT_FOUND_ERROR
&& (b->condition_not_parsed
|| (b->loc && b->loc->shlib_disabled)
|| b->enable_state == bp_disabled))
@ -10987,7 +10983,7 @@ addr_string_to_sals (struct breakpoint *b, char *addr_string, int *found)
}
}
if (!not_found)
if (e.reason == 0 || e.error != NOT_FOUND_ERROR)
{
gdb_assert (sals.nelts == 1);
@ -11009,9 +11005,11 @@ addr_string_to_sals (struct breakpoint *b, char *addr_string, int *found)
if (b->type == bp_static_tracepoint && !marker_spec)
sals.sals[0] = update_static_tracepoint (b, sals.sals[0]);
}
*found = !not_found;
*found = 1;
}
else
*found = 0;
return sals;
}
@ -11650,10 +11648,10 @@ decode_line_spec_1 (char *string, int funfirstline)
sals = decode_line_1 (&string, funfirstline,
default_breakpoint_symtab,
default_breakpoint_line,
NULL, NULL);
NULL);
else
sals = decode_line_1 (&string, funfirstline,
(struct symtab *) NULL, 0, NULL, NULL);
(struct symtab *) NULL, 0, NULL);
if (*string)
error (_("Junk at end of line specification: %s"), string);
return sals;

View File

@ -787,7 +787,7 @@ edit_command (char *arg, int from_tty)
/* Now should only be one argument -- decode it in SAL. */
arg1 = arg;
sals = decode_line_1 (&arg1, 0, 0, 0, 0, 0);
sals = decode_line_1 (&arg1, 0, 0, 0, 0);
if (! sals.nelts)
{
@ -917,7 +917,7 @@ list_command (char *arg, int from_tty)
dummy_beg = 1;
else
{
sals = decode_line_1 (&arg1, 0, 0, 0, 0, 0);
sals = decode_line_1 (&arg1, 0, 0, 0, 0);
if (!sals.nelts)
return; /* C++ */
@ -950,9 +950,9 @@ list_command (char *arg, int from_tty)
else
{
if (dummy_beg)
sals_end = decode_line_1 (&arg1, 0, 0, 0, 0, 0);
sals_end = decode_line_1 (&arg1, 0, 0, 0, 0);
else
sals_end = decode_line_1 (&arg1, 0, sal.symtab, sal.line, 0, 0);
sals_end = decode_line_1 (&arg1, 0, sal.symtab, sal.line, 0);
if (sals_end.nelts == 0)
return;
if (sals_end.nelts > 1)

View File

@ -67,8 +67,7 @@ static struct symtabs_and_lines decode_compound (char **argptr,
int funfirstline,
struct linespec_result *canonical,
char *saved_arg,
char *p,
int *not_found_ptr);
char *p);
static struct symbol *lookup_prefix_sym (char **argptr, char *p);
@ -77,8 +76,7 @@ static struct symtabs_and_lines find_method (int funfirstline,
char *saved_arg,
char *copy,
struct type *t,
struct symbol *sym_class,
int *not_found_ptr);
struct symbol *sym_class);
static void cplusplus_error (const char *name, const char *fmt, ...)
ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (2, 3);
@ -108,8 +106,7 @@ static struct symtabs_and_lines decode_line_2 (struct symbol *[],
struct linespec_result *);
static struct symtab *symtab_from_filename (char **argptr,
char *p, int is_quote_enclosed,
int *not_found_ptr);
char *p, int is_quote_enclosed);
static struct symbol *find_function_symbol (char **argptr, char *p,
int is_quote_enclosed);
@ -135,8 +132,7 @@ static int decode_label (struct symbol *function_symbol,
static struct symtabs_and_lines decode_variable (char *copy,
int funfirstline,
struct linespec_result *canonical,
struct symtab *file_symtab,
int *not_found_ptr);
struct symtab *file_symtab);
static struct
symtabs_and_lines symbol_found (int funfirstline,
@ -783,12 +779,7 @@ keep_name_info (char *ptr)
Note that it is possible to return zero for the symtab
if no file is validly specified. Callers must check that.
Also, the line number returned may be invalid.
If NOT_FOUND_PTR is not null, store a boolean true/false value at
the location, based on whether or not failure occurs due to an
unknown function or file. In the case where failure does occur due
to an unknown function or file, do not issue an error message. */
Also, the line number returned may be invalid. */
/* We allow single quotes in various places. This is a hideous
kludge, which exists because the completer can't yet deal with the
@ -797,8 +788,7 @@ keep_name_info (char *ptr)
struct symtabs_and_lines
decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
int default_line, struct linespec_result *canonical,
int *not_found_ptr)
int default_line, struct linespec_result *canonical)
{
char *p;
char *q;
@ -825,9 +815,6 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
was thrown when trying to parse a filename. */
volatile struct gdb_exception file_exception;
if (not_found_ptr)
*not_found_ptr = 0;
/* Defaults have defaults. */
initialize_defaults (&default_symtab, &default_line);
@ -888,7 +875,7 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
if (is_quote_enclosed)
++saved_arg;
values = decode_compound (argptr, funfirstline, canonical,
saved_arg, p, not_found_ptr);
saved_arg, p);
if (is_quoted && **argptr == '\'')
*argptr = *argptr + 1;
return values;
@ -899,8 +886,7 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
TRY_CATCH (file_exception, RETURN_MASK_ERROR)
{
file_symtab = symtab_from_filename (argptr, p, is_quote_enclosed,
not_found_ptr);
file_symtab = symtab_from_filename (argptr, p, is_quote_enclosed);
}
/* If that failed, maybe we have `function:label'. */
if (file_exception.reason < 0)
@ -910,8 +896,6 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
exception. */
if (!function_symbol)
throw_exception (file_exception);
if (not_found_ptr)
*not_found_ptr = 0;
}
/* Check for single quotes on the non-filename part. */
@ -1016,17 +1000,12 @@ decode_line_1 (char **argptr, int funfirstline, struct symtab *default_symtab,
}
if (function_symbol)
{
if (not_found_ptr)
*not_found_ptr = 1;
throw_exception (file_exception);
}
throw_exception (file_exception);
/* Look up that token as a variable.
If file specified, use that file's per-file block to start with. */
return decode_variable (copy, funfirstline, canonical,
file_symtab, not_found_ptr);
return decode_variable (copy, funfirstline, canonical, file_symtab);
}
@ -1333,7 +1312,7 @@ decode_objc (char **argptr, int funfirstline, struct symtab *file_symtab,
static struct symtabs_and_lines
decode_compound (char **argptr, int funfirstline,
struct linespec_result *canonical,
char *the_real_saved_arg, char *p, int *not_found_ptr)
char *the_real_saved_arg, char *p)
{
struct symtabs_and_lines values;
char *p2;
@ -1568,7 +1547,7 @@ decode_compound (char **argptr, int funfirstline,
we'll lookup the whole string in the symbol tables. */
values = find_method (funfirstline, canonical, saved_arg,
copy, t, sym_class, not_found_ptr);
copy, t, sym_class);
if (saved_java_argptr != NULL && values.nelts == 1)
{
/* The user specified a specific return type for a java method.
@ -1622,8 +1601,6 @@ decode_compound (char **argptr, int funfirstline,
}
/* Couldn't find a minimal symbol, either, so give up. */
if (not_found_ptr)
*not_found_ptr = 1;
cplusplus_error (the_real_saved_arg,
"Can't find member of namespace, "
"class, struct, or union named \"%s\"\n",
@ -1693,8 +1670,7 @@ lookup_prefix_sym (char **argptr, char *p)
static struct symtabs_and_lines
find_method (int funfirstline, struct linespec_result *canonical,
char *saved_arg,
char *copy, struct type *t, struct symbol *sym_class,
int *not_found_ptr)
char *copy, struct type *t, struct symbol *sym_class)
{
struct symtabs_and_lines values;
struct symbol *sym = NULL;
@ -1782,8 +1758,6 @@ find_method (int funfirstline, struct linespec_result *canonical,
}
else
{
if (not_found_ptr)
*not_found_ptr = 1;
if (copy[0] == '~')
cplusplus_error (saved_arg,
"the class `%s' does not have destructor defined\n",
@ -1798,14 +1772,10 @@ find_method (int funfirstline, struct linespec_result *canonical,
/* Return the symtab associated to the filename given by the substring
of *ARGPTR ending at P, and advance ARGPTR past that filename. If
NOT_FOUND_PTR is not null and the source file is not found, store
boolean true at the location pointed to and do not issue an
error message. */
of *ARGPTR ending at P, and advance ARGPTR past that filename. */
static struct symtab *
symtab_from_filename (char **argptr, char *p, int is_quote_enclosed,
int *not_found_ptr)
symtab_from_filename (char **argptr, char *p, int is_quote_enclosed)
{
char *p1;
char *copy;
@ -1829,8 +1799,6 @@ symtab_from_filename (char **argptr, char *p, int is_quote_enclosed,
file_symtab = lookup_symtab (copy);
if (file_symtab == 0)
{
if (not_found_ptr)
*not_found_ptr = 1;
if (!have_full_symbols () && !have_partial_symbols ())
throw_error (NOT_FOUND_ERROR,
_("No symbol table is loaded. "
@ -2094,14 +2062,12 @@ decode_label (struct symbol *function_symbol, char *copy,
}
/* Decode a linespec that's a variable. If FILE_SYMTAB is non-NULL,
look in that symtab's static variables first. If NOT_FOUND_PTR is
not NULL and the function cannot be found, store boolean true in
the location pointed to and do not issue an error message. */
look in that symtab's static variables first. */
static struct symtabs_and_lines
decode_variable (char *copy, int funfirstline,
struct linespec_result *canonical,
struct symtab *file_symtab, int *not_found_ptr)
struct symtab *file_symtab)
{
struct symbol *sym;
struct minimal_symbol *msymbol;
@ -2121,9 +2087,6 @@ decode_variable (char *copy, int funfirstline,
if (msymbol != NULL)
return minsym_found (funfirstline, msymbol);
if (not_found_ptr)
*not_found_ptr = 1;
if (!have_full_symbols ()
&& !have_partial_symbols ()
&& !have_minimal_symbols ())

View File

@ -46,6 +46,6 @@ extern void init_linespec_result (struct linespec_result *);
extern struct symtabs_and_lines
decode_line_1 (char **argptr, int funfirstline,
struct symtab *default_symtab, int default_line,
struct linespec_result *canonical, int *not_found_ptr);
struct linespec_result *canonical);
#endif /* defined (LINESPEC_H) */

View File

@ -454,7 +454,7 @@ gdbpy_decode_line (PyObject *self, PyObject *args)
arg = xstrdup (arg);
make_cleanup (xfree, arg);
copy = arg;
sals = decode_line_1 (&copy, 0, 0, 0, 0, 0);
sals = decode_line_1 (&copy, 0, 0, 0, 0);
make_cleanup (xfree, sals.sals);
}
else

View File

@ -4375,7 +4375,7 @@ decode_line_spec (char *string, int funfirstline)
sals = decode_line_1 (&string, funfirstline,
cursal.symtab, cursal.line,
NULL, NULL);
NULL);
if (*string)
error (_("Junk at end of line specification: %s"), string);

View File

@ -2333,7 +2333,7 @@ scope_info (char *args, int from_tty)
error (_("requires an argument (function, "
"line or *addr) to define a scope"));
sals = decode_line_1 (&args, 1, NULL, 0, NULL, NULL);
sals = decode_line_1 (&args, 1, NULL, 0, NULL);
if (sals.nelts == 0)
return; /* Presumably decode_line_1 has already warned. */