Commit Graph

102987 Commits

Author SHA1 Message Date
Alan Modra
00bc5e68b2 PR26478 UBSAN: mmo.c:2941 null pointer memcpy
PR 26478
	* mmo.c (mmo_write_symbols_and_terminator): Don't memcpy empty table.
2020-08-26 23:23:45 +09:30
Alan Modra
55e61b8ad9 PR26475 UBSAN: elfxx-mips.c:12180 null pointer memset
Another memset(0,0,0)

	PR 26475
	* elfxx-mips.c (_bfd_mips_elf_finish_dynamic_sections): Check
	sstubs->contents != NULL.
2020-08-26 23:23:44 +09:30
Alan Modra
1673aff569 PR26458 UBSAN: elf32-i386.c:3615 left shift of negative value
Happens when poking symbol index -2 into r_info.  (The index is
updated before writing out to file.)

	PR 26458
	* elf/common.h (ELF32_R_INFO): Cast symbol index to unsigned.
2020-08-26 23:23:44 +09:30
Alan Modra
66ad6b4458 PR26453 UBSAN: som.c:2885 null pointer memcpy
PR 26453
	* som.c (som_prep_for_fixups): Return early when no symbols.
2020-08-26 23:23:44 +09:30
Alan Modra
d8d6da137d PR26448 UBSAN: symbols.c:1586 left shift of negative value
Besides avoiding the UB, this also makes right shifts inside
expression symbols unsigned, consistent with the way gas evaluates
expressions in source.

	PR 26448
	* symbols.c: Include limits.h.
	(resolve_symbol_value <O_left_shift, O_right_shift>): Do an
	unsigned shift.  Warn if shift count larger than valueT size.
2020-08-26 23:23:44 +09:30
Alan Modra
b2f386b99c PR26447 UBSAN: expr.c:1936 left shift of negative value
PR 26447
	* expr.c (expr <O_left_shift>): Do an unsigned shift.
2020-08-26 23:23:44 +09:30
Alan Modra
aaf9875ef9 PR26431 UBSAN: pe-dll.c:568 null pointer bsearch
PR 26431
	* pe-dll.c (auto_export): Don't call bsearch with zero count.
2020-08-26 23:23:44 +09:30
Alan Modra
9863cbb7bd PR26418 UBSAN: cache.c:386 null pointer fwrite
PR 26418
	* ecofflink.c (WRITE): Don't write size 0 chunks.
2020-08-26 23:23:44 +09:30
Alan Modra
c01de19363 asan: alpha-vms: mmember access within null pointer
* bfdio.c (bfd_get_file_size): Don't segv on NULL adata.
2020-08-26 23:23:44 +09:30
Alan Modra
b4e125d935 PR26415 UBSAN: vms-misc.c:636 left shift cannot be represented
An unsigned short value is promoted to int, thus triggering UB on a
left shift of a positive value that results in a negative int.

	PR 26415
	* vms-misc.c (vms_time_t_to_vms_time): Don't use unsigned short vars.
2020-08-26 23:23:44 +09:30
Alan Modra
a68aba2da7 PR26412 UBSAN: objcopy.c:3026 null pointer fwrite
PR 26412
	* objcopy.c (copy_object): Don't fwrite NULL contents.
2020-08-26 23:23:43 +09:30
David Faust
4449c81a85 bpf: add xBPF ISA
This patch adds support for xBPF, another ISA targetting the BPF
virtual architecture. For now, the primary difference between eBPF
and xBPF is that xBPF supports indirect calls through the
'call %reg' form of the call instruction.

bfd/
	* archures.c (bfd_mach_xbpf): Define.
	* bfd-in2.h: Regenerate.
	* cpu-bpf.c (bfd_xbpf_arch) New.
	(bfd_bpf_arch) Update next in list field to point to xbpf arch.

cpu/
	* bpf.cpu (arch bpf): Add xbpf mach and isas.
	(define-xbpf-isa) New pmacro.
	(all-isas) Add xbpfle,xbpfbe.
	(endian-isas): New pmacro.
	(mach xbpf): New.
	(model xbpf-def): Likewise.
	(h-gpr): Add xbpf mach.
	(f-dstle, f-srcle, dstle, srcle): Add xbpfle isa.
	(f-dstbe, f-srcbe, dstbe, srcbe): Add xbpfbe isa.
	(define-alu-insn-un): Use new endian-isas pmacro.
	(define-alu-insn-bin, define-alu-insn-mov): Likewise.
	(define-endian-insn, define-lddw): Likewise.
	(dlind, dxli, dxsi, dsti): Likewise.
	(define-cond-jump-insn, define-call-insn): Likewise.
	(define-atomic-insns): Likewise.

