aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2015-08-11Explicit locations: use new location APIKeith Seitz22-411/+897
This patch converts the code base to use the new struct event_location API being introduced. This patch preserves the current functionality and adds no new features. The "big picture" API usage introduced by this patch may be illustrated with a simple exmaple. Where previously developers would write: void my_command (char *arg, int from_tty) { create_breakpoint (..., arg, ...); ... } one now uses: void my_command (char *arg, int from_tty) { struct event_locaiton *location; struct cleanup *back_to; location = string_to_event_locaiton (&arg, ...); back_to = make_cleanup_delete_event_location (location); create_breakpoint (..., location, ...); do_cleanups (back_to); } Linespec-decoding functions (now called location-decoding) such as decode_line_full no longer skip argument pointers over processed input. That functionality has been moved into string_to_event_location as demonstrated above. gdb/ChangeLog * ax-gdb.c: Include location.h. (agent_command_1) Use linespec location instead of address string. * break-catch-throw.c: Include location.h. (re_set_exception_catchpoint): Use linespec locations instead of address strings. * breakpoint.c: Include location.h. (create_overlay_event_breakpoint, create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint, update_breakpoints_after_exec): Use linespec location instead of address string. (print_breakpoint_location): Use locations and event_location_to_string. Print extra_string for pending locations for non-MI streams. (print_one_breakpoint_location): Use locations and event_location_to_string. (init_raw_breakpoint_without_location): Initialize b->location. (create_thread_event_breakpoint): Use linespec location instead of address string. (init_breakpoint_sal): Likewise. Only save extra_string if it is non-NULL and not the empty string. Use event_location_to_string instead of `addr_string'. Constify `p' and `endp'. Use skip_spaces_const/skip_space_const instead of non-const versions. Copy the location into the breakpoint. If LOCATION is NULL, save the breakpoint address as a linespec location instead of an address string. (create_breakpoint_sal): Change `addr_string' parameter to a struct event_location. All uses updated. (create_breakpoints_sal): Likewise for local variable `addr_string'. (parse_breakpoint_sals): Use locations instead of address strings. Remove check for empty linespec with conditional. Refactor. (decode_static_tracepoint_spec): Make argument const and update function. (create_breakpoint): Change `arg' to a struct event_location and rename. Remove `copy_arg' and `addr_start'. If EXTRA_STRING is empty, set it to NULL. Don't populate `canonical' for pending breakpoints. Pass `extra_string' to find_condition_and_thread. Clear `extra_string' if `rest' was NULL. Do not error with "garbage after location" if setting a dprintf breakpoint. Copy the location into the breakpoint instead of an address string. (break_command_1): Use string_to_event_location and pass this to create_breakpoint instead of an address string. Check against `arg_cp' for a probe linespec. (dprintf_command): Use string_to_event_location and pass this to create_breakpoint instead of an address string. Throw an exception if no format string was specified. (print_recreate_ranged_breakpoint): Use event_location_to_string instead of address strings. (break_range_command, until_break_command) (init_ada_exception_breakpoint): Use locations instead of address strings. (say_where): Print out extra_string for pending locations. (base_breakpoint_dtor): Delete `location' and `location_range_end' of the breakpoint. (base_breakpoint_create_sals_from_location): Use struct event_location instead of address string. Remove `addr_start' and `copy_arg' parameters. (base_breakpoint_decode_location): Use struct event_location instead of address string. (bkpt_re_set): Use locations instead of address strings. Use event_location_empty_p to check for unset location. (bkpt_print_recreate): Use event_location_to_string instead of an address string. Print out extra_string for pending locations. (bkpt_create_sals_from_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location): Use struct event_location instead of address string. (bkpt_probe_decode_location): Use struct event_location instead of address string. (tracepoint_print_recreate): Use event_location_to_string to recreate the tracepoint. (tracepoint_create_sals_from_location, tracepoint_decode_location) (tracepoint_probe_create_sals_from_location) (tracepoint_probe_decode_location): Use struct event_location instead of address string. (dprintf_print_recreate): Use event_location_to_string to recreate the dprintf. (dprintf_re_set): Remove check for valid/missing format string. (strace_marker_create_sals_from_location) (strace_marker_create_breakpoints_sal, strace_marker_decode_location) (update_static_tracepoint): Use struct event_location instead of address string. (location_to_sals): Likewise. Pass `extra_string' to find_condition_and_thread. For newly resolved pending breakpoint locations, clear the location's string representation. Assert that the breakpoint's condition string is NULL when condition_not_parsed. (breakpoint_re_set_default, create_sals_from_location_default) (decode_location_default, trace_command, ftrace_command) (strace_command, create_tracepoint_from_upload): Use locations instead of address strings. * breakpoint.h (struct breakpoint_ops) <create_sals_from_location>: Use struct event_location instead of address string. Update all uses. <decode_location>: Likewise. (struct breakpoint) <addr_string>: Change to struct event_location and rename `location'. <addr_string_range_end>: Change to struct event_location and rename `location_range_end'. (create_breakpoint): Use struct event_location instead of address string. * cli/cli-cmds.c: Include location.h. (edit_command, list_command): Use locations instead of address strings. * elfread.c: Include location.h. (elf_gnu_ifunc_resolver_return_stop): Use event_location_to_string. * guile/scm-breakpoint.c: Include location.h. (bpscm_print_breakpoint_smob): Use event_location_to_string. (gdbscm_register_breakpoint): Use locations instead of address strings. * linespec.c: Include location.h. (struct ls_parser) <stream>: Change to const char *. (PARSER_STREAM): Update. (lionespec_lexer_lex_keyword): According to find_condition_and_thread, keywords must be followed by whitespace. (canonicalize_linespec): Save a linespec location into `canonical'. Save a canonical linespec into `canonical'. (parse_linespec): Change `argptr' to const char * and rename `arg'. All uses updated. Update function description. (linespec_parser_new): Initialize `parser'. Update initialization of parsing stream. (event_location_to_sals): New function. (decode_line_full): Change `argptr' to a struct event_location and rename it `location'. Use locations instead of address strings. Call event_location_to_sals instead of parse_linespec. (decode_line_1): Likewise. (decode_line_with_current_source, decode_line_with_last_displayed) Use locations instead of address strings. (decode_objc): Likewise. Change `argptr' to const char * and rename `arg'. (destroy_linespec_result): Delete the linespec result's location instead of freeing the address string. * linespec.h (struct linespec_result) <addr_string>: Change to struct event_location and rename to ... <location>: ... this. (decode_line_1, decode_line_full): Change `argptr' to struct event_location. All callers updated. * mi/mi-cmd-break.c: Include language.h, location.h, and linespec.h. (mi_cmd_break_insert_1): Use locations instead of address strings. Throw an error if there was "garbage" at the end of the specified linespec. * probe.c: Include location.h. (parse_probes): Change `argptr' to struct event_location. Use event locations instead of address strings. * probe.h (parse_probes): Change `argptr' to struct event_location. * python/py-breakpoint.c: Include location.h. (bppy_get_location): Constify local variable `str'. Use event_location_to_string. (bppy_init): Use locations instead of address strings. * python/py-finishbreakpoint.c: Include location.h. (bpfinishpy_init): Remove local variable `addr_str'. Use locations instead of address strings. * python/python.c: Include location.h. (gdbpy_decode_line): Use locations instead of address strings. * remote.c: Include location.h. (remote_download_tracepoint): Use locations instead of address strings. * spu-tdep.c: Include location.h. (spu_catch_start): Remove local variable `buf'. Use locations instead of address strings. * tracepoint.c: Include location.h. (scope_info): Use locations instead of address strings. (encode_source_string): Constify parameter `src'. * tracepoint.h (encode_source_string): Likewise. gdb/testsuite/ChangeLog * gdb.base/dprintf-pending.exp: Update dprintf "without format" test. Add tests for missing ",FMT" and ",".
2015-08-11Explicit locations: introduce new struct event_location-based APIKeith Seitz6-3/+385
This patch introduces the new breakpoint/"linespec" API based on a new struct event_location. This API currently only supports traditional linespecs, maintaining the status quo of the code base. Future patches will add additional functionality for other location types such as address locations. gdb/ChangeLog: * Makefile.in (SFILES): Add location.c. (HFILES_NO_SRCDIR): Add location.h. (COMMON_OBS): Add location.o. * linespec.c (linespec_lex_to_end): New function. * linespec.h (linespec_lex_to_end): Declare. * location.c: New file. * location.h: New file.
2015-08-11Explicit locations: rename "address string"/"addr_string" to "location"Keith Seitz4-66/+99
This patch renames all occurrances of "addr_string" and "address string" in the breakpoint/linespec APIs. This will emphasize the change from address strings used in setting breakpoints (et al) to the new locations-based API introduced in subsequent patches. gdb/ChangeLog: * breakpoint.h (struct breakpoint_ops) <create_sals_from_address>: Renamed to create_sals_from_location. <decode_linespec>: Renamed to decode_location. Update all callers. * breakpoint.c (create_sals_from_address_default): Renamed to ... (create_sals_from_location_default): ... this. (addr_string_to_sals): Renamed to ... (location_to_sals): ... this. (decode_linespec_default): Renamed to ... (decode_location_default): ... this. (base_breakpoint_create_sals_from_address): Renamed to ... (base_breakpoint_create_sals_from_location): ... this. (bkpt_create_sals_from_address): Renamed to ... (bkpt_create_sals_from_location): ... this. (bkpt_decode_linespec): Renamed to ... (bkpt_decode_location): ... this. (bkpt_probe_create_sals_from_address): Renamed to ... (bkpt_probe_create_sals_from_location): ... this. (tracepoint_create_sals_from_address): Renamed to ... (tracepoint_create_sals_from_location): ... this. (tracepoint_decode_linespec): Renamed to ... (tracepoint_decode_location): ... this. (tracepoint_probe_create_sals_from_address): Renamed to ... (tracepoint_probe_create_sals_from_location): ... this. (tracepoint_probe_decode_linespec): Renamed to ... (tracepoint_probe_decode_location): ... this. (strace_marker_create_sals_from_address): Renamed to ... (strace_marker_create_sals_from_location): ... this. (decode_linespec_default): Renamed to ... (decode_location_default): ... this.
2015-08-12Automatic date update in version.inGDB Administrator1-1/+1
2015-08-11[AArch64] Improve BFD overflow warning message for -fpicJiong Wang2-0/+18
2015-08-11 Jiong Wang <jiong.wang@arm.com> bfd/ * elfnn-aarch64.c (elfNN_aarch64_relocate_section): Improve warning message for R_AARCH64_LD64_GOTPAGE_LO15/R_AARCH64_LD32_GOTPAGE_LO14.
2015-08-11[AArch64] Commit missing testcasesJiong Wang4-0/+56
2015-08-11[AArch64]Speed up linking speed by skipping unncessary TLS reloc type checkJiong Wang2-1/+20
2015-08-11 Jiong Wang <jiong.wang@arm.com> bfd/ * elfnn-aarch64.c (IS_AARCH64_TLS_RELAX_RELOC): New. (aarch64_can_relax_tls): Use the new IS_AARCH64_TLS_RELAX_RELOC.
2015-08-11[AArch64] Long branch veneer support far symbol defined by --defsymJiong Wang4-2/+19
2015-08-11 Jiong Wang <jiong.wang@arm.com> bfd/ * bfd/elfnn-aarch64.c (aarch64_type_of_stub): New parameter "sym_sec". Loose the check for symbol from ABS section. (elfNN_aarch64_size_stubs): Pass sym_sec. ld/testsuite/ * ld-aarch64/farcall-b-defsym.s: New test. * ld-aarch64/farcall-bl-defsym.s: Likewise. * ld-aarch64/farcall-b-defsym.d: New expectation. * ld-aarch64/farcall-bl-defsym.d: Likewise.
2015-08-11[AArch64] PR18668, repair long branch veneer for plt stubJiong Wang10-31/+161
2015-08-11 Jiong Wang <jiong.wang@arm.com> bfd/ PR ld/18668 * elfnn-aarch64.c (aarch64_type_of_stub): Update destination for calls go through plt stub. (elfNN_aarch64_final_link_relocate): Adjust code logic for CALL26, JUMP26 relocation to support inserting veneer for call to plt stub. ld/testsuite/ * ld-aarch64/farcall-b-gsym.s: New test. * ld-aarch64/farcall-b-plt.s: Likewise. * ld-aarch64/farcall-bl-plt.s: Likewise. * ld-aarch64/farcall-b-gsym.d: New expect file. * ld-aarch64/farcall-b-plt.d: Likewise. * ld-aarch64/farcall-bl-plt.d: Likewise.
2015-08-11[AArch64][8/8] LD support BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12Jiong Wang13-0/+102
2015-08-11 Jiong Wang <jiong.wang@arm.com> bfd/ * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12. (aarch64_reloc_got_type): Likewise. (elfNN_aarch64_final_link_relocate): Likewise. (elfNN_aarch64_relocate_section): Likewise. * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise. (_bfd_aarch64_elf_resolve_relocation): Likewise. ld/testsuite/ * ld-aarch64/emit-relocs-529.s: New testcase. * ld-aarch64/emit-relocs-529-overflow.s: Likewise. * ld-aarch64/emit-relocs-86.s: Likewise. * ld-aarch64/emit-relocs-86-overflow.s: Likewise. * ld-aarch64/emit-relocs-529.d: New expectation file. * ld-aarch64/emit-relocs-529-overflow.d: Likewise. * ld-aarch64/emit-relocs-86.d: Likewise. * ld-aarch64/emit-relocs-86-overflow.d: Likewise. * ld-aarch64/aarch64-elf.exp: Run new testcases.
2015-08-11[AArch64][7/8] GAS support BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12Jiong Wang14-0/+90
2015-08-11 Jiong Wang <jiong.wang@arm.com> include/elf/ * aarch64.h (R_AARCH64_P32_TLSLD_ADD_DTPREL_LO12): Define. bfd/ * reloc.c (BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12): New entry. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12. gas/ * config/tc-aarch64.c (reloc_table): New relocation modifiers "dtprel_lo12". (md_apply_fix): Support BFD_RELOC_AARCH64_TLSLD_ADD_DTPREL_LO12. (aarch64_force_relocation): Likewise. gas/testsuite/ * gas/aarch64/reloc-dtprel_lo12-1.s: New testcase. * gas/aarch64/reloc-dtprel_lo12-ilp32-1.s: Likewise. * gas/aarch64/reloc-dtprel_lo12-1.d: New expectation file. * gas/aarch64/reloc-dtprel_lo12-ilp32-1.d: Likewise.
2015-08-11[AArch64][6/8] LD support BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NCJiong Wang5-2/+27
2015-08-11 Jiong Wang <jiong.wang@arm.com> bfd/ * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC. (aarch64_reloc_got_type): Likewise. (elfNN_aarch64_final_link_relocate): Likewise. (elfNN_aarch64_relocate_section): Likewise. (elfNN_aarch64_gc_sweep_hook): Likewise. (elfNN_aarch64_check_relocs): Likewise. * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise. (_bfd_aarch64_elf_resolve_relocation): Likewise. ld/testsuite/ * ld-aarch64/tls-small-ld.s: Update testcase.
2015-08-11[AArch64][5/8] GAS support BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NCJiong Wang12-0/+90
2015-08-11 Jiong Wang <jiong.wang@arm.com> bfd/ * reloc.c (BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC): New entry. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC. gas/ * config/tc-aarch64.c (reloc_table): New relocation modifiers. (md_apply_fix): Support BFD_RELOC_AARCH64_TLSLD_ADD_LO12_NC. (aarch64_force_relocation): Likewise. gas/testsuite/ * gas/aarch64/reloc-tlsldm_lo12_nc-1.s: New testcase. * gas/aarch64/reloc-tlsldm_lo12_nc-ilp32-1.s: Likewise. * gas/aarch64/reloc-tlsldm_lo12_nc-1.d: New expectation file. * gas/aarch64/reloc-tlsldm_lo12_nc-ilp32-1.d: Likewise.
2015-08-11[AArch64][4/8] Add R_AARCH64_P32_TLSLD_ADD_LO12_NC in elf headerJiong Wang2-0/+5
2015-08-11 Jiong Wang <jiong.wang@arm.com> include/elf/ * aarch64.h (R_AARCH64_P32_TLSLD_ADD_LO12_NC): Define.
2015-08-11[AArch64][3/8] LD support BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21Jiong Wang7-2/+48
2015-08-11 Jiong Wang <jiong.wang@arm.com> bfd/ * elfnn-aarch64.c (IS_AARCH64_TLS_RELOC): Recognize BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21. (aarch64_reloc_got_type): Likewise. (elfNN_aarch64_final_link_relocate): Likewise. (elfNN_aarch64_relocate_section): Likewise. (elfNN_aarch64_gc_sweep_hook): Likewise. (elfNN_aarch64_check_relocs): Likewise. * elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Likewise. (_bfd_aarch64_elf_resolve_relocation): Likewise. ld/testsuite/ * ld-aarch64/tls-small-ld.s: New file. * ld-aarch64/tls-small-ld.d: Likewise. * ld-aarch64/aarch64-elf.exp: Run new test.
2015-08-11[AArch64][2/8] GAS support BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21Jiong Wang12-1/+84
2015-08-11 Jiong Wang <jiong.wang@arm.com> bfd/ * reloc.c (BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21): New entry. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * elfnn-aarch64.c (elfNN_aarch64_howto_table): New entry for BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21. gas/ * config/tc-aarch64.c (reloc_table): New relocation modifiers. (md_apply_fix): Support BFD_RELOC_AARCH64_TLSLD_ADR_PAGE21. (aarch64_force_relocation): Likewise. gas/testsuite/ * gas/aarch64/reloc-tlsldm-page-1.s: New testcase. * gas/aarch64/reloc-tlsldm-page-ilp32-1.s: Likewise. * gas/aarch64/reloc-tlsldm-page-1.d: New expectation file. * gas/aarch64/reloc-tlsldm-page-ilp32-1.d: Likewise.
2015-08-11[AArch64][1/8] Add R_AARCH64_P32_TLSLD_ADR_PAGE21 in elf headerJiong Wang2-0/+5
2015-08-11 Jiong Wang <jiong.wang@arm.com> include/elf/ * aarch64.h (R_AARCH64_P32_TLSLD_ADR_PAGE21): Define.
2015-08-11Skip IFUNC relocations in debug sectionsH.J. Lu9-4/+141
Skip IFUNC relocations in debug sections ignored by ld.so. bfd/ PR ld/18808 * elf32-i386.c (elf_i386_relocate_section): Skip IFUNC relocations in debug sections. * elf64-x86-64.c (elf_x86_64_relocate_section): Likewise. ld/testsuite/ PR ld/18808 * ld-ifunc/ifunc.exp: Add a test for PR ld/18808. * ld-ifunc/pr18808.out: New file. * ld-ifunc/pr18808a.c: Likewise. * ld-ifunc/pr18808b.c: Likewise.
2015-08-11Fix the disassembly of the AArch64 SIMD EXT instruction.Nick Clifton2-1/+7
PR 18800 * aarch64-tbl.h (aarch64_opcode_table): Fix mask for SIMD EXT instruction.
2015-08-11Fix encoding or OpenRisk1000 PC relative relocations.Peter Zotov2-3/+10
PR ld/18759 * elf32-or1k.c (R_OR1K_32_PCREL): Set pcrel_offset to TRUE. (R_OR1K_16_PCREL): Likewise. (R_OR1K_8_PCREL): Likewise.
2015-08-11Fix typo in coff-sh.c.Nick Clifton2-1/+5
PR binutils/18747 * coff-sh.c (_bfd_sh_align_load_span): Fix typo when setting opcode count.
2015-08-11Tweak binutils testsuiteAlan Modra7-13/+27
Some targets provide aligned .bss sections, so explicitly align. msp430 and rl78 emit "magic" symbols when assembling symbol.s, and mips targets emit STT_OBJECT rather than STT_NOTYPE syms. * binutils-all/strip-12.s: Align .bss section. * binutils-all/strip-12.d: Adjust. * binutils-all/symbols-1.d: Allow extraneous symbols. * binutils-all/symbols-2.d: Likewise, and V for weakened syms. * binutils-all/symbols-3.d: Likewise. * binutils-all/symbols-4.d: Likewise.
2015-08-11Fix memory access problems discovered when running some binary tools on ↵Nick Clifton3-2/+56
corrupt files. PR binutils/18758 * elf.c (_bfd_elf_setup_sections): Add checks for corrupt section group information. * peicode.h (pe_ILF_make_a_section): Ensure alignment of the used_by_bfd pointer. (pe_ILF_build_a_bfd): Ensure alignment of vars.data pointer.
2015-08-11Fix a typo in _bfd_elf_copy_private_bfd_dataH.J. Lu2-2/+6
* elf.c (_bfd_elf_copy_private_bfd_data): Fix a typo.
2015-08-11Fix compile time warning messages about constant expressions where a value ↵Nick Clifton2-5/+13
is being shifted into bit 31. PR gas/18765 * config/tc-arm.c (move_or_literal_pool): Use U suffix to remove compile time warnings about constant expressions being shifted into bit 31. (do_iwmmxt_wldstd): Likewise. (do_iwmmxt_wrwrwr_or_imm5): Likewise. (md_assemble): Likewise.
2015-08-11Convert 'A && (!A || B)' to 'A || B' in various places.Nick Clifton2-10/+15
PR gas/18574 * config/tc-msp430.c (msp430_operands): Rewrite if statements to remove redundant checks. (md_apply_fix): Likewise.
2015-08-11Fix typo checking MMIX operands.Nick Clifton2-2/+6
PR gas/18677 * config/tc-mmix.c (md_assemble): Fix typo checking operands with a numeric constant value.
2015-08-11Fix typo checking number of operands.Nick Clifton2-1/+4
PR gas/18678 * config/tc-tic4x.c (tic4x_insn_check): Fix typo.
2015-08-11Fix a typo where the same name was checked twice.Nick Clifton2-1/+6
PR gas/18679 * config/xtensa-relax.c (same_operand_name): Fix typo.
2015-08-11PR gdb/18669 libiberty demangle.test failure: strtod() on sparc-sun-solaris2.9Iain Buclaw3-22/+22
Test symbols did not demangle as per the d-demangle-expected tests because strtod() on Solaris 9 does not accept hexadecimal numbers. This has now been fixed up so that no attempt at formatting/converting the demangled hexadecimal literals are done. libiberty/ChangeLog: 2015-08-11 Iain Buclaw <ibuclaw@gdcproject.org> * d-demangle.c (dlang_parse_real): Remove call to strtod. (strtod): Remove declaration. * testsuite/d-demangle-expected: Update float and complex literal tests to check correct hexadecimal demangling.
2015-08-11Automatic date update in version.inGDB Administrator1-1/+1
2015-08-10remove trailing space in previous entryDoug Evans1-1/+1
2015-08-10PR gdb/17960 Internal error: tracker != NULL when completing on file:functionDoug Evans4-5/+129
gdb/ChangeLog: * symtab.c (make_file_symbol_completion_list_1): Renamed from make_file_symbol_completion_list and made static. (make_file_symbol_completion_list): New function. gdb/testsuite/ChangeLog: * gdb.base/completion.exp: Add location completer tests.
2015-08-10gdb/infrun.c: Various trivial ARI fixes.Joel Brobecker2-5/+11
gdb/ChangeLog: * infrun.c (follow_fork, displaced_step_prepare, resume): Remove trailing new-line at end of warning message. (proceed): Add i18n marker to error messages.
2015-08-10Replace hidden with versioned in elf_link_hash_entryH.J. Lu3-47/+107
This patch replaces the "hidden" field with the "versioned" field in elf_link_hash_entry so that we can avoid calling strchr and strrchr if the symbol is unversioned. * elf-bfd.h (elf_symbol_version): New enum. (elf_link_hash_entry): Replace hidden with versioned. * elflink.c (_bfd_elf_merge_symbol): Don't look for symbol version if the symbol is unversioned. Initialize versioned. (_bfd_elf_add_default_symbol): Don't look for symbol version if the symbol is unversioned or hidden. Initialize versioned. (elf_collect_hash_codes): Don't look for symbol version if the symbol is unversioned. (elf_collect_gnu_hash_codes): Likewise. (bfd_elf_gc_mark_dynamic_ref_symbol): Likewise. (_bfd_elf_link_hash_copy_indirect): Check versioned instead of hidden. (elf_link_output_extsym): Likewise.
2015-08-10Add SIGRIE instruction for MIPS R6Robert Suchanek7-0/+21
opcodes/ * mips-opc.c (mips_builtin_opcodes): Add "sigrie". gas/testsuite/ * gas/mips/r6.s: Add tests for "sigrie". * gas/mips/r6.d: Check for "sigrie". * gas/mips/r6-n32.d: Likewise. * gas/mips/r6-n64.d: Likewise.
2015-08-10Automatic date update in version.inGDB Administrator1-1/+1
2015-08-09Automatic date update in version.inGDB Administrator1-1/+1
2015-08-08tc-arm.c: Append ULL to 0xFFFFFFFFFFFFF to avoid errors on 32-bit hosts.Hans-Peter Nilsson2-2/+7
2015-08-08Automatic date update in version.inGDB Administrator1-1/+1
2015-08-08binutils-all/strip-12.s: Use ".section .bss" instead of ".bss"Hans-Peter Nilsson2-1/+6
which isn't supported by all ELF targets.
2015-08-07Check sh_type/sh_flags/sh_addralign/sh_entsize when copying sh_link/sh_infoH.J. Lu6-1/+39
When copying the sh_link and sh_info fields in stripped section headers, we also check if the sh_type, sh_flags, /sh_addralign and sh_entsize fields of the output section match the output. Since --only-keep-debug turns all non-debug sections into SHT_NOBITS sections, the output SHT_NOBITS type matches any input type. bfd/ PR binutils/18785 * elf.c (_bfd_elf_copy_private_bfd_data): When copying the sh_link and sh_info fields in stripped section headers, we also check if the sh_type, sh_flags, /sh_addralign and sh_entsize fields of the output section match the output. Since --only-keep-debug turns all non-debug sections into SHT_NOBITS sections, the output SHT_NOBITS type matches any input type. binutils/testsuite/ PR binutils/18785 * binutils-all/objcopy.exp: Run strip-12. * binutils-all/strip-12.d: New file. * binutils-all/strip-12.s: Likewise.
2015-08-07native Linux: enable always non-stop by defaultPedro Alves2-1/+5
The testsuite shows no regressions with this forced on, on: - Native x86_64 Fedora 20, with and output "set displaced off". - Native x86_64 Fedora 20, on top of x86 software single-step series. - PPC64 Fedora 18. - S/390 RHEL 7.1. Let's try making it the default. gdb/ChangeLog: 2015-08-07 Pedro Alves <palves@redhat.com> * linux-nat.c (linux_nat_always_non_stop_p): Return 1.
2015-08-07S/390: displaced stepping and PC-relative RIL-b/RIL-c instructionsPedro Alves2-3/+120
This adds displaced stepping support for the General-Instruction Extension Facility instructions, which have a PC-relative displacement (RIL-b/RIL-c). We already handle RIL branches, but not others. Currently, displaced stepping a breakpoint put on any of these instructions results in the inferior crashing when or after the instruction is executed out-of-line in the scratch pad. This patch takes the easy route of patching the displacement in the copy of the instruction in the scratch pad. As the displacement is a signed 32-bit field, it's possible that the stratch pad ends too far that the needed displacement doesn't fit in the adjusted instruction, as e.g., if stepping over a breakpoint in a shared library (the scratch pad is around the main program's entry point). That case is detected and GDB falls back to stepping over the breakpoint in-line (which involves pausing all threads momentarily). (We could probably do something smarter, but I don't plan on doing it myself. This was already sufficient to get "maint set target-non-stop on" working regression free on S/390.) Tested on S/390 RHEL 7.1, where it fixes a few hundred FAILs when testing with displaced stepping force-enabled, with the end result being no regressions compared to a test run that doesn't force displaced stepping. Fixes the non-stop tests compared to mainline too; most are crashing due to this on the machine I run tests on. gdb/ChangeLog: 2015-08-07 Pedro Alves <palves@redhat.com> * s390-linux-tdep.c (is_non_branch_ril) (s390_displaced_step_copy_insn): New functions. (s390_displaced_step_fixup): Update comment. (s390_gdbarch_init): Install s390_displaced_step_copy_insn as gdbarch_displaced_step_copy_insn hook.
2015-08-07PPC64: Fix gdb.arch/ppc64-atomic-inst.exp with displaced steppingPedro Alves7-34/+131
The ppc64 displaced step code can't handle atomic sequences. Fallback to stepping over the breakpoint in-line if we detect one. gdb/ChangeLog: 2015-08-07 Pedro Alves <palves@redhat.com> * infrun.c (displaced_step_prepare_throw): Return -1 if gdbarch_displaced_step_copy_insn returns NULL. Update intro comment. * rs6000-tdep.c (LWARX_MASK, LWARX_INSTRUCTION, LDARX_INSTRUCTION) (STWCX_MASK, STWCX_INSTRUCTION, STDCX_INSTRUCTION): Move higher up in file. (ppc_displaced_step_copy_insn): New function. (ppc_displaced_step_fixup): Update comment. (rs6000_gdbarch_init): Install ppc_displaced_step_copy_insn as gdbarch_displaced_step_copy_insn hook. * gdbarch.sh (displaced_step_copy_insn): Document what happens on NULL return. * gdbarch.h: Regenerate. gdb/testsuite/ChangeLog: 2015-08-07 Pedro Alves <palves@redhat.com> * gdb.arch/ppc64-atomic-inst.exp (do_test): New procedure, move tests here. (top level): Run do_test with and without displaced stepping.
2015-08-07Disable displaced stepping if trying it failsPedro Alves5-20/+277
Running the testsuite with "maint set target-non-stop on" shows: (gdb) PASS: gdb.base/valgrind-infcall.exp: continue #98 (false warning) continue Continuing. dl_main (phdr=<optimized out>..., auxv=<optimized out>) at rtld.c:2302 2302 LIBC_PROBE (init_complete, 2, LM_ID_BASE, r); Cannot access memory at address 0x400532 (gdb) PASS: gdb.base/valgrind-infcall.exp: continue #99 (false warning) p gdb_test_infcall () $1 = 1 (gdb) FAIL: gdb.base/valgrind-infcall.exp: p gdb_test_infcall () Even though that was a native GNU/Linux test run, this test spawns Valgrind and connects to it with "target remote". The error above is actually orthogonal to target-non-stop. The real issue is that that enables displaced stepping, and displaced stepping doesn't work with Valgrind, because we can't write to the inferior memory (thus can't copy the instruction to the scratch pad area). I'm sure there will be other targets with the same issue, so trying to identify Valgrind wouldn't be sufficient. The fix is to try setting up the displaced step anyway. If we get a MEMORY_ERROR, we disable displaced stepping for that inferior, and fall back to doing an in-line step-over. If "set displaced-stepping" is "on" (as opposed to "auto), GDB warns displaced stepping failed ("on" is mainly useful for the testsuite, not for users). Tested on x86_64 Fedora 20. gdb/ChangeLog: 2015-08-07 Pedro Alves <palves@redhat.com> * inferior.h (struct inferior) <displaced_stepping_failed>: New field. * infrun.c (use_displaced_stepping_now_p): New parameter 'inf'. Return false if dispaced stepping failed before. (resume): Pass the current inferior to use_displaced_stepping_now_p. Wrap displaced_step_prepare in TRY/CATCH. If we get a MEMORY_ERROR, set the inferior's displaced_stepping_failed flag, and fall back to an in-line step-over. gdb/testsuite/ChangeLog: 2015-08-07 Pedro Alves <palves@redhat.com> * gdb.base/valgrind-disp-step.c: New file. * gdb.base/valgrind-disp-step.exp: New file.
2015-08-07Fix step-over-{trips-on-watchpoint|lands-on-breakpoint}.exp racePedro Alves5-22/+42
On a target that is both always in non-stop mode and can do displaced stepping (such as native x86_64 GNU/Linux, with "maint set target-non-stop on"), the step-over-trips-on-watchpoint.exp test sometimes fails like this: (gdb) PASS: gdb.threads/step-over-trips-on-watchpoint.exp: no thread-specific bp: step: thread 1 set scheduler-locking off (gdb) PASS: gdb.threads/step-over-trips-on-watchpoint.exp: no thread-specific bp: step: set scheduler-locking off step -[Switching to Thread 0x7ffff7fc0700 (LWP 11782)] -Hardware watchpoint 4: watch_me - -Old value = 0 -New value = 1 -child_function (arg=0x0) at /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.c:39 -39 other = 1; /* set thread-specific breakpoint here */ -(gdb) PASS: gdb.threads/step-over-trips-on-watchpoint.exp: no thread-specific bp: step: step +wait_threads () at /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.threads/step-over-trips-on-watchpoint.c:49 +49 return 1; /* in wait_threads */ +(gdb) FAIL: gdb.threads/step-over-trips-on-watchpoint.exp: no thread-specific bp: step: step Note "scheduler-locking" was set off. The problem is that on such targets, the step-over of thread 2 and the "step" of thread 1 can be set to run simultaneously (since with displaced stepping the breakpoint isn't ever removed from the target), and sometimes, the "step" of thread 1 finishes first, so it'd take another resume to see the watchpoint trigger. Fix this by replacing the wait_threads function with a one-line infinite loop that doesn't call any function, so that the "step" of thread 1 never finishes. gdb/testsuite/ChangeLog: 2015-08-07 Pedro Alves <palves@redhat.com> * gdb.threads/step-over-lands-on-breakpoint.c (wait_threads): Delete function. (main): Add alarm. Run an infinite loop instead of calling wait_threads. * gdb.threads/step-over-lands-on-breakpoint.exp (do_test): Change comment. * gdb.threads/step-over-trips-on-watchpoint.c (wait_threads): Delete function. (main): Add alarm. Run an infinite loop instead of calling wait_threads. * gdb.threads/step-over-trips-on-watchpoint.exp (do_test): Change comment.
2015-08-07Fix interrupt-noterm.exp on targets always in non-stopPedro Alves14-48/+174
With "maint set target-non-stop on" we get: @@ -66,13 +66,16 @@ Continuing. interrupt (gdb) PASS: gdb.base/interrupt-noterm.exp: interrupt -Program received signal SIGINT, Interrupt. -PASS: gdb.base/interrupt-noterm.exp: inferior received SIGINT -testcase src/gdb/testsuite/gdb.base/interrupt-noterm.exp completed in 0 seconds +[process 12119] #1 stopped. +0x0000003615ebc6d0 in __nanosleep_nocancel () at ../sysdeps/unix/syscall-template.S:81 +81 T_PSEUDO (SYSCALL_SYMBOL, SYSCALL_NAME, SYSCALL_NARGS) +FAIL: gdb.base/interrupt-noterm.exp: inferior received SIGINT (timeout) +testcase src/gdb/testsuite/gdb.base/interrupt-noterm.exp completed in 10 seconds That is, we get "[$thread] #1 stopped" instead of SIGINT. The issue is that we don't currently distinguish send "interrupt/ctrl-c" to target terminal vs "stop/pause" thread well; both cases go through "target_stop". And then, the native Linux backend (linux-nat.c) implements target_stop with SIGSTOP in non-stop mode, and SIGINT in all-stop mode. Since "maint set target-non-stop on" forces the backend to be always running in non-stop mode, even though the user-visible behavior is "set non-stop" is "off", "interrupt" causes a SIGSTOP instead of the SIGINT the test expects. Fix this by introducing a target_interrupt method to use in the "interrupt/ctrl-c" case, so "set non-stop off" can always work the same irrespective of "maint set target-non-stop on/off". I'm explictly considering changing the "set non-stop on" behavior as out of scope here. Most of the patch is an across-the-board rename of to_stop hook implementations to to_interrupt. The only targets where something more than a rename is being done are linux-nat.c and remote.c, which are the only targets that support async, and thus are the only ones the core side calls target_stop on. gdb/ChangeLog: 2015-08-07 Pedro Alves <palves@redhat.com> * darwin-nat.c (darwin_stop): Rename to ... (darwin_interrupt): ... this. (_initialize_darwin_inferior): Adjust. * gnu-nat.c (gnu_stop): Delete. (gnu_target): Don't install gnu_stop. * inf-ptrace.c (inf_ptrace_stop): Rename to ... (inf_ptrace_interrupt): ... this. (inf_ptrace_target): Adjust. * infcmd.c (interrupt_target_1): Use target_interrupt instead of target_stop. * linux-nat (linux_nat_stop): Rename to ... (linux_nat_interrupt): ... this. (linux_nat_stop): Reimplement. (linux_nat_add_target): Install linux_nat_interrupt. * nto-procfs.c (nto_interrupt_twice): Rename to ... (nto_handle_sigint_twice): ... this. (nto_interrupt): Rename to ... (nto_handle_sigint): ... this. Call target_interrupt instead of target_stop. (procfs_wait): Adjust. (procfs_stop): Rename to ... (procfs_interrupt): ... this. (init_procfs_targets): Adjust. * procfs.c (procfs_stop): Rename to ... (procfs_interrupt): ... this. (procfs_target): Adjust. * remote-m32r-sdi.c (m32r_stop): Rename to ... (m32r_interrupt): ... this. (init_m32r_ops): Adjust. * remote-sim.c (gdbsim_stop_inferior): Rename to ... (gdbsim_interrupt_inferior): ... this. (gdbsim_stop): Rename to ... (gdbsim_interrupt): ... this. (gdbsim_cntrl_c): Adjust. (init_gdbsim_ops): Adjust. * remote.c (sync_remote_interrupt): Adjust comments. (remote_stop_as): Rename to ... (remote_interrupt_as): ... this. (remote_stop): Adjust comment. (remote_interrupt): New function. (init_remote_ops): Install remote_interrupt. * target.c (target_interrupt): New function. * target.h (struct target_ops) <to_interrupt>: New field. (target_interrupt): New declaration. * windows-nat.c (windows_stop): Rename to ... (windows_interrupt): ... this. * target-delegates.c: Regenerate.
2015-08-07Fix signal-while-stepping-over-bp-other-thread.exp on targets always in non-stopPedro Alves2-1/+6
With "maint set target-non-stop on" we get: -PASS: gdb.threads/signal-while-stepping-over-bp-other-thread.exp: step +FAIL: gdb.threads/signal-while-stepping-over-bp-other-thread.exp: step The issue is simply that switch_back_to_stepped_thread is not used in non-stop mode, thus infrun doesn't output the expected "switching back to stepped thread" log. gdb/testsuite/ChangeLog: 2015-08-07 Pedro Alves <palves@redhat.com> * signal-while-stepping-over-bp-other-thread.exp: Expect "restart threads" as alternative to "switching back to stepped thread".
2015-08-07Implement all-stop on top of a target running non-stop modePedro Alves11-38/+318
This finally implements user-visible all-stop mode running with the target_ops backend always in non-stop mode. This is a stepping stone towards finer-grained control of threads, being able to do interesting things like thread groups, associating groups with breakpoints, etc. From the user's perspective, all-stop mode is really just a special case of being able to stop and resume specific sets of threads, so it makes sense to do this step first. With this, even in all-stop, the target is no longer in charge of stopping all threads before reporting an event to the core -- the core takes care of it when it sees fit. For example, when "next"- or "step"-ing, we can avoid stopping and resuming all threads at each internal single-step, and instead only stop all threads when we're about to present the stop to the user. The implementation is almost straight forward, as the heavy lifting has been done already in previous patches. Basically, we replace checks for "set non-stop on/off" (the non_stop global), with calls to a new target_is_non_stop_p function. In a few places, if "set non-stop off", we stop all threads explicitly, and in a few other places we resume all threads explicitly, making use of existing methods that were added for teaching non-stop to step over breakpoints without displaced stepping. This adds a new "maint set target-non-stop on/off/auto" knob that allows both disabling the feature if we find problems, and force-enable it for development (useful when teaching a target about this. The default is "auto", which means the feature is enabled if a new target method says it should be enabled. The patch implements the method in linux-nat.c, just for illustration, because it still returns false. We'll need a few follow up fixes before turning it on by default. This is a separate target method from indicating regular non-stop support, because e.g., while e.g., native linux-nat.c is close to regression free with all-stop-non-stop (with following patches will fixing the remaining regressions), remote.c+gdbserver will still need more fixing, even though it supports "set non-stop on". Tested on x86_64 Fedora 20, native, with and without "set displaced off", and with and without "maint set target-non-stop on"; and also against gdbserver. gdb/ChangeLog: 2015-08-07 Pedro Alves <palves@redhat.com> * NEWS: Mention "maint set/show target-non-stop". * breakpoint.c (update_global_location_list): Check target_is_non_stop_p instead of non_stop. * infcmd.c (attach_command_post_wait, attach_command): Likewise. * infrun.c (show_can_use_displaced_stepping) (can_use_displaced_stepping_p, start_step_over_inferior): Likewise. (internal_resume_ptid): New function. (resume): Use it. (proceed): Check target_is_non_stop_p instead of non_stop. If in all-stop mode but the target is always in non-stop mode, start all the other threads that are implicitly resumed too. (for_each_just_stopped_thread, fetch_inferior_event) (adjust_pc_after_break, stop_all_threads): Check target_is_non_stop_p instead of non_stop. (handle_inferior_event): Likewise. Handle detach-fork in all-stop with the target always in non-stop mode. (handle_signal_stop) <random signal>: Check target_is_non_stop_p instead of non_stop. (switch_back_to_stepped_thread): Check target_is_non_stop_p instead of non_stop. (keep_going_stepped_thread): Use internal_resume_ptid. (stop_waiting): If in all-stop mode, and the target is in non-stop mode, stop all threads. (keep_going_pass): Likewise, when starting a new in-line step-over sequence. * linux-nat.c (get_pending_status, select_event_lwp) (linux_nat_filter_event, linux_nat_wait_1, linux_nat_wait): Check target_is_non_stop_p instead of non_stop. (linux_nat_always_non_stop_p): New function. (linux_nat_stop): Check target_is_non_stop_p instead of non_stop. (linux_nat_add_target): Install linux_nat_always_non_stop_p. * target-delegates.c: Regenerate. * target.c (target_is_non_stop_p): New function. (target_non_stop_enabled, target_non_stop_enabled_1): New globals. (maint_set_target_non_stop_command) (maint_show_target_non_stop_command): New functions. (_initilize_target): Install "maint set/show target-non-stop" commands. * target.h (struct target_ops) <to_always_non_stop_p>: New field. (target_non_stop_enabled): New declaration. (target_is_non_stop_p): New declaration. gdb/doc/ChangeLog: 2015-08-07 Pedro Alves <palves@redhat.com> * gdb.texinfo (Maintenance Commands): Document "maint set/show target-non-stop".