diff options
author | Tom Tromey <tromey@redhat.com> | 2011-12-06 18:54:35 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2011-12-06 18:54:35 +0000 |
commit | d2fae92c9d78b49086182385a5bbd086b7a030b6 (patch) | |
tree | e99d98d4f0fc93aef20aefabad7504b1ac346a1b /gdb/testsuite | |
parent | 3014fc3a955d3f5ee57e79877a06ad51f780418c (diff) | |
download | gdb-d2fae92c9d78b49086182385a5bbd086b7a030b6.tar.gz |
the "ambiguous linespec" series
gdb
2011-12-06 Joel Brobecker <brobecker@acacore.com>
* language.h (struct language_defn): Add new component
la_symbol_name_compare.
* symfile.h (struct quick_symbol_functions): Update the profile
of parameter "name_matcher" for the expand_symtabs_matching
method. Update the documentation accordingly.
* ada-lang.h (ada_name_for_lookup): Add declaration.
* ada-lang.c (ada_name_for_lookup): New function, extracted out
from ada_iterate_over_symbols.
(ada_iterate_over_symbols): Do not encode symbol name anymore.
(ada_expand_partial_symbol_name): Adjust profile.
(ada_language_defn): Add value for la_symbol_name_compare field.
* linespec.c: #include "ada-lang.h".
(iterate_name_matcher): Add language parameter. Replace call
to strcmp_iw by call to language->la_symbol_name_compare.
(decode_variable): Encode COPY if current language is Ada.
* dwarf2read.c (dw2_expand_symtabs_matching): Adjust profile
of name_matcher parameter. Adjust call to name_matcher.
* psymtab.c (expand_symtabs_matching_via_partial): Likewise.
(expand_partial_symbol_names): Update profile of parameter "fun".
* psymtab.h (expand_partial_symbol_names): Update profile of
parameter "fun".
* symtab.c (demangle_for_lookup): Update function documentation.
(search_symbols_name_matches): Add language parameter.
(expand_partial_symbol_name): Likewise.
* c-lang.c (c_language_defn, cplus_language_defn)
(asm_language_defn, minimal_language_defn): Add value for
la_symbol_name_compare field.
* d-lang.c (d_language_defn): Likewise.
* f-lang.c (f_language_defn): Ditto.
* jv-lang.c (java_language_defn): Ditto.
* m2-lang.c (m2_language_defn): Ditto.
* objc-lang.c (objc_language_defn): Ditto.
* opencl-lang.c (opencl_language_defn): Ditto.
* p-lang.c (pascal_language_defn): Ditto.
* language.c (unknown_language_defn, auto_language_defn)
(local_language_defn): Ditto.
2011-12-06 Tom Tromey <tromey@redhat.com>
* linespec.c (iterate_over_all_matching_symtabs): Use
LA_ITERATE_OVER_SYMBOLS.
(lookup_prefix_sym, add_matching_symbols_to_info): Likewise.
(find_function_symbols, decode_variable): Remove Ada special
case.
* language.h (struct language_defn) <la_iterate_over_symbols>: New
field.
(LA_ITERATE_OVER_SYMBOLS): New macro.
* language.c (unknown_language_defn, auto_language_defn)
(local_language_defn): Update.
* c-lang.c (c_language_defn, cplus_language_defn)
(asm_language_defn, minimal_language_defn): Update.
* d-lang.c (d_language_defn): Update.
* f-lang.c (f_language_defn): Update.
* jv-lang.c (java_language_defn): Update.
* m2-lang.c (m2_language_defn): Update.
* objc-lang.c (objc_language_defn): Update.
* opencl-lang.c (opencl_language_defn): Update.
* p-lang.c (pascal_language_defn): Update.
* ada-lang.c (ada_iterate_over_symbols): New function.
(ada_language_defn): Update.
2011-12-06 Tom Tromey <tromey@redhat.com>
Joel Brobecker <brobecker@acacore.com>
PR breakpoints/13105, PR objc/8341, PR objc/8343, PR objc/8366,
PR objc/8535, PR breakpoints/11657, PR breakpoints/11970,
PR breakpoints/12023, PR breakpoints/12334, PR breakpoints/12856,
PR shlibs/8929, PR shlibs/7393:
* python/py-type.c (compare_maybe_null_strings): Rename from
compare_strings.
(check_types_equal): Update.
* utils.c (compare_strings): New function.
* tui/tui-winsource.c (tui_update_breakpoint_info): Update for
location changes.
* tracepoint.c (scope_info): Update.
(trace_find_line_command): Use DECODE_LINE_FUNFIRSTLINE.
* symtab.h (iterate_over_minimal_symbols)
(iterate_over_some_symtabs, iterate_over_symtabs)
(find_pcs_for_symtab_line, iterate_over_symbols)
(demangle_for_lookup): Declare.
(expand_line_sal): Remove.
* symtab.c (iterate_over_some_symtabs, iterate_over_symtabs)
(lookup_symtab_callback): New functions.
(lookup_symtab): Rewrite.
(demangle_for_lookup): New function, extract from
lookup_symbol_in_language.
(lookup_symbol_in_language): Use it.
(iterate_over_symbols): New function.
(find_line_symtab): Update.
(find_pcs_for_symtab_line): New functions.
(find_line_common): Add 'start' argument.
(decode_line_spec): Update. Change argument to 'flags', change
interpretation.
(append_expanded_sal): Remove.
(append_exact_match_to_sals): Remove.
(expand_line_sal): Remove.
* symfile.h (struct quick_symbol_functions) <lookup_symtab>:
Remove.
<map_symtabs_matching_filename>: New field.
* stack.c (func_command): Only look in the current program space.
Use DECODE_LINE_FUNFIRSTLINE.
* source.c (line_info): Set pspace on sal. Check program space in
the loop. Use DECODE_LINE_LIST_MODE.
(select_source_symtab): Use DECODE_LINE_FUNFIRSTLINE.
* solib-target.c: Remove DEF_VEC_I(CORE_ADDR).
* python/python.c (gdbpy_decode_line): Update.
* psymtab.c (partial_map_expand_apply): New function.
(partial_map_symtabs_matching_filename): Rename from
lookup_partial_symbol. Update arguments.
(lookup_symtab_via_partial_symtab): Remove.
(psym_functions): Update.
* objc-lang.h (parse_selector, parse_method): Don't declare.
(find_imps): Update.
* objc-lang.c (parse_selector, parse_method): Now static.
(find_methods): Change arguments. Fill in a vector of symbol
names.
(uniquify_strings): New function.
(find_imps): Change arguments.
* minsyms.c (iterate_over_minimal_symbols): New function.
* linespec.h (enum decode_line_flags): New.
(struct linespec_sals): New.
(struct linespec_result) <canonical>: Remove.
<pre_expanded, addr_string, sals>: New fields.
(destroy_linespec_result, make_cleanup_destroy_linespec_result)
(decode_line_full): Declare.
(decode_line_1): Update.
* linespec.c (struct address_entry, struct linespec_state, struct
collect_info): New types.
(add_sal_to_sals_basic, add_sal_to_sals, hash_address_entry)
(eq_address_entry, maybe_add_address): New functions.
(total_number_of_methods): Remove.
(iterate_name_matcher, iterate_over_all_matching_symtabs): New
functions.
(find_methods): Change arguments. Don't canonicalize input.
Simplify logic.
(add_matching_methods, add_constructors)
(build_canonical_line_spec): Remove.
(filter_results, convert_results_to_lsals): New functions.
(decode_line_2): Change arguments. Rewrite for new data
structures.
(decode_line_internal): Rename from decode_line_1. Change
arguments. Add cleanups. Update for new data structures.
(linespec_state_constructor, linespec_state_destructor)
(decode_line_full, decode_line_1): New functions.
(decode_indirect): Change arguments. Update.
(locate_first_half): Use skip_spaces.
(decode_objc): Change arguments. Update for new data structures.
Simplify logic.
(decode_compound): Change arguments. Add cleanups. Remove
fallback code, replace with error.
(struct decode_compound_collector): New type.
(collect_one_symbol): New function.
(lookup_prefix_sym): Change arguments. Update.
(compare_symbol_name, add_all_symbol_names_from_pspace)
(find_superclass_methods ): New functions.
(find_method): Rewrite.
(struct symtab_collector): New type.
(add_symtabs_to_list, collect_symtabs_from_filename): New
functions.
(symtabs_from_filename): Change API. Rename from
symtab_from_filename.
(collect_function_symbols): New function.
(find_function_symbols): Change API. Rename from
find_function_symbol. Rewrite.
(decode_all_digits): Change arguments. Rewrite.
(decode_dollar): Change arguments. Use decode_variable.
(decode_label): Change arguments. Rewrite.
(collect_symbols): New function.
(minsym_found): Change arguments. Rewrite.
(check_minsym, search_minsyms_for_name)
(add_matching_symbols_to_info): New function.
(decode_variable): Change arguments. Iterate over all symbols.
(symbol_found): Remove.
(symbol_to_sal): New function.
(init_linespec_result, destroy_linespec_result)
(cleanup_linespec_result, make_cleanup_destroy_linespec_result):
New functions.
(decode_digits_list_mode, decode_digits_ordinary): New functions.
* dwarf2read.c (dw2_map_expand_apply): New function.
(dw2_map_symtabs_matching_filename): Rename from
dw2_lookup_symtab. Change arguments.
(dwarf2_gdb_index_functions): Update.
* dwarf2loc.c: Remove DEF_VEC_I(CORE_ADDR).
* defs.h (compare_strings): Declare.
* cli/cli-cmds.c (compare_strings): Move to utils.c.
(edit_command, list_command): Use DECODE_LINE_LIST_MODE. Call
filter_sals.
(compare_symtabs, filter_sals): New functions.
* breakpoint.h (struct bp_location) <line_number, source_file>:
New fields.
(struct breakpoint) <line_number, source_file>: Remove.
<filter>: New field.
* breakpoint.c (print_breakpoint_location, init_raw_breakpoint)
(momentary_breakpoint_from_master, add_location_to_breakpoint):
Update for changes to locations.
(init_breakpoint_sal): Add 'filter' argument. Set 'filter' on
breakpoint.
(create_breakpoint_sal): Add 'filter' argument.
(remove_sal, expand_line_sal_maybe): Remove.
(create_breakpoints_sal): Remove 'sals' argument. Handle
pre-expanded sals and the filter.
(parse_breakpoint_sals): Use decode_line_full.
(check_fast_tracepoint_sals): Use get_sal_arch.
(create_breakpoint): Create a linespec_sals. Update.
(break_range_command): Use decode_line_full. Update.
(until_break_command): Update.
(clear_command): Update match conditions for linespec.c changes.
Use DECODE_LINE_LIST_MODE.
(say_where): Update for changes to locations.
(bp_location_dtor): Free 'source_file'.
(base_breakpoint_dtor): Free 'filter'. Don't free 'source_file'.
(update_static_tracepoint): Update for changes to locations.
(update_breakpoint_locations): Disable ranged breakpoint if too
many locations match. Update.
(addr_string_to_sals): Use decode_line_full. Resolve all sal
PCs.
(breakpoint_re_set_default): Don't call expand_line_sal_maybe.
(decode_line_spec_1): Update. Change argument name to 'flags',
change interpretation.
* block.h (block_containing_function): Declare.
* block.c (block_containing_function): New function.
* skip.c (skip_function_command): Update.
(skip_re_set): Update.
* infcmd.c (jump_command): Use DECODE_LINE_FUNFIRSTLINE.
* mi/mi-main.c (mi_cmd_trace_find): Use DECODE_LINE_FUNFIRSTLINE.
* NEWS: Add entry.
2011-12-06 Tom Tromey <tromey@redhat.com>
* elfread.c (elf_gnu_ifunc_resolver_return_stop): Allow
breakpoint's pspace to be NULL.
* breakpoint.h (struct breakpoint) <pspace>: Update comment.
* breakpoint.c (init_raw_breakpoint): Conditionally set
breakpoint's pspace.
(init_breakpoint_sal): Don't set breakpoint's pspace.
(prepare_re_set_context): Conditionally switch program space.
(addr_string_to_sals): Check executing_startup on location's
program space.
2011-12-06 Tom Tromey <tromey@redhat.com>
* breakpoint.h (enum enable_state) <bp_startup_disabled>: Remove.
* breakpoint.c (should_be_inserted): Explicitly check if program
space is executing startup.
(describe_other_breakpoints): Update.
(disable_breakpoints_before_startup): Change executing_startup
earlier. Remove loop.
(enable_breakpoints_after_startup): Likewise.
(init_breakpoint_sal): Don't use bp_startup_disabled.
(create_breakpoint): Don't use bp_startup_disabled.
(update_global_location_list): Use should_be_inserted.
(bkpt_re_set): Update.
gdb/testsuite
2011-12-06 Joel Brobecker <brobecker@acacore.com>
* gdb.ada/fullname_bp.exp: Add tests for other valid linespecs
involving a fully qualified function name.
2011-12-06 Tom Tromey <tromey@redhat.com>
* gdb.ada/homonym.exp: Add three breakpoint tests.
2011-12-06 Tom Tromey <tromey@redhat.com>
* gdb.base/solib-weak.exp (do_test): Remove kfail.
* gdb.trace/tracecmd.exp: Disable pending breakpoints earlier.
* gdb.objc/objcdecode.exp: Update for output changes.
* gdb.linespec/linespec.exp: New file.
* gdb.linespec/lspec.cc: New file.
* gdb.linespec/lspec.h: New file.
* gdb.linespec/body.h: New file.
* gdb.linespec/base/two/thefile.cc: New file.
* gdb.linespec/base/one/thefile.cc: New file.
* gdb.linespec/Makefile.in: New file.
* gdb.cp/templates.exp (test_template_breakpoints): Update for
output changes.
* gdb.cp/re-set-overloaded.exp: Remove kfail.
* gdb.cp/ovldbreak.exp: Update for output changes. "all" test now
makes one breakpoint.
* gdb.cp/method2.exp (test_break): Update for output changes.
* gdb.cp/mb-templates.exp: Update for output changes.
* gdb.cp/mb-inline.exp: Update for output changes.
* gdb.cp/mb-ctor.exp: Update for output changes.
* gdb.cp/ovsrch.exp: Use fully-qualified names.
* gdb.base/solib-symbol.exp: Run to main later. Breakpoint now
has multiple matches.
* gdb.base/sepdebug.exp: Disable pending breakpoints. Update for
error message change.
* gdb.base/list.exp (test_list_filename_and_number): Update for
error message change.
* gdb.base/break.exp: Disable pending breakpoints. Update for
output changes.
* configure.ac: Add gdb.linespec.
* configure: Rebuild.
* Makefile.in (ALL_SUBDIRS): Add gdb.linespec.
gdb/doc
2011-12-06 Tom Tromey <tromey@redhat.com>
* gdb.texinfo (Set Breaks): Update for new behavior.
Diffstat (limited to 'gdb/testsuite')
31 files changed, 434 insertions, 100 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 2033f121ceb..7626a06fd1c 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,46 @@ +2011-12-06 Joel Brobecker <brobecker@acacore.com> + + * gdb.ada/fullname_bp.exp: Add tests for other valid linespecs + involving a fully qualified function name. + +2011-12-06 Tom Tromey <tromey@redhat.com> + + * gdb.ada/homonym.exp: Add three breakpoint tests. + +2011-12-06 Tom Tromey <tromey@redhat.com> + + * gdb.base/solib-weak.exp (do_test): Remove kfail. + * gdb.trace/tracecmd.exp: Disable pending breakpoints earlier. + * gdb.objc/objcdecode.exp: Update for output changes. + * gdb.linespec/linespec.exp: New file. + * gdb.linespec/lspec.cc: New file. + * gdb.linespec/lspec.h: New file. + * gdb.linespec/body.h: New file. + * gdb.linespec/base/two/thefile.cc: New file. + * gdb.linespec/base/one/thefile.cc: New file. + * gdb.linespec/Makefile.in: New file. + * gdb.cp/templates.exp (test_template_breakpoints): Update for + output changes. + * gdb.cp/re-set-overloaded.exp: Remove kfail. + * gdb.cp/ovldbreak.exp: Update for output changes. "all" test now + makes one breakpoint. + * gdb.cp/method2.exp (test_break): Update for output changes. + * gdb.cp/mb-templates.exp: Update for output changes. + * gdb.cp/mb-inline.exp: Update for output changes. + * gdb.cp/mb-ctor.exp: Update for output changes. + * gdb.cp/ovsrch.exp: Use fully-qualified names. + * gdb.base/solib-symbol.exp: Run to main later. Breakpoint now + has multiple matches. + * gdb.base/sepdebug.exp: Disable pending breakpoints. Update for + error message change. + * gdb.base/list.exp (test_list_filename_and_number): Update for + error message change. + * gdb.base/break.exp: Disable pending breakpoints. Update for + output changes. + * configure.ac: Add gdb.linespec. + * configure: Rebuild. + * Makefile.in (ALL_SUBDIRS): Add gdb.linespec. + 2011-12-06 Ulrich Weigand <uweigand@de.ibm.com> * gdb.base/callfuncs.exp (fetch_all_registers): Filter out read-only diff --git a/gdb/testsuite/Makefile.in b/gdb/testsuite/Makefile.in index 8b22324ef29..d3c9cfc213a 100644 --- a/gdb/testsuite/Makefile.in +++ b/gdb/testsuite/Makefile.in @@ -35,7 +35,7 @@ SUBDIRS = @subdirs@ RPATH_ENVVAR = @RPATH_ENVVAR@ ALL_SUBDIRS = gdb.ada gdb.arch gdb.asm gdb.base gdb.cell gdb.cp gdb.disasm \ gdb.dwarf2 gdb.fortran gdb.gdb gdb.hp \ - gdb.java gdb.mi gdb.modula2 gdb.multi \ + gdb.java gdb.linespec gdb.mi gdb.modula2 gdb.multi \ gdb.objc gdb.opencl gdb.opt gdb.pascal gdb.python gdb.server \ gdb.stabs gdb.reverse gdb.threads gdb.trace gdb.xml \ $(SUBDIRS) diff --git a/gdb/testsuite/configure b/gdb/testsuite/configure index 82206b32dd9..fb70b3df9bc 100755 --- a/gdb/testsuite/configure +++ b/gdb/testsuite/configure @@ -3448,7 +3448,7 @@ done -ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile" +ac_config_files="$ac_config_files Makefile gdb.ada/Makefile gdb.arch/Makefile gdb.asm/Makefile gdb.base/Makefile gdb.cell/Makefile gdb.cp/Makefile gdb.disasm/Makefile gdb.dwarf2/Makefile gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile gdb.hp/gdb.defects/Makefile gdb.linespec/Makefile gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile gdb.threads/Makefile gdb.trace/Makefile gdb.xml/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -4166,6 +4166,7 @@ do "gdb.hp/gdb.aCC/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.hp/gdb.aCC/Makefile" ;; "gdb.hp/gdb.compat/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.hp/gdb.compat/Makefile" ;; "gdb.hp/gdb.defects/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.hp/gdb.defects/Makefile" ;; + "gdb.linespec/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.linespec/Makefile" ;; "gdb.mi/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.mi/Makefile" ;; "gdb.modula2/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.modula2/Makefile" ;; "gdb.multi/Makefile") CONFIG_FILES="$CONFIG_FILES gdb.multi/Makefile" ;; diff --git a/gdb/testsuite/configure.ac b/gdb/testsuite/configure.ac index 8631442e481..121fd37597e 100644 --- a/gdb/testsuite/configure.ac +++ b/gdb/testsuite/configure.ac @@ -95,7 +95,7 @@ AC_OUTPUT([Makefile \ gdb.fortran/Makefile gdb.server/Makefile gdb.java/Makefile \ gdb.hp/Makefile gdb.hp/gdb.objdbg/Makefile gdb.hp/gdb.base-hp/Makefile \ gdb.hp/gdb.aCC/Makefile gdb.hp/gdb.compat/Makefile \ - gdb.hp/gdb.defects/Makefile \ + gdb.hp/gdb.defects/Makefile gdb.linespec/Makefile \ gdb.mi/Makefile gdb.modula2/Makefile gdb.multi/Makefile \ gdb.objc/Makefile gdb.opencl/Makefile gdb.opt/Makefile gdb.pascal/Makefile \ gdb.python/Makefile gdb.reverse/Makefile gdb.stabs/Makefile \ diff --git a/gdb/testsuite/gdb.ada/fullname_bp.exp b/gdb/testsuite/gdb.ada/fullname_bp.exp index faf63b93991..0e4d32f0836 100644 --- a/gdb/testsuite/gdb.ada/fullname_bp.exp +++ b/gdb/testsuite/gdb.ada/fullname_bp.exp @@ -25,6 +25,9 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } return -1 } +# Note: We restart the debugger before setting each breakpoint, because +# we want to test the situation where the symtab for our breakpoint +# has not been created yet. clean_restart ${testfile} # Break on "pck.hello" rather than just "hello" to make sure we trigger @@ -32,3 +35,23 @@ clean_restart ${testfile} gdb_test "break pck.hello" \ "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file .*pck.adb, line \[0-9\]+." +# Do the same, but this time using a linespec where the user also +# provided a filename. + +clean_restart ${testfile} + +gdb_test "break pck.adb:pck.hello" \ + "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file .*pck.adb, line \[0-9\]+." + +# Same scenarios as above, but with a function name that is spelled +# with upper-case letters. + +clean_restart ${testfile} + +gdb_test "break Pck.Hello" \ + "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file .*pck.adb, line \[0-9\]+." + +clean_restart ${testfile} + +gdb_test "break pck.adb:Pck.Hello" \ + "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file .*pck.adb, line \[0-9\]+." diff --git a/gdb/testsuite/gdb.ada/homonym.exp b/gdb/testsuite/gdb.ada/homonym.exp index b5dff1b77a2..d56863312d9 100644 --- a/gdb/testsuite/gdb.ada/homonym.exp +++ b/gdb/testsuite/gdb.ada/homonym.exp @@ -31,6 +31,24 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } clean_restart ${testfile} + +# Do these tests before running, so we are operating in a known +# environment. + +gdb_test "break Get_Value" \ + "Breakpoint \[0-9\]+ at $hex: Get_Value. .2 locations." \ + "set breakpoint at Get_Value" + +gdb_test "break homonym.adb:Get_Value" \ + "Breakpoint \[0-9\]+ at $hex: homonym.adb:Get_Value. .2 locations." \ + "set breakpoint at homonym.adb:Get_Value" + +gdb_test "break <homonym__get_value>" \ + "Breakpoint \[0-9\]+ at $hex: <homonym__get_value>. .2 locations." \ + "set breakpoint at <homonym__get_value>" + +delete_breakpoints + set bp_location [gdb_get_line_number "BREAK_1" ${testdir}/homonym.adb] runto "homonym.adb:$bp_location" @@ -86,6 +104,3 @@ gdb_test "ptype lcl" \ gdb_test "print lcl" \ "= 17" \ "print lcl at BREAK_2" - - - diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index 92fcc6937b2..c5885ba46d6 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -540,8 +540,9 @@ gdb_test_multiple "catch exec" "$name" { # Verify that GDB responds gracefully when asked to set a breakpoint # on a nonexistent source line. # +gdb_test_no_output "set breakpoint pending off" gdb_test "break 999" \ - "No line 999 in file .*" \ + "No line 999 in the current file." \ "break on non-existent source line" # Run to the desired default location. If not positioned here, the diff --git a/gdb/testsuite/gdb.base/list.exp b/gdb/testsuite/gdb.base/list.exp index d967dd2384d..6a4153c6552 100644 --- a/gdb/testsuite/gdb.base/list.exp +++ b/gdb/testsuite/gdb.base/list.exp @@ -489,7 +489,7 @@ proc test_list_filename_and_function {} { gdb_test "list foobar.c:main" "No source file named foobar.c.|Location not found" "list filename:function; nonexistant file" - gdb_test "list list0.h:foobar" "Function \"foobar\" not defined.|Location not found" "list filename:function; nonexistant function" + gdb_test "list list0.h:foobar" "Function \"foobar\" not defined in \"list0.h\"." "list filename:function; nonexistant function" } diff --git a/gdb/testsuite/gdb.base/sepdebug.exp b/gdb/testsuite/gdb.base/sepdebug.exp index 1a9072dd9e1..bb0b9141feb 100644 --- a/gdb/testsuite/gdb.base/sepdebug.exp +++ b/gdb/testsuite/gdb.base/sepdebug.exp @@ -337,7 +337,8 @@ gdb_test_multiple "catch exec" $name { # on a nonexistent source line. # -gdb_test "break 999" "No line 999 in file .*" \ +gdb_test_no_output "set breakpoint pending off" +gdb_test "break 999" "No line 999 in the current file." \ "break on non-existent source line" # Run to the desired default location. If not positioned here, the diff --git a/gdb/testsuite/gdb.base/solib-symbol.exp b/gdb/testsuite/gdb.base/solib-symbol.exp index aa723c65611..d402ebb9ffd 100644 --- a/gdb/testsuite/gdb.base/solib-symbol.exp +++ b/gdb/testsuite/gdb.base/solib-symbol.exp @@ -46,11 +46,6 @@ gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} gdb_load_shlibs $binfile_lib -if ![runto_main] then { - fail "Can't run to main" - return 0 -} - # Set a breakpoint in the binary. gdb_test "br foo2" \ "Breakpoint.*file.*${testfile}\\.c.*" \ @@ -58,6 +53,11 @@ gdb_test "br foo2" \ delete_breakpoints +if ![runto_main] then { + fail "Can't run to main" + return 0 +} + # Break in the library. gdb_test "br foo" \ "Breakpoint.*file.*${libname}\\.c.*" \ @@ -67,9 +67,9 @@ gdb_test "continue" \ "Continuing.*" \ "continue" -# This symbol is now looked up in the ELF library. +# This symbol is now looked up in the ELF library and the binary. gdb_test "br foo2" \ - "Breakpoint.*file.*${libname}\\.c.*" \ + "Breakpoint.*: foo2. .2 locations..*" \ "foo2 in mdlib" gdb_exit diff --git a/gdb/testsuite/gdb.base/solib-weak.exp b/gdb/testsuite/gdb.base/solib-weak.exp index 1f23aa28948..52fd72d3aaf 100644 --- a/gdb/testsuite/gdb.base/solib-weak.exp +++ b/gdb/testsuite/gdb.base/solib-weak.exp @@ -101,15 +101,6 @@ proc do_test { lib1opts lib2opts lib1first } { gdb_breakpoint "bar" - # If the library which will be used is compiled without debugging - # information, GDB will pick the wrong copy of "bar", i.e. the one - # with debugging information. - - if {(${lib1opts} == "" && ${lib2opts} != "" && ${lib1first} == 1) - || (${lib1opts} != "" && ${lib2opts} == "" && ${lib1first} == 0)} { - setup_kfail gdb/1824 *-*-* - } - gdb_test "continue" "Breakpoint .* \\.?bar .*${expected_file}\\..*" \ "run to breakpoint - $testopts" } diff --git a/gdb/testsuite/gdb.cp/mb-ctor.exp b/gdb/testsuite/gdb.cp/mb-ctor.exp index 6a99175f789..04384248536 100644 --- a/gdb/testsuite/gdb.cp/mb-ctor.exp +++ b/gdb/testsuite/gdb.cp/mb-ctor.exp @@ -50,13 +50,13 @@ if ![runto_main] then { # and a condition. gdb_test "break 'Derived::Derived(int)'" \ - "Breakpoint.*at.* file .*$srcfile, line.*\\(2 locations\\).*" \ + "Breakpoint.*at.*: Derived::Derived.int.. \\(2 locations\\).*" \ "set-breakpoint at ctor" gdb_breakpoint [gdb_get_line_number "set breakpoint here"] gdb_test "break 'Derived::~Derived()'" \ - "Breakpoint.*at.* file .*$srcfile, line.*\\(2 locations\\).*" \ + "Breakpoint.*at.*: Derived::~Derived... \\(2 locations\\).*" \ "set-breakpoint at dtor" gdb_test "continue" \ diff --git a/gdb/testsuite/gdb.cp/mb-inline.exp b/gdb/testsuite/gdb.cp/mb-inline.exp index d670b56ed1c..05b378cf47c 100644 --- a/gdb/testsuite/gdb.cp/mb-inline.exp +++ b/gdb/testsuite/gdb.cp/mb-inline.exp @@ -62,7 +62,7 @@ set bp_location [gdb_get_line_number "set breakpoint here" $hdrfile] # Set a breakpoint with multiple locations. gdb_test "break $hdrfile:$bp_location" \ - "Breakpoint.*at.* file .*$hdrfile, line.*\\(2 locations\\).*" \ + "Breakpoint.*at.*: $hdrfile:$bp_location. \\(2 locations\\).*" \ "set breakpoint" gdb_run_cmd @@ -128,7 +128,7 @@ if { ![runto_main] } { } gdb_test "break $hdrfile:$bp_location" \ - "Breakpoint.*at.* file .*$hdrfile, line.*\\(2 locations\\).*" \ + "Breakpoint.*at.*: $hdrfile:$bp_location. \\(2 locations\\).*" \ "set multi_line_foo breakpoint" gdb_test "continue" \ ".*Breakpoint.*multi_line_foo \\(i=0\\).*" \ diff --git a/gdb/testsuite/gdb.cp/mb-templates.exp b/gdb/testsuite/gdb.cp/mb-templates.exp index 80c080b0929..933d690152d 100644 --- a/gdb/testsuite/gdb.cp/mb-templates.exp +++ b/gdb/testsuite/gdb.cp/mb-templates.exp @@ -52,7 +52,7 @@ set bp_location [gdb_get_line_number "set breakpoint here"] # and a condition. gdb_test "break $srcfile:$bp_location if i==1" \ - "Breakpoint.*at.* file .*$srcfile, line.*\\(2 locations\\).*" \ + "Breakpoint.*at.*: $srcfile:$bp_location. \\(2 locations\\).*" \ "initial condition: set breakpoint" gdb_run_cmd @@ -80,7 +80,7 @@ gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} gdb_test "break $srcfile:$bp_location" \ - "Breakpoint.*at.* file .*$srcfile, line.*\\(2 locations\\).*" \ + "Breakpoint.*at.*: $srcfile:$bp_location. \\(2 locations\\).*" \ "separate condition: set breakpoint" gdb_test_no_output "condition 1 i==1" \ @@ -177,7 +177,7 @@ if { ![runto_main] } { } gdb_test "break $srcfile:$bp_location" \ - "Breakpoint.*at.* file .*$srcfile, line.*\\(2 locations\\).*" \ + "Breakpoint.*at.*: $srcfile:$bp_location. \\(2 locations\\).*" \ "set multi_line_foo breakpoint" gdb_test "continue" \ ".*Breakpoint.*multi_line_foo<int> \\(i=0\\).*" \ diff --git a/gdb/testsuite/gdb.cp/method2.exp b/gdb/testsuite/gdb.cp/method2.exp index 2fa41697576..29a387de886 100644 --- a/gdb/testsuite/gdb.cp/method2.exp +++ b/gdb/testsuite/gdb.cp/method2.exp @@ -51,7 +51,7 @@ proc test_break { lang } { "setting language $lang" gdb_test_multiple "break A::method" "breaking in method ($lang)" { - -re ".0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*.2. A::method\\(A\\*\\) at .*\[\r\n\]*.3. A::method\\(int\\) at .*\[\r\n\]*\[\r\n\]*.4. A::method\\(\\) at .*\[\r\n\]*> $" { + -re ".0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*.2. .*:A::method\\(A\\*\\)\[\r\n\]*.3. .*:A::method\\(int\\)\[\r\n\]*.4. .*:A::method\\(\\)\[\r\n\]*> $" { gdb_test "0" \ "canceled" \ "breaking in method ($lang)" diff --git a/gdb/testsuite/gdb.cp/ovldbreak.exp b/gdb/testsuite/gdb.cp/ovldbreak.exp index f5d4051fae5..f5b41abe601 100644 --- a/gdb/testsuite/gdb.cp/ovldbreak.exp +++ b/gdb/testsuite/gdb.cp/ovldbreak.exp @@ -130,18 +130,18 @@ proc set_bp_overloaded {name expectedmenu mychoice bpnumber linenumber} { set menu_overload1arg "\\\[0\\\] cancel\r\n" append menu_overload1arg "\\\[1\\\] all\r\n" -append menu_overload1arg "\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n" -append menu_overload1arg "\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n" -append menu_overload1arg "\\\[4\\\] foo::overload1arg\\((unsigned long|long unsigned)( int)?\\) at.*$srcfile:119\r\n" -append menu_overload1arg "\\\[5\\\] foo::overload1arg\\(long( int)?\\) at.*$srcfile:118\r\n" -append menu_overload1arg "\\\[6\\\] foo::overload1arg\\((unsigned int|unsigned)\\) at.*$srcfile:117\r\n" -append menu_overload1arg "\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n" -append menu_overload1arg "\\\[8\\\] foo::overload1arg\\((unsigned short|short unsigned)( int)?\\) at.*$srcfile:115\r\n" -append menu_overload1arg "\\\[9\\\] foo::overload1arg\\(short( int)?\\) at.*$srcfile:114\r\n" -append menu_overload1arg "\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n" -append menu_overload1arg "\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n" -append menu_overload1arg "\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n" -append menu_overload1arg "\\\[13\\\] foo::overload1arg\\((void|)\\) at.*$srcfile:110\r\n" +append menu_overload1arg "\\\[2\\\] .*$srcfile:foo::overload1arg\\(double\\)\r\n" +append menu_overload1arg "\\\[3\\\] .*$srcfile:foo::overload1arg\\(float\\)\r\n" +append menu_overload1arg "\\\[4\\\] .*$srcfile:foo::overload1arg\\((unsigned long|long unsigned)( int)?\\)\r\n" +append menu_overload1arg "\\\[5\\\] .*$srcfile:foo::overload1arg\\(long( int)?\\)\r\n" +append menu_overload1arg "\\\[6\\\] .*$srcfile:foo::overload1arg\\((unsigned int|unsigned)\\)\r\n" +append menu_overload1arg "\\\[7\\\] .*$srcfile:foo::overload1arg\\(int\\)\r\n" +append menu_overload1arg "\\\[8\\\] .*$srcfile:foo::overload1arg\\((unsigned short|short unsigned)( int)?\\)\r\n" +append menu_overload1arg "\\\[9\\\] .*$srcfile:foo::overload1arg\\(short( int)?\\)\r\n" +append menu_overload1arg "\\\[10\\\] .*$srcfile:foo::overload1arg\\(unsigned char\\)\r\n" +append menu_overload1arg "\\\[11\\\] .*$srcfile:foo::overload1arg\\(signed char\\)\r\n" +append menu_overload1arg "\\\[12\\\] .*$srcfile:foo::overload1arg\\(char\\)\r\n" +append menu_overload1arg "\\\[13\\\] .*$srcfile:foo::overload1arg\\((void|)\\)\r\n" append menu_overload1arg "> $" # Set multiple-symbols to "ask", to allow us to test the use @@ -279,7 +279,7 @@ gdb_expect { # Choose all. send_gdb "1\n" gdb_expect { - -re "Breakpoint $decimal at $hex: file.*$srcfile, line 121.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 120.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 119.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 118.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 117.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 116.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 115.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 114.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 113.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 112.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 111.\r\nBreakpoint $decimal at $hex: file.*$srcfile, line 110.\r\nwarning: Multiple breakpoints were set.\r\nUse the .delete. command to delete unwanted breakpoints.\r\n$gdb_prompt $" { + -re "Breakpoint $decimal at $hex: foo::overload1arg. .12 locations.\r\n.*$gdb_prompt $" { pass "set bp on overload1arg all" } -re ".*$gdb_prompt $" { @@ -306,18 +306,19 @@ gdb_expect { gdb_test "info break" \ "Num Type\[\t \]+Disp Enb Address\[\t \]+What.* -\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(double\\) at.*$srcfile:121\r -\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(float\\) at.*$srcfile:120\r -\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned long|long unsigned)( int)?\\) at.*$srcfile:119\r -\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long( int)?\\) at.*$srcfile:118\r -\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned|unsigned int)\\) at.*$srcfile:117\r -\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(int\\) at.*$srcfile:116\r -\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned short|short unsigned)( int)?\\) at.*$srcfile:115\r -\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short( int)?\\) at.*$srcfile:114\r -\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r -\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r -\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(char\\) at.*$srcfile:111\r -\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((void|)\\) at.*$srcfile:110" \ +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+<MULTIPLE>\[\t \]*\r +\[0-9\]+.1\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(double\\) at.*$srcfile:121\r +\[0-9\]+.2\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(float\\) at.*$srcfile:120\r +\[0-9\]+.3\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned long|long unsigned)( int)?\\) at.*$srcfile:119\r +\[0-9\]+.4\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long( int)?\\) at.*$srcfile:118\r +\[0-9\]+.5\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned|unsigned int)\\) at.*$srcfile:117\r +\[0-9\]+.6\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(int\\) at.*$srcfile:116\r +\[0-9\]+.7\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned short|short unsigned)( int)?\\) at.*$srcfile:115\r +\[0-9\]+.8\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short( int)?\\) at.*$srcfile:114\r +\[0-9\]+.9\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r +\[0-9\]+.10\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r +\[0-9\]+.11\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(char\\) at.*$srcfile:111\r +\[0-9\]+.12\[\t \]+y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((void|)\\) at.*$srcfile:110" \ "breakpoint info (after setting on all)" @@ -333,10 +334,10 @@ proc continue_to_bp_overloaded {might_kfail bpnumber argtype actuals} { send_gdb "continue\n" gdb_expect { - -re "Continuing.\r\n\r\nBreakpoint ${bpnumber}, (${hex} in )?foo::overload1arg(\\(${argtype}\\))? \\(this=${hex}(, )?${actuals}\\) at.*${srcfile}:${decimal}\r\n${decimal}\[\t \]+int foo::overload1arg \\(${argtype}( arg)?\\).*\r\n.*$gdb_prompt $" { + -re "Continuing.\r\n\r\nBreakpoint ${bpnumber}, foo::overload1arg \\(this=${hex}(, )?${actuals}\\) at.*${srcfile}:${decimal}\r\n${decimal}\[\t \]+int foo::overload1arg \\(${argtype}( arg)?\\).*\r\n.*$gdb_prompt $" { pass "continue to bp overloaded : ${argtype}" } - -re "Continuing.\r\n\r\nBreakpoint ${bpnumber}, (${hex} in )?foo::overload1arg(\\(${argtype}\\))? \\(this=${hex}, arg=.*\\) at.*${srcfile}:${decimal}\r\n${decimal}\[\t \]+int foo::overload1arg \\(${argtype}( arg)?\\).*\r\n.*$gdb_prompt $" { + -re "Continuing.\r\n\r\nBreakpoint ${bpnumber}, foo::overload1arg \\(this=${hex}, arg=.*\\) at.*${srcfile}:${decimal}\r\n${decimal}\[\t \]+int foo::overload1arg \\(${argtype}( arg)?\\).*\r\n.*$gdb_prompt $" { if $might_kfail { kfail "gdb/1025" "continue to bp overloaded : ${argtype}" } else { @@ -352,17 +353,17 @@ proc continue_to_bp_overloaded {might_kfail bpnumber argtype actuals} { } } -continue_to_bp_overloaded 0 25 "(void|)" "" -continue_to_bp_overloaded 1 24 "char" "arg=2 \\'\\\\002\\'" -continue_to_bp_overloaded 1 23 "signed char" "arg=3 \\'\\\\003\\'" -continue_to_bp_overloaded 1 22 "unsigned char" "arg=4 \\'\\\\004\\'" -continue_to_bp_overloaded 1 21 "short" "arg=5" -continue_to_bp_overloaded 1 20 "unsigned short" "arg=6" -continue_to_bp_overloaded 0 19 "int" "arg=7" -continue_to_bp_overloaded 0 18 "(unsigned|unsigned int)" "arg=8" -continue_to_bp_overloaded 0 17 "long" "arg=9" -continue_to_bp_overloaded 0 16 "unsigned long" "arg=10" -continue_to_bp_overloaded 0 15 "float" "arg=100" +continue_to_bp_overloaded 0 14 "(void|)" "" +continue_to_bp_overloaded 1 14 "char" "arg=2 \\'\\\\002\\'" +continue_to_bp_overloaded 1 14 "signed char" "arg=3 \\'\\\\003\\'" +continue_to_bp_overloaded 1 14 "unsigned char" "arg=4 \\'\\\\004\\'" +continue_to_bp_overloaded 1 14 "short" "arg=5" +continue_to_bp_overloaded 1 14 "unsigned short" "arg=6" +continue_to_bp_overloaded 0 14 "int" "arg=7" +continue_to_bp_overloaded 0 14 "(unsigned|unsigned int)" "arg=8" +continue_to_bp_overloaded 0 14 "long" "arg=9" +continue_to_bp_overloaded 0 14 "unsigned long" "arg=10" +continue_to_bp_overloaded 0 14 "float" "arg=100" continue_to_bp_overloaded 1 14 "double" "arg=200" # Test breaking on an overloaded function when multiple-symbols @@ -375,7 +376,7 @@ gdb_test "break foo::foofunc" \ # is set to "all" gdb_test_no_output "set multiple-symbols all" gdb_test "break foo::foofunc" \ - "Breakpoint \[0-9\]+ at ${hex}: file .*ovldbreak\\.cc, line \[0-9\]+\\.\r\nBreakpoint \[0-9\]+ at ${hex}: file .*ovldbreak\\.cc, line \[0-9\]+\\.\r\nwarning: Multiple breakpoints were set\\.\r\nUse the \"delete\" command to delete unwanted breakpoints\\." + "Breakpoint \[0-9\]+ at ${hex}: foo::foofunc. .2 locations..*" # That's all, folks. diff --git a/gdb/testsuite/gdb.cp/ovsrch.exp b/gdb/testsuite/gdb.cp/ovsrch.exp index b509a2519d8..f6ad34bc79c 100644 --- a/gdb/testsuite/gdb.cp/ovsrch.exp +++ b/gdb/testsuite/gdb.cp/ovsrch.exp @@ -49,7 +49,7 @@ proc test_class {class} { # Test whether open parentheses are correctly identified as overload # information or conditional. - gdb_test "break ${class}::foo if (a == 3)" "Breakpoint (\[0-9\]).*" + gdb_test "break ${class}::hibob if (a_param == 3)" "Breakpoint (\[0-9\]).*" } if { [skip_cplus_tests] } { continue } @@ -73,28 +73,28 @@ if {![runto_main]} { } # Break in A::stop_here and run tests. -if {[gdb_breakpoint "stop_here"]} { - pass "break stop_here" +if {[gdb_breakpoint "A::stop_here"]} { + pass "break A::stop_here" } -if {[gdb_breakpoint "'stop_here'"]} { - pass "break 'stop_here'" +if {[gdb_breakpoint "'A::stop_here'"]} { + pass "break 'A::stop_here'" } gdb_continue_to_breakpoint "stop_here" -test_class outer +test_class A::outer # Break in A::B::stop_here_too and run tests. -if {[gdb_breakpoint "B::stop_here_too"]} { - pass "break B::stop_here_too" +if {[gdb_breakpoint "A::B::stop_here_too"]} { + pass "break A::B::stop_here_too" } -if {[gdb_breakpoint "'B::stop_here_too'"]} { - pass "break 'B::stop_here_too'" +if {[gdb_breakpoint "'A::B::stop_here_too'"]} { + pass "break 'A::B::stop_here_too'" } gdb_continue_to_breakpoint "stop_here_too" -test_class inner +test_class A::B::inner gdb_exit return 0 diff --git a/gdb/testsuite/gdb.cp/ovsrch.h b/gdb/testsuite/gdb.cp/ovsrch.h index b2e518d2a21..983b51e5fb5 100644 --- a/gdb/testsuite/gdb.cp/ovsrch.h +++ b/gdb/testsuite/gdb.cp/ovsrch.h @@ -24,6 +24,8 @@ namespace A void foo (int) const; void foo (char *) const; bool func (void) { return true; } + void hibob (int) const; + void hibob (char *) const; }; namespace B @@ -34,6 +36,8 @@ namespace A void foo (void) const; void foo (int) const; void foo (char *) const; + void hibob (int) const; + void hibob (char *) const; }; } } diff --git a/gdb/testsuite/gdb.cp/ovsrch3.cc b/gdb/testsuite/gdb.cp/ovsrch3.cc index e6e38a4507b..a7d9551a1fb 100644 --- a/gdb/testsuite/gdb.cp/ovsrch3.cc +++ b/gdb/testsuite/gdb.cp/ovsrch3.cc @@ -18,11 +18,21 @@ #include "ovsrch.h" void -A::outer::foo (int a) const +A::outer::foo (int a_param) const { } void -A::B::inner::foo (int a) const +A::B::inner::foo (int a_param) const +{ +} + +void +A::outer::hibob (int a_param) const +{ +} + +void +A::B::inner::hibob (int a_param) const { } diff --git a/gdb/testsuite/gdb.cp/ovsrch4.cc b/gdb/testsuite/gdb.cp/ovsrch4.cc index 2f0c1a62a07..5bb08b37d5a 100644 --- a/gdb/testsuite/gdb.cp/ovsrch4.cc +++ b/gdb/testsuite/gdb.cp/ovsrch4.cc @@ -18,11 +18,21 @@ #include "ovsrch.h" void -A::outer::foo (char *a) const +A::outer::foo (char *a_param) const { } void -A::B::inner::foo (char *a) const +A::B::inner::foo (char *a_param) const +{ +} + +void +A::outer::hibob (char *a_param) const +{ +} + +void +A::B::inner::hibob (char *a_param) const { } diff --git a/gdb/testsuite/gdb.cp/re-set-overloaded.exp b/gdb/testsuite/gdb.cp/re-set-overloaded.exp index 2052552ca0b..bd5f3bad224 100644 --- a/gdb/testsuite/gdb.cp/re-set-overloaded.exp +++ b/gdb/testsuite/gdb.cp/re-set-overloaded.exp @@ -46,7 +46,6 @@ gdb_test_no_output {set variable $brk = $bpnum} # runto or runto_main would call delete_breakpoints. gdb_breakpoint "main" gdb_run_cmd -setup_kfail breakpoints/11657 *-*-* gdb_test "" ".*" "start" set test "breakpoint resolved" diff --git a/gdb/testsuite/gdb.cp/templates.exp b/gdb/testsuite/gdb.cp/templates.exp index 6612b4a8c19..59e94763fed 100644 --- a/gdb/testsuite/gdb.cp/templates.exp +++ b/gdb/testsuite/gdb.cp/templates.exp @@ -109,12 +109,7 @@ proc test_template_breakpoints {} { global hp_aCC_compiler gdb_test_multiple "break T5<int>::T5" "constructor breakpoint" { - -re "0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*.2. T5<int>::T5\\(int\\) at .*\[\r\n\]*.3. T5<int>::T5\\((T5<int> const|const T5<int>) ?&\\) at .*\[\r\n\]*> $" { - gdb_test "0" \ - "canceled" \ - "constructor breakpoint (obsolete format!)" - } - -re ".0. cancel\[\r\n\]*.1. all\[\r\n\]*.2. T5<int>::T5\\((T5<int> const|const T5<int>) ?&\\) at .*templates.cc:.*\[\r\n\]*.3. T5<int>::T5\\(int\\) at .*templates.cc:.*\[\r\n\]*> $" { + -re "0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*.2.*templates.cc:T5<int>::T5\\((T5<int> const|const T5<int>) ?&\\)\[\r\n\]*.3.*templates.cc:T5<int>::T5\\(int\\)\[\r\n\]*> $" { gdb_test "0" \ "canceled" \ "constructor breakpoint" @@ -152,9 +147,26 @@ proc test_template_breakpoints {} { set bp_location [gdb_get_line_number \ "set breakpoint on a line with no real code"] - gdb_test "break ${testfile}.cc:${bp_location}" \ - "Breakpoint.*at.* file .*${testfile}.cc, line.*(2 locations).*" \ - "breakpoint on a line with no real code" + + gdb_test_multiple "break ${testfile}.cc:${bp_location}" \ + "breakpoint on a line with no real code" { + -re "0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*.2.*templates.cc:GetMax<int>\\(int, int\\)\[\r\n\]*.3.*templates.cc:GetMax<long>\\(long, long\\)\[\r\n\]*> $" { + gdb_test "0" \ + "canceled" \ + "breakpoint on a line with no real code" + } + -re "0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*.2.*\[\r\n\]*.3.*\[\r\n\]*> $" { + gdb_test "0" \ + "nonsense intended to insure that this test fails" \ + "breakpoint on a line with no real code" + } + -re ".*\n> $" { + gdb_test "0" \ + "nonsense intended to insure that this test fails" \ + "breakpoint on a line with no real code" + } + } + delete_breakpoints } diff --git a/gdb/testsuite/gdb.linespec/Makefile.in b/gdb/testsuite/gdb.linespec/Makefile.in new file mode 100644 index 00000000000..2658a241ce9 --- /dev/null +++ b/gdb/testsuite/gdb.linespec/Makefile.in @@ -0,0 +1,14 @@ +VPATH = @srcdir@ +srcdir = @srcdir@ + +EXECUTABLES = lspec + +all info install-info dvi install uninstall installcheck check: + @echo "Nothing to be done for $@..." + +clean mostlyclean: + -rm -f *~ *.o *.ci + -rm -f core $(EXECUTABLES) + +distclean maintainer-clean realclean: clean + -rm -f Makefile config.status config.log gdb.log gdb.sum diff --git a/gdb/testsuite/gdb.linespec/base/one/thefile.cc b/gdb/testsuite/gdb.linespec/base/one/thefile.cc new file mode 100644 index 00000000000..f8712c2af0d --- /dev/null +++ b/gdb/testsuite/gdb.linespec/base/one/thefile.cc @@ -0,0 +1,20 @@ +/* The commented line must have the same line number in the other + "thefile.c". */ + +#define WANT_F1 +#include "../../lspec.h" + + + + + + +int m(int x) +{ + return x + 23; /* thefile breakpoint */ +} + +int NameSpace::overload(int x) +{ + return x + 23; +} diff --git a/gdb/testsuite/gdb.linespec/base/two/thefile.cc b/gdb/testsuite/gdb.linespec/base/two/thefile.cc new file mode 100644 index 00000000000..ffca87a4e87 --- /dev/null +++ b/gdb/testsuite/gdb.linespec/base/two/thefile.cc @@ -0,0 +1,20 @@ +/* The commented line must have the same line number in the other + "thefile.c". */ + +#define WANT_F2 +#include "../../lspec.h" + +static int dupname(int y) +{ + label: return y; +} + +int n(int y) +{ + return dupname(y) - 23; /* thefile breakpoint */ +} + +int NameSpace::overload(double x) +{ + return (int) x - 23; +} diff --git a/gdb/testsuite/gdb.linespec/body.h b/gdb/testsuite/gdb.linespec/body.h new file mode 100644 index 00000000000..e8765f69dff --- /dev/null +++ b/gdb/testsuite/gdb.linespec/body.h @@ -0,0 +1,5 @@ +/* This is included directly into the body of a function. */ + +/* body breakpoint no code */ + +return x; diff --git a/gdb/testsuite/gdb.linespec/linespec.exp b/gdb/testsuite/gdb.linespec/linespec.exp new file mode 100644 index 00000000000..440233a5d1a --- /dev/null +++ b/gdb/testsuite/gdb.linespec/linespec.exp @@ -0,0 +1,117 @@ +# Copyright 2011 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# Tests of ambiguous linespecs. + +set testfile linespec + +set exefile lspec +set binfile ${objdir}/${subdir}/${exefile} + +set baseone base/one/thefile.cc +set basetwo base/two/thefile.cc + +if {[skip_cplus_tests]} { + unsupported linespec.exp + return +} + +if {[prepare_for_testing ${testfile}.exp $exefile \ + [list lspec.cc $baseone $basetwo] \ + {debug nowarnings}]} { + return -1 +} + +gdb_test_no_output "set multiple-symbols all" \ + "set multiple-symbols to all for linespec tests" + +set l1 [gdb_get_line_number "thefile breakpoint" $baseone] +set l2 [gdb_get_line_number "thefile breakpoint" $basetwo] + +if {$l1 != $l2} { + error "somebody incompatibly modified the source files needed by linespec.exp" +} + +gdb_test "break thefile.cc:$l1" \ + "Breakpoint 1 at $hex: thefile.cc:$l1. \[(\]2 locations\[)\]" \ + "multi-location break using file:line" + +# We'd like this to work, but it currently does not. +# gdb_test "break one/thefile.cc:$l1" + +gdb_test "break dupname" \ + "Breakpoint 2 at $hex: dupname. \[(\]2 locations\[)\]" \ + "multi-location break using duplicate function name" + +gdb_test "break dupname:label" \ + "Breakpoint 3 at $hex: dupname:label. \[(\]2 locations\[)\]" \ + "multi-location break using duplicate function name and label" + +gdb_test_no_output "set breakpoint pending off" \ + "disable pending breakpoints for linespec tests" + +# This is PR breakpoints/12856. +gdb_test "break lspec.cc:nosuchfunction" \ + "Function \"nosuchfunction\" not defined in \"lspec.cc\"." \ + "set breakpoint on non-existent function" + +gdb_test "break NameSpace::overload" \ + "Breakpoint \[0-9\]+ at $hex: NameSpace::overload. \[(\]3 locations\[)\]" \ + "set breakpoint at all instances of NameSpace::overload" + +gdb_test "break lspec.cc:NameSpace::overload" \ + "Breakpoint \[0-9\]+ at $hex: file .*lspec.cc, line 7." \ + "set breakpoint at lspec.cc instance of NameSpace::overload" + +gdb_test "break lspec.cc:NameSpace::overload(double)" \ + "Function \"NameSpace::overload\\(double\\)\" not defined in \"lspec.cc\"." \ + "set breakpoint at non-existent lspec.cc instance of NameSpace::overload" + +gdb_test "break NameSpace::overload()" \ + "Breakpoint \[0-9\]+ at $hex: file .*lspec.cc, line 7." \ + "set breakpoint at specific instance of NameSpace::overload" + +# This should manage to set a breakpoint even though body.h does not +# include all of the function in question. +set line [gdb_get_line_number "body breakpoint no code" body.h] +gdb_test "break body.h:$line" \ + "Breakpoint \[0-9\]+.*" \ + "set breakpoint in body.h" + +# This should only have a single location -- in f1. +set line [gdb_get_line_number "f1 breakpoint" lspec.h] +gdb_test "break lspec.h:$line" \ + "Breakpoint \[0-9\]+ at $hex: file .*lspec.h, line $line." \ + "set breakpoint in f1" + +# +# Multi-inferior tests. +# + +gdb_test "add-inferior" "Added inferior 2" \ + "add inferior for linespec tests" + +gdb_test "inferior 2" "Switching to inferior 2 .*" \ + "switch to inferior 2 for linespec tests" + +# Note that in particular this should not cause errors when re-setting +# breakpoints. +gdb_test "file $binfile" \ + "Reading symbols from .*done." \ + "set the new inferior file for linespec tests" + +gdb_test "break main" \ + "Breakpoint \[0-9\]+ at $hex: main. .2 locations." \ + "set breakpoint at main in both inferiors" diff --git a/gdb/testsuite/gdb.linespec/lspec.cc b/gdb/testsuite/gdb.linespec/lspec.cc new file mode 100644 index 00000000000..b1092e22d75 --- /dev/null +++ b/gdb/testsuite/gdb.linespec/lspec.cc @@ -0,0 +1,19 @@ +#include "lspec.h" + +static int dupname (int x) { label: return x; } + +int NameSpace::overload() +{ + return 23; +} + +int body_elsewhere() +{ + int x = 5; +#include "body.h" +} + +int main() +{ + return dupname(0) + m(0) + n(0) + f1() + f2() + body_elsewhere(); +} diff --git a/gdb/testsuite/gdb.linespec/lspec.h b/gdb/testsuite/gdb.linespec/lspec.h new file mode 100644 index 00000000000..0a647fafce6 --- /dev/null +++ b/gdb/testsuite/gdb.linespec/lspec.h @@ -0,0 +1,26 @@ +extern int m(int x); +extern int n(int y); + +namespace NameSpace { + int overload (); + int overload (int); + int overload (double); +}; + +#ifdef WANT_F1 +int f1(void) +{ + return 1; /* f1 breakpoint */ +} +#else +extern int f1(void); +#endif + +#ifdef WANT_F2 +int f2(void) +{ + return 1; /* f2 breakpoint */ +} +#else +extern int f2(void); +#endif diff --git a/gdb/testsuite/gdb.objc/objcdecode.exp b/gdb/testsuite/gdb.objc/objcdecode.exp index 720bfd85616..e3916f6996c 100644 --- a/gdb/testsuite/gdb.objc/objcdecode.exp +++ b/gdb/testsuite/gdb.objc/objcdecode.exp @@ -52,17 +52,19 @@ proc do_objc_tests {} { do_objc_tests +gdb_test_no_output "set multiple-symbols ask" + # # Break on multiply defined method (PR objc/1236) # set name "break on multiply defined method" gdb_test_multiple "break multipleDef" $name \ { - -re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] -.Decode multipleDef. at .*\r\n\\\[3\\\] multipleDef at .*\r\n> $" { + -re "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] .*${srcfile}:-.Decode multipleDef.\r\n\\\[3\\\] .*${srcfile}:multipleDef\r\n> $" { send_gdb "3\n" exp_continue } - -re "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: file .*\r\n$gdb_prompt $" { pass $name } + -re "Breakpoint \[0-9\]+ at 0x\[0-9a-f\]+: .*\r\n$gdb_prompt $" { pass $name } -re ".*$gdb_prompt $" { kfail "gdb/1236" $name } } diff --git a/gdb/testsuite/gdb.trace/tracecmd.exp b/gdb/testsuite/gdb.trace/tracecmd.exp index 679cc32cc36..89a2e24bba7 100644 --- a/gdb/testsuite/gdb.trace/tracecmd.exp +++ b/gdb/testsuite/gdb.trace/tracecmd.exp @@ -74,6 +74,7 @@ gdb_test "info trace" "in gdb_recursion_test.*$srcfile:$testline2" \ # 1.2 trace invalid source line gdb_delete_tracepoints +gdb_test_no_output "set breakpoint pending off" gdb_test "trace $srcfile:99999" "No line 99999 in file \".*$srcfile\"." \ "1.2a: trace invalid line in sourcefile" gdb_test "info trace" "No tracepoints.*" \ @@ -81,7 +82,6 @@ gdb_test "info trace" "No tracepoints.*" \ # 1.3 trace line in invalid source file gdb_delete_tracepoints -gdb_test_no_output "set breakpoint pending off" gdb_test "trace NoSuChFiLe.c:1" "No source file named NoSuChFiLe.c." \ "1.3a: trace invalid source file" gdb_test "info trace" "No tracepoints.*" \ |