gas/
	* config/tc-bpf.c: Add option -mxbpf to select xbpf isa.
	* testsuite/gas/bpf/indcall-1.d: New file.
	* testsuite/gas/bpf/indcall-1.s: Likewise.
	* testsuite/gas/bpf/indcall-bad-1.l: Likewise.
	* testsuite/gas/bpf/indcall-bad-1.s: Likewise.
	* testsuite/gas/bpf/bpf.exp: Run new tests.

opcodes/
	* bpf-desc.c: Regenerate.
	* bpf-desc.h: Likewise.
	* bpf-opc.c: Likewise.
	* bpf-opc.h: Likewise.
	* disassemble.c (disassemble_init_for_target): Set bits for xBPF
	ISA when appropriate.
2020-08-26 15:39:00 +02:00
Katayama Hirofumi
37f628c34d windres: AUTOCHECKBOX default style must have WS_TABSTOP style
PR 26340
	* rcparse.y (AUTOCHECKBOX): Add WS_TABSTOP to the base style.
2020-08-26 11:57:02 +01:00
Shahab Vahedi
4c6e63bfa8 gdb: Add ARC target and maintainer to MAINTAINERS
This patch updates gdb/MAINTAINERS with ARC as a target and
myself as the maintainer.  There is no mention of "-Werror"
because that is enabled by default for gdb/ targets now.

gdb/ChangeLog:

	* MAINTAINERS: Add ARC target and maintainer.
2020-08-26 10:07:14 +02:00
Alan Modra
13f8a2465e Re: CSKY: Add new arch CK860
bfd-in2.h is a generated file.  Put the new machine where it belongs.

	* archures.c (bfd_mach_ck860): Define.
2020-08-26 11:43:03 +09:30
GDB Administrator
3c68b07e84 Automatic date update in version.in 2020-08-26 00:00:10 +00:00
Anton Kolesov
8d7f06359a arc: Add GNU/Linux support for ARC
ARC Linux targets differences from baremetal:

- No support for hardware single instruction stepping.
- Different access rules to registers.
- Use of another instruction for breakpoints.

v2: Changes after Tom's remarks [1]
 arc-linux-tdep.c
  - Use true/false instead of TRUE/FALSE.
  - arc_linux_sw_breakpoint_from_kind (): Break long lines into two.
  - arc_linux_sw_breakpoint_from_kind (): Remove starting blank line.
  - Use explicit number evaluation, e.g: if (a & b) -> if ((a & b) != 0)
 arc-tdep.c
  - Use explicit number evaluation, e.g: if (a & b) -> if ((a & b) != 0)
 gdb/configure.tgt
  - arc*-*-linux*): Remove "build_gdbserver=yes".

v3: Changes after Simon's remarks [2]
  arc-linux-tdep.c
  - Use "return trap_size" instead of cryptic "return 2".
  - Removed unnecessary curly braces.
  - Removed "void" from "_initialize_arc_linux_tdep (void)".

v5: Changes after Simon's remarks [3]
- Remove unnecessary empty lines.
- Replace "breakpoint uses" with "breakpoints use" in a comment.
- "return condition;" i.s.o. "if (condition) return true; else return false;"

[1] Tom's remarks
https://sourceware.org/pipermail/gdb-patches/2020-April/167887.html

[2] Simon's remarks on v2
https://sourceware.org/pipermail/gdb-patches/2020-May/168513.html

[3] Simon's remarks on v4
https://sourceware.org/pipermail/gdb-patches/2020-August/170994.html

gdb/ChangeLog:

2020-08-25  Anton Kolesov  <anton.kolesov@synopsys.com>

	* configure.tgt: ARC support for GNU/Linux.
	* Makefile.in (ALL_TARGET_OBJS): Likewise.
	* arc-linux-tdep.c: New file.
	* arc-tdep.h (ARC_STATUS32_L_MASK, ARC_STATUS32_DE_MASK): Declare.
	* arc-tdep.c (arc_write_pc): Use it.
