aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.linespec
AgeCommit message (Collapse)AuthorFilesLines
2016-03-15PR 18303, Tolerate malformed input for lookup_symbol-called functionsDon Breazeal2-176/+223
lookup_symbol is often called with user input. Consequently, any function called from lookup_symbol{,_in_language} should attempt to deal with malformed input gracefully. After all, malformed user input is not a programming/API error. This patch does not attempt to find/correct all instances of this. It only fixes locations in the code that trigger test suite failures. This patch fixes PR breakpoints/18303, "Assertion: -breakpoint-insert with windows paths of file in non-current directory". The patch includes three new tests related to this. One is just gdb.linespec/ls-errs.exp copied and converted to use C++ instead of C, and to add a case using a file name containing a Windows-style logical drive specifier. The others include an MI test to provide a regression test for the specific case reported in PR 18303, and a C++ test for proper error handling of access to a program variable when using a file scope specifier that refers to a non-existent file. Tested on x86_64 native Linux. gdb/ChangeLog 2016-01-28 Keith Seitz <keiths@redhat.com> PR breakpoints/18303 * cp-namespace.c (cp_lookup_bare_symbol): Change assertion to look for "::" instead of simply ":". (cp_search_static_and_baseclasses): Return null_block_symbol for malformed input. Remove assertions. * cp-support.c (cp_find_first_component_aux): Do not return a prefix length for ':' unless the next character is also ':'. gdb/testsuite/ChangeLog 2016-01-28 Don Breazeal <donb@codesourcery.com> * gdb.cp/scope-err.cc: New test program. * gdb.cp/scope-err.exp: New test script. * gdb.linespec/ls-errs.c (myfunction): Expanded to have multiple lines and "set breakpoint here" comment. * gdb.linespec/ls-errs.exp: Added C++ testing and new test case. Fixed some whitespace and format issues. * gdb.mi/mi-linespec-err-cp.cc: New test program. * gdb.mi/mi-linespec-err-cp.exp: New test script.
2016-02-08Always organize test artifacts in a directory hierarchySimon Marchi1-15/+0
When running tests in parallel, each test puts its generated files in a different directory, under "outputs". I think it would be nice if it was always the case, as it would isolate the test cases a bit more. An artifact created by a test wouldn't get overwritten by another test. Also, it makes it easier to clean up. A lot of executables are left all over the place because their names do not appear in gdb.*/Makefile. If everything is in "outputs", then we just have to delete that directory (which we already do). At the same time it makes the gdb.foo directories and their Makefiles useless in the build directory, since they are pretty much only used for cleaning. What do you think? gdb/testsuite/ChangeLog: * Makefile.in (ALL_SUBDIRS): Remove. (clean mostlyclean): Do not recurse in ALL_SUBDIRS. (distclean maintainer-clean realclean): Likewise. * configure.ac (AC_OUTPUT): Remove gdb.*/Makefile. * configure: Regenerate. * gdb.ada/Makefile.in: Delete. * gdb.arch/Makefile.in: Likewise. * gdb.asm/Makefile.in: Likewise. * gdb.base/Makefile.in: Likewise. * gdb.btrace/Makefile.in: Likewise. * gdb.cell/Makefile.in: Likewise. * gdb.compile/Makefile.in: Likewise. * gdb.cp/Makefile.in: Likewise. * gdb.disasm/Makefile.in: Likewise. * gdb.dlang/Makefile.in: Likewise. * gdb.dwarf2/Makefile.in: Likewise. * gdb.fortran/Makefile.in: Likewise. * gdb.gdb/Makefile.in: Likewise. * gdb.go/Makefile.in: Likewise. * gdb.guile/Makefile.in: Likewise. * gdb.java/Makefile.in: Likewise. * gdb.linespec/Makefile.in: Likewise. * gdb.mi/Makefile.in: Likewise. * gdb.modula2/Makefile.in: Likewise. * gdb.multi/Makefile.in: Likewise. * gdb.objc/Makefile.in: Likewise. * gdb.opencl/Makefile.in: Likewise. * gdb.opt/Makefile.in: Likewise. * gdb.pascal/Makefile.in: Likewise. * gdb.perf/Makefile.in: Likewise. * gdb.python/Makefile.in: Likewise. * gdb.reverse/Makefile.in: Likewise. * gdb.server/Makefile.in: Likewise. * gdb.stabs/Makefile.in: Likewise. * gdb.threads/Makefile.in: Likewise. * gdb.trace/Makefile.in: Likewise. * gdb.xml/Makefile.in: Likewise. * lib/gdb.exp (make_gdb_parallel_path): Add check for GDB_PARALLEL. (standard_output_file): Remove check for GDB_PARALLEL, always return path in outputs/$subdir/$testname.
2016-01-13Per-inferior/Inferior-qualified thread IDsPedro Alves1-4/+4
This commit changes GDB to track thread numbers per-inferior. Then, if you're debugging multiple inferiors, GDB displays "inferior-num.thread-num" instead of just "thread-num" whenever it needs to display a thread: (gdb) info inferiors Num Description Executable 1 process 6022 /home/pedro/gdb/tests/threads * 2 process 6037 /home/pedro/gdb/tests/threads (gdb) info threads Id Target Id Frame 1.1 Thread 0x7ffff7fc2740 (LWP 6022) "threads" (running) 1.2 Thread 0x7ffff77c0700 (LWP 6028) "threads" (running) 1.3 Thread 0x7ffff7fc2740 (LWP 6032) "threads" (running) 2.1 Thread 0x7ffff7fc1700 (LWP 6037) "threads" (running) 2.2 Thread 0x7ffff77c0700 (LWP 6038) "threads" (running) * 2.3 Thread 0x7ffff7fc2740 (LWP 6039) "threads" (running) (gdb) ... (gdb) thread 1.1 [Switching to thread 1.1 (Thread 0x7ffff7fc2740 (LWP 8155))] (gdb) ... etc. You can still use "thread NUM", in which case GDB infers you're referring to thread NUM of the current inferior. The $_thread convenience var and Python's InferiorThread.num attribute are remapped to the new per-inferior thread number. It's a backward compatibility break, but since it only matters when debugging multiple inferiors, I think it's worth doing. Because MI thread IDs need to be a single integer, we keep giving threads a global identifier, _in addition_ to the per-inferior number, and make MI always refer to the global thread IDs. IOW, nothing changes from a MI frontend's perspective. Similarly, since Python's Breakpoint.thread and Guile's breakpoint-thread/set-breakpoint-thread breakpoint methods need to work with integers, those are adjusted to work with global thread IDs too. Follow up patches will provide convenient means to access threads' global IDs. To avoid potencially confusing users (which also avoids updating much of the testsuite), if there's only one inferior and its ID is "1", IOW, the user hasn't done anything multi-process/inferior related, then the "INF." part of thread IDs is not shown. E.g,.: (gdb) info inferiors Num Description Executable * 1 process 15275 /home/pedro/gdb/tests/threads (gdb) info threads Id Target Id Frame * 1 Thread 0x7ffff7fc1740 (LWP 15275) "threads" main () at threads.c:40 (gdb) add-inferior Added inferior 2 (gdb) info threads Id Target Id Frame * 1.1 Thread 0x7ffff7fc1740 (LWP 15275) "threads" main () at threads.c:40 (gdb) No regressions on x86_64 Fedora 20. gdb/ChangeLog: 2016-01-13 Pedro Alves <palves@redhat.com> * NEWS: Mention that thread IDs are now per inferior and global thread IDs. * Makefile.in (SFILES): Add tid-parse.c. (COMMON_OBS): Add tid-parse.o. (HFILES_NO_SRCDIR): Add tid-parse.h. * ada-tasks.c: Adjust to use ptid_to_global_thread_id. * breakpoint.c (insert_breakpoint_locations) (remove_threaded_breakpoints, bpstat_check_breakpoint_conditions) (print_one_breakpoint_location, set_longjmp_breakpoint) (check_longjmp_breakpoint_for_call_dummy) (set_momentary_breakpoint): Adjust to use global IDs. (find_condition_and_thread, watch_command_1): Use parse_thread_id. (until_break_command, longjmp_bkpt_dtor) (breakpoint_re_set_thread, insert_single_step_breakpoint): Adjust to use global IDs. * dummy-frame.c (pop_dummy_frame_bpt): Adjust to use ptid_to_global_thread_id. * elfread.c (elf_gnu_ifunc_resolver_stop): Likewise. * gdbthread.h (struct thread_info): Rename field 'num' to 'global_num. Add new fields 'per_inf_num' and 'inf'. (thread_id_to_pid): Rename thread_id_to_pid to global_thread_id_to_ptid. (pid_to_thread_id): Rename to ... (ptid_to_global_thread_id): ... this. (valid_thread_id): Rename to ... (valid_global_thread_id): ... this. (find_thread_id): Rename to ... (find_thread_global_id): ... this. (ALL_THREADS, ALL_THREADS_BY_INFERIOR): Declare. (print_thread_info): Add comment. * tid-parse.h: New file. * tid-parse.c: New file. * infcmd.c (step_command_fsm_prepare) (step_command_fsm_should_stop): Adjust to use the global thread ID. (until_next_command, until_next_command) (finish_command_fsm_should_stop): Adjust to use the global thread ID. (attach_post_wait): Adjust to check the inferior number too. * inferior.h (struct inferior) <highest_thread_num>: New field. * infrun.c (handle_signal_stop) (insert_exception_resume_breakpoint) (insert_exception_resume_from_probe): Adjust to use the global thread ID. * record-btrace.c (record_btrace_open): Use global thread IDs. * remote.c (process_initial_stop_replies): Also consider the inferior number. * target.c (target_pre_inferior): Clear the inferior's highest thread num. * thread.c (clear_thread_inferior_resources): Adjust to use the global thread ID. (new_thread): New inferior parameter. Adjust to use it. Set both the thread's global ID and the thread's per-inferior ID. (add_thread_silent): Adjust. (find_thread_global_id): New. (find_thread_id): Make static. Adjust to rename. (valid_thread_id): Rename to ... (valid_global_thread_id): ... this. (pid_to_thread_id): Rename to ... (ptid_to_global_thread_id): ... this. (thread_id_to_pid): Rename to ... (global_thread_id_to_ptid): ... this. Adjust. (first_thread_of_process): Adjust. (do_captured_list_thread_ids): Adjust to use global thread IDs. (should_print_thread): New function. (print_thread_info): Rename to ... (print_thread_info_1): ... this, and add new show_global_ids parameter. Handle it. Iterate over inferiors. (print_thread_info): Reimplement as wrapper around print_thread_info_1. (show_inferior_qualified_tids): New function. (print_thread_id): Use it. (tp_array_compar): Compare inferior numbers too. (thread_apply_command): Use tid_range_parser. (do_captured_thread_select): Use parse_thread_id. (thread_id_make_value): Adjust. (_initialize_thread): Adjust "info threads" help string. * varobj.c (struct varobj_root): Update comment. (varobj_create): Adjust to use global thread IDs. (value_of_root_1): Adjust to use global_thread_id_to_ptid. * windows-tdep.c (display_tib): No longer accept an argument. * cli/cli-utils.c (get_number_trailer): Make extern. * cli/cli-utils.h (get_number_trailer): Declare. (get_number_const): Adjust documentation. * mi/mi-cmd-var.c (mi_cmd_var_update_iter): Adjust to use global thread IDs. * mi/mi-interp.c (mi_new_thread, mi_thread_exit) (mi_on_normal_stop, mi_output_running_pid, mi_on_resume): * mi/mi-main.c (mi_execute_command, mi_cmd_execute): Likewise. * guile/scm-breakpoint.c (gdbscm_set_breakpoint_thread_x): Likewise. * python/py-breakpoint.c (bppy_set_thread): Likewise. * python/py-finishbreakpoint.c (bpfinishpy_init): Likewise. * python/py-infthread.c (thpy_get_num): Add comment and return the per-inferior thread ID. (thread_object_getset): Update comment of "num". gdb/testsuite/ChangeLog: 2016-01-07 Pedro Alves <palves@redhat.com> * gdb.base/break.exp: Adjust to output changes. * gdb.base/hbreak2.exp: Likewise. * gdb.base/sepdebug.exp: Likewise. * gdb.base/watch_thread_num.exp: Likewise. * gdb.linespec/keywords.exp: Likewise. * gdb.multi/info-threads.exp: Likewise. * gdb.threads/thread-find.exp: Likewise. * gdb.multi/tids.c: New file. * gdb.multi/tids.exp: New file. gdb/doc/ChangeLog: 2016-01-07 Pedro Alves <palves@redhat.com> * gdb.texinfo (Threads): Document per-inferior thread IDs, qualified thread IDs, global thread IDs and thread ID lists. (Set Watchpoints, Thread-Specific Breakpoints): Adjust to refer to thread IDs. (Convenience Vars): Document the $_thread convenience variable. (Ada Tasks): Adjust to refer to thread IDs. (GDB/MI Async Records, GDB/MI Thread Commands, GDB/MI Ada Tasking Commands, GDB/MI Variable Objects): Update to mention global thread IDs. * guile.texi (Breakpoints In Guile) <breakpoint-thread/set-breakpoint-thread breakpoint>: Mention global thread IDs instead of thread IDs. * python.texi (Threads In Python): Adjust documentation of InferiorThread.num. (Breakpoint.thread): Mention global thread IDs instead of thread IDs.
2016-01-01GDB copyright headers update after running GDB's copyright.py script.Joel Brobecker25-25/+25
gdb/ChangeLog: Update year range in copyright notice of all files.
2015-09-18Require readline for gdb.linespec/explicit.exp tab-completion tests.Sandra Loosemore1-135/+142
2015-09-18 Sandra Loosemore <sandra@codesourcery.com> gdb/testsuite/ * gdb.linespec/explicit.exp: Check for readline support for tab-completion tests. Fix obvious typo.
2015-08-17Move strace -m/explicit location test to strace.expKeith Seitz1-4/+0
One of the build slaves shows this error running explicit.exp: (gdb) strace -m gdbfoobarbaz Remote failure reply: E.In-process agent library not loaded in process. Fast and static tracepoints unavailable. (gdb) FAIL: gdb.linespec/explicit.exp: strace -m gdbfoobarbaz There are two big problems with this test: 1) The expected output is actually not what the test is meant to test for. 2) This test should really only run where it is supported. This is most easily fixed by moving the test to gdb.trace/strace.exp. gdb/testsuite/ChangeLog * gdb.linespec/explicit.exp: Move strace test from here ... * gdb.trace/strace.exp: ... to here.
2015-08-11Explicit locations: add UI features for CLIKeith Seitz7-8/+738
This patch exposes explicit locations to the CLI user. This enables users to "explicitly" specify attributes of the breakpoint location to avoid any ambiguity that might otherwise exist with linespecs. The general syntax of explicit locations is: -source SOURCE_FILENAME -line {+-}LINE -function FUNCTION_NAME -label LABEL_NAME Option names may be abbreviated, e.g., "-s SOURCE_FILENAME -li 3" and users may use the completer with either options or values. gdb/ChangeLog: * completer.c: Include location.h. (enum match_type): New enum. (location_completer): Rename to ... (linespec_completer): ... this. (collect_explicit_location_matches, backup_text_ptr) (explicit_location_completer): New functions. (location_completer): "New" function; handle linespec and explicit location completions. (complete_line_internal): Remove all location completer-specific handling. * linespec.c (linespec_lexer_lex_keyword, is_ada_operator) (find_toplevel_char): Export. (linespec_parse_line_offset): Export. Issue error if STRING is not numerical. (gdb_get_linespec_parser_quote_characters): New function. * linespec.h (linespec_parse_line_offset): Declare. (get_gdb_linespec_parser_quote_characters): Declare. (is_ada_operator): Declare. (find_toplevel_char): Declare. (linespec_lexer_lex_keyword): Declare. * location.c (explicit_to_event_location): New function. (explicit_location_lex_one): New function. (string_to_explicit_location): New function. (string_to_event_location): Handle explicit locations. * location.h (explicit_to_event_location): Declare. (string_to_explicit_location): Declare. gdb/testsuite/ChangeLog: * gdb.linespec/3explicit.c: New file. * gdb.linespec/cpexplicit.cc: New file. * gdb.linespec/cpexplicit.exp: New file. * gdb.linespec/explicit.c: New file. * gdb.linespec/explicit.exp: New file. * gdb.linespec/explicit2.c: New file. * gdb.linespec/ls-errs.exp: Add explicit location tests. * lib/gdb.exp (capture_command_output): Regexp-escape `command' before using in the matching pattern. Clarify that `prefix' is a regular expression.
2015-03-26Handle the effect of skipping prologueYao Qi2-0/+28
break-asm-file.exp has some manually written dwarf to create some line number entries like this, [0x0000013d] Extended opcode 2: set Address to 0x40053f [0x00000144] Advance Line by 4 to 7 [0x00000146] Copy [0x00000147] Extended opcode 2: set Address to 0x400541 [0x0000014e] Advance Line by 1 to 8 [0x00000150] Copy [0x00000151] Extended opcode 2: set Address to 0x400547 [0x00000158] Extended opcode 1: End of Sequence 0x40053f is the start address of function func, and is mapped to line 7. 0x400541 is within function func, and is mapped to line 8. (gdb) disassemble /r 0x40053f,+8 Dump of assembler code from 0x40053f to 0x400547: 0x000000000040053f <func+0>: 00 00 add %al,(%rax) 0x0000000000400541 <func+2>: 00 00 add %al,(%rax) 0x0000000000400543 <func+4>: 00 00 add %al,(%rax) 0x0000000000400545 <func+6>: 00 00 add %al,(%rax) in the following test, (gdb) break a/break-asm-file0.s:func Breakpoint 1 at 0x40053f: file a/break-asm-file0.s, line 7. As we can see, breakpoint is set at the start address of function func on x86, which means no prologue is skipped. On other targets, such as arm and aarch64, breakpoint is set at the address *after* the start address, which is mapped to line 8. Then test fails. In fact, it is lucky this test doesn't fail on x86 and x86_64, whose gdbarch method skip_prologue doesn't reply on skip_prologue_using_sal if producer isn't clang. if (find_pc_partial_function (start_pc, NULL, &func_addr, NULL)) { CORE_ADDR post_prologue_pc = skip_prologue_using_sal (gdbarch, func_addr); struct compunit_symtab *cust = find_pc_compunit_symtab (func_addr); /* Clang always emits a line note before the prologue and another one after. We trust clang to emit usable line notes. */ if (post_prologue_pc && (cust != NULL && COMPUNIT_PRODUCER (cust) != NULL && startswith (COMPUNIT_PRODUCER (cust), "clang "))) return max (start_pc, post_prologue_pc); } so it doesn't return and go further to prologue analyser. Since ".int 0" isn't an instruction of prologue, nothing is skipped, starting address is used, and test passes. however, on targets which don't have such producer checking, the first line number entry is skipped, and skip_prologue_using_sal returns sal represents the second line number entry. The idea of this patch is to force GDB stop at somewhere which is stilled mapped to line 7 after skipping prologue. I choose to add a new line number entry for the following instruction but mapped to the same line (7), because I see the comments in dwarf2read.c, ... fact that two consecutive line number entries for the same line is a heuristic used by gcc to denote the end of the prologue. then the line table becomes: [0x000000d4] Extended opcode 2: set Address to 0x400529 [0x000000db] Advance Line by 4 to 7 [0x000000dd] Copy [0x000000de] Extended opcode 2: set Address to 0x40052a [0x000000e5] Advance Line by 0 to 7 [0x000000e7] Copy [0x000000e8] Extended opcode 2: set Address to 0x40052b [0x000000ef] Advance Line by 1 to 8 [0x000000f1] Copy [0x000000f2] Extended opcode 2: set Address to 0x40052c [0x000000f9] Extended opcode 1: End of Sequence gdb/testsuite: 2015-03-26 Yao Qi <yao.qi@linaro.org> PR testsuite/18139 * gdb.linespec/break-asm-file0.s (func): New label .Lfunc_2. Add a line number entry for the same line. * gdb.linespec/break-asm-file1.s (func): New label .Lfunc_2. Add a line number entry for the same line.
2015-03-26Remove some hard-coded stuff in testsYao Qi2-10/+12
There are some hard-coded stuff in .s files, such as .int 0 and address offset, which isn't portable. This patch is to replace ".int 0" with nop and address offset with labels. gdb/testsuite: 2015-03-26 Yao Qi <yao.qi@linaro.org> * gdb.linespec/break-asm-file0.s (func2): Use nop instead of .int 0. (func): Likewise. Add .Lfunc_1 label. Use .Lfunc_1 label. * gdb.linespec/break-asm-file1.s (func3): Use nop instead of .int 0. (func): Likewise. Use .Lfunc_1 label.
2015-03-26Compile break-asm-file{0,1}.s without debug infoYao Qi1-5/+18
If I add some nop into break-asm-file1.s like this, --- INDEX:/gdb/testsuite/gdb.linespec/break-asm-file1.s +++ WORKDIR:/gdb/testsuite/gdb.linespec/break-asm-file1.s @@ -31,8 +31,8 @@ _func: .type func, %function func: .Lbegin_func: - .int 0 - .int 0 + nop + nop .Lend_func: .size func, .-func .Lend_text1: I get the following error: Running gdb/testsuite/gdb.linespec/break-asm-file.exp ... gdb/testsuite/gdb.linespec/break-asm-file1.s: Assembler messages:^M gdb/testsuite/gdb.linespec/break-asm-file1.s: Fatal error: duplicate .debug_line sections break-asm-file0.s and break-asm-file1.s have already had debug information (written manually), so don't need to generate debug infor for them. gdb/testsuite: 2015-03-26 Yao Qi <yao.qi@linaro.org> * gdb.linespec/break-asm-file.exp: Don't call prepare_for_testing. Call gdb_compile instead to compile each .s files without debug information.
2015-03-23Expand keyword lexing intelligence in the linespec parser.Keith Seitz2-0/+113
This patch changes the heuristic the linespec lexer uses to detect a keyword in the input stream. Currently, the heuristic is: a word is a keyword if it 1) points to a string that is a keyword 2) is followed by a non-identifier character This is strictly more correct than using whitespace. For example, it allows constructs such as "break foo if(i == 1)". However, find_condition_and_thread in breakpoint.c does not support this expanded usage. It requires whitespace to follow the keyword. The proposed new heuristic is: a word is a keyword if it 1) points to a string that is a keyword 2) is followed by whitespace 3) is not followed by another keyword string followed by whitespace This additional complexity allows constructs such as "break thread thread 3" and "break thread 3". In the former case, the actual location is a symbol named "thread" to be set on thread #3. In the later case, the location is NULL, i.e., the default location, to be set on thread #3. In order to pass all the new tests added here, I've also had to add a new feature to parse_breakpoint_sals, which expands recognition of the default location to keywords other than "if", which is the only keyword currently permitted with the default (NULL) location, but there is no reason to exclude other keywords. Consequently, it will be possible to use "break thread 1" or "break task 1". In addition to all of this, it is now possible to remove the keyword_ok state from the linespec parser. gdb/ChangeLog * breakpoint.c (parse_breakpoint_sals): Use linespec_lexer_lex_keyword to ascertain if the user specified a NULL location. * linespec.c [IF_KEYWORD_INDEX]: Define. (linespec_lexer_lex_keyword): Export. (struct ls_parser) <keyword_ok>: Remove. A keyword is only a keyword if not followed by another keyword. (linespec_lexer_lex_one): Remove keyword_ok handling. Add comment explaining why the parsing stream is not advanced when a keyword is seen. (parse_linespec): Remove parser->keyword_ok. * linespec.h (linespec_lexer_lex_keyword): Add declaration. gdb/testsuite/ChangeLog * gdb.linespec/keywords.c: New file. * gdb.linespec/keywords.exp: New file.
2015-01-31Add max-completions parameter, and implement tab-completion limiting.Gary Benson1-0/+3
This commit adds a new exception, MAX_COMPLETIONS_REACHED_ERROR, to be thrown whenever the completer has generated too many candidates to be useful. A new user-settable variable, "max_completions", is added to control this behaviour. A top-level completion limit is added to complete_line_internal, as the final check to ensure the user never sees too many completions. An additional limit is added to default_make_symbol_completion_list_break_on, to halt time-consuming symbol table expansions. gdb/ChangeLog: PR cli/9007 PR cli/11920 PR cli/15548 * cli/cli-cmds.c (complete_command): Notify user if max-completions reached. * common/common-exceptions.h (enum errors) <MAX_COMPLETIONS_REACHED_ERROR>: New value. * completer.h (get_max_completions_reached_message): New declaration. (max_completions): Likewise. (completion_tracker_t): New typedef. (new_completion_tracker): New declaration. (make_cleanup_free_completion_tracker): Likewise. (maybe_add_completion_enum): New enum. (maybe_add_completion): New declaration. (throw_max_completions_reached_error): Likewise. * completer.c (max_completions): New global variable. (new_completion_tracker): New function. (free_completion_tracker): Likewise. (make_cleanup_free_completion_tracker): Likewise. (maybe_add_completions): Likewise. (throw_max_completions_reached_error): Likewise. (complete_line): Remove duplicates and limit result to max_completions entries. (get_max_completions_reached_message): New function. (gdb_display_match_list): Handle max_completions. (_initialize_completer): New declaration and function. * symtab.c: Include completer.h. (completion_tracker): New static variable. (completion_list_add_name): Call maybe_add_completion. (default_make_symbol_completion_list_break_on_1): Renamed from default_make_symbol_completion_list_break_on. Maintain completion_tracker across calls to completion_list_add_name. (default_make_symbol_completion_list_break_on): New function. * top.c (init_main): Set rl_completion_display_matches_hook. * tui/tui-io.c: Include completer.h. (tui_old_rl_display_matches_hook): New static global. (tui_rl_display_match_list): Notify user if max-completions reached. (tui_setup_io): Save/restore rl_completion_display_matches_hook. * NEWS (New Options): Mention set/show max-completions. gdb/doc/ChangeLog: * gdb.texinfo (Command Completion): Document new "set/show max-completions" option. gdb/testsuite/ChangeLog: * gdb.base/completion.exp: Disable completion limiting for existing tests. Add new tests to check completion limiting. * gdb.linespec/ls-errs.exp: Disable completion limiting.
2015-01-01Update year range in copyright notice of all files owned by the GDB project.Joel Brobecker17-17/+17
gdb/ChangeLog: Update year range in copyright notice of all files.
2014-12-20gdb/17394: cannot put breakpoint only in selected ASM file.Mihail-Marian Nistor4-0/+552
This patch fixes a problem when trying to insert a breakpoint on a specific symbol defined in a specific file, eg: break foo.c:func This currently works for files in C/C++/Ada, etc, but doesn't always work for Asm files. Analysis of the problem showed that this related to a limitation in gas, which does not generate debug info for functions/ symbols. Thus, we have a symtab for the file ("info sources" shows the file), but it contains no symbols. When find_linespec_symbols is called in linespec_parse_basic, it calls find_function_symbols, which uses add_matching_symbols_to_info to collect all matching symbols. That function does [pardon any mangled formatting]: for (ix = 0; VEC_iterate (symtab_ptr, info->file_symtabs, ix, elt); ++ix) { if (elt == NULL) { iterate_over_all_matching_symtabs (info->state, name, VAR_DOMAIN, collect_symbols, info, pspace, 1); search_minsyms_for_name (info, name, pspace); } else if (pspace == NULL || pspace == SYMTAB_PSPACE (elt)) { /* Program spaces that are executing startup should have been filtered out earlier. */ gdb_assert (!SYMTAB_PSPACE (elt)->executing_startup); set_current_program_space (SYMTAB_PSPACE (elt)); iterate_over_file_blocks (elt, name, VAR_DOMAIN, collect_symbols, info); } } This iterates over the symtabs. In the failing use case, ELT is non-NULL (points to the symtab for the .s file), so it calls iterate_over_file_blocks. Herein is where the problem exists: it is assumed that if NAME exists, it must exist in the given symtab -- a reasonable assumption for "normal" (non-asm) cases. It never searches minimal symbols (or in the global default symtab). This patch fixes the problem by doing so. It is important to note that iterating over minsyms is fairly expensive, so this patch only adds that extra search if the language is language_asm and iterate_over_file_blocks returns no symbols. gdb/ChangeLog: 2014-12-20 Keith Seitz <keiths@redhat.com> Mihail-Marian Nistor <mihail.nistor@freescale.com> PR gdb/17394 * linespec.c (struct collect_minsyms): Add new member `symtab'. (add_minsym): Handle cases where info.symtab is non-NULL. (search_minsyms_for_name): Add new parameter `symtab'. Handle limiting searches to a specific symtab. (add_matching_symtabs_to_info): Search through minimal symbols for language_asm files for which no new symbols are found. gdb/testsuite/ChangeLog: 2014-12-20 Mihail-Marian Nistor <mihail.nistor@freescale.com> PR gdb/17394 * gdb.linespec/break-asm-file.c: New file. * gdb.linespec/break-asm-file.exp: New file. * gdb.linespec/break-asm-file0.s: New file. * gdb.linespec/break-asm-file1.s: New file.
2014-10-30Skip tests that use cd for remote hostsLuis Machado1-0/+5
Several GDB tests change directory before compiling the test program in order to test source file names that include directories. This doesn't work on a remote host because default_target_compile in DejaGnu's target.exp copies each source file with "[remote_download host $x]" which uses "[file tail $file] to strip off the directory of each file. If the source directory is remote mounted on the host, this also leaves copied files in the source directory. A similar skip is already used in gdb.test/fullname.exp: # We rely on being able to copy things around. if { [is_remote host] } { untested "setting breakpoints by full path" return -1 } This patch causes three GDB tests that use "cd" to be skipped for a remote host. For gdb.base/fullpath-expand.exp this eliminates two failures and prevents the test from leaving files fullpath-expand.c and fullpath-expand-func.c in gdb/testsuite. For gdb.base/realname-expand.exp it eliminates two failures. For gdb.linespec/macro-relative.exp it prevents file macro-relative.c from being left in gdb/testsuite/gdb.linespec/base/two. gdb/testsuite/ * gdb.base/fullpath-expand.exp: Skip for a remote host. * gdb.base/realname-expand.exp: Likewise. * gdb.linespec/macro-relative.exp: Likewise.
2014-05-05Fix a dangling cleanup in linspec_parse_basic.Keith Seitz1-1/+10
2014-05-05 Keith Seitz <keiths@redhat.com> * linespec.c (linespec_parse_basic): Run cleanups if a convenience variable or history value is successfully parsed. 2014-05-05 Keith Seitz <keiths@redhat.com> * gdb.linespec/ls-dollar.exp: Add test for linespec file:convenience_variable.
2014-04-24XFAIL under Clang tests using labelsDavid Blaikie1-61/+47
gdb/testsuite/ * gdb.base/label.exp: XFAIL label related tests under Clang. * gdb.cp/cplabel.exp: Ditto. * gdb.linespec/ls-errs.exp: Refactor tests to execute directly and XFAIL under Clang those using labels.
2014-03-24gdb.linespec/macro-relative.exp: Mark the test as unsupported if using fission.Doug Evans1-0/+6
2014-01-01Update Copyright year range in all files maintained by GDB.Joel Brobecker13-13/+13
2013-05-07gdb/Sergio Durigan Junior1-0/+4
2013-05-07 Sergio Durigan Junior <sergiodj@redhat.com> PR breakpoints/15413: * breakpoint.c (condition_completer): Simplify the code to disconsider multiple locations of breakpoints when completing the "condition" command. gdb/testsuite/ 2013-05-07 Sergio Durigan Junior <sergiodj@redhat.com> PR breakpoints/15413: * gdb.base/pending.exp: Add test for completion of the "condition" command for pending breakpoints. * gdb.linespec/linespec.ex: Add test for completion of the "condition" command when dealing with multiple locations.
2013-04-042013-04-04 Sandra Loosemore <sandra@codesourcery.com>Sandra Loosemore1-7/+13
gdb/testsuite/ * gdb.linespec/linespec.exp: Make dir/file:line tests conditional for non-remote hosts only.
2013-03-04gdb/Jan Kratochvil4-3/+113
* linespec.c (struct linespec_canonical_name): New. (struct linespec_state): Change canonical_names type to it. (add_sal_to_sals): Change variable canonical_name to canonical. Change xrealloc element size. Initialize the different CANONICAL fields. (canonical_to_fullform): New. (filter_results): Use it. Add variables canonical, fullform and cleanup. (struct decode_line_2_item, decode_line_2_compare_items): New. (decode_line_2): Remove variables iter and item_names, add variables items and items_count. Modify the code for these new variables. gdb/testsuite/ * gdb.linespec/base/one/thefile.cc (twodup): New. (m): Call it. * gdb.linespec/base/two/thefile.cc (dupname): New. (n): Call it. * gdb.linespec/break-ask.exp: New file. * gdb.linespec/lspec.cc (body_elsewhere): New comment marker.
2013-02-03gdb/Jan Kratochvil4-0/+134
* dwarf2read.c (file_file_name): New function with code from file_full_name. (file_full_name): Move most of the code to file_file_name. (macro_start_file): Rename variable full_name to file_name and use file_file_name for it. Add comp_dir parameter to new_macro_table. * macrocmd.c (show_pp_source_pos): New variable fullname. Replace any macro_source_file->filename access by macro_source_fullname call. * macroscope.c (_initialize_macroscope): Update the new_macro_table caller. * macrotab.c (struct macro_table): New field comp_dir. (macro_include): New variables link_fullname and source_fullname. Replace any macro_source_file->filename access by macro_source_fullname call. (macro_lookup_inclusion): Remove the partial filenames checking code. (check_for_redefinition): New variables source_fullname and found_key_fullname. Replace any macro_source_file->filename access by macro_source_fullname call. (macro_undef): New variables source_fullname and key_fullname. Replace any macro_source_file->filename access by macro_source_fullname call. (macro_lookup_definition): New variables retval and source_fullname. Replace any macro_source_file->filename access by macro_source_fullname call. (foreach_macro): New variable key_fullname. Replace any macro_source_file->filename access by macro_source_fullname call. (foreach_macro_in_scope): New variable datum_fullname. Replace any macro_source_file->filename access by macro_source_fullname call. (new_macro_table): Add parameter comp_dir. Initialize T with it. (macro_source_fullname): New function. * macrotab.h (struct macro_source_file): Extent the filename field comment. (new_macro_table): New parameter comp_dir, add a comment for it. (macro_source_fullname): new declaration. gdb/testsuite/ * gdb.linespec/base/one/header.h: New file. * gdb.linespec/base/two/header.h: New file. * gdb.linespec/macro-relative.c: New file. * gdb.linespec/macro-relative.exp: New file.
2013-01-01Update years in copyright notice for the GDB files.Joel Brobecker8-8/+8
Two modifications: 1. The addition of 2013 to the copyright year range for every file; 2. The use of a single year range, instead of potentially multiple year ranges, as approved by the FSF.
2012-12-24gdb/Jan Kratochvil2-1/+86
* breakpoint.c (breakpoint_re_set): Remove the skip_re_set call. * infrun.c (handle_inferior_event): Rename the called function to function_name_is_marked_for_skip, pass it TMP_SAL. * skip.c (struct skiplist_entry): Update function_name comment. Remove fields pc, gdbarch and pending. (skip_function_pc): Rename this forward declaration to ... (skip_function): ... here. (skip_file_command): Remove variable pending and its use, remove initialization of E fields pending and gdbarch. Do not use SYMTAB filename, use the specified one. (skip_function_command): Remove variable func_pc, do not set it. Update the caller of skip_function. Replace decode_line_1 call by a lookup_symbol call. Remove variables orig_arg, decode_exception and sals. Update the caller of skip_function. (skip_info): Remove variable address_width and its use. Do not print address (PC). Renumber column 5 to 4. (skip_function_pc): Rename to ... (skip_function): ... here and remove its parameters pc, arch and pending. Update the function comment and no longer use those parameters. (function_pc_is_marked_for_skip): Rename to ... (function_name_is_marked_for_skip): ... here, update function comment just to a skip.h reference, replace pc parameter by function_name and function_sal. No longer use E field pending and pc. Remove variables searched_for_sal, sal and filename. Call compare_filenames_for_search instead of just strcmp. (skip_re_set): Remove the function. * skip.h (struct symtab_and_line): New declaration. (function_pc_is_marked_for_skip): Rename to ... (function_name_is_marked_for_skip): ... here, replace pc parameter by function_name and function_sal, update the function comment. gdb/testsuite/ * gdb.base/skip-solib.exp (info skip with pending file): Update the expected output. (info skip with pending file): Remove. (ignoring function in solib, info skip for function multiply): Update the expected output. * gdb.base/skip.ex (skip (main), skip function baz, info skip) (info skip (delete 1), info skip after disabling all) (info skip after enabling all, info skip after disabling 4 2-3) (info skip after enabling 2-3, info skip 2-3) (info skip after deleting 2 3): Update the expected output. * gdb.linespec/base/two/thefile.cc (n): New variable v, split the statement to its initialization and return. * gdb.linespec/skip-two.exp: New file.
2012-10-11 PR breakpoints/14643.Doug Evans3-1/+73
* linespec.c (struct ls_parser): New member keyword_ok. (linespec_lexer_lex_string): Add comment. (linespec_lexer_lex_one): Ignore keywords if it's the wrong place for one. (parse_linespec): Set keyword_ok. testsuite/ * gdb.linespec/ls-errs.exp: Change tests of "b if|task|thread". * gdb.linespec/thread.c: New file. * gdb.linespec/thread.exp: New file.
2012-07-30 * linespec.c (linespec_lex_number): A number followedKeith Seitz1-0/+2
by quotes is a valid number, too. * gdb.linespec/ls-errs.exp: Check some quote-enclosed linespecs.
2012-06-25 * gdb.linespec/ls-errs.exp: Use standard_testfile.Tom Tromey3-12/+7
* gdb.linespec/ls-dollar.exp: Use standard_testfile. * gdb.linespec/linespec.exp: Use standard_testfile.
2012-06-13 PR breakpoints/13798 and mi/11541Keith Seitz1-1/+3
* gdb.linespec/ls-errs.exp: Add a few more tests for filenames with spaces and colons.
2012-05-17 * Makefile.in (clean): Remove Fission .dwo and .dwp files.Doug Evans1-0/+1
* gdb.ada/Makefile.in (clean): Ditto. * gdb.arch/Makefile.in (clean): Ditto. * gdb.asm/Makefile.in (clean): Ditto. * gdb.base/Makefile.in (clean): Ditto. * gdb.cell/Makefile.in (clean): Ditto. * gdb.cp/Makefile.in (clean): Ditto. * gdb.disasm/Makefile.in (clean): Ditto. * gdb.dwarf2/Makefile.in (clean): Ditto. * gdb.fortran/Makefile.in (clean): Ditto. * gdb.go/Makefile.in (clean): Ditto. * gdb.hp/Makefile.in (clean): Ditto. * gdb.hp/gdb.aCC/Makefile.in (clean): Ditto. * gdb.hp/gdb.base-hp/Makefile.in (clean): Ditto. * gdb.hp/gdb.compat/Makefile.in (clean): Ditto. * gdb.hp/gdb.defects/Makefile.in (clean): Ditto. * gdb.hp/gdb.objdbg/Makefile.in (clean): Ditto. * gdb.java/Makefile.in (clean): Ditto. * gdb.linespec/Makefile.in (clean): Ditto. * gdb.mi/Makefile.in (clean): Ditto. * gdb.modula2/Makefile.in (clean): Ditto. * gdb.multi/Makefile.in (clean): Ditto. * gdb.objc/Makefile.in (clean): Ditto. * gdb.opencl/Makefile.in (clean): Ditto. * gdb.opt/Makefile.in (clean): Ditto. * gdb.pascal/Makefile.in (clean): Ditto. * gdb.python/Makefile.in (clean): Ditto. * gdb.reverse/Makefile.in (clean): Ditto. * gdb.server/Makefile.in (clean): Ditto. * gdb.stabs/Makefile.in (clean): Ditto. * gdb.threads/Makefile.in (clean): Ditto. * gdb.trace/Makefile.in (clean): Ditto. * gdb.xml/Makefile.in (clean): Ditto.
2012-04-05linespec rewrite:Keith Seitz2-0/+218
* linespec.c (decode_compound): Remove. (enum offset_relative_sign): New enum. (struct line_offset): New struct. (struct linespec): New struct. (struct linespec_state): Move file_symtabs, user_filename, and user_function into struct linespec. Make result an anonymous struct holding vectors of symbolp and minsym_and_objfile_d. Add language member. (enum ls_token_type): New enum. (linespec_keywords): New array. (struct ls_token): New struct. (struct ls_parser): New struct. (linespec_lexer_lex_number): New function. (linespec_lexer_lex_keyword): New function. (is_ada_operator): New function. (skip_quote_char): New function. (copy_token_string): New function. (is_closing_quote_enclosed): New function. (find_parameter_list_end): New function. (linespec_lexer_lex_string): New function. (linespec_lexer_lex_one): New function. (linespec_lexer_consume_token): New function. (linespec_lexer_peek_token): New function. (cplusplus_error): Remove unused function. (find_methods): Update comment. (find_toplevel_char): Return const. (is_objc_method_format): Remove unused function. (find_toplevel_string): New function. (is_linespec_boundary): Remove. (symbol_not_found_error): New function. (find_method_overload_end): Remove function. (unexpected_linespec_error): New function. (keep_name_info): Remove. (linespec_parse_line_offset): New function. (linespec_parse_basic): New function. (canonicalize_linespec): New function. (decode_line_internal): Remove. (create_sals_line_offset): New function adapted from decode_all_digits. (convert_linespec_to_sals): New function. (parse_linespec): New function. (linespec_parser_new): New function. (linespec_state_destructor): Change parameter type to struct linespec_state *. Add language parameter. Remove freeing of moved members. (linespec_parser_delete): New function. (decode_line_full): Use parse_linespec and linespec_parser_new. (decode_line_1): Likewise. (decode_indirect): Rename to ... (linespec_expression_to_pc): ... this and rewrite to simply find CORE_ADDR, storing this result for later conversion to SALs. (locate_first_half): Remove. (deocde_objc): Add parameter LS. Initialize new struct collect_info members. Handle minimal symbols, too. (decode_compound): Delete. (lookup_prefix_sym): Rewrite. (compare_msymbols): New function. (find_method): Rewrite. Do not call cplusplus_error. (symtabs_from_filename): Rewrite. (collect_function_symbols): Delete. (find_function_symbols): Rewrite without ARGPTR-style processing. (decode_all_digits): Delete. (Rewritten as create_sals_line_offset.) (decode_dollar): Adapted and renamed to ... (linespec_parse_variable): ... this. (find_linespec_symbols): New function. (decode_label): Adapted and renamed to ... (find_label_symbols): ... this. (decode_digits_list_mode): Add and use LS argument. (decode_digits_ordinary): Likewise. (collect_symbols): Do not collect SALs, just symbols and msymbols. If in list mode, allow any symbol class. Otherwise, only permit LOC_BLOCK symbols. (minsym_found): Update comments. (search_minsyms_for_name): Do not convert the matching symbol into a SAL. Simply push the symbol and objfile into the result vector. (decode_variable): Delete. Contents adapted into find_linespec_symbols. * cp-support.c (SKIP_SPACE): Remove. (operator_tokens): Remove unused global. (cp_validate_operator): Remove. * cp-support.h (cp_validate_operator): Remove declaration. * gdb.base/advance.exp: Update error message for "advance malformed" test. * gdb.base/break.exp: Likewise for "breakpoint with trailing garbage" test. * gdb.base/hbreak2.exp: Likewise for "hardware breakpoint with trailing garbage" test. * gdb.base/jump.exp: Likewise for "jump with trailing argument junk" test. * gdb.base/sepdebug.exp: Likewise for "breakpoint with trailng garbage" test. * gdb.base/until.exp: Likewise for "malformed until" test. * gdb.cp/ovldbreak.exp: Create the breakpoint table for "breakpoint info (after setting on all)". * gdb.cp/userdef.exp: Remove quoting for "break A2::operator+" tests. * gdb.cp/cplabel.cc: New file. * gdb.cp/cplabel.exp: New test. * gdb.linespec/ls-errs.c: New file. * gdb.linespec/ls-errs.exp: New test.
2012-03-28 * gdb.linespec/ls-dollar.cc: New file.Keith Seitz2-0/+64
* gdb.linespec/ls-dollar.exp: New test.
2012-01-16gdbTom Tromey1-6/+11
* NEWS: Add item. * symtab.h (compare_filenames_for_search): Declare. * symtab.c (compare_filenames_for_search): New function. (iterate_over_some_symtabs): Use it. * symfile.h (struct quick_symbol_functions) <map_symtabs_matching_filename>: Change spec. * psymtab.c (partial_map_symtabs_matching_filename): Use compare_filenames_for_search. Update for new spec. * dwarf2read.c (dw2_map_symtabs_matching_filename): Use compare_filenames_for_search. Update for new spec. * breakpoint.c (clear_command): Use compare_filenames_for_search. gdb/doc * gdb.texinfo (Specify Location): Document relative file name handling. gdb/testsuite * gdb.linespec/linespec.exp: Change some tests to use $decimal. Add tests for relative directory.
2012-01-04Copyright year update in most files of the GDB Project.Joel Brobecker1-1/+1
gdb/ChangeLog: Copyright year update in most files of the GDB Project.
2011-12-24gdb/testsuite/Jan Kratochvil1-1/+1
* gdb.linespec/linespec.exp: Compile using {c++}.
2011-12-06the "ambiguous linespec" seriesTom Tromey7-0/+221
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.