aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2020-04-30Add generic tests for linker support of the -shared or -pie options to tests ↵Nick Clifton80-77/+181
which use them. binutils* testsuite/lib/binutils-common.exp (check_pie_support): New proc. ld * testsuite/ld-elf/compress1c.d: XFAIL if thet target linker does not support the -shared command line option. * /ld-elf/compressed1c.d: Likewise. * /ld-elf/compressed1e.d: Likewise. * /ld-elf/dynamic1.d: Likewise. * /ld-elf/dynsym1.d: Likewise. * /ld-elf/ehdr_start-shared.d: Likewise. * /ld-elf/exclude3b.d: Likewise. * /ld-elf/global1.d: Likewise. * /ld-elf/hash.d: Likewise. * /ld-elf/local1.d: Likewise. * /ld-elf/mbind1b.d: Likewise. * /ld-elf/now-1.d: Likewise. * /ld-elf/now-2.d: Likewise. * /ld-elf/now-3.d: Likewise. * /ld-elf/now-4.d: Likewise. * /ld-elf/pr12975.d: Likewise. * /ld-elf/pr13177.d: Likewise. * /ld-elf/pr13195.d: Likewise. * /ld-elf/pr16322.d: Likewise. * /ld-elf/pr16498a.d: Likewise. * /ld-elf/pr16498b.d: Likewise. * /ld-elf/pr17615.d: Likewise. * /ld-elf/pr19162.d: Likewise. * /ld-elf/pr19698.d: Likewise. * /ld-elf/pr20513c.d: Likewise. * /ld-elf/pr20513d.d: Likewise. * /ld-elf/pr21389a.d: Likewise. * /ld-elf/pr21389b.d: Likewise. * /ld-elf/pr21389c.d: Likewise. * /ld-elf/pr21562a.d: Likewise. * /ld-elf/pr21562b.d: Likewise. * /ld-elf/pr21562c.d: Likewise. * /ld-elf/pr21562d.d: Likewise. * /ld-elf/pr21562e.d: Likewise. * /ld-elf/pr21562f.d: Likewise. * /ld-elf/pr21562g.d: Likewise. * /ld-elf/pr21562h.d: Likewise. * /ld-elf/pr21562i.d: Likewise. * /ld-elf/pr21562j.d: Likewise. * /ld-elf/pr21562k.d: Likewise. * /ld-elf/pr21562l.d: Likewise. * /ld-elf/pr21562m.d: Likewise. * /ld-elf/pr21562n.d: Likewise. * /ld-elf/pr21903a.d: Likewise. * /ld-elf/pr21903b.d: Likewise. * /ld-elf/pr22269b.d: Likewise. * /ld-elf/pr22393-1a.d: Likewise. * /ld-elf/pr22393-1b.d: Likewise. * /ld-elf/pr23658-1c.d: Likewise. * /ld-elf/pr25708.d: Likewise. * /ld-elf/rpath-1.d: Likewise. * /ld-elf/rpath-2.d: Likewise. * /ld-elf/runpath-1.d: Likewise. * /ld-elf/runpath-2.d: Likewise. * /ld-elf/sizeofb.d: Likewise. * /ld-elf/startofb.d: Likewise. * /ld-elf/strtab.d: Likewise. * /ld-elf/textaddr2.d: Likewise. * /ld-elf/textaddr5.d: Likewise. * /ld-elf/textaddr6.d: Likewise. * /ld-elf/unknown2.d: Likewise. * /ld-undefined/entry-3.d: Likewise. * /ld-undefined/entry-4.d: Likewise. * /ld-elf/mbind1c.d: XFAIL if the target linker does not support the -pie option. * /ld-elf/pie.d: Likewise. * /ld-elf/pr19539.d: Likewise. * /ld-elf/pr21903d.d: Likewise. * /ld-elf/pr22269a.d: Likewise. * /ld-elf/pr22393-1c.d: Likewise. * /ld-elf/pr22393-1d.d: Likewise. * /ld-elf/pr22423.d: Likewise. * /ld-elf/loadaddr1.d: Expect to fail on the rx-linux target. * /ld-elf/loadaddr2.d: Likewise. * /ld-elf/pr22393-1e.d: Likewise. * /ld-elf/pr22393-1f.d: Likewise. * /ld-elf/textaddr1.d: Likewise. * /ld-elf/textaddr4.d: Likewise.
2020-04-30Use thiscall calling convention for class membersHannes Domani4-7/+83
Non-static member functions for Windows 32bit programs need the thiscall calling convention, so the 'this' pointer needs to be passed in ECX. gdb/ChangeLog: 2020-04-30 Hannes Domani <ssbssa@yahoo.de> PR gdb/15559 * i386-tdep.c (i386_push_dummy_call): Call i386_thiscall_push_dummy_call. (i386_thiscall_push_dummy_call): New function. * i386-tdep.h (i386_thiscall_push_dummy_call): Declare. * i386-windows-tdep.c (i386_windows_push_dummy_call): New function. (i386_windows_init_abi): Call set_gdbarch_push_dummy_call.
2020-04-30ld: Add rx-linux emulation. gas: Change ELF flags initial value in rx-linuxYoshinori Sato8-1/+83
ld * emulparams/elf32rx_linux.sh: New rx-linux emulation. * emultempl/rxlinux.em: New. * configure.tgt: Add rx-linux. * Makefile.am: Add eelf32rx_linux.c * Makefile.in: Regenerate. gas * config/tc-rx.c (elf_flags): Reset default value. (md_parse_option): For rx-elf Initialize elf_flags with RX_ABI.
2020-04-29xtensa: fix XTENSA_NDIFF handling for PR ld/25861Max Filippov8-11/+83
Fields marked with XTENSA_NDIFF relocations are not negated, they only have sign bits removed. Don't negate their values when relaxation is performed. Don't add sign bits when the value is zero. Report overflow when the result has negative sign but all significant bits are zero. 2020-04-29 Max Filippov <jcmvbkbc@gmail.com> bfd/ * elf32-xtensa.c (relax_section): Don't negate diff_value for XTENSA_NDIFF relocations. Don't add sign bits whe diff_value equals 0. Report overflow when the result has negative sign but all significant bits are zero. ld/ * testsuite/ld-xtensa/relax-diff1.d: New test definition. * testsuite/ld-xtensa/relax-diff1.s: New test source. * testsuite/ld-xtensa/relax-ndiff.d: New test definition. * testsuite/ld-xtensa/relax-ndiff.s: New test source. * testsuite/ld-xtensa/xtensa.exp: (relax-diff1) (relax-ndiff): New tests.
2020-04-29xtensa: gas: support optional immediate simcall parameterMax Filippov2-0/+29
Starting with RH.0 release Xtensa ISA adds immediate parameter to simcall opcode. For assembly source compatibility treat "simcall" instruction without parameter as "simcall 0" when parameter is required. 2020-04-29 Max Filippov <jcmvbkbc@gmail.com> gas/ * config/tc-xtensa.c (XTENSA_MARCH_EARLIEST): Define macro as 0 if it's not defined. (microarch_earliest): New static variable. (xg_translate_idioms): Translate "simcall" to "simcall 0" when simcall opcode has mandatory parameter. (xg_init_global_config): Initialize microarch_earliest.
2020-04-29gdb: silence shellcheck warning SC2162 (use read -r) in gdbarch.shSimon Marchi2-0/+6
shellcheck reports: In gdbarch.sh line 53: while IFS='' read line ^--^ SC2162: read without -r will mangle backslashes. See the rationale at [1]. In our case, we actually want the backslashes to be interpreted and removed. Silence the warning using a directive. [1] https://github.com/koalaman/shellcheck/wiki/SC2162 gdb/ChangeLog: * gdbarch.sh (do_read): Add shellcheck disable directive for warning SC2162.
2020-04-29gdb: fix shellcheck warnings SC2154 (referenced but not assigned) in gdbarch.shSimon Marchi2-7/+12
Fix all instances of this kind of warning: In gdbarch.sh line 96: m ) staticdefault="${predefault}" ;; ^-----------^ SC2154: predefault is referenced but not assigned. These warnings appear because we are doing something a bit funky when reading the gdbarch fields. These variables are not assigned explicitly, but using some `eval` commands. I don't think there is so much we can fix about those warnings. To silence them, I've changed `${foo}` to `${foo:-}`. This tells the shell to substitute with an empty string if `foo` is not defined. This retains the current behavior, but the warnings go away. gdb/ChangeLog: * gdbarch.sh: Use ${foo:-} where shellcheck would report a "referenced but not assigned" warning.
2020-04-29gdb: fix shellcheck warnings SC2034 (unused variable) in gdbarch.shSimon Marchi2-19/+6
shellcheck reports: In gdbarch.sh line 139: fallbackdefault="0" ^-------------^ SC2034: fallbackdefault appears unused. Verify use (or export if used externally). Indeed, the `fallbackdefault` variable appears to be unused, remove the code that sets it. gdb/ChangeLog: * gdbarch.sh: Remove code that sets fallbackdefault.
2020-04-29gdb: fix shellcheck warnings SC2166 (&& and !! instead of -a and -o) in ↵Simon Marchi2-7/+12
gdbarch.sh Fix all warnings of this type: In gdbarch.sh line 1238: if [ "x${invalid_p}" = "x0" -a -n "${postdefault}" ] ^-- SC2166: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. See the rationale here [1]. [1] https://github.com/koalaman/shellcheck/wiki/SC2166 gdb/ChangeLog: * gdbarch.sh: Use shell operators && and || instead of -a and -o.
2020-04-29gdb: fix shellcheck warnings SC2006 (use $() instead of ``) in gdbarch.shSimon Marchi2-3/+7
Fix all instances of: In gdbarch.sh line 2195: printf " `echo "$function" | sed -e 's/./ /g'` %s %s)\n" "$returntype" "$function" ^-- SC2006: Use $(...) notation instead of legacy backticked `...`. Did you mean: printf " $(echo "$function" | sed -e 's/./ /g') %s %s)\n" "$returntype" "$function" See here [1] for the rationale. [1] https://github.com/koalaman/shellcheck/wiki/SC2006 gdb/ChangeLog: * gdbarch.sh: Use $(...) instead of `...`.
2020-04-29gdb: fix shellcheck warnings SC2086 (missing double quotes) in gdbarch.shSimon Marchi2-8/+12
Fix all instances of: In gdbarch.sh line 31: if test ! -r ${file} ^-----^ SC2086: Double quote to prevent globbing and word splitting. Did you mean: if test ! -r "${file}" Note that some instances of these are in text that is eval'ed. I'm pretty sure that things could go wrong during the eval too, but that's not something shellcheck can check. gdb/ChangeLog: * gdbarch.sh: Use double quotes around variables.
2020-04-29gdb: fix shellcheck warnings SC2059 (variables in printf format string) in ↵Simon Marchi2-61/+66
gdbarch.sh Fix all instances of this: In gdbarch.sh line 2182: printf " gdb_assert (!(${invalid_p}));\n" ^-- SC2059: Don't use variables in the printf format string. Use printf "..%s.." "$foo". ... by doing exactly as the message suggests. The rationale explained here [1] makes sense, if there happens to be a format specifier in text substituted for the variable, the printf won't do what we expect. [1] https://github.com/koalaman/shellcheck/wiki/SC2059 gdb/ChangeLog: * gdbarch.sh: Use %s with printf, instead of variables in the format string.
2020-04-292020-04-29 Sterling Augustine <saugustine@google.com>Sterling Augustine2-0/+5
* dwarf2/read.c (setup_type_unit_groups): Set list_in_scope.
2020-04-30Automatic date update in version.inGDB Administrator1-1/+1
2020-04-29Sync config and libiberty with GCCH.J. Lu5-49/+273
config/ 2020-04-29 H.J. Lu <hongjiu.lu@intel.com> Sync with GCC 2020-04-28 H.J. Lu <hongjiu.lu@intel.com> PR bootstrap/94739 * cet.m4 (GCC_CET_HOST_FLAGS): Add -fcf-protection=none to -Wl,-z,ibt,-z,shstk. Check whether -fcf-protection=none -Wl,-z,ibt,-z,shstk works first. 2020-04-25 H.J. Lu <hongjiu.lu@intel.com> PR bootstrap/94739 * cet.m4 (GCC_CET_HOST_FLAGS): New. 2020-04-22 Jakub Jelinek <jakub@redhat.com> PR libfortran/94694 PR libfortran/94586 * math.m4 (GCC_CHECK_MATH_INLINE_BUILTIN_FALLBACK1, GCC_CHECK_MATH_INLINE_BUILTIN_FALLBACK2): New. libiberty/ 2020-04-28 H.J. Lu <hongjiu.lu@intel.com> PR bootstrap/94739 * configure: Regenerated.
2020-04-29gdb: fix duplicate test names in gdb.base/break.expSimon Marchi2-34/+43
These test names are duplicated: 2 PASS: gdb.base/break.exp: set breakpoint via non-integer convenience variable disallowed 2 PASS: gdb.base/break.exp: set convenience variable $foo to 81.5 Wrap them with `with_test_prefix`. I've actually wrapped a bit more tests that are related, I think it helps to give the test names a bit more context. The modified test names are: -PASS: gdb.base/break.exp: set convenience variable $foo to bp_location11 -PASS: gdb.base/break.exp: set breakpoint via convenience variable -PASS: gdb.base/break.exp: set convenience variable $foo to 81.5 -PASS: gdb.base/break.exp: set breakpoint via non-integer convenience variable disallowed +PASS: gdb.base/break.exp: set line breakpoint via convenience variable: set convenience variable $foo to bp_location11 +PASS: gdb.base/break.exp: set line breakpoint via convenience variable: break $foo +PASS: gdb.base/break.exp: set line breakpoint via convenience variable: set convenience variable $foo to 81.5 +PASS: gdb.base/break.exp: set line breakpoint via convenience variable: non-integer convenience variable disallowed -PASS: gdb.base/break.exp: set $l = 47 -PASS: gdb.base/break.exp: break break.c:$l -PASS: gdb.base/break.exp: set convenience variable $foo to 81.5 -PASS: gdb.base/break.exp: set breakpoint via non-integer convenience variable disallowed +PASS: gdb.base/break.exp: set line:file breakpoint via convenience variable: set $l = 47 +PASS: gdb.base/break.exp: set line:file breakpoint via convenience variable: break break.c:$l +PASS: gdb.base/break.exp: set line:file breakpoint via convenience variable: set convenience variable $foo to 81.5 +PASS: gdb.base/break.exp: set line:file breakpoint via convenience variable: non-integer convenience variable disallowed gdb/testsuite/ChangeLog: * gdb.base/break.exp: Use with_test_prefix.
2020-04-29Fix Ada crash with .debug_typesTom Tromey2-34/+36
PR ada/25875 concerns a gdb crash when gdb.ada/arr_enum_idx_w_gap.exp is run using the .debug_types board. The problem turns out to be caused by weird compiler output. In this test, the compiler emits a top-level type that refers to an enumeration type which is nested in a function. However, this function is just a declaration. This results in gdb calling read_enumeration_type for the enum type, but process_enumeration_scope is never called, yielding an enum with no fields. This causes the crash. This patch fixes the problem by arranging to create the enum fields in read_enumeration_type. Tested on x86-64 Fedora 30. gdb/ChangeLog 2020-04-29 Tom Tromey <tromey@adacore.com> PR ada/25875: * dwarf2/read.c (update_enumeration_type_from_children): Compute type fields here. (read_enumeration_type): Call update_enumeration_type_from_children later. Update comments. (process_enumeration_scope): Don't create type fields.
2020-04-29Set NetBSD xml syscall file name to syscalls/netbsd.xmlKamil Rytarowski2-0/+7
The syscall literal names are not stable on NetBSD and can change once a syscall is versioned. Thus these names are internal to the system and in GDB mostly descriptive, not intended to be a stable interface with fixed names across GDB and NetBSD versions to track certain syscalls. gdb/ChangeLog: * nbsd-tdep.c: Include "xml-syscall.h". (nbsd_init_abi): Call `set_xml_syscall_file_name'.
2020-04-29Add basic event handling in the NetBSD targetKamil Rytarowski4-0/+264
Implement the following events: - single step (TRAP_TRACE) - software breakpoint (TRAP_DBREG) - exec() (TRAP_EXEC) - syscall entry/exit (TRAP_SCE / TRAP_SCX) Add support for NetBSD specific ::wait () and ::resume (). Instruct the generic code that exec and syscall events are supported. Define an empty nbsd_get_syscall_number as it is prerequisite for catching syscall entry and exit events, even if it is unused. This function is used to detect whether the gdbarch supports the 'catch syscall' feature. gdb/ChangeLog: * nbsd-nat.c: Include "sys/wait.h". (nbsd_resume, nbsd_nat_target::resume, nbsd_wait) (nbsd_nat_target::wait, nbsd_nat_target::insert_exec_catchpoint) (nbsd_nat_target::remove_exec_catchpoint) (nbsd_nat_target::set_syscall_catchpoint): Add. * nbsd-nat.h (nbsd_nat_target::resume, nbsd_nat_target::wait) (nbsd_nat_target::insert_exec_catchpoint) (nbsd_nat_target::remove_exec_catchpoint) (nbsd_nat_target::set_syscall_catchpoint): Add. * nbsd-tdep.c (nbsd_get_syscall_number): Add. (nbsd_init_abi): Call `set_gdbarch_get_syscall_number' and pass `nbsd_get_syscall_number'.
2020-04-29When displaying ranges, ignore duplicate offsets.Andrew Burgess2-0/+15
* dwarf.c (display_debug_ranges): Ignore duplicate entries in range_entries for the same offset.
2020-04-29Update expected disassembly after recent update.Nick Clifton2-1/+2
PR 22699 * testsuite/gas/sh/sh4al-dsp.d: Update expected disassembly.
2020-04-29Also use unsigned 8-bit immediate values for the LDRC and SETRC insns.Nick Clifton2-2/+8
PR 22699 * sh-opc.h: Also use unsigned 8-bit immediate values for the LDRC and SETRC insns.
2020-04-29Add a warning if an emtpty SHT_REL, SHT_RELA or SHT_PROGBITS section is ↵Nick Clifton10-53/+201
detected. Disable all warnings unless the (new) lint mode is enabled. * readelf.c (warn): New function - like elfcomm.c version but only produces output if warnings are enabled. (struct options): Add --lint and --enable-checks. (usage): Add entry for --lint. (parse_args): Handle -L. If checks are enabled but no dumps have been selected then enable all dumps. (process_section_headers): Replace long if-then-else sequence with a switch. Add warning messages for empty SHT_REL, SHT_RELA and SHT_PROGBITS sections. (process_file): Do not complain if the file is an archive and lint mode has been enabled. * elfcomm.c (error): Make the function weak. (warn): Likewise. * NEWS: Mention the new feature. * doc/binutils.texi: Document the new feature. * dwarf.h (report_leb_status): Add file name and line number parameters. Include them in the diagnostic output. (READ_ULEB): Pass file and line number to report_leb_status. (READ_SLEB): Likewise. * dwarf.c (read_and_print_leb128): Pass file and line number to report_leb_status. * testsuite/binutils-all/readelf.exp: Add test of new feature. * testsuite/binutils-all/zero-sec.s: New test source file. * testsuite/binutils-all/zero-sec.r: Expected output from new test.
2020-04-29Remove some dead codeTom Tromey2-50/+4
print_block_frame_labels has been commented out since 2010. I don't think we need it; this patch removes it. 2020-04-29 Tom Tromey <tom@tromey.com> * stack.c (print_block_frame_labels): Remove.
2020-04-29bfd: Fix 64-bit relocation handling for a.outGunther Nikl2-3/+16
* aoutx.h (swap_std_reloc_out): Special case 64 bit relocations. (aout_link_reloc_link_order): Likewise. Make r_length an unsigned.
2020-04-29Updated Serbian translation for the binutils sub-directory, and Swedish ↵Nick Clifton4-2806/+6037
translation for the opcodes sub-directory.
2020-04-29Fix the disassmbly of SH instructions which have an unsigned 8-bit immediate ↵Nick Clifton7-19/+46
operand. PR 22699 opcodes * sh-opc.h (IMM0_8): Replace with IMM0_8S and IMM0_8U. Use IMM0_8S for arithmetic insns and IMM0_8U for logical insns. * sh-dis.c (print_insn_sh): Change IMM0_8 case to IMM0_8S and add IMM0_8U case. gas * config/tc-sh.c (build_Mytes): Change operand type IMM0_8 to IMM0_8S and add support for IMM0_8U. * testsuite/gas/sh/sh4a.s: Add test of a logical insn using an unsigned 8-bit immediate. * testsuite/gas/sh/sh4a.d: Extended expected disassembly.
2020-04-29Remove restriction on skipping some linker tests because their default image ↵Stephen Casner1-0/+11
base is too high. PR 25829 * testsuite/ld-scripts/default-script.exp: Add --image-base=0 to LDFLAGS for targets *-*-mingw64 x86_64-*-cygwin. * testsuite/ld-scripts/default-script1.d: No longer have to skip test for those targets. * testsuite/ld-scripts/default-script2.d: Likewise. * testsuite/ld-scripts/default-script3.d: Likewise. * testsuite/ld-scripts/default-script4.d: Likewise.
2020-04-29[gdb/testsuite] Add xfails for PR gcc/90232Tom de Vries4-3/+57
With target board debug-types, we have these FAILs: ... FAIL: gdb.guile/scm-symtab.exp: test simple_struct in static symbols FAIL: gdb.python/py-symtab.exp: test simple_struct in static symbols ... due to PR gcc/90232, as explained in commit 15cd93d05e8 "[gdb/symtab] Handle struct decl with DW_AT_signature". Marks these as XFAILs. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-04-29 Tom de Vries <tdevries@suse.de> * lib/gdb.exp (debug_types): New proc. * gdb.guile/scm-symtab.exp: Add xfail for PR gcc/90232. * gdb.python/py-symtab.exp: Same.
2020-04-29Fix array pretty formatterHannes Domani9-20/+125
Currently, printing with array pretty formatting makes the output actually less readable than without: (gdb) p -array on -- {{1,2,3},{4,5,6}} $1 = { {1, 2, 3}, {4, 5, 6}} (gdb) p -array on -array-indexes on -- {{1,2,3},{4,5,6}} $2 = {[0] = {[0] = 1, [1] = 2, [2] = 3}, [1] = {[0] = 4, [1] = 5, [2] = 6}} These changes now also put the first element and the array end bracket on a new line, similar to the structure pretty formatter: (gdb) p -array on -- {{1,2,3},{4,5,6}} $1 = { { 1, 2, 3 }, { 4, 5, 6 } } (gdb) p -array on -array-indexes on -- {{1,2,3},{4,5,6}} $2 = { [0] = { [0] = 1, [1] = 2, [2] = 3 }, [1] = { [0] = 4, [1] = 5, [2] = 6 } } gdb/ChangeLog: 2020-04-29 Hannes Domani <ssbssa@yahoo.de> PR gdb/17320 * ada-valprint.c (val_print_packed_array_elements): Move array end bracket to new line. (ada_val_print_string): Remove extra spaces before first array element. * c-valprint.c (c_value_print_array): Likewise. * m2-valprint.c (m2_print_array_contents): Likewise. (m2_value_print_inner): Likewise. * p-valprint.c (pascal_value_print_inner): Likewise. * valprint.c (generic_val_print_array): Likewise. (value_print_array_elements): Move first array element and array end bracket to new line. gdb/testsuite/ChangeLog: 2020-04-29 Hannes Domani <ssbssa@yahoo.de> PR gdb/17320 * gdb.base/pretty-array.c: New test. * gdb.base/pretty-array.exp: New file.
2020-04-29[gdb] Fix range loop index in find_methodTom de Vries5-4/+45
With target board debug-types, we have: ... FAIL: gdb.cp/cpexprs.exp: list policy1::function ... This is a regression triggered by commit 770479f223e "gdb: Fix toplevel types with -fdebug-types-section". However, the FAIL is caused by commit 4dedf84da98 "Change decode_compound_collector to use std::vector" which changes a VEC_iterate loop into a range loop: ... - for (ix = 0; VEC_iterate (symbolp, sym_classes, ix, sym); ++ix) + unsigned int ix = 0; + for (const auto &sym : *sym_classes) ... but fails to ensure that the increment of ix happens every iteration. Fix this by calculating the index variable at the start of the loop body: ... for (const auto &elt : *sym_classes) { unsigned int ix = &elt - &*sym_classes->begin (); ... Tested on x86_64-linux, with native and target board debug-types. gdb/ChangeLog: 2020-04-29 Tom de Vries <tdevries@suse.de> PR symtab/25889 * linespec.c (find_method): Fix ix calculation. gdb/testsuite/ChangeLog: 2020-04-29 Tom de Vries <tdevries@suse.de> PR symtab/25889 * gdb.cp/cpexprs.exp: Adapt for inclusion. * gdb.cp/cpexprs-debug-types.exp: New file. Set -fdebug-types-section and include cpexprs.exp.
2020-04-29Automatic date update in version.inGDB Administrator1-1/+1
2020-04-29Add definitions of system calls to catch in native NetBSD targetsKamil Rytarowski4-1/+547
All platforms on NetBSD use a shared system call table, so use a single XML file to describe the system calls available on each NetBSD platform. gdb/ChangeLog: * syscalls/update-netbsd.sh: New file. * syscalls/netbsd.xml: Regenerate. * data-directory/Makefile.in: Register `netbsd.xml' in `SYSCALLS_FILES'
2020-04-28gdb: fix shellcheck warning in update-freebsd.shSimon Marchi2-1/+5
shellcheck reports: In update-freebsd.sh line 72: }' $1 >> freebsd.xml.tmp ^-- SC2086: Double quote to prevent globbing and word splitting. Did you mean: }' "$1" >> freebsd.xml.tmp For more information: https://www.shellcheck.net/wiki/SC2086 -- Double quote to prevent globbing ... Add double quotes to fix it. gdb/ChangeLog: * syscalls/update-freebsd.sh: Add double quotes.
2020-04-28Allow Python commands to be in class_tuiTom Tromey5-4/+25
Now that Python code can create TUI windows, it seemed appropriate to allow Python commands to appear in the "TUI" help class. This patch adds this capability. gdb/ChangeLog 2020-04-28 Tom Tromey <tom@tromey.com> * NEWS: Update. * python/py-cmd.c (gdbpy_initialize_commands): Add COMMAND_TUI. (cmdpy_init): Allow class_tui. gdb/doc/ChangeLog 2020-04-28 Tom Tromey <tom@tromey.com> * python.texi (Commands In Python): Document gdb.COMMAND_TUI.
2020-04-28Add missing ChangeLog entriesTom de Vries2-0/+12
2020-04-28gdb: Fix toplevel types with -fdebug-types-sectionMark Williams3-0/+59
When debugging a program compiled with -fdebug-types-section, only the first top-level type in each file is visible to gdb. The problem was caused by moving the assignment to list_in_scope from process_full_comp_unit and process_full_type_unit to start_symtab. This was fine for process_full_comp_unit, because symtabs and comp units are one-to-one. But there can be many type units per symtab (one for each type), and we only call start_symtab for the first one. This adds the necessary assignments on the paths where start_symtab is not called. gdb/Changelog: 2020-04-28 Mark Williams <mark@myosotissp.com> PR gdb/24480 * dwarf2read.c: Add missing assingments to list_in_scope when start_symtab was already called. gdb/testsuite/Changelog: 2020-04-28 Mark Williams <mark@myosotissp.com> PR gdb/24480 * dw4-toplevel-types.exp: Test for top level types. * dw4-toplevel-types.cc: Test for top level types.
2020-04-28gdb: use gdb:hash_enum as hash function in offset_map_typeSimon Marchi2-1/+8
When building with g++ 4.8, we get this error (just an excerpt, because g++ outputs a very long error message): CXX dwarf2/read.o ... /home/smarchi/src/binutils-gdb/gdb/dwarf2/read.c:14616:31: required from here /usr/include/c++/4.8/bits/hashtable_policy.h:1070:12: error: invalid use of incomplete type ‘struct std::hash<sect_offset>’ struct _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, This is the same problem and fix as in commit f23f598e28ad ("[gdb] Fix build breaker with gcc 4.8"). Pass an explicit hash function rather than relying on the default std::hash<sect_offset>. gdb/ChangeLog: PR gdb/25881 * dwarf2/read.c (offset_map_type): Use gdb:hash_enum<sect_offset> as hash function.
2020-04-28Rebase libiberty source with latest changes from gcc.Nick Clifton8-21/+196
PR 25876 PR demangler/94797 * cp-demangle.c (cplus_demangle_operators): Add ss <=> operator. * testsuite/demangle-expected: Add operator<=> test.
2020-04-28Fix typo (thead -> thread)Tankut Baris Aktemur6-3/+16
gdb/stubs/ChangeLog: 2020-04-28 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * ia64vms-stub.c: Fix typo in comment (thead -> thread). gdb/testsuite/ChangeLog: 2020-04-28 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * gdb.threads/stop-with-handle.exp: Fix typo in comment (theads -> threads). gdbsupport/ChangeLog: 2020-04-28 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * gdb-sigmask.h: Fix typo (pthead_sigmask -> pthread_sigmask).
2020-04-28[gdb/testsuite] Add PR number to KFAIL in gdb.opt/inline-cmds.expTom de Vries2-1/+5
With test-case gdb.opt/inline-cmds.exp, we have: ... KFAIL: gdb.opt/inline-cmds.exp: next to second func1 (PRMS: gdb/NNNN) ... I've filed PR25884 for this failure. Set the KFAIL PR accordingly. gdb/testsuite/ChangeLog: 2020-04-28 Tom de Vries <tdevries@suse.de> * gdb.opt/inline-cmds.exp: Set KFAIL PR.
2020-04-28[gdb/testsuite] Remove KFAIL from gdb.base/info-macros.expTom de Vries2-4/+5
When running test-case gdb.base/info-macros.exp, we have: ... (gdb) KFAIL: gdb.base/info-macros.exp: info macros info-macros.c:42 \ (PRMS: gdb/NNNN) ... The described failure mode however: ... set test "info macros info-macros.c:42" set r1 ".*define DEF_MACROS" set r2 ".*define ONE" setup_kfail "gdb/NNNN" *-*-* gdb_test "$test" "$r1$r2" ... does not match the actual output, given that both defines are in fact printed. The pattern fails to match because it's missing a trailing ".*". Fix this by removing the KFAIL and adding the missing trailing ".*". Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-04-28 Tom de Vries <tdevries@suse.de> * gdb.base/info-macros.exp: Remove KFAIL. Add missing trailing ".*".
2020-04-28[gdb/testsuite] Add PR number in KFAIL in gdb.ada/array_ptr_renaming.expTom de Vries2-1/+5
When running test-case gdb.ada/array_ptr_renaming.exp we run into: ... (gdb) print ntp^M $3 = (3 => 30, 40)^M (gdb) KFAIL: gdb.ada/array_ptr_renaming.exp: print ntp (PRMS: gdb/NNNN) ... I've opened PR25883 for this failure. Reference the PR from the KFAIL, such that we have: ... KFAIL: gdb.ada/array_ptr_renaming.exp: print ntp (PRMS: gdb/25883) ... gdb/testsuite/ChangeLog: 2020-04-28 Tom de Vries <tdevries@suse.de> * gdb.ada/array_ptr_renaming.exp: Add PR number in KFAIL.
2020-04-28[gdb/symtab] Handle struct decl with DW_AT_signatureTom de Vries5-1/+187
Consider a test-case with sources 36.c: ... struct s { int i; }; extern void f (void); int main (void) { struct s a; f (); return 0; } ... and 36b.c: ... struct s { int j; }; void f (void) { struct s b; } ... compiled like this: ... $ gcc 36.c 36b.c -g ... It contains DWARF like this: ... <0><d2>: Abbrev Number: 1 (DW_TAG_compile_unit) <d8> DW_AT_name : 36.c <1><f4>: Abbrev Number: 2 (DW_TAG_structure_type) <f5> DW_AT_name : s <2><fe>: Abbrev Number: 3 (DW_TAG_member) <ff> DW_AT_name : i <1><110>: Abbrev Number: 5 (DW_TAG_subprogram) <111> DW_AT_name : main <2><12d>: Abbrev Number: 6 (DW_TAG_variable) <12e> DW_AT_name : a <132> DW_AT_type : <0xf4> <0><146>: Abbrev Number: 1 (DW_TAG_compile_unit) <14c> DW_AT_name : 36b.c <1><168>: Abbrev Number: 2 (DW_TAG_structure_type) <169> DW_AT_name : s <2><172>: Abbrev Number: 3 (DW_TAG_member) <173> DW_AT_name : j <1><184>: Abbrev Number: 5 (DW_TAG_subprogram) <185> DW_AT_name : f <2><19b>: Abbrev Number: 6 (DW_TAG_variable) <19c> DW_AT_name : b <1a0> DW_AT_type : <0x168> ... And when printing "struct s", we get first a random one (with int j), and then context-specific ones (with int i in main, and int j in f): ... $ gdb -batch a.out \ -ex "ptype struct s" \ -ex start \ -ex "ptype struct s" \ -ex "break f" -ex continue \ -ex "ptype struct s" \ | grep "int [ij];" int j; int i; int j; ... Same for -readnow. However, if we use -fdebug-types-section: ... $ gcc 36.c 36b.c -g -fdebug-types-section ... we get: ... $ gdb ... | grep "int [ij];" int j; int i; int i; $ gdb -readnow ... | grep "int [ij];" int j; int j; int j; ... This is due to the fact that both "struct s" DIEs have been moved to the .debug_types section: ... Compilation Unit @ offset 0x0: Signature: 0xfd1462823bb6f7b7 <0><17>: Abbrev Number: 1 (DW_TAG_type_unit) <1><1d>: Abbrev Number: 2 (DW_TAG_structure_type) <1e> DW_AT_name : s <2><27>: Abbrev Number: 3 (DW_TAG_member) <28> DW_AT_name : i Compilation Unit @ offset 0x3a: Signature: 0x534310fbefba324d <0><51>: Abbrev Number: 1 (DW_TAG_type_unit) <1><57>: Abbrev Number: 2 (DW_TAG_structure_type) <58> DW_AT_name : s <2><61>: Abbrev Number: 3 (DW_TAG_member) <62> DW_AT_name : j ... and there's no longer a "struct s" DIE in the 36.c and and 36b.c CUs to specify which "struct s" belongs in the CU. This is gcc PR90232. However, using a tentative patch for gcc that adds these DIEs (according to DWARF standard: If the complete declaration of a type has been placed in a separate type unit, an incomplete declaration of that type in the compilation unit may provide the unique 64-bit signature of the type using a DW_AT_signature attribute): ... <0><d2>: Abbrev Number: 5 (DW_TAG_compile_unit) <d8> DW_AT_name : 36.c + <1><f4>: Abbrev Number: 6 (DW_TAG_structure_type) + <f5> DW_AT_name : s + <f7> DW_AT_signature : signature: 0xfd1462823bb6f7b7 + <ff> DW_AT_declaration : 1 <0><13c>: Abbrev Number: 5 (DW_TAG_compile_unit) <142> DW_AT_name : 36b.c + <1><15e>: Abbrev Number: 6 (DW_TAG_structure_type) + <15f> DW_AT_name : s + <161> DW_AT_signature : signature: 0x534310fbefba324d + <169> DW_AT_declaration : 1 ... still does not help, because they're declarations, so new_symbol is not called for them in process_structure_scope. Fix this by calling new_symbol for these decls. Build and tested on x86_64-linux. Also tested with target board enabling by default -fdebug-types-section -gdwarf-4, and with gcc with aforementioned tentative patch. In this configuration, the patch reduces number of FAILs from 2888 to 238. gdb/ChangeLog: 2020-04-28 Tom de Vries <tdevries@suse.de> * dwarf2/read.c (process_structure_scope): Add symbol for struct decl with DW_AT_signature. gdb/testsuite/ChangeLog: 2020-04-28 Tom de Vries <tdevries@suse.de> * gdb.dwarf2/main-foo.c: New test. * gdb.dwarf2/struct-with-sig.exp: New file.
2020-04-28Automatic date update in version.inGDB Administrator1-1/+1
2020-04-28alpha-vms: divide by zeroAlan Modra2-1/+9
The zero check was on the wrong operand. And, yes, the second operand popped is supposed to be divided by the first operand popped. * vms-alpha.c (_bfd_vms_slurp_etir): Correct divide by zero check. Emit warning message.
2020-04-27x86: Add i386 PE big-object supportTamar Christina17-75/+205
The 64-bit version of binutils got support for the PE COFF BIG OBJ format a couple of years ago. The BIG OBJ format is a slightly different COFF format which extends the size of the number of section field in the header from a uint16_t to a uint32_t and so greatly increases the number of sections allowed. However the 32-bit version of bfd never got support for this. The GHC Haskell compiler generates a great deal of symbols due to it's use of -ffunction-sections and -fdata-sections. This meant that we could not build the 32-bit version of the GHC Compiler for many releases now as binutils didn't have this support. This patch adds the support to the 32-bit port of binutils as well and also does come cleanup in the code. bfd/ChangeLog: * coff-i386.c (COFF_WITH_PE_BIGOBJ): New. * coff-x86_64.c (COFF_WITH_PE_BIGOBJ): New. * config.bfd (targ_selvecs): Rename x86_64_pe_be_vec to x86_64_pe_big_vec as it not a big-endian format. (vec i386_pe_big_vec): New. * configure.ac: Likewise. * targets.c: Likewise. * configure: Regenerate. * pe-i386.c (TARGET_SYM_BIG, TARGET_NAME_BIG, COFF_WITH_PE_BIGOBJ): New. * pe-x86_64.c (TARGET_SYM_BIG, TARGET_NAME_BIG): New. (x86_64_pe_be_vec): Moved. gas/ChangeLog: * NEWS: Add news entry for big-obj. * config/tc-i386.c (i386_target_format): Support new format. * doc/c-i386.texi: Add i386 support. * testsuite/gas/pe/big-obj.d: Rename test to not be x64 specific. * testsuite/gas/pe/pe.exp (big-obj): Make test run on i386 as well. ld/ChangeLog: * pe-dll.c (pe_detail_list): Add pe-bigobj-i386.
2020-04-27gdb, gdbserver: remove configure check for fs_base/gs_base in user_regs_structSimon Marchi11-177/+22
I recently stumbled on this code mentioning Linux kernel 2.6.25, and thought it could be time for some spring cleaning (newer GDBs probably don't need to supports 12-year old kernels). I then found that the "legacy" case is probably broken anyway, which gives an even better motivation for its removal. In short, this patch removes the configure checks that check if user_regs_struct contains the fs_base/gs_base fields and adjusts all uses of the HAVE_STRUCT_USER_REGS_STRUCT_{FS,GS}_BASE macros. The longer explanation/rationale follows. Apparently, Linux kernels since 2.6.25 (that's from 2008) have been reliably providing fs_base and gs_base as part of user_regs_struct. Commit df5d438e33d7 in the Linux kernel [1] seems related. This means that we can get these values by reading registers with PTRACE_GETREGS. Previously, these values were obtained using a separate PTRACE_ARCH_PRCTL ptrace call. First, I'm not even sure the configure check was really right in the first place. The user_regs_struct used by GDB comes from /usr/include/x86_64-linux-gnu/sys/user.h (or equivalent on other distros) and is provided by glibc. glibc has had the fs_base/gs_base fields in there for a very long time, at least since this commit from 2001 [2]. The Linux kernel also has its version of user_regs_struct, which I think was exported to user-space at some point. It included the fs_base/gs_base fields since at least this 2002 commit [3]. In any case, my conclusion is that the fields were there long before the aforementioned Linux kernel commit. The kernel commit didn't add these fields, it only made sure that they have reliable values when obtained with PTRACE_GETREGS. So, checking for the presence of the fs_base/gs_base fields in struct user_regs_struct doesn't sound like a good way of knowing if we can reliably get the fs_base/gs_base values from PTRACE_GETREGS. My guess is that if we were using that strategy on a < 2.6.25 kernel, things would not work correctly: - configure would find that the user_regs_struct has the fs_base/gs_base fields (which are probided by glibc anyway) - we would be reading the fs_base/gs_base values using PTRACE_GETREGS, for which the kernel would provide unreliable values Second, I have tried to see how things worked by forcing GDB to not use fs_base/gs_base from PTRACE_GETREGS (forcing it to use the "legacy" code, by configuring with ac_cv_member_struct_user_regs_struct_gs_base=no ac_cv_member_struct_user_regs_struct_fs_base=no Doing so breaks writing registers back to the inferior. For example, calling an inferior functions gives an internal error: (gdb) p malloc(10) /home/smarchi/src/binutils-gdb/gdb/i387-tdep.c:1408: internal-error: invalid i387 regnum 152 The relevant last frames where this error happens are: #8 0x0000563123d262fc in internal_error (file=0x563123e93fd8 "/home/smarchi/src/binutils-gdb/gdb/i387-tdep.c", line=1408, fmt=0x563123e94482 "invalid i387 regnum %d") at /home/smarchi/src/binutils-gdb/gdbsupport/errors.cc:55 #9 0x0000563123047d0d in i387_collect_xsave (regcache=0x5631269453f0, regnum=152, xsave=0x7ffd38402a20, gcore=0) at /home/smarchi/src/binutils-gdb/gdb/i387-tdep.c:1408 #10 0x0000563122c69e8a in amd64_collect_xsave (regcache=0x5631269453f0, regnum=152, xsave=0x7ffd38402a20, gcore=0) at /home/smarchi/src/binutils-gdb/gdb/amd64-tdep.c:3448 #11 0x0000563122c5e94c in amd64_linux_nat_target::store_registers (this=0x56312515fd10 <the_amd64_linux_nat_target>, regcache=0x5631269453f0, regnum=152) at /home/smarchi/src/binutils-gdb/gdb/amd64-linux-nat.c:335 #12 0x00005631234c8c80 in target_store_registers (regcache=0x5631269453f0, regno=152) at /home/smarchi/src/binutils-gdb/gdb/target.c:3485 #13 0x00005631232e8df7 in regcache::raw_write (this=0x5631269453f0, regnum=152, buf=0x56312759e468 "@\225\372\367\377\177") at /home/smarchi/src/binutils-gdb/gdb/regcache.c:765 #14 0x00005631232e8f0c in regcache::cooked_write (this=0x5631269453f0, regnum=152, buf=0x56312759e468 "@\225\372\367\377\177") at /home/smarchi/src/binutils-gdb/gdb/regcache.c:778 #15 0x00005631232e75ec in regcache::restore (this=0x5631269453f0, src=0x5631275eb130) at /home/smarchi/src/binutils-gdb/gdb/regcache.c:283 #16 0x0000563123083fc4 in infcall_suspend_state::restore (this=0x5631273ed930, gdbarch=0x56312718cf20, tp=0x5631270bca90, regcache=0x5631269453f0) at /home/smarchi/src/binutils-gdb/gdb/infrun.c:9103 #17 0x0000563123081eed in restore_infcall_suspend_state (inf_state=0x5631273ed930) at /home/smarchi/src/binutils-gdb/gdb/infrun.c:9151 The problem seems to be that amd64_linux_nat_target::store_registers calls amd64_native_gregset_supplies_p to know whether gregset provides fs_base. When !HAVE_STRUCT_USER_REGS_STRUCT_FS_BASE, amd64_native_gregset_supplies_p returns false. store_registers therefore assumes that it must be an "xstate" register. This is of course wrong, and that leads to the failed assertion when i387_collect_xsave doesn't recognize the register. amd64_linux_nat_target::store_registers could probably be fixed to handle this case, but I don't think it's worth it, given that it would only be to support very old kernels. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=df5d438e33d7fc914ba9b6e0d6b019a8966c5fcc [2] https://sourceware.org/git/?p=glibc.git;a=commit;h=c9cf6ddeebb7bb [3] https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git/commit/?id=88e4bc32686ebd0b1111a94f93eba2d334241f68 gdb/ChangeLog: * configure.ac: Remove check for fs_base/gs_base in user_regs_struct. * configure: Re-generate. * config.in: Re-generate. * amd64-nat.c (amd64_native_gregset_reg_offset): Adjust. * amd64-linux-nat.c (amd64_linux_nat_target::fetch_registers, amd64_linux_nat_target::store_registers, ps_get_thread_area, ): Adjust. gdbserver/ChangeLog: * configure.ac: Remove check for fs_base/gs_base in user_regs_struct. * configure: Re-generate. * config.in: Re-generate. * linux-x86-low.cc (x86_64_regmap, x86_fill_gregset, x86_store_gregset): Adjust.
2020-04-27Expand dynamic type documentationTom Tromey2-2/+25
This expands the Python dynamic type documentation, as suggested by Christian. gdb/doc/ChangeLog 2020-04-27 Tom Tromey <tromey@adacore.com> * python.texi (Types In Python): Mention missing fields. Add dynamic type example.
2020-04-27gdbsupport: include cstdlib in common-defs.hSimon Marchi2-0/+9
In PR 25731 [1], the following build failure was reported: ../../binutils-gdb/gdb/gdbtypes.c:1254:10: error: no member named 'abs' in namespace 'std'; did you mean simply 'abs'? = ((std::abs (stride) * element_count) + 7) / 8; ^~~~~~~~ abs /usr/include/stdlib.h:129:6: note: 'abs' declared here int abs(int) __pure2; ^ The original report was using: $ gcc -v Apple LLVM version 8.0.0 (clang-800.0.42.1) Target: x86_64-apple-darwin15.6.0 Note that I was _not_ able to reproduce using: $ g++ --version Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1 Apple clang version 11.0.0 (clang-1100.0.33.17) Target: x86_64-apple-darwin19.3.0 The proposed fix is to include <cstdlib> in addition to <stdlib.h>. Here's an excerpt of [2] relevant to this problem: These headers [speaking of the .h form] are allowed to also declare the same names in the std namespace, and the corresponding cxxx headers are allowed to also declare the same names in the global namespace: including <cstdlib> definitely provides std::malloc and may also provide ::malloc. Including <stdlib.h> definitely provides ::malloc and may also provide std::malloc Since we use std::abs, we should not assume that our include of stdlib.h declares an `abs` function in the `std` namespace. If we replace the include of stdlib.h with cstdlib, then we fall in the opposite situation. A standard C++ library may decide to only put the declarations in the std namespace, requiring us to prefix all standard functions with `std::`. I'm not against that, but for the moment I think the safest way forward is to just include both. Note that I don't know what effect this patch can have on any stdlib.h fix provided by gnulib. [1] https://sourceware.org/bugzilla/show_bug.cgi?id=25731 [2] https://en.cppreference.com/w/cpp/header#C_compatibility_headers gdbsupport/ChangeLog: * common-defs.h: Include cstdlib.h.