2020-08-25 17:31:29 +02:00
Shahab Vahedi
fdd8731bd1 arc: Add hardware loop detection
For ARC there are registers that are not part of a required set in XML
target descriptions by default, but are almost always present on ARC
targets and are universally exposed by the ptrace interface.  Hardware
loop registers being one of them.

LP_START and LP_END auxiliary registers are hardware loop start and end.
Formally, they are optional, but it is hard to find an ARC configuration
that doesn't have them.  They are always present in processors that can
run GNU/Linux.  GDB needs to know about those registers to implement
proper software single stepping, since they affect  what instruction
will be next.

This commit adds the code to check for the existance of "lp_start" and
"lp_end" in XML target descriptions. If they exist, then the function
reports that the target supports hardware loops.

gdb/ChangeLog:

	* arc-tdep.c (arc_check_for_hardware_loop): New.
	* arc-tdep.h (gdbarch_tdep): New field has_hw_loops.

gdb/doc/ChangeLog:

	* gdb.texinfo (Synopsys ARC): Document LP_START, LP_END and BTA.
2020-08-25 17:31:29 +02:00
Shahab Vahedi
2245952499 arc: Add inclusion of "gdbarch.h" in "arc-tdep.h"
The "arc-tdep.h" makes use of definitions in "gdbarch.h", but it
does not include it explicitly.  I have piggy backed this fix
in another commit [1], but I was asked to do it separately [2].

[1] arc: Add hardware loop detection
https://sourceware.org/pipermail/gdb-patches/2020-July/170800.html

[2] Simon's remarks to "arc: Add hardware loop detection"
https://sourceware.org/pipermail/gdb-patches/2020-August/170993.html

gdb/ChangeLog:

	* arc-tdep.h: Include "gdbarch.h".
2020-08-25 17:31:29 +02:00
Shahab Vahedi
995d3a197d arc: Add ARCv2 XML target along with refactoring
A few changes have been made to make the register support simpler,
more flexible and extendible.  The trigger for most of these changes
are the remarks [1] made earlier for v2 of this patch.  The noticeable
improvements are:

- The arc XML target features are placed under gdb/features/arc
- There are two cores (based on ISA) and one auxiliary feature:
  v1-core: ARC600, ARC601, ARC700
  v2-core: ARC EM, ARC HS
  aux: common in both
- The XML target features represent a minimalistic sane set of
  registers irrespective of application (baremetal or linux).
- A concept of "feature" class has been introduced in the code.
  The "feature" object is constructed from BFD and GDBARCH data.
  It contains necessary information (ISA and register size) to
  determine which XML target feature to use.
- A new structure (ARC_REGISTER_FEATURE) is added that allows
  providing index, names, and the necessity of registers. This
  simplifies the sanity checks and future extendibility.
- Documnetation has been updated to reflect ARC features better.
- Although the feature names has changed, there still exists
  backward compatibility with older names through
  find_obsolete_[core,aux]_names() functions.

The last two points were inspired from RiscV port.

[1]
https://sourceware.org/pipermail/gdb-patches/2020-May/168511.html

gdb/ChangeLog:

	* arch/arc.h
	  (arc_gdbarch_features): New class to stir the selection of target XML.
	  (arc_create_target_description): Use FEATURES to choose XML target.
	  (arc_lookup_target_description): Use arc_create_target_description
	  to create _new_ target descriptions or return the already created
	  ones if the FEATURES is the same.
	* arch/arc.c: Implementation of prototypes described above.
	* gdb/arc-tdep.h (arc_regnum enum): Add more registers.
	  (arc_gdbarch_features_init): Initialize the FEATURES struct.
	* arc-tdep.c (*_feature_name): Make feature names consistent.
	  (arc_register_feature): A new struct to hold information about
	  registers of a particular target/feature.
	  (arc_check_tdesc_feature): Check if XML provides registers in
	  compliance with ARC_REGISTER_FEATURE structs.
	  (arc_update_acc_reg_names): Add aliases for r58 and r59.
	  (determine_*_reg_feature_set): Which feature name to look for.
	  (arc_gdbarch_features_init): Given MACH and ABFD, initialize FEATURES.
	  (mach_type_to_arc_isa): Convert from a set of binutils machine types
	  to expected ISA enums to be used in arc_gdbarch_features structs.
	* features/Makefile (FEATURE_XMLFILES): Add new files.
	* gdb/features/arc/v1-aux.c: New file.
	* gdb/features/arc/v1-aux.xml: Likewise.
	* gdb/features/arc/v1-core.c: Likewise.
	* gdb/features/arc/v1-core.xml: Likewise.
	* gdb/features/arc/v2-aux.c: Likewise.
	* gdb/features/arc/v2-aux.xml: Likewise.
	* gdb/features/arc/v2-core.c: Likewise.
	* gdb/features/arc/v2-core.xml: Likewise.
	* NEWS (Changes since GDB 9): Announce obsolence of old feature names.

