aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2019-09-19Automatic date update in version.inGDB Administrator1-1/+1
2019-09-19[gdb/testsuite] Fix gdb_target_cmdTom de Vries2-2/+6
In commit 81dc3ab594 "[gdb/testsuite] Handle unreachable network in server-connect.exp" a regression was introduced in gdb_target_cmd, causing ERRORs like this: ... ERROR: tcl error sourcing src/gdb/testsuite/gdb.server/abspath.exp. ERROR: wrong # args: should be "gdb_target_cmd {$args}" while executing "gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport" ... Fix the argument passing in gdb_target_cmd. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-09-19 Tom de Vries <tdevries@suse.de> * lib/gdbserver-support.exp (gdb_target_cmd): Fix argument passing.
2019-09-19[gdb/testsuite] Handle unreachable network in server-connect.expTom de Vries3-5/+26
When running gdb.server/server-connect.exp I run into: ... FAIL: gdb.server/server-connect.exp: tcp6: connect to gdbserver using tcp6:::1 FAIL: gdb.server/server-connect.exp: tcp6-with-brackets: connect to gdbserver \ using tcp6:[::1] FAIL: gdb.server/server-connect.exp: udp6: connect to gdbserver using udp6:::1 FAIL: gdb.server/server-connect.exp: udp6-with-brackets: connect to gdbserver \ using udp6:[::1] ... The FAIL is caused by the fact that the ipv6 loopback address is not available: ... PASS: gdb.server/server-connect.exp: tcp6: start gdbserver target remote tcp6:::1:2347^M A program is being debugged already. Kill it? (y or n) y^M tcp6:::1:2347: Network is unreachable.^M (gdb) FAIL: gdb.server/server-connect.exp: tcp6: connect to gdbserver using tcp6:::1 ... This should be marked UNSUPPORTED rather than FAIL. Furthermore, the test-case takes about 4 minutes, because the 'Network is unreachable' response is not explicitly handled in gdb_target_cmd, so instead it runs into the timeout case. Fix this by handling the 'Network is unreachable' response as UNSUPPORTED. This reduces testing time from 4 minutes to about 2 seconds. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-09-19 Tom de Vries <tdevries@suse.de> * lib/gdbserver-support.exp (gdb_target_cmd_ext): Return 2 (meaning UNSUPPORTED) for 'Network is unreachable' message. Factor out of ... (gdb_target_cmd): ... here. * gdb.server/server-connect.exp: Use gdb_target_cmd_ext, handle return value 2.
2019-09-18Update ChangeLog entry of commit 677052f2a5c67f1d9b2e6d1b2a2149b5f0c20cd0...Joel Brobecker1-0/+1
... to include PR breakpoints/24541 (for documentation purposes). For the reader's convenience, the commit in question was the following: commit 677052f2a5c67f1d9b2e6d1b2a2149b5f0c20cd0 Author: Sergio Durigan Junior <sergiodj@redhat.com> Date: Thu May 16 16:23:24 2019 -0400 Subject: Make stap-probe.c:stap_parse_register_operand's "regname" an std::string
2019-09-18Give a name to the TUI SingleKey keymapTom Tromey5-3/+30
Readline 8.0 has a feature that lets an application name a keymap. This in turn makes it simpler for users to bind keys in keymaps in their .inputrc. This patch gives a name to the TUI SingleKey keymap, so that additional bindings can be made there. For example: $if gdb set keymap SingleKey "X": "echo hello\\n\n" $endif The call to rl_initialize, in tui_initialize_readline, had to be removed so that .inputrc was not read too early. Note that Readline explicitly documents that this call is not needed. gdb/ChangeLog 2019-09-18 Tom Tromey <tom@tromey.com> * NEWS: Add entry. * tui/tui.c (tui_initialize_readline): Set name of keymap. Do not call rl_initialize. (tui_enable): Do not call rl_initialize. gdb/doc/ChangeLog 2019-09-18 Tom Tromey <tom@tromey.com> * gdb.texinfo (Editing): Document readline application name. (TUI Single Key Mode): Document TUI SingleKey keymap name.
2019-09-18gdb: Fix native build on Linux/Alpha.Christian Groessler2-0/+5
Fixes: CXX alpha-linux-nat.o alpha-linux-nat.c: In member function 'virtual CORE_ADDR alpha_linux_nat_target::register_u_offset(gdbarch*, int, int)': alpha-linux-nat.c:93:16: error: 'gdbarch_pc_regnum' was not declared in this scope if (regno == gdbarch_pc_regnum (gdbarch)) ^~~~~~~~~~~~~~~~~ alpha-linux-nat.c:93:16: note: suggested alternative: 'gdbarch_info' if (regno == gdbarch_pc_regnum (gdbarch)) ^~~~~~~~~~~~~~~~~ gdbarch_info alpha-linux-nat.c:97:15: error: 'gdbarch_fp0_regnum' was not declared in this scope if (regno < gdbarch_fp0_regnum (gdbarch)) ^~~~~~~~~~~~~~~~~~ alpha-linux-nat.c:97:15: note: suggested alternative: 'gdbarch_info' if (regno < gdbarch_fp0_regnum (gdbarch)) ^~~~~~~~~~~~~~~~~~ gdbarch_info make[2]: *** [Makefile:1638: alpha-linux-nat.o] Error 1 make[2]: Leaving directory '/home/chris/tmp/binutils-gdb/gdb' 2019-09-12 Christian Groessler <chris@groessler.org> * alpha-linux-nat.c: Include gdbarch.h.
2019-09-18gdb: remove local extern declaration of cli_stylingSimon Marchi2-2/+6
Following the int -> bool conversion of boolean options (commit 491144b5e21b ("Change boolean options to bool instead of int")), I see this ASAN error: ==357543==ERROR: AddressSanitizer: global-buffer-overflow on address 0x55555b25d440 at pc 0x5555583ce9e1 bp 0x7fffffffd390 sp 0x7fffffffd380 READ of size 4 at 0x55555b25d440 thread T0 #0 0x5555583ce9e0 in term_cli_styling /home/simark/src/binutils-gdb/gdb/ui-file.c:111 #1 0x5555583cf8b0 in stdio_file::can_emit_style_escape() /home/simark/src/binutils-gdb/gdb/ui-file.c:308 #2 0x5555584450d2 in set_output_style /home/simark/src/binutils-gdb/gdb/utils.c:1442 #3 0x5555584491af in fprintf_styled(ui_file*, ui_file_style const&, char const*, ...) /home/simark/src/binutils-gdb/gdb/utils.c:2143 #4 0x5555582fa13c in print_gdb_version(ui_file*, bool) /home/simark/src/binutils-gdb/gdb/top.c:1339 #5 0x555557b723ab in captured_main_1 /home/simark/src/binutils-gdb/gdb/main.c:981 #6 0x555557b7353b in captured_main /home/simark/src/binutils-gdb/gdb/main.c:1172 #7 0x555557b735d0 in gdb_main(captured_main_args*) /home/simark/src/binutils-gdb/gdb/main.c:1197 #8 0x55555700a53d in main /home/simark/src/binutils-gdb/gdb/gdb.c:32 #9 0x7ffff64c9ee2 in __libc_start_main (/usr/lib/libc.so.6+0x26ee2) #10 0x55555700a30d in _start (/home/simark/build/binutils-gdb/gdb/gdb+0x1ab630d) 0x55555b25d441 is located 0 bytes to the right of global variable 'cli_styling' defined in '/home/simark/src/binutils-gdb/gdb/cli/cli-style.c:31:6' (0x55555b25d440) of size 1 The reason of this is that we have this declaration of cli_styling in cli/cli-style.h: extern bool cli_styling; but ui-file.c uses its own local declaration: extern int cli_styling; Because of that, the code in ui-file.c thinks the variable is 4 bytes long, when it is actually 1 byte long, so the generated code reads past the variable. Fix it by removing the declaration and making ui-file.c include cli/cli-style.h. gdb/ChangeLog: * ui-file.c: Include cli/cli-style.h. (term_cli_styling): Remove cli_styling declaration.
2019-09-18gdb/testsuite: Avoid directory names in test namesAndrew Burgess2-1/+7
Give a test an actual name in order to avoid having a directory name in the .sum file. gdb/testsuite/ChangeLog: * gdb.base/source-dir.exp: Avoid having directory names in test names.
2019-09-18bfd_asymbol_* macrosAlan Modra30-99/+143
The main point of this patch is to give bfd_get_section a better name, bfd_asymbol_section. bfd/ * bfd-in.h (bfd_asymbol_section): Rename from bfd_get_section. (bfd_get_output_section): Delete. (bfd_asymbol_base): Delete. (bfd_asymbol_section, bfd_asymbol_value, bfd_asymbol_name), (bfd_asymbol_bfd, bfd_asymbol_flavour): Tidy. (bfd_set_asymbol_name): New macro. * bfd-in2.h: Regenerate. * aout-cris.c: Update throughout to use bfd_asymbol_section. * aoutx.h: Likewise. * cofflink.c: Likewise. * dwarf2.c: Likewise. * ecoff.c: Likewise. * elf.c: Likewise. * elf32-arm.c: Likewise. * elf32-mips.c: Likewise. * elf32-score.c: Likewise. * elf32-score7.c: Likewise. * elfn32-mips.c: Likewise. * elfnn-aarch64.c: Likewise. * elfxx-mips.c: Likewise. * linker.c: Likewise. * pdp11.c: Likewise. * elf64-mmix.c (mmix_elf_reloc): Expand bfd_get_output_section. binutils/ * nm.c: Update bfd_get_section to bfd_asymbol_section throughout. * objcopy.c: Likewise. * objdump.c: Likewise. * rdcoff.c: Likewise. * objcopy.c (create_new_symbol): Use bfd_set_asymbol_name. (filter_symbols): Likewise. gas/ * symbols.c (S_IS_LOCAL): Update bfd_get_section to bfd_asymbol_section. gdb/ * arm-tdep.c (arm_record_special_symbol): Update bfd_get_section to bfd_asymbol_section. ld/ * ldcref.c (check_reloc_refs): Update bfd_get_section to bfd_asymbol_section.
2019-09-18binutils: doc: make `make clean` clean more thingsSimon Marchi3-6/+9
There is a bunch of things left over after a `make clean` in the doc directory. This patch changes the Makefile so that everything built by make is cleaned: - man pages (the man_MANS variable) - cxxfilt.man - binutils.info I am not sure why the last one was in MAINTAINERCLEANFILES. It's generated from binutils.texi using makeinfo, and it's not particularly long to build, so I don't see why it shouldn't be cleaned like the other files. Note: with my automake 1,15.1 (built from source), I get a spurious diff in Makefile.in, where the runstatedir = @runstatedir@ line gets removed. I am not sure why, but I haven't included it. binutils/ChangeLog: * doc/Makefile.am (MOSTLYCLEANFILES): Clean all man pages, cxxfilt.man and binutils.info. (MAINTAINERCLEANFILES): Remove. * doc/Makefile.in: Re-generate.
2019-09-18binutils: doc: remove binutils_TEXINFOS usagesSimon Marchi3-30/+35
This variable doesn't exist (it evaluates to nothing). It was introduced in commit 42ecbf5edab08ee88b37d9fbd8542f5f25ce51ae Author: Daniel Jacobowitz <drow@false.org> Date: Sun May 15 18:19:45 2005 +0000 And removed in commit c428fa83c21769fafedcebb7b4a381c6ca24f998 Author: H.J. Lu <hjl.tools@gmail.com> Date: Thu Mar 15 14:17:20 2007 +0000 Note: with my automake 1,15.1 (built from source), I get a spurious diff in Makefile.in, where the runstatedir = @runstatedir@ line gets removed. I am not sure why, but I haven't included it. binutils/ChangeLog: * doc/Makefile.am: Remove references to binutils_TEXINFOS. * doc/Makefile.in: Re-generate.
2019-09-18binutils: doc: remove stale things from MakefileSimon Marchi3-28/+13
The `install-data-local: install-info` part: the comment refers to when the Makefile had the cygnus option. It no longer uses that, so the info file should get installed without that rule. I verified that `make install` still installed $(prefix)/share/info/binutils.info. The `DISTCLEANFILES` part: the comment talks about Automake 1.9, we are using 1.15.1, which doesn't appear to have this problem. binutils.info is built fine without this snippet. Note: with my automake 1,15.1 (built from source), I get a spurious diff in Makefile.in, where the runstatedir = @runstatedir@ line gets removed. I am not sure why, but I haven't included it. binutils/ChangeLog: * doc/Makefile.am (install-data-loca): Remove target. (DISTCLEANFILES): Remove variable. * doc/Makefile.in: Re-generate.
2019-09-18Re-generate many configure and Makefile.in filesSimon Marchi23-131/+80
I get some spurious changes when running autoconf/automake for various projects in the tree. This is likely because they were generated using distro-patched tools last time. I ran `autoreconf -f` in the various automake projects of the binutils-gdb tree, and this is the result. The tools I am using have been compiled from source, from the upstream release. bfd/ChangeLog: * Makefile.in: Re-generate. * configure: Re-generate. * doc/Makefile.in: Re-generate. binutils/ChangeLog: * Makefile.in: Re-generate. * configure: Re-generate. * doc/Makefile.in: Re-generate. gas/ChangeLog: * Makefile.in: Re-generate. * configure: Re-generate. * doc/Makefile.in: Re-generate. gold/ChangeLog: * testsuite/Makefile.in: Re-generate. gprof/ChangeLog: * Makefile.in: Re-generate. * configure: Re-generate. ld/ChangeLog: * Makefile.in: Re-generate. * configure: Re-generate. opcodes/ChangeLog: * Makefile.in: Re-generate. * configure: Re-generate.
2019-09-18Don't use bfd_get_* macro to set bfd fieldsAlan Modra22-63/+103
* aoutx.h (slurp_symbol_table): Don't set symcount using bfd_get macros. * pdp11.c (slurp_symbol_table): Likewise. * som.c (som_slurp_symbol_table): Likewise. * coff-ppc.c (ppc_bfd_coff_final_link): Likewise. * coffcode.h (coff_slurp_symbol_table): Likewise. * cofflink.c (_bfd_coff_final_link): Likewise. * ecoff.c (ecoff_slurp_symbolic_header): Likewise. (_bfd_ecoff_slurp_symbolic_info): Likewise. (_bfd_ecoff_slurp_symbol_table): Likewise. (_bfd_ecoff_bfd_final_link): Likewise. * elf.c (_bfd_elf_canonicalize_symtab): Likewise. * elflink.c (elf_link_output_symstrtab): Likewise. (bfd_elf_final_link): Likewise. * peicode.h (pe_ILF_build_a_bfd): Likewise. * xcofflink.c (_bfd_xcoff_bfd_final_link): Likewise. * aoutx.h (some_aout_object_p, slurp_symbol_table): Don't set start_address or symcount using bfd_get macros. * coffgen.c (coff_real_object_p): Likewise. * pdp11.c (some_aout_object_p, slurp_symbol_table): Likewise. * som.c (som_object_setup, som_slurp_symbol_table): Likewise. * elfcore.h (elf_core_file_p): Don't set start_address using bfd_get macro. * elf.c (_bfd_elf_canonicalize_dynamic_symtab): Don't set dynsymcount using bfd_get macro. * bfd.c (bfd_set_file_flags): Don't set flags using bfd_get macro. * linker.c (bfd_generic_link_read_symbols): Don't set outsymbols or symcount using bfd_get macros. (_bfd_generic_final_link, generic_add_output_symbol): Likewise. * syms.c (bfd_set_symtab): Likewise. * vms-alpha.c (alpha_vms_bfd_final_link): Likewise. * archive.c (do_slurp_bsd_armap): Don't set has_armap using bfd_has_map macro. (do_slurp_coff_armap, bfd_slurp_armap): Likewise. * archive64.c (_bfd_archive_64_bit_slurp_armap): Likewise. * coff-rs6000.c (_bfd_xcoff_slurp_armap): Likewise. * coff64-rs6000.c (xcoff64_slurp_armap): Likewise. * ecoff.c (_bfd_ecoff_slurp_armap): Likewise. * som.c (som_slurp_armap): Likewise.
2019-09-18Constify bfd_octets_per_byte and related functionsAlan Modra3-15/+22
* archures.c (bfd_get_arch): Make param const. (bfd_get_mach, bfd_arch_bits_per_byte): Likewise. (bfd_arch_bits_per_address, bfd_octets_per_byte): Likewise. * bfd-in2.h: Regenerate.
2019-09-18Constify target name, reloc name, and carsym nameAlan Modra13-23/+47
bfd/ * bfd-in.h (carsym.name): Make const. * reloc.c (struct reloc_howto_struct.name): Likewise. * targets.c (bfd_target.name): Likewise.! * bfd.c (bfd_get_sign_extend_vma): Make variable const. * som.c (som_bfd_fill_in_ar_symbols): Use an intermediary variable when setting carsym.name. * bfd-in2.h: Regenerate. gdb/ * amd64-dicos-tdep.c (amd64_dicos_osabi_sniffer): Constify target. * i386-cygwin-tdep.c (i386_cygwin_init_abi): Likewise. * i386-dicos-tdep.c (i386_dicos_osabi_sniffer): Likewise. ld/ * ldlang.c (stricpy, strcut, name_compare): Constify params. (get_first_input_target): Make return and "target" const.
2019-09-18Use bfd_set_filename moreAlan Modra9-30/+66
Fixes a few leaks in bfd and ld. bfd/ * mach-o.c (bfd_mach_o_fat_member_init): Likewise. Replace xstrdup and xmalloc with bfd_strdup and bfd_malloc. Return an error status. Adjust calls. * vms-lib.c (_bfd_vms_lib_get_module): Test mhd->id earlier. Close bfd on failure. Replace xstrdup/bfd_alloc use with bfd_malloc. Use bfd_set_filename. gdb/ * solib-spu.c (spu_bfd_open): Use bfd_set_filename. * spu-linux-nat.c (spu_bfd_open): Likewise. ld/ * emultempl/pe.em (after_open): Use bfd_set_filename. * emultempl/pep.em (after_open): Use bfd_set_filename.
2019-09-18PowerPC64, support medium model access to common symbolsAlan Modra2-7/+48
Some versions of clang apparently generate non-PIC on powerpc64le to access common symbols. Since a common symbol and a strong definition with the same name should resolve to the strong definition we have the possibility of non-PIC attempting to access shared library variables. This is really a clanger since powerpc64le is supposed to be PIC by default, but let's see if ld can cope by generating .dynbss copies. * elf64-ppc.c (must_be_dyn_reloc): Return 0 for TOC16 relocs. (ppc64_elf_check_relocs): Support dynamic/copy relocs for TOC16. (ppc64_elf_adjust_dynamic_symbol): Don't keep dynamic reloc when needs_copy even if all relocs are in rw sections. (dec_dynrel_count): Handle TOC16 relocs. (ppc64_elf_relocate_section): Support dynamic relocs for TOC16. (ppc64_elf_finish_dynamic_symbol): Adjust to handle needs_copy semantic change.
2019-09-18Make extern declaration of dwarf_always_disassemble correctChristian Biesinger2-1/+6
This was an oversight in 491144b5e21bbfd41969c175aebb663976f59058; dwarf2loc.c has an extern definition for dwarf_always_disassemble that I missed. This patch updates it from int to bool to match the definition in dwarf2read.c. gdb/ChangeLog: 2019-09-18 Christian Biesinger <cbiesinger@google.com> * dwarf2loc.c: Change extern declaration of dwarf_always_disassemble to bool to match definition in dwarf2read.c.
2019-09-17RISC-V: Gate opcode tables by enum rather than string.Jim Wilson6-668/+716
Generalize opcode arch dependencies so that we can support the overlapping B extension Zb* subsets. 2019-09-17 Maxim Blinov <maxim.blinov@embecosm.com> gas/ * config/tc-riscv.c (riscv_multi_subset_supports): Handle insn_class enum rather than subset char string. (riscv_ip): Update call to riscv_multi_subset_supports. include/ * opcode/riscv.h (riscv_insn_class): New enum. * opcode/riscv.h (struct riscv_opcode): Change subset field to insn_class field. opcodes/ * riscv-opc.c (riscv_opcodes): Change subset field to insn_class field for all instructions. (riscv_insn_types): Likewise.
2019-09-18Change boolean options to bool instead of intChristian Biesinger115-304/+563
This is for add_setshow_boolean_cmd as well as the gdb::option interface. gdb/ChangeLog: 2019-09-17 Christian Biesinger <cbiesinger@google.com> * ada-lang.c (ada_ignore_descriptive_types_p): Change to bool. (print_signatures): Likewise. (trust_pad_over_xvs): Likewise. * arch/aarch64-insn.c (aarch64_debug): Likewise. * arch/aarch64-insn.h (aarch64_debug): Likewise. * arm-linux-nat.c (arm_apcs_32): Likewise. * arm-linux-tdep.c (arm_apcs_32): Likewise. * arm-nbsd-nat.c (arm_apcs_32): Likewise. * arm-tdep.c (arm_debug): Likewise. (arm_apcs_32): Likewise. * auto-load.c (debug_auto_load): Likewise. (auto_load_gdb_scripts): Likewise. (global_auto_load): Likewise. (auto_load_local_gdbinit): Likewise. (auto_load_local_gdbinit_loaded): Likewise. * auto-load.h (global_auto_load): Likewise. (auto_load_local_gdbinit): Likewise. (auto_load_local_gdbinit_loaded): Likewise. * breakpoint.c (disconnected_dprintf): Likewise. (breakpoint_proceeded): Likewise. (automatic_hardware_breakpoints): Likewise. (always_inserted_mode): Likewise. (target_exact_watchpoints): Likewise. (_initialize_breakpoint): Update. * breakpoint.h (target_exact_watchpoints): Change to bool. * btrace.c (maint_btrace_pt_skip_pad): Likewise. * cli/cli-cmds.c (trace_commands): Likewise. * cli/cli-cmds.h (trace_commands): Likewise. * cli/cli-decode.c (add_setshow_boolean_cmd): Change int* argument to bool*. * cli/cli-logging.c (logging_overwrite): Change to bool. (logging_redirect): Likewise. (debug_redirect): Likewise. * cli/cli-option.h (option_def) <boolean>: Change return type to bool*. (struct boolean_option_def) <get_var_address_cb_>: Change return type to bool. <boolean_option_def>: Update. (struct flag_option_def): Change default type of Context to bool from int. <flag_option_def>: Change return type of var_address_cb_ to bool*. * cli/cli-setshow.c (do_set_command): Cast to bool* instead of int*. (get_setshow_command_value_string): Likewise. * cli/cli-style.c (cli_styling): Change to bool. (source_styling): Likewise. * cli/cli-style.h (source_styling): Likewise. (cli_styling): Likewise. * cli/cli-utils.h (struct qcs_flags) <quiet, cont, silent>: Change to bool. * command.h (var_types): Update comment. (add_setshow_boolean_cmd): Change int* var argument to bool*. * compile/compile-cplus-types.c (debug_compile_cplus_types): Change to bool. (debug_compile_cplus_scopes): Likewise. * compile/compile-internal.h (compile_debug): Likewise. * compile/compile.c (compile_debug): Likewise. (struct compile_options) <raw>: Likewise. * cp-support.c (catch_demangler_crashes): Likewise. * cris-tdep.c (usr_cmd_cris_version_valid): Likewise. (usr_cmd_cris_dwarf2_cfi): Likewise. * csky-tdep.c (csky_debug): Likewise. * darwin-nat.c (enable_mach_exceptions): Likewise. * dcache.c (dcache_enabled_p): Likewise. * defs.h (info_verbose): Likewise. * demangle.c (demangle): Likewise. (asm_demangle): Likewise. * dwarf-index-cache.c (debug_index_cache): Likewise. * dwarf2-frame.c (dwarf2_frame_unwinders_enabled_p): Likewise. * dwarf2-frame.h (dwarf2_frame_unwinders_enabled_p): Likewise. * dwarf2read.c (check_physname): Likewise. (use_deprecated_index_sections): Likewise. (dwarf_always_disassemble): Likewise. * eval.c (overload_resolution): Likewise. * event-top.c (set_editing_cmd_var): Likewise. (exec_done_display_p): Likewise. * event-top.h (set_editing_cmd_var): Likewise. (exec_done_display_p): Likewise. * exec.c (write_files): Likewise. * fbsd-nat.c (debug_fbsd_lwp): Likewise (debug_fbsd_nat): Likewise. * frame.h (struct frame_print_options) <print_raw_frame_arguments>: Likewise. (struct set_backtrace_options) <backtrace_past_main>: Likewise. <backtrace_past_entry> Likewise. * gdb-demangle.h (demangle): Likewise. (asm_demangle): Likewise. * gdb_bfd.c (bfd_sharing): Likewise. * gdbcore.h (write_files): Likewise. * gdbsupport/common-debug.c (show_debug_regs): Likewise. * gdbsupport/common-debug.h (show_debug_regs): Likewise. * gdbthread.h (print_thread_events): Likewise. * gdbtypes.c (opaque_type_resolution): Likewise. (strict_type_checking): Likewise. * gnu-nat.c (gnu_debug_flag): Likewise. * guile/scm-auto-load.c (auto_load_guile_scripts): Likewise. * guile/scm-param.c (pascm_variable): Add boolval. (add_setshow_generic): Update. (pascm_param_value): Update. (pascm_set_param_value_x): Update. * hppa-tdep.c (hppa_debug): Change to bool.. * infcall.c (may_call_functions_p): Likewise. (coerce_float_to_double_p): Likewise. (unwind_on_signal_p): Likewise. (unwind_on_terminating_exception_p): Likewise. * infcmd.c (startup_with_shell): Likewise. * inferior.c (print_inferior_events): Likewise. * inferior.h (startup_with_shell): Likewise. (print_inferior_events): Likewise. * infrun.c (step_stop_if_no_debug): Likewise. (detach_fork): Likewise. (debug_displaced): Likewise. (disable_randomization): Likewise. (non_stop): Likewise. (non_stop_1): Likewise. (observer_mode): Likewise. (observer_mode_1): Likewise. (set_observer_mode): Update. (sched_multi): Change to bool. * infrun.h (debug_displaced): Likewise. (sched_multi): Likewise. (step_stop_if_no_debug): Likewise. (non_stop): Likewise. (disable_randomization): Likewise. * linux-tdep.c (use_coredump_filter): Likewise. (dump_excluded_mappings): Likewise. * linux-thread-db.c (auto_load_thread_db): Likewise. (check_thread_db_on_load): Likewise. * main.c (captured_main_1): Update. * maint-test-options.c (struct test_options_opts) <flag_opt, xx1_opt, xx2_opt, boolean_opt>: Change to bool. * maint-test-settings.c (maintenance_test_settings_boolean): Likewise. * maint.c (maintenance_profile_p): Likewise. (per_command_time): Likewise. (per_command_space): Likewise. (per_command_symtab): Likewise. * memattr.c (inaccessible_by_default): Likewise. * mi/mi-main.c (mi_async): Likewise. (mi_async_1): Likewise. * mips-tdep.c (mips64_transfers_32bit_regs_p): Likewise. * nat/fork-inferior.h (startup_with_shell): Likewise. * nat/linux-namespaces.c (debug_linux_namespaces): Likewise. * nat/linux-namespaces.h (debug_linux_namespaces): Likewise. * nios2-tdep.c (nios2_debug): Likewise. * or1k-tdep.c (or1k_debug): Likewise. * parse.c (parser_debug): Likewise. * parser-defs.h (parser_debug): Likewise. * printcmd.c (print_symbol_filename): Likewise. * proc-api.c (procfs_trace): Likewise. * python/py-auto-load.c (auto_load_python_scripts): Likewise. * python/py-param.c (union parmpy_variable): Add "bool boolval" field. (set_parameter_value): Update. (add_setshow_generic): Update. * python/py-value.c (copy_py_bool_obj): Change argument from int* to bool*. * python/python.c (gdbpy_parameter_value): Cast to bool* instead of int*. * ravenscar-thread.c (ravenscar_task_support): Change to bool. * record-btrace.c (record_btrace_target::store_registers): Update. * record-full.c (record_full_memory_query): Change to bool. (record_full_stop_at_limit): Likewise. * record-full.h (record_full_memory_query): Likewise. * remote-notif.c (notif_debug): Likewise. * remote-notif.h (notif_debug): Likewise. * remote.c (use_range_stepping): Likewise. (interrupt_on_connect): Likewise. (remote_break): Likewise. * ser-tcp.c (tcp_auto_retry): Likewise. * ser-unix.c (serial_hwflow): Likewise. * skip.c (debug_skip): Likewise. * solib-aix.c (solib_aix_debug): Likewise. * spu-tdep.c (spu_stop_on_load_p): Likewise. (spu_auto_flush_cache_p): Likewise. * stack.c (struct backtrace_cmd_options) <full, no_filters, hide>: Likewise. (struct info_print_options) <quiet>: Likewise. * symfile-debug.c (debug_symfile): Likewise. * symfile.c (auto_solib_add): Likewise. (separate_debug_file_debug): Likewise. * symfile.h (auto_solib_add): Likewise. (separate_debug_file_debug): Likewise. * symtab.c (basenames_may_differ): Likewise. (struct filename_partial_match_opts) <dirname, basename>: Likewise. (struct info_print_options) <quiet, exclude_minsyms>: Likewise. (struct info_types_options) <quiet>: Likewise. * symtab.h (demangle): Likewise. (basenames_may_differ): Likewise. * target-dcache.c (stack_cache_enabled_1): Likewise. (code_cache_enabled_1): Likewise. * target.c (trust_readonly): Likewise. (may_write_registers): Likewise. (may_write_memory): Likewise. (may_insert_breakpoints): Likewise. (may_insert_tracepoints): Likewise. (may_insert_fast_tracepoints): Likewise. (may_stop): Likewise. (auto_connect_native_target): Likewise. (target_stop_and_wait): Update. (target_async_permitted): Change to bool. (target_async_permitted_1): Likewise. (may_write_registers_1): Likewise. (may_write_memory_1): Likewise. (may_insert_breakpoints_1): Likewise. (may_insert_tracepoints_1): Likewise. (may_insert_fast_tracepoints_1): Likewise. (may_stop_1): Likewise. * target.h (target_async_permitted): Likewise. (may_write_registers): Likewise. (may_write_memory): Likewise. (may_insert_breakpoints): Likewise. (may_insert_tracepoints): Likewise. (may_insert_fast_tracepoints): Likewise. (may_stop): Likewise. * thread.c (struct info_threads_opts) <show_global_ids>: Likewise. (make_thread_apply_all_options_def_group): Change argument from int* to bool*. (thread_apply_all_command): Update. (print_thread_events): Change to bool. * top.c (confirm): Likewise. (command_editing_p): Likewise. (history_expansion_p): Likewise. (write_history_p): Likewise. (info_verbose): Likewise. * top.h (confirm): Likewise. (history_expansion_p): Likewise. * tracepoint.c (disconnected_tracing): Likewise. (circular_trace_buffer): Likewise. * typeprint.c (print_methods): Likewise. (print_typedefs): Likewise. * utils.c (debug_timestamp): Likewise. (sevenbit_strings): Likewise. (pagination_enabled): Likewise. * utils.h (sevenbit_strings): Likewise. (pagination_enabled): Likewise. * valops.c (overload_resolution): Likewise. * valprint.h (struct value_print_options) <prettyformat_arrays, prettyformat_structs, vtblprint, unionprint, addressprint, objectprint, stop_print_at_null, print_array_indexes, deref_ref, static_field_print, pascal_static_field_print, raw, summary, symbol_print, finish_print>: Likewise. * windows-nat.c (new_console): Likewise. (cygwin_exceptions): Likewise. (new_group): Likewise. (debug_exec): Likewise. (debug_events): Likewise. (debug_memory): Likewise. (debug_exceptions): Likewise. (useshell): Likewise. * windows-tdep.c (maint_display_all_tib): Likewise. * xml-support.c (debug_xml): Likewise.
2019-09-18Automatic date update in version.inGDB Administrator1-1/+1
2019-09-17gdb: Look for compilation directory relative to directory search pathMike Gulick7-42/+343
The 'directory' command allows the user to provide a list of filesystem directories in which to search for source code. The directories in this search path are used as the base directory for the source filename from the debug information (DW_AT_name). Thus the directory search path provides alternatives to the existing compilation directory from the debug information (DW_AT_comp_dir). Generally speaking, DW_AT_name stores the filename argument passed to the compiler (including any directory components), and DW_AT_comp_dir stores the current working directory from which the compiler was executed. For example: $ cd /path/to/project/subdir1 $ gcc -c a/test.c -g The corresponding debug information will look like this: DW_AT_name : a/test.c DW_AT_comp_dir : /path/to/project/subdir1 When compiling with the -fdebug-prefix-map GCC option, the compilation directory can be arbitrarily rewritten. In the above example, we may rewrite the compilation directory as follows: $ gcc -c a/test.c -g -fdebug-prefix-map=/path/to/project= In this case, the corresponding debug information will look like: DW_AT_name : a/test.c DW_AT_comp_dir : /subdir1 This prevents GDB from finding the corresponding source code based on the debug information alone. In some cases, a substitute-path command can be used to re-map a consistent prefix in the rewritten compilation directory to the real filesystem path. However, there may not be a consistent prefix remaining in the debug symbols (for example in a project that has source code in many subdirectories under the project's root), thereby requiring multiple substitute-path rules. In this case, it is easier to add the missing prefix to the directory search path via the 'directory' command. The function find_and_open_source currently searches in: SEARCH_PATH/FILENAME where SEARCH_PATH corresponds to each individual entry in the directory search path (which is guaranteed to contain the compilation directory from the debug information, as well as the current working directory). FILENAME corresponds to the source filename (DW_AT_name), which may have directory components in it. In addition, GDB searches in: SEARCH_PATH/FILE_BASENAME where FILE_BASENAME is the basename of the DW_AT_name entry. This change modifies find_and_open_source to additionally search in: SEARCH_PATH/COMP_DIR/FILENAME where COMP_DIR is the compilation directory from the debug symbols. In the example given earlier, running: (gdb) directory /path/to/project will now allow GDB to correctly locate the source code from the debug information. gdb/ChangeLog: * source.c (prepare_path_for_appending): New function. (openp): Make use of new function. (find_and_open_source): Search for the compilation directory and source file as a relative path beneath the directory search path. gdb/doc/ChangeLog: * gdb.texinfo (Source Path): Additional text to better describe how the source path directory list is used when searching for source files. gdb/testsuite/ChangeLog: * gdb.base/source-dir.exp: Add extra test for mapped compilation directory.
2019-09-17gdb: Catch exceptions when accessing source cacheAndrew Burgess4-10/+90
The source_cache::get_line_charpos function can currently throw an exception if the source file is missing, which doesn't match the expected behaviour documented in the functions header file. The documented behaviour is to return false on failure, and this is how the function appears to be used throughout GDB. I spotted this in the 'info source' command, currently for a missing source file you'll see something like this: (gdb) info source Current source file is /path/to/src/file.c Compilation directory is /path/to/build/ /path/to/src/file.c: No such file or directory. (gdb) After this patch we see this: (gdb) info source Current source file is /path/to/src/file.c Compilation directory is /path/to/build/ Source language is c. Producer is COMPILER VERSION AND FLAGS. Compiled with DWARF 2 debugging format. Does not include preprocessor macro info. We don't currently indicate that the source file can't be found, and maybe that would be something worth adding in the future. gdb/ChangeLog: * source-cache.c (source_cache::get_line_charpos): Catch exceptions and return false, this matches the behaviour documented in the header file. gdb/testsuite/ChangeLog: * gdb.base/list-missing-source.exp: New file.
2019-09-17(Ada) do not print Ada task names in quotes in "info tasks" outputJoel Brobecker2-3/+7
A recent change enhanced a couple of notifications about Ada tasks to include the task's name in addition to the task's number. That change also modified the output of the "info tasks" when printing the detailed information of one given task. I believe this change was unintentionally left over from the initial version after it was decided that quoting the task's name should not be done. This patch therefore undoes this part of the patch. gdb/ChangeLog: * ada-tasks.c (info_task): Remove quoting of the task's name. Tested on x86_64-linux, with both the official testsuite as well as AdaCore's testsuite.
2019-09-16Don't duplicate comment in symfile.c and .hChristian Biesinger2-9/+6
This just replaces the comment in the .c file with "See symfile.h.". gdb/ChangeLog: 2019-09-16 Christian Biesinger <cbiesinger@google.com> * symfile.c (auto_solib_add): Replace comment with a reference to the header file.
2019-09-17Automatic date update in version.inGDB Administrator1-1/+1
2019-09-16PR25002, ld/ldelf.c missing safe-ctype.h includeAlan Modra2-0/+6
PR 25002 * ldelf.c: Include safe-ctype.h.
2019-09-16Delete accidentally-checked in editor temporary file.Phil Blundell1-0/+0
2019-09-16Update version to 2.33.50 and regenerate configure scripts.Phil Blundell21-101/+200
2019-09-16Automatic date update in version.inGDB Administrator1-1/+1
2019-09-14Add a NEWS entry that gdb can be compiled with py3 on Windows.Christian Biesinger2-0/+7
This was fixed in commit 272044897e178835f596c96740c5a1800ec6f9fb. 2019-09-14 Christian Biesinger <cbiesinger@google.com> * NEWS: Mention that gdb can now be compiled with Python 3 on Windows.
2019-09-15Automatic date update in version.inGDB Administrator1-1/+1
2019-09-14[gdb/testsuite] Require gnatmake 8 for gdb.ada/rename_subscript_param.expTom de Vries3-0/+29
When running gdb.ada/rename_subscript_param.exp with gnatmake 7.4.1, we get: ... FAIL: gdb.ada/rename_subscript_param.exp: print rename_subscript_param_b \ before changing its value FAIL: gdb.ada/rename_subscript_param.exp: print rename_subscript_param_b \ after changing its value ... The commit last touching the test-case (afcfda091e) states: ... The test still fails with old compilers that do not properly generate debug info for this renaming: ... Fix this by requiring at least gnatmake 8 for the test-case. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-09-14 Tom de Vries <tdevries@suse.de> PR teststuite/24599 * gdb.ada/rename_subscript_param.exp: Require gnatmake 8. * lib/ada.exp (gnatmake_version_at_least): New proc.
2019-09-14Automatic date update in version.inGDB Administrator1-1/+1
2019-09-13Always add input_statement to statement_listAlan Modra2-17/+32
I think this is safer than leaving an input_statement added during open_input_bfds off the list. There are a number of places that fiddle with various lists and might be confused by an off-list statement, eg. orphan handling. * ldlang.c (new_afile): Remove add_to_list parameter. (lang_add_input_file): Update new_afile calls. (lookup_name): Splice input_statement added by new_afile into statement_list after current input_file_chain entry. (lang_process): Update comment.
2019-09-12gdb: Force use of float version of log10Andrew Burgess2-1/+7
This commit: commit aa17805fb9a3a1983a510ba425b682fba03410c2 Date: Sat Aug 31 23:44:40 2019 +0100 gdb: Have 'maint info sections' print all sections again introduced a use of log10 that took an int as a parameter. Unfortunately this was causing a compilation error on Solaris, see: https://sourceware.org/ml/gdb-patches/2019-09/msg00230.html https://sourceware.org/ml/gdb-patches/2019-09/msg00231.html because there was only a float, double, or long double version of log10, and the compiler doesn't know which to choose. This commit should resolve this issue by casting the argument to float. gdb/ChangeLog: * maint.c (maint_print_section_data::maint_print_section_data): Force use of 'float log10 (float)' by casting the argument to float.
2019-09-12gdb/testsuite: Make use of exec_has_index_section functionAndrew Burgess2-12/+5
Make use of exec_has_index_section library function rather than manually checking in the 'maintenance info sections' output. Should make no difference to the test results, just makes the code easier to read. gdb/testsuite/ChangeLog: * gdb.base/maint.exp: Use exec_has_index_section.
2019-09-12gdb: Have 'maint info sections' print all sections againAndrew Burgess4-15/+161
In this commit: commit 6eac171f0624303d944ff1a1ae4d0e3b0a63c800 Date: Fri Aug 16 00:25:14 2019 +0200 [gdb] Make maint info sections print relocated addresses A couple of things broke with the 'maintenance info sections' command, here is some before output: (gdb) maintenance info sections Exec file: `/path/to/gdb/build/gdb/testsuite/outputs/gdb.base/maint/maint', file type elf64-x86-64. [0] 0x00400238->0x00400254 at 0x00000238: .interp ALLOC LOAD READONLY DATA HAS_CONTENTS [1] 0x00400254->0x00400274 at 0x00000254: .note.ABI-tag ALLOC LOAD READONLY DATA HAS_CONTENTS [2] 0x00400274->0x00400298 at 0x00000274: .note.gnu.build-id ALLOC LOAD READONLY DATA HAS_CONTENTS [3] 0x00400298->0x004002bc at 0x00000298: .gnu.hash ALLOC LOAD READONLY DATA HAS_CONTENTS [4] 0x004002c0->0x00400380 at 0x000002c0: .dynsym ALLOC LOAD READONLY DATA HAS_CONTENTS [5] 0x00400380->0x004003e3 at 0x00000380: .dynstr ALLOC LOAD READONLY DATA HAS_CONTENTS [6] 0x004003e4->0x004003f4 at 0x000003e4: .gnu.version ALLOC LOAD READONLY DATA HAS_CONTENTS [7] 0x004003f8->0x00400418 at 0x000003f8: .gnu.version_r ALLOC LOAD READONLY DATA HAS_CONTENTS [8] 0x00400418->0x00400460 at 0x00000418: .rela.dyn ALLOC LOAD READONLY DATA HAS_CONTENTS [9] 0x00400460->0x004004c0 at 0x00000460: .rela.plt ALLOC LOAD READONLY DATA HAS_CONTENTS [10] 0x004004c0->0x004004d7 at 0x000004c0: .init ALLOC LOAD READONLY CODE HAS_CONTENTS [11] 0x004004e0->0x00400530 at 0x000004e0: .plt ALLOC LOAD READONLY CODE HAS_CONTENTS [12] 0x00400530->0x00400802 at 0x00000530: .text ALLOC LOAD READONLY CODE HAS_CONTENTS [13] 0x00400804->0x0040080d at 0x00000804: .fini ALLOC LOAD READONLY CODE HAS_CONTENTS [14] 0x00400810->0x0040084e at 0x00000810: .rodata ALLOC LOAD READONLY DATA HAS_CONTENTS [15] 0x00400850->0x004008c4 at 0x00000850: .eh_frame_hdr ALLOC LOAD READONLY DATA HAS_CONTENTS [16] 0x004008c8->0x00400ab8 at 0x000008c8: .eh_frame ALLOC LOAD READONLY DATA HAS_CONTENTS [17] 0x00600e00->0x00600e08 at 0x00000e00: .init_array ALLOC LOAD DATA HAS_CONTENTS [18] 0x00600e08->0x00600e10 at 0x00000e08: .fini_array ALLOC LOAD DATA HAS_CONTENTS [19] 0x00600e10->0x00600ff0 at 0x00000e10: .dynamic ALLOC LOAD DATA HAS_CONTENTS [20] 0x00600ff0->0x00601000 at 0x00000ff0: .got ALLOC LOAD DATA HAS_CONTENTS [21] 0x00601000->0x00601038 at 0x00001000: .got.plt ALLOC LOAD DATA HAS_CONTENTS [22] 0x00601038->0x0060103c at 0x00001038: .data ALLOC LOAD DATA HAS_CONTENTS [23] 0x00601040->0x006012c8 at 0x0000103c: .bss ALLOC [24] 0x00000000->0x0000002c at 0x0000103c: .comment READONLY HAS_CONTENTS [25] 0x00000000->0x00000060 at 0x00001068: .debug_aranges READONLY HAS_CONTENTS [26] 0x00000000->0x0000061b at 0x000010c8: .debug_info READONLY HAS_CONTENTS [27] 0x00000000->0x00000264 at 0x000016e3: .debug_abbrev READONLY HAS_CONTENTS [28] 0x00000000->0x000001e6 at 0x00001947: .debug_line READONLY HAS_CONTENTS [29] 0x00000000->0x00000487 at 0x00001b2d: .debug_str READONLY HAS_CONTENTS (gdb) And here is the output after the above commit: (gdb) maintenance info sections +maintenance info sections Exec file: `/path/to/gdb/build/gdb/testsuite/outputs/gdb.base/maint/maint', file type elf64-x86-64. 0x00400238->0x00400254 at 0x00000238: .interp ALLOC LOAD READONLY DATA HAS_CONTENTS 0x00400254->0x00400274 at 0x00000254: .note.ABI-tag ALLOC LOAD READONLY DATA HAS_CONTENTS 0x00400274->0x00400298 at 0x00000274: .note.gnu.build-id ALLOC LOAD READONLY DATA HAS_CONTENTS 0x00400298->0x004002bc at 0x00000298: .gnu.hash ALLOC LOAD READONLY DATA HAS_CONTENTS 0x004002c0->0x00400380 at 0x000002c0: .dynsym ALLOC LOAD READONLY DATA HAS_CONTENTS 0x00400380->0x004003e3 at 0x00000380: .dynstr ALLOC LOAD READONLY DATA HAS_CONTENTS 0x004003e4->0x004003f4 at 0x000003e4: .gnu.version ALLOC LOAD READONLY DATA HAS_CONTENTS 0x004003f8->0x00400418 at 0x000003f8: .gnu.version_r ALLOC LOAD READONLY DATA HAS_CONTENTS 0x00400418->0x00400460 at 0x00000418: .rela.dyn ALLOC LOAD READONLY DATA HAS_CONTENTS 0x00400460->0x004004c0 at 0x00000460: .rela.plt ALLOC LOAD READONLY DATA HAS_CONTENTS 0x004004c0->0x004004d7 at 0x000004c0: .init ALLOC LOAD READONLY CODE HAS_CONTENTS 0x004004e0->0x00400530 at 0x000004e0: .plt ALLOC LOAD READONLY CODE HAS_CONTENTS 0x00400530->0x00400802 at 0x00000530: .text ALLOC LOAD READONLY CODE HAS_CONTENTS 0x00400804->0x0040080d at 0x00000804: .fini ALLOC LOAD READONLY CODE HAS_CONTENTS 0x00400810->0x0040084e at 0x00000810: .rodata ALLOC LOAD READONLY DATA HAS_CONTENTS 0x00400850->0x004008c4 at 0x00000850: .eh_frame_hdr ALLOC LOAD READONLY DATA HAS_CONTENTS 0x004008c8->0x00400ab8 at 0x000008c8: .eh_frame ALLOC LOAD READONLY DATA HAS_CONTENTS 0x00600e00->0x00600e08 at 0x00000e00: .init_array ALLOC LOAD DATA HAS_CONTENTS 0x00600e08->0x00600e10 at 0x00000e08: .fini_array ALLOC LOAD DATA HAS_CONTENTS 0x00600e10->0x00600ff0 at 0x00000e10: .dynamic ALLOC LOAD DATA HAS_CONTENTS 0x00600ff0->0x00601000 at 0x00000ff0: .got ALLOC LOAD DATA HAS_CONTENTS 0x00601000->0x00601038 at 0x00001000: .got.plt ALLOC LOAD DATA HAS_CONTENTS 0x00601038->0x0060103c at 0x00001038: .data ALLOC LOAD DATA HAS_CONTENTS 0x00601040->0x006012c8 at 0x0000103c: .bss ALLOC 0x00000000->0x00000000 at 0x00000000: *COM* IS_COMMON 0x00000000->0x00000000 at 0x00000000: *UND* 0x00000000->0x00000000 at 0x00000000: *ABS* 0x00000000->0x00000000 at 0x00000000: *IND* (gdb) We lost the section index numbers, but more importantly, we lost the information about the .debug* sections. We also gained entries for the "fake" sections *COM*, *UND*, *ABS*, and *IND*. I noticed this when running: make check-gdb RUNTESTFLAGS="--target_board=cc-with-gdb-index gdb.base/maint.exp" As this test relies on looking in the 'maint info sections' output to see if we have a .debug_names or .gdb_index section, and these are debug sections so they no longer show up in the 'main info sections' output, the gdb.base/maint.exp test fails. This commit restores the old behaviour while keeping the important change that the above commit introduced, the addresses printed for sections are the relocated addresses where appropriate. The above commit mentions using this test: make check-gdb RUNTESTFLAGS="CFLAGS_FOR_TARGET='-pie' gdb.base/compare-sections.exp" And this still passes after this commit. The output for 'maint info sections' now looks like this: (gdb) maintenance info sections Exec file: `/home/andrew/projects/binutils-gdb/build/gdb/testsuite/outputs/gdb.base/maint/maint', file type elf64-x86-64. [0] 0x00400238->0x00400254 at 0x00000238: .interp ALLOC LOAD READONLY DATA HAS_CONTENTS [1] 0x00400254->0x00400274 at 0x00000254: .note.ABI-tag ALLOC LOAD READONLY DATA HAS_CONTENTS [2] 0x00400274->0x00400298 at 0x00000274: .note.gnu.build-id ALLOC LOAD READONLY DATA HAS_CONTENTS [3] 0x00400298->0x004002bc at 0x00000298: .gnu.hash ALLOC LOAD READONLY DATA HAS_CONTENTS [4] 0x004002c0->0x00400380 at 0x000002c0: .dynsym ALLOC LOAD READONLY DATA HAS_CONTENTS [5] 0x00400380->0x004003e3 at 0x00000380: .dynstr ALLOC LOAD READONLY DATA HAS_CONTENTS [6] 0x004003e4->0x004003f4 at 0x000003e4: .gnu.version ALLOC LOAD READONLY DATA HAS_CONTENTS [7] 0x004003f8->0x00400418 at 0x000003f8: .gnu.version_r ALLOC LOAD READONLY DATA HAS_CONTENTS [8] 0x00400418->0x00400460 at 0x00000418: .rela.dyn ALLOC LOAD READONLY DATA HAS_CONTENTS [9] 0x00400460->0x004004c0 at 0x00000460: .rela.plt ALLOC LOAD READONLY DATA HAS_CONTENTS [10] 0x004004c0->0x004004d7 at 0x000004c0: .init ALLOC LOAD READONLY CODE HAS_CONTENTS [11] 0x004004e0->0x00400530 at 0x000004e0: .plt ALLOC LOAD READONLY CODE HAS_CONTENTS [12] 0x00400530->0x00400802 at 0x00000530: .text ALLOC LOAD READONLY CODE HAS_CONTENTS [13] 0x00400804->0x0040080d at 0x00000804: .fini ALLOC LOAD READONLY CODE HAS_CONTENTS [14] 0x00400810->0x0040084e at 0x00000810: .rodata ALLOC LOAD READONLY DATA HAS_CONTENTS [15] 0x00400850->0x004008c4 at 0x00000850: .eh_frame_hdr ALLOC LOAD READONLY DATA HAS_CONTENTS [16] 0x004008c8->0x00400ab8 at 0x000008c8: .eh_frame ALLOC LOAD READONLY DATA HAS_CONTENTS [17] 0x00600e00->0x00600e08 at 0x00000e00: .init_array ALLOC LOAD DATA HAS_CONTENTS [18] 0x00600e08->0x00600e10 at 0x00000e08: .fini_array ALLOC LOAD DATA HAS_CONTENTS [19] 0x00600e10->0x00600ff0 at 0x00000e10: .dynamic ALLOC LOAD DATA HAS_CONTENTS [20] 0x00600ff0->0x00601000 at 0x00000ff0: .got ALLOC LOAD DATA HAS_CONTENTS [21] 0x00601000->0x00601038 at 0x00001000: .got.plt ALLOC LOAD DATA HAS_CONTENTS [22] 0x00601038->0x0060103c at 0x00001038: .data ALLOC LOAD DATA HAS_CONTENTS [23] 0x00601040->0x006012c8 at 0x0000103c: .bss ALLOC [24] 0x00000000->0x0000002c at 0x0000103c: .comment READONLY HAS_CONTENTS [25] 0x00000000->0x00000060 at 0x00001068: .debug_aranges READONLY HAS_CONTENTS [26] 0x00000000->0x0000061b at 0x000010c8: .debug_info READONLY HAS_CONTENTS [27] 0x00000000->0x00000264 at 0x000016e3: .debug_abbrev READONLY HAS_CONTENTS [28] 0x00000000->0x000001e6 at 0x00001947: .debug_line READONLY HAS_CONTENTS [29] 0x00000000->0x00000487 at 0x00001b2d: .debug_str READONLY HAS_CONTENTS (gdb) This is basically as it was before, except that the index numbers are now padded so the section information all lines up. When GDB has relocated a section then the relocated addresses will be printed, otherwise the non-relocated addresses from the bfd will be printed. I've added a test to gdb.base/maint.exp to do some basic validation of the output format. gdb/ChangeLog: * maint.c: Add 'cmath' include. (struct maint_print_section_data): New structure. (print_section_index): New function. (print_bfd_section_info): Add header comment, small whitespace cleanup, and update to call new print_section_index function. (print_objfile_section_info): Likewise. (maint_obj_section_from_bfd_section): New function. (print_bfd_section_info_maybe_relocated): New function. (maintenance_info_sections): Add header comment, always use bfd_map_over_sections instead of ALL_OBJFILE_OSECTIONS. gdb/testsuite/ChangeLog: * gdb.base/maint.exp: Add test for 'maint info sections'.
2019-09-12gdb: Don't fault for 'maint print psymbols' when using an indexAndrew Burgess3-8/+29
I found that these tests: make check-gdb RUNTESTFLAGS="--target_board=cc-with-gdb-index gdb.base/maint.exp" make check-gdb RUNTESTFLAGS="--target_board=cc-with-debug-names gdb.base/maint.exp" were causing GDB to segfault. It turns out that this test runs this command: maint print psymbols -pc main /path/to/some/file which tries to lookup the partial_symtab for 'main'. The problem is that there is no partial_symtab for 'main' as we are using the .gdb_index or .debug_names instead of partial_symtabs. What happens is that maintenance_print_symbols calls find_pc_sect_psymtab, which looks for the partial_symtab in the objfile's objfile->partial_symtabs->psymtabs_addrmap. This is a problem because when we are using the indexes psymtabs_addrmap is reused to hold things other than partial_symtabs, this can be seen in dwarf2read.c in create_addrmap_from_index and create_addrmap_from_aranges. If we then lookup in psymtabs_addrmap we end up returning a pointer to something that isn't really a partial_symtab, after which everything goes wrong. Initially I simply added a check at the start of find_pc_sect_psymtab that the objfile had some partial_symtabs, like: if (objfile->partial_symtabs->psymtabs == NULL) return NULL; Figuring that if there were no partial_symtabs at all then this function should always return NULL, however, this caused a failure in the test gdb.python/py-event.exp which I didn't dig into too deeply, but seems to be that in this tests there are initially no psymtabs, but the second part of find_pc_sect_psymtab does manage to read some in from somewhere, with the check I added the test fails as we returned NULL here and this caused GDB to load in the full symtabs earlier than was expected. Instead I chose to guard only the access to psymtabs_addrmap with a check that the function has some psymtabs. This allows my original tests to pass, and the py-event.exp test to pass too. Now, a good argument can be made that we simply should never call find_pc_sect_psymtab on an objfile that is using indexes instead of partial_symtabs. I did consider this approach, we could easily add an assert into find_pc_sect_psymtab that if we find a partial_symtab in psymtabs_addrmap then the psymtabs pointer must be non-null. The responsibility would then be on the user of find_pc_sect_psymtab to ensure that the objfile being checked is suitable. In the end I didn't take this approach as the check in find_pc_sect_psymtab is cheap and this ensures that any future miss-uses of the function will not cause problems. I also extended the comment on psymtabs_addrmap to indicate that it holds more than just partial_symtabs as this was not at all clear from the original comment, and caused me some confusion when I was initially debugging this problem. gdb/ChangeLog: * psymtab.c (find_pc_sect_psymtab): Move baseaddr local into more inner scope, add check that the objfile has psymtabs before checking psymtabs_addrmap. * psymtab.h (psymtab_storage) <psymtabs_addrmap>: Extend comment.
2019-09-13Automatic date update in version.inGDB Administrator1-1/+1
2019-09-12[gdb/testsuite] Allow some tests in gdb.base/store.exp to be unsupportedTom de Vries2-20/+50
The test-case gdb.base/store.exp fails with gcc 7.4.0: ... nr of unexpected failures 27 ... The first FAIL: ... 110 l = add_float (l, r); (gdb) PASS: gdb.base/store.exp: continue to wack_float print l $21 = <optimized out> FAIL: gdb.base/store.exp: var float l; print old l, expecting -1 ... relates to this bit in the test-case (compiled at -O0): ... 106 float 107 wack_float (register float u, register float v) 108 { 109 register float l = u, r = v; 110 l = add_float (l, r); 111 return l + r; 112 } ... and it expects to be able to read and modify variable l before executing line 110, but it already fails to read the value, because l has no DW_AT_location attribute in the debug info. Variable l is declared with the register keyword, and GCC implements the register keyword at -O0 like so: ... the compiler allocates distinct stack memory for all variables that do not have the register storage-class specifier; if register is specified, the variable may have a shorter lifespan than the code would indicate and may never be placed in memory. ... The fact that l has no DW_AT_location attribute, matches with the documented "variable may have a shorter lifespan that code would indicate", (though it is the most extreme case of it) so the gcc behaviour is valid. We can of course improve gcc to generate better debuginfo (filed gcc PR91611), but this not a wrong-debug problem. [ The test-case passes with gcc 4.2.1, but for the failing test discussed above, it passes simply because it doesn't store l in a register. ] With the debug info missing for l, reading and setting l is unsupported, so fix the FAIL by marking the test UNSUPPORTED instead. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-09-12 Tom de Vries <tdevries@suse.de> * gdb.base/store.exp: Allow register variables to be optimized out at -O0.
2019-09-12Output the Ada task name in more messages.Philippe Waroquiers8-21/+87
With this patch, we e.g. get: [Switching to task 2 "task_list(1)"] [Current task is 2 "task_list(1)"] instead of [Switching to task 2] [Current task is 2] The logic to produce the taskno optionally followed by the task name has been factorized in the task_to_str function. Task names are output between double quotes in the new messages, similarly to what GDB does for thread names. However, no quotes are put around task names in 'info tasks' Name column. This was discussed with Tom, that preferred no quotes there, while I was more in favour of visual consistency. I discussed with a few more users, which led to (exactly) 50% preferring quotes and 50% preferring no quotes :). To arrive to the decision to remove the quotes, the following "killing args" were used: * To have quotes or to not have quotes, that is the question; yes but not *THE* question :). * If there is not a clear majority that prefers quotes, better to not disturb the existing user basis for a (somewhat) irrelevant aspect. * The opinion of the reviewer has more weight. So, compared to the previous version, this version remotes the quotes in 'info tasks'. It improves the alignement of 'info tasks' output. With this patch, we get: (gdb) info task ID TID P-ID Pri State Name * 1 555555759030 48 Runnable main_task 2 555555759e30 1 48 Selective Wait mit (gdb) instead of (gdb) info task ID TID P-ID Pri State Name * 1 555555759030 48 Runnable main_task 2 555555759e30 1 48 Selective Wait mit (gdb) (e.g. the first one properly shows parent and priority under the correct header). This is version 4 of the 'task name' patch. Compared to version 3, the changes are: output task names between quotes but not in 'info tasks' gdb/ChangeLog 2019-09-12 Philippe Waroquiers <philippe.waroquiers@skynet.be> * NEWS: Announce that Ada task names are now shown at more places, and between quotes (except in info task output). * gdb/ada-tasks.c (task_to_str): New function. (display_current_task_id): Call task_to_str. (task_command_1): Likewise. (print_ada_task_info): In non-mi mode, Properly align headers and data when task-id length is > 9 (9 is the default for a 32 bits CORE_ADDR). gdb/doc/ChangeLog 2019-09-12 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.texinfo (Ada Tasks): Tell the task name is printed, update examples. gdb/testsuite/ChangeLog 2019-09-12 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.ada/rdv_wait.exp: Update to new task names. * gdb.base/task_switch_in_core.exp: Likewise. * gdb.base/info_sources_base.c: Likewise.
2019-09-12LOAD in linker map fileAlan Modra2-3/+6
For some reason, commit 906e58cab5 2008-05-15 excluded input statements with BFD_LINKER_CREATED BFDs from being printed to map files. This isn't ideal since it loses claimed plugin BFDs. * ldlang.c (print_input_statement): Do not exclude linker created BFDs.
2019-09-12PR24981, Hit assertion failure in ld/ldlang.c:7504Alan Modra2-2/+8
This fixes a problem with commit 128bf1fe608, a patch I made 2019-08-06. Apparently it is possible to trigger the assertion I added during an LTO bootstrap, something I haven't reproduced. However, I did find a case triggered by an odd linker script feature that allows a file to be loaded from the script without specifying that file on the command line. Regarding input sections: "When you use a file name which is not an archive:file specifier and does not contain any wild card characters, the linker will first see if you also specified the file name on the linker command line or in an INPUT command. If you did not, the linker will attempt to open the file as an input file, as though it appeared on the command line." So putting .foo : { foo.a(*) } into a script supposedly extracts foo.a into .foo. Except it doesn't, since this feature is meant for object files only. Well anyway, assuming --whole-archive was given on the command line, foo.a contains a -flto object and no other objects involved were -flto then we'll hit the assert due to files added like foo.a here *not* having their input statement put on the general statement list. Why these are not put on the statement list isn't obvious but it has been that way since commit 193c5f93a17 in 1994. PR 24981 * ldlang.c (lang_process): Remove assertion. Comment.
2019-09-12Fix signals reported for faults on SolarisRainer Orth2-33/+10
It's been a long-standing nuisance that gdb reported unaligned accesses on Solaris/SPARC as SIGSEGV, contrary to the shells and truss which correctly report SIGBUS instead. I could trace this down to the fault handling code in procfs.c (procfs_target::wait): when pr_why is set to PR_FAULTED, the current code sets the signal based on the fault number. For one, the code gets this wrong for FLTACCESS (the unaligned access case) where it uses SIGSEGV. What's worse, it's completely unnecessary to make up the signal number inside gdb. Instead, it should just take what procfs reports to avoid mismatches, which is what this patch does. I've completely removed the explicit handling of the various fault codes: for one, the list has already been incomplete, lacking FLTCPCOVF which existed since at least Solaris 8. Besides, there's no reason to error out on unknown fault codes: either the fault causes a signal which can then be reported from procfs, or it doesn't (as for FLTPAGE) and no reporting is necessary. Tested on sparcv9-sun-solaris2.11 and x86_64-pc-solaris2.11. Also spot-checked manually for a couple of cases (unaligned access, division by 0, NULL pointer dereference). * procfs.c (procfs_target::wait) <PR_FAULTED>: Get signal from prstatus.pr_lwp.pr_info instead of making it up.
2019-09-12Automatic date update in version.inGDB Administrator1-1/+1
2019-09-11Make relocate_{path,gdb_directory} return std::stringChristian Biesinger9-60/+81
This simplifies memory management. I've also changed some global variables to std::string accordingly (which store the result of these functions), but not all because some are used with add_setshow_optional_filename_cmd which requires a char*. gdb/ChangeLog: 2019-09-11 Christian Biesinger <cbiesinger@google.com> * auto-load.c (auto_load_expand_dir_vars): Update. * defs.h (gdb_datadir): Change to std::string. (python_libdir): Likewise. (relocate_gdb_directory): Change return type to std::string. * guile/guile.c (gdbscm_data_directory): Update. (initialize_scheme_side): Update. * jit.c (jit_reader_dir): Change to std::string. (jit_reader_load_command): Update. * main.c (gdb_datadir): Change to std::string. (python_libdir): Likewise. (set_gdb_data_directory): Update. (relocate_path): Change to return std::string. (relocate_gdb_directory): Change to return std::string. (relocate_gdbinit_path_maybe_in_datadir): Update. (captured_main_1): Update. * python/python.c (do_start_initialization): Update. * top.c (show_gdb_datadir): Update. * xml-syscall.c (xml_init_syscalls_info): Update. (init_syscalls_info): Update.
2019-09-11Factor out the code to do the datadir-relocation for gdbinitChristian Biesinger2-31/+49
This simplifies get_init_files and makes it possible to reuse this code in an upcoming patch for SYSTEM_GDBINIT_DIR. gdb/ChangeLog: 2019-09-11 Christian Biesinger <cbiesinger@google.com> * main.c (relocate_gdbinit_path_maybe_in_datadir): Factor this code out of get_init_files. (get_init_files): Update.
2019-09-11Refactor get_init_files to use std::stringChristian Biesinger2-53/+57
To avoid manual memory management. Tested on buildbot. gdb/ChangeLog: 2019-09-11 Christian Biesinger <cbiesinger@google.com> * main.c (get_init_files): Change to use std::string. (captured_main_1): Update. (print_gdb_help): Update.