From 58438ac18761353e6d8461c914992071d4fcb1d3 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 4 Apr 2011 17:41:07 +0000 Subject: [PATCH] * 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. --- gdb/ChangeLog | 18 ++++++++++++++ gdb/breakpoint.c | 38 ++++++++++++++-------------- gdb/cli/cli-cmds.c | 8 +++--- gdb/linespec.c | 71 +++++++++++++---------------------------------------- gdb/linespec.h | 2 +- gdb/python/python.c | 2 +- gdb/symtab.c | 2 +- gdb/tracepoint.c | 2 +- 8 files changed, 61 insertions(+), 82 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9d0d1d1..6aca3c3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,23 @@ 2011-04-04 Tom Tromey + * 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 + * breakpoint.c (struct captured_parse_breakpoint_args): Remove. (do_captured_parse_breakpoint): Remove. (create_breakpoint): `e' is now volatile. Remove `parse_args'. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 14adae6..2352191 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -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, ¬_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, ¬_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; diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 0fc5efc..7fd2f50 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -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) diff --git a/gdb/linespec.c b/gdb/linespec.c index 70df3ca..94bb86f 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -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 ()) diff --git a/gdb/linespec.h b/gdb/linespec.h index d8d2ec9..3c86af3 100644 --- a/gdb/linespec.h +++ b/gdb/linespec.h @@ -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) */ diff --git a/gdb/python/python.c b/gdb/python/python.c index 90d5dc8..8a7bc66 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -454,7 +454,7 @@ gdbpy_decode_line (PyObject *self, PyObject *args) arg = xstrdup (arg); make_cleanup (xfree, arg); copy = arg; - sals = decode_line_1 (©, 0, 0, 0, 0, 0); + sals = decode_line_1 (©, 0, 0, 0, 0); make_cleanup (xfree, sals.sals); } else diff --git a/gdb/symtab.c b/gdb/symtab.c index 96b0773..cfceef6 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -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); diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 3ae35d0..d5f69e7 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -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. */ -- 2.7.4