gdb/doc/ChangeLog:

	* gdb.texinfo (Synopsys ARC): Update the documentation for ARC
	Features.

gdb/testsuite/ChangeLog:

	* gdb.arch/arc-tdesc-cpu.xml: Use new feature names.
2020-08-25 17:31:26 +02:00
Simon Marchi
8cac2b318b gdb/testsuite: fix gdb.threads/stepi-random-signal.exp pattern (gdb/26532)
Commit 1eb8556f5a ("gdb: add infrun_debug_printf macro") changed the
debug output format for `set debug infrun 1`.  The test
gdb.threads/stepi-random-signal.exp uses that debug output, and was
updated, but not correctly.  It results in this failure:

    FAIL: gdb.threads/stepi-random-signal.exp: stepi (no random signal)

Fix it by adjusting the pattern in the test.

gdb/testsuite/ChangeLog:

	PR gdb/26532
	* gdb.threads/stepi-random-signal.exp: Update pattern.

Change-Id: If5fa525e9545e32a286effe6a6184358374bd37c
2020-08-25 11:06:43 -04:00
Simon Marchi
2bc19622c9 gdb/testsuite: fix gdb.base/ui-redirect.exp pattern (gdb/26532)
Commit 1eb8556f5a ("gdb: add infrun_debug_printf macro") changed the
debug output format for `set debug infrun 1`.  It broke test
gdb.base/ui-redirect.exp, which I missed:

    FAIL: gdb.base/ui-redirect.exp: debugging: continue

Fix it by adjusting the pattern in the test to the new reality.

gdb/testsuite/ChangeLog:

	PR gdb/26532
	* gdb.base/ui-redirect.exp: Update pattern.

Change-Id: Ie8a8f6675e35a0cab55109b1534b44eb51baec9d
2020-08-25 11:06:27 -04:00
Gary Benson
8571e9c891 Fix ChangeLog entry for commit b04aa1fc8c 2020-08-25 15:53:33 +01:00
Mark Wielaard
c3757b583d Fix the linker's handling of DWARF-5 line number tables.
When building with gcc with -gdwarf-5 ld tests (including ld-elf/dwarf.exp)
fail because they try to read the .debug_ranges section. But DWARF5
introduces a new .debug_rnglists section that encodes the address ranges
more efficiently. Implement reading the debug_rnglists in bfd/dwarf2.c.
Which makes all tests pass again and fixes several gcc testsuite tests
when defaulting to DWARF5.

	*  dwarf2.c (struct dwarf2_debug_file): Add dwarf_rnglists_buffer
	and dwarf_rnglists_size fields.
	(dwarf_debug_sections): Add debug_rnglists.
	(dwarf_debug_section_enum): Likewise.
	(read_debug_rnglists): New function.
	(read_rangelist): New function to call either read_ranges or
	read_rnglists. Rename original function to...
	(read_ranges): ...this.
	(read_rnglists): New function.
2020-08-25 15:33:00 +01:00
Gary Benson
b04aa1fc8c Disable Clang's integrated assembler for two testcases
gdb.dwarf2/dw2-dir-file-name.exp fails to build using Clang because
the generated assembly language contains .ascii directives with more
than one string literal.  gdb.dwarf2/dw2-restore.exp fails to build
using Clang because it contains .func and .endfunc directives.
This commit causes Clang to invoke the system assembler to assemble
the relevant files.

gdb/testsuite/ChangeLog:

	* gdb.dwarf2/dw2-dir-file-name.exp: Use system assembler
	when compiling with clang.
	* gdb.dwarf2/dw2-restore.exp: Likewise
2020-08-25 15:25:04 +01:00
Gary Benson
9f68b45348 Enable gdb.cp/ambiguous.exp with GCC and clang
gdb.cp/ambiguous.exp failed to build using clang with the following
error:

 gdb compile failed, /gdbtest/src/gdb/testsuite/gdb.cp/ambiguous.cc:70:36:
   warning: direct base 'A1' is inaccessible due to ambiguity:
     class JVA1 -> class KV -> class A1
     class JVA1 -> class A1 [-Winaccessible-base]
 class JVA1 : public KV, public LV, public A1 {
                                   ^~~~~~~~~

This commit builds this testcase with -Wno-inaccessible-base when
using clang, to avoid this failure.

Furthermore, gdb.cp/ambiguous.exp has been disabled when using GCC
since 1998.  This commit enables this testcase, building with
-Wno-inaccessible-base when using GCC >= 10.1, and -w otherwise.

gdb/testsuite/ChangeLog:

	* gdb.cp/ambiguous.exp: Enable test when compiling with GCC.
	Add additional_flags=-Wno-inaccessible-base when compiling
	with GCC >= 10.1 or clang.  Add additional_flags=-w when
	compiling with GCC < 10.
2020-08-25 15:14:46 +01:00
Alan Modra
1ab8d92897 PR26505, ASAN: xstormy16_elf_relax_section elf32-xstormy16.c:595
PR 26505
	* elf32-xstormy16.c (xstormy16_elf_relax_section): Check
	is_elf_hash_table before accessing elf fields.
2020-08-25 23:07:10 +09:30
Alan Modra
8640c87dcd PR26504, ASAN: parse_disassembler_options vax-dis.c:142
PR 26504
	* vax-dis.c (parse_disassembler_options): Always add at least one
	to entry_addr_total_slots.
2020-08-25 23:07:10 +09:30
Alan Modra
69ff2100fd PR26501, ASAN: tic54x_undefined_symbol tc-tic54x.c:5015
PR26501
	* gas/config/tc-tic54x.c (tic54x_undefined_symbol): Properly treat
	misc_symbol_hash entries without values.
2020-08-25 23:07:10 +09:30
Alan Modra
1de153a168 PR26500, ASAN: tic4x_inst_make tc-tic4x.c:1247
PR 26500
	* tc-tic4x.c (tic4x_inst_make): Don't die on terminating insn
	with name = "".
2020-08-25 23:07:10 +09:30
Alan Modra
a93ba4c0cf PR26482, ASAN: _bfd_xcoff_sizeof_headers coff-rs6000.c:2585
PR 26482
	* coff-rs6000.c (_bfd_xcoff_sizeof_headers): Ignore sections that
	won't be output.
2020-08-25 23:07:10 +09:30
Alan Modra
1438dd86cc PR26463, ASAN: m32c_elf_relax_section elf32-m32c.c:1448
PR 26463
	* elf32-m32c.c (m32c_elf_relax_section): Check is_elf_hash_table
	before accessing elf fields.
2020-08-25 23:07:10 +09:30
Alan Modra
2186273ac4 PR26452, ASAN: som_compute_checksum som.c:4293
PR 26452
	* som.c (som_compute_checksum): XOR 32-bit words in header,
	not unsigned long sized words.
2020-08-25 23:07:10 +09:30
Alan Modra
d3e0baddb2 PR26441, ASAN: get_b_cc tc-cr16.c:1521
PR 26441
	* config/tc-cr16.c (get_b_cc): Return NULL early if op isn't
	two or three chars, and don't bother copying.
2020-08-25 23:07:10 +09:30
Alan Modra
0c1438eb15 PR26430, ASAN: nacl_modify_segment_map elf-nacl.c:164
PR 26430
	* elf-nacl.c (nacl_modify_segment_map): Correct alloc size and
	amount copied for elf_segment_map defined with one element
	sections array.
2020-08-25 23:07:10 +09:30
Alan Modra
250dd99fc9 PR26426, ASAN: neon_quad tc-arm.c:15175
PR 26426
	* config/tc-arm.c (do_neon_mvn, do_neon_swp): Bail out on
	NS_NULL shape.
2020-08-25 23:07:10 +09:30
Alan Modra
d2327e47ef PR26422, ASAN: elf32_arm_final_link_relocate elf32-arm.c:10351
Always reading 32 bits in order to extract addends from instruction
fields is wrong when the field size is smaller.  It also leads to
reading past the end of the section.  This patch tidies that by
reading the proper field size, which allows some later refetching of
addends to disappear.

	PR 26422
	* elf32-arm.c (elf32_arm_final_link_relocate): Use the appropriate
	bfd_get_x size function to read addends out of fields.  Apply
	rightshift adjustment too.  Don't apply the now unnecessary
	howto->size shift to branch REL addends.  Don't refetch R_ARM_ABS8
	and R_ARM_ABS16 addends.  Don't refetch thumb branch addends.
	Correct R_ARM_THM_JUMP6 addend.
2020-08-25 23:07:10 +09:30
Alan Modra
b8ff233b54 PR26419, ASAN: mn10300_elf_relax_section elf-m10300.c:3943
PR 26419
	* elf-m10300.c (mn10300_elf_relax_section): Don't attempt access
	before start of section.
2020-08-25 23:07:10 +09:30
Alan Modra
30b940a097 PR26410, UBSAN: symbols.c:1818
Don't memset(0,0,0).

	PR 26410
	* symbols.c (dollar_label_count, dollar_label_max): Make size_t.
	(dollar_label_clear): Don't call memset with NULL pointer.
2020-08-25 23:07:10 +09:30
Alan Modra
ca159256b4 gas warning fixes
Some versions of gcc with -Werror=format-overflow complain about using
a perfectly good 7 char buffer for "r%dr%d" when the int is between 0
and 64, apparently not seeing the value range.

note: __builtin___sprintf_chk output between 5 and 24 bytes into a destination of size 7

	* config/tc-arc.c (declare_register_set): Avoid false positive
	format-overflow warning.
	* config/tc-epiphany.c (md_assemble): Likewise.
	* config/tc-mips.c (md_begin): Likewise.
	* config/tc-mmix.c (mmix_md_begin): Likewise.
	* config/tc-nds32.c (nds32_elf_append_relax_relocs): Avoid false
	positive "may be used uninitialized" warning.
2020-08-25 23:06:50 +09:30
Alan Modra
8d30354667 tic54x ld testsuite
* testsuite/ld-libs/libs.exp: Don't run on sh-pe, tic30 or tic54x.
	* testsuite/ld-scripts/data.d: xfail tic4x and tic54x.
	* testsuite/ld-scripts/empty-address-2a.d: xfail tic54x.
	* testsuite/ld-scripts/empty-address-2b.d: Likewise.
	* testsuite/ld-scripts/include-1.d: xfail tic4x and tic54x.
	* testsuite/ld-scripts/provide-1.d: xfail tic54x.
	* testsuite/ld-scripts/provide-2.d: Likewise.
	* testsuite/ld-scripts/provide-4.d: Likewise.
2020-08-25 19:31:57 +09:30
Gaius Mulley
3945d2d77e gdb/modula-2: parsing of multi-subscript arrays
Fix bug PR m2/26372, GDB's inability to parse multi-dimensional
modula-2 arrays.

We previously had two rules for handling the parsing of array
sub-scripts.  I have reproduced them here with the actual handler
blocks removed to make the bug clearer:

  exp     :    exp '[' non_empty_arglist ']'
          ;

  exp     :    exp '[' exp ']'
          ;

  non_empty_arglist
          :       exp
          ;

  non_empty_arglist
          :       non_empty_arglist ',' exp
          ;

This is ambiguous as the pattern "exp '[' exp" could match either of
the 'exp' rules.  Currently it just so happens that the parser picks
the second 'exp' rule which means we can only handle a single array
index.

As the handler code for the first 'exp' pattern will correctly handle
and number of array indexes then lets just remove the second pattern.

gdb/ChangeLog:

	PR m2/26372
        * m2-exp.y (exp): Improve comment for non_empty_arglist case, add
	an assert.  Remove single element array indexing pattern as the
	MULTI_SUBSCRIPT support will handle this case too.

gdb/testsuite/ChangeLog:

	PR m2/26372
        * gdb.modula2/multidim.c: New file.
        * gdb.modula2/multidim.exp: New file.
2020-08-25 10:28:06 +01:00
Andrew Burgess
419cca029e Revert "Fix for Bug 26372 [Modula-2] Parsing of multi-subscript arrays"
This reverts commit 07758bdfa9.
2020-08-25 10:25:32 +01:00
Gaius Mulley
07758bdfa9 Fix for Bug 26372 [Modula-2] Parsing of multi-subscript arrays
Here is a bugfix for Pr 26372 [Modula-2] Parsing of multi-subscript arrays.
Also included is a dejagnu testcase.  No extra regressions are caused on
Debian GNU/Linux Buster amd64.

gdb/ChangeLog:

2020-08-25  Gaius Mulley  <gaiusmod2@gmail.com>

	PR m2/26372
	* m2-exp.y: Rewrite array subscript rules to support multidimension
	array access.  (ArgumentList) replaces non_empty_arglist.

gdb/testsuite/ChangeLog:

2020-08-25  Gaius Mulley  <gaiusmod2@gmail.com>

	PR m2/26372
	* testsuite/gdb.modula2/multidim.exp: New file.
	* testsuite/gdb.modula2/multidim.c: New file.
2020-08-25 11:16:56 +02:00
Simon Marchi
2677f2d3fd gdb: move declaration of valprint_check_validity to valprint.h
The implementation is in valprint.c, so the declaration belongs in
valprint.h.

gdb/ChangeLog:

	* value.h (valprint_check_validity): Move declaration from
	here...
	* valprint.h (valprint_check_validity): ... to here.

Change-Id: Ibe577d3696720099e6d79888d4ee8e3c1bf05a26
2020-08-24 22:51:50 -04:00
GDB Administrator
4cf3d79e64 Automatic date update in version.in 2020-08-25 00:00:09 +00:00
Simon Marchi
60122dbef4 gdb/testsuite: make runto always emit a FAIL on internal error
I noticed that when a test uses `runto_main` and a GDB internal error
happens while running to main, no error or fail is emitted.  This is
because `runto_main` uses the `no-message` option of `runto`.

As a result, if a test fails to run to main and exits, no sign that
something went wrong is emitted.  For example, add this always-false
assertion to compute_frame_id:

    --- a/gdb/frame.c
    +++ b/gdb/frame.c
    @@ -545,6 +545,7 @@ static void
     compute_frame_id (struct frame_info *fi)
     {
       gdb_assert (!fi->this_id.p);
    +  gdb_assert (false);

       if (frame_debug)
         fprintf_unfiltered (gdb_stdlog, "{ compute_frame_id (fi=%d) ",

... and run gdb.dwarf2/dw2-align.exp.  No fail or sign that something
went wrong is shown.  It just appears as if the test gets skipped.

A developer introducing such a regression in this test today would
likely notice it, because we are used to diff-ing test results.  So we
would see some PASSes dispappear for no good reason and look into it.

But I find it worrysome for two reasons:

1. Scripts that analyze regressions (such as the one on the buildbot)
   may only look for new FAILs or new ERRORs.  It would probably miss
   this.
2. Imagine that we one day have a testsuite that runs cleanly (some
   people might already run subsets of the testsuite and expect it to
   all pass), we would just run the testsuite and check that there are
   no fails.  It would be easy to miss something like this.

In case of internal error, I suggest making `runto` emit a FAIL even if
`no-message` was passed.  This is different from other failure modes
that might be expected (whchi rightfully cause the test to simply be
skipped).  An internal error is always bad, so if it happens it should
noisily fail.

gdb/testsuite/ChangeLog:

	* lib/gdb.exp (runto): Always emit fail on internal error.

Change-Id: I6e6faed4868ea821541a23042b2d01c30058b0d3
2020-08-24 19:44:53 -04:00
Simon Marchi
c426fddb87 gdb: add debug_prefixed_vprintf
To help ensure that all debug statements have the same format, introduce
the debug_prefixed_vprintf helper.  Implement linux_nat_debug_printf_1
and infrun_debug_printf_1 with it.

I would eventually like to style the module and function name with some
color, to help them stick out, but I don't really know how to do that
yet, it can always be done later.

gdb/ChangeLog:

	* debug.h: New file.
	* debug.c (debug_prefixed_vprintf): New function.
	* infrun.c (infrun_debug_printf_1): Use debug_prefixed_vprintf.
	* linux-nat.c (linux_nat_debug_printf_1): Likewise.

Change-Id: Iccc290a2dc6b5fffcbe1c2866ed8d804ad380764
2020-08-24 15:50:19 -04:00
Simon Marchi
1eb8556f5a gdb: add infrun_debug_printf macro
Introduce this macro to print debug statements in the infrun.c file,
same idea as what was done in 9327494e0e ("gdb: add
linux_nat_debug_printf macro").

Although in this case, there are places outside infrun.c that print
debug statements if debug_infrun is set.  So the macro has to be
declared in the header file, so that it can be used in these other
files.

Note one special case.  In stop_all_threads, I've used an explicit

    if (debug_infrun)
      infrun_debug_printf_1 ("stop_all_threads", "done");

for the message in the SCOPE_EXIT.  Otherwise, the message appears like
this:

  [infrun] operator(): done

Until we find a better solution for extracting a meaningful function
name for lambda functions, I think it's fine to handle these special
cases manually, they are quite rare.

Some tests need to be updated, because they rely on some infrun debug
statements.

gdb/ChangeLog:

	* infrun.h (infrun_debug_printf_1): New function declaration.
	(infrun_debug_printf): New macro.
	* infrun.c (infrun_debug_printf_1): Use infrun_debug_printf
	throughout.
	(infrun_debug_printf): New function.
	* breakpoint.c (should_be_inserted): Use infrun_debug_printf.
	(handle_jit_event): Likewise.

gdb/testsuite/ChangeLog:

	* gdb.base/gdb-sigterm.exp (do_test): Update expected regexp.
	* gdb.threads/signal-while-stepping-over-bp-other-thread.exp:
	Likewise.
	* gdb.threads/stepi-random-signal.exp: Likewise.

Change-Id: I66433c8a9caa64c8525ab57c593022b9d1956d5c
2020-08-24 15:49:47 -04:00
Alan Modra
0f55320bc4 elf_hash_table_id access
* elf-m10300.c (elf32_mn10300_hash_table): Test is_elf_hash_table
	before accessing elf_hash_table_id.
	* elf32-arc.c (elf_arc_hash_table): Likewise.
	* elf32-arm.c (elf32_arm_hash_table): Likewise.
	* elf32-avr.c (avr_link_hash_table): Likewise.
	* elf32-bfin.c (bfinfdpic_hash_table): Likewise.
	* elf32-cris.c (elf_cris_hash_table): Likewise.
	* elf32-csky.c (csky_elf_hash_table): Likewise.
	* elf32-frv.c (frvfdpic_hash_table): Likewise.
	* elf32-hppa.c (hppa_link_hash_table): Likewise.
	* elf32-lm32.c (lm32_elf_hash_table): Likewise.
	* elf32-m32r.c (m32r_elf_hash_table): Likewise.
	* elf32-m68hc1x.h (m68hc11_elf_hash_table): Likewise.
	* elf32-m68k.c (elf_m68k_hash_table): Likewise.
	* elf32-metag.c (metag_link_hash_table): Likewise.
	* elf32-microblaze.c (elf32_mb_hash_table): Likewise.
	* elf32-nds32.h (nds32_elf_hash_table): Likewise.
	* elf32-or1k.c (or1k_elf_hash_table): Likewise.
	* elf32-s390.c (elf_s390_hash_table): Likewise.
	* elf32-sh.c (sh_elf_hash_table): Likewise.
	* elf32-spu.c (spu_hash_table): Likewise.
	* elf32-tilepro.c (tilepro_elf_hash_table): Likewise.
	* elf32-xtensa.c (elf_xtensa_hash_table): Likewise.
	* elf64-alpha.c (alpha_elf_hash_table): Likewise.
	* elf64-hppa.c (hppa_link_hash_table): Likewise.
	* elf64-ia64-vms.c (elf64_ia64_hash_table): Likewise.
	* elf64-s390.c (elf_s390_hash_table): Likewise.
	* elfnn-ia64.c (elfNN_ia64_hash_table): Likewise.
	* elfnn-riscv.c (riscv_elf_hash_table): Likewise.
	* elfxx-mips.c (mips_elf_hash_table): Likewise.
	* elfxx-sparc.h (_bfd_sparc_elf_hash_table): Likewise.
	* elfxx-tilegx.c (tilegx_elf_hash_table): Likewise.
2020-08-25 02:45:58 +09:30