Commit Graph

101522 Commits

Author SHA1 Message Date
Tom de Vries
6015a06749 [gdb/testsuite] Fix gdb.base/async.exp with gcc-8
When running test-case gdb.base/async.exp with gcc-8, we run into:
...
FAIL: gdb.base/async.exp: stepi&
...

The problem is that with gcc-8, the instruction address is no longer printed:
...
 stepi&
-(gdb) 0x00000000004004b2       9        x = 5; x = 5; x = 5;
+(gdb) 9         x = 5; x = 5; x = 5;
 completed.
-PASS: gdb.base/async.exp: stepi&
+FAIL: gdb.base/async.exp: stepi&
...

This is due to the fact that gcc-8 contains more precise line info, making the
address being stepped to a "recommended breakpoint location", and consequently
gdb doesn't print the address prefix anymore.

Given that:
- we step through statements on the same line, and
- there's no addres prefix anymore,
this gives the impression of lack of progress, which could be improved upon,
filed as enhancement PR25911 - "Show column when stepping through line".

Fix the FAIL by checking in the test-case whether addresses are at
"recommended breakpoint location" or not.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-05-04  Tom de Vries  <tdevries@suse.de>

	* gdb.base/async.exp: Check whether instruction addresses are a
	"recommended breakpoint location".
2020-05-04 08:40:38 +02:00
Alan Modra
9c7b8e9b92 readelf: nds32 specific decoding
* readelf.c (process_nds32_specific): Check size of .nds32_e_flags
	section.  Don't assume endian of host matches nds32 target.  Free
	buffer.
2020-05-04 11:28:40 +09:30
GDB Administrator
c3bf7d31de Automatic date update in version.in 2020-05-04 00:00:06 +00:00
Tom Tromey
3b6acaee89 Update more calls to add_prefix_cmd
I looked at all the calls to add_prefix_cmd, and replaced them with
calls to add_basic_prefix_cmd or add_show_prefix_cmd when appropriate.
This makes gdb's command language a bit more regular.  I don't think
there's a significant downside.

Note that this patch removes a couple of tests.  The removed ones are
completely redundant.

gdb/ChangeLog
2020-05-03  Tom Tromey  <tom@tromey.com>

	* breakpoint.c (catch_command, tcatch_command): Remove.
	(_initialize_breakpoint): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	(set_breakpoint_cmd, show_breakpoint_cmd): Remove
	* utils.c (set_internal_problem_cmd, show_internal_problem_cmd):
	Remove.
	(add_internal_problem_command): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	* mips-tdep.c (set_mipsfpu_command): Remove.
	(_initialize_mips_tdep): Use add_basic_prefix_cmd.
	* dwarf2/index-cache.c (set_index_cache_command): Remove.
	(_initialize_index_cache): Use add_basic_prefix_cmd.
	* memattr.c (dummy_cmd): Remove.
	(_initialize_mem): Use add_basic_prefix_cmd, add_show_prefix_cmd.
	* tui/tui-win.c (set_tui_cmd, show_tui_cmd): Remove.
	(_initialize_tui_win): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	* cli/cli-logging.c (set_logging_command): Remove.
	(_initialize_cli_logging): Use add_basic_prefix_cmd,
	add_show_prefix_cmd.
	(show_logging_command): Remove.
	* target.c (target_command): Remove.
	(add_target): Use add_basic_prefix_cmd.

gdb/testsuite/ChangeLog
2020-05-03  Tom Tromey  <tom@tromey.com>

	* gdb.base/sepdebug.exp: Remove "catch" test.
	* gdb.base/break.exp: Remove "catch" test.
	* gdb.base/default.exp: Update expected output.
2020-05-03 11:31:20 -06:00
GDB Administrator
c69ad65744 Automatic date update in version.in 2020-05-03 00:00:07 +00:00
H.J. Lu
8c16443418 gold: Compile common tests with -fcommon
Since GCC 10 defaults to -fno-common, add -fcommon to common tests to
force common behavior.

	PR gold/25904
	* testsuite/Makefile.am (COMMON_TEST_C_CFLAGS): New.
	(common_test_1.o): New rule.
	(common_test_2.o): Likewise.
	(common_test_3.o): Likewise.
	(plugin_common_test_1.o): Likewise.
	(plugin_common_test_2.o): Likewise.
	(common_test_1_v1.o): Likewise.
	(common_test_1_v2.o): Likewise.
	(common_test_2_pic.o): Compile with $(COMMON_TEST_C_CFLAGS).
	(common_test_3_pic.o): Likewise.
	* testsuite/Makefile.in: Regenerated.
2020-05-02 06:48:26 -07:00
Hannes Domani
a51119cde4 Fix typo in comment of DYN_PROP_ASSOCIATED
gdb/ChangeLog:

2020-05-02  Hannes Domani  <ssbssa@yahoo.de>

	* gdbtypes.h (enum dynamic_prop_node_kind): Fix typo.
2020-05-02 12:55:51 +02:00
Andrew Burgess
6a6ea76aee gdb: Fix formatting error in ChangeLog 2020-05-02 10:28:56 +01:00
Tom de Vries
5beb4d1771 [gdb/testsuite] Fix i386-mpx.exp compilation warnings
When running test-case gdb.arch/i386-mpx.exp with gcc-10, we get:
...
Running src/gdb/testsuite/gdb.arch/i386-mpx.exp ...
gdb compile failed, xgcc: warning: switch '-mmpx' is no longer supported
xgcc: warning: switch '-fcheck-pointer-bounds' is no longer supported
...

The test-case uses a combination of options, -mmpx and -fcheck-pointer-bounds.

The -fcheck-pointer-bounds option requires the -mmpx option:
...
$ gcc -fcheck-pointer-bounds ~/hello.c
hello.c:1:0: warning: Pointer Checker requires MPX support on this target. \
  Use -mmpx options to enable MPX.
 #include <stdio.h>

cc1: error: ‘-fcheck-pointer-bounds’ is not supported for this target
...

Both options is no longer supported in gcc-9.

Fix the warnings by testing if the option combination is supported.

Tested on x86_64-linux, with gcc-7.5.0 and gcc-10.0.1.

gdb/testsuite/ChangeLog:

2020-05-02  Tom de Vries  <tdevries@suse.de>

	* lib/gdb.exp (supports_mpx_check_pointer_bounds): New proc.
	* gdb.arch/i386-mpx-call.exp: Use supports_mpx_check_pointer_bounds.
	* gdb.arch/i386-mpx-map.exp: Same.
	* gdb.arch/i386-mpx-sigsegv.exp: Same.
	* gdb.arch/i386-mpx-simple_segv.exp: Same.
	* gdb.arch/i386-mpx.exp: Same.
2020-05-02 10:56:48 +02:00
Tom de Vries
8caf140db2 [gdb/testsuite] Update psym-external-decl.exp for gcc-10/clang
When running test-case gdb.base/psym-external-decl.exp with gcc-10, we have:
...
(gdb) print aaa^M
'aaa' has unknown type; cast it to its declared type^M
(gdb) FAIL: gdb.base/psym-external-decl.exp: print aaa
...

With an an earlier version, gcc still emits the debug info for the
declaration of aaa:
...
 <0><d2>: Abbrev Number: 1 (DW_TAG_compile_unit)
    <d8>   DW_AT_name        : psym-external-decl.c
 <1><f4>: Abbrev Number: 2 (DW_TAG_variable)
    <f5>   DW_AT_name        : aaa
    <ff>   DW_AT_external    : 1
    <ff>   DW_AT_declaration : 1
...
but with gcc-10 that's no longer the case.

Fix the test-case by adding a use of aaa in psym-external-decl.c.

That still doesn't work for clang, so skip test in that case.

Tested with x86_64-linux, with gcc 7.5.0, gcc 10.0.0 and clang 5.0.2.

Also tested by reverting corresponding fix and ensuring test-case still
fails.

gdb/testsuite/ChangeLog:

2020-05-02  Tom de Vries  <tdevries@suse.de>

	* gdb.base/psym-external-decl.c (main): Add use of variable aaa.
2020-05-02 09:50:50 +02:00
GDB Administrator
a4be18526b Automatic date update in version.in 2020-05-02 00:00:07 +00:00
H.J. Lu
ccf20d460f gold: x86-64: Fix TLSDESC relaxation for x32
X32 TLSDESC sequences can be:

40 8d 05 00 00 00 00	rex lea	foo@TLSDESC(%rip), %reg
...
67 ff 10		call	*foo@TLSCALL(%eax)

or the same sequence as LP64:

48 8d 05 00 00 00 00	lea	foo@TLSDESC(%rip), %reg
...
ff 10			call	*foo@TLSCALL(%rax)

We need to support both sequences for x32.  For both GDesc -> IE/LE
transitions,

67 ff 10		call	*foo@TLSCALL(%eax)

should relaxed to

0f 1f 00		nopl	(%rax)

For GDesc -> LE transition,

40 8d 05 00 00 00 00	rex lea	foo@TLSDESC(%rip), %reg

should relaxed to

40 c7 c0 fc ff ff ff	rex movl $foo@tpoff, %reg

For GDesc -> IE transition,

40 8d 05 00 00 00 00	rex lea	foo@TLSDESC(%rip), %reg

should relaxed to

40 8b 05 00 00 00 00	rex movl foo@gottpoff(%rip), %eax

	PR gold/25426
	* x86_64.cc (Target_x86_64<size>::Relocate::tls_desc_gd_to_ie):
	For x32, relax "rex leal foo@tlsdesc(%rip), %reg" to
	"rex movl foo@gottpoff(%rip), %eax" and relax ""call *(%eax)"
	to "nopl (%rax)".
	(Target_x86_64<size>::Relocate::tls_desc_gd_to_le): For x32,
	relax "rex leal foo@tlsdesc(%rip), %reg" to
	"rex movl foo@tpoff, %eax" and relax "call *foo@tlscall(%eax)"
	to "nopl (%rax)".
	* testsuite/Makefile.am (tls_test_gnu2.o): Depend on
	gcctestdir/as.
	(tls_test_file2_gnu2.o): Likewise.
	(tls_test_c_gnu2.o): Likewise.
	* testsuite/Makefile.in: Regenerated.
2020-05-01 10:11:23 -07:00
H.J. Lu
6d520e36de gold: x86-64: Fix TLSDESC -> LE relaxation
X86-64 TLSDESC sequences can be:

4c 8d 0d 00 00 00 00	leaq	foo@TLSDESC(%rip), %r9
4c 89 c8		movq	%r9, %rax
ff 10			call	*foo@TLSCALL(%rax)

TLSDESC -> LE relaxation can turn them into:

49 c7 c1 fc ff ff ff 	mov    $0xfffffffffffffffc,%r9
4c 89 c8             	mov    %r9,%rax
66 90                	xchg   %ax,%ax

We need to check and update the REX byte in this case.

	PR gold/25473
	* x86_64.cc (Target_x86_64<size>::Relocate::tls_desc_gd_to_ie):
	Properly check r8 - r15 in "lea foo@TLSDESC(%rip), %reg".
	(Target_x86_64<size>::Relocate::tls_desc_gd_to_le): Properly
	relax r8 - r15 in "lea foo@TLSDESC(%rip), %reg".
	* testsuite/Makefile.am (check_SCRIPTS): Add x86_64_gd_to_le.sh.
	(check_DATA): Add x86_64_gd_to_le.stdout.
	(MOSTLYCLEANFILES): Add x86_64_gd_to_le.
	(x86_64_gd_to_le.o): New target.
	(x86_64_gd_to_le): Likewise.
	(x86_64_gd_to_le.stdout): Likewise.
	* testsuite/Makefile.in: Regenerated.
	* testsuite/x86_64_gd_to_le.s: New file.
	* testsuite/x86_64_gd_to_le.sh: Likewise.
2020-05-01 10:08:48 -07:00
H.J. Lu
e10cfd0633 gold: Make Ordering::operator() even more complex
GCC 9 generates the same function size for Ordering::operator() in
odr_violation1.cc and odr_violation2.cc on x32:

  134: 00000000    31 FUNC    WEAK   DEFAULT   64 _ZN8OrderingclEii
   40: 00000000    31 FUNC    GLOBAL DEFAULT   10 _ZN8OrderingclEii

This patch makes Ordering::operator() even more complex

   134: 00000000    31 FUNC    WEAK   DEFAULT   64 _ZN8OrderingclEii
    42: 00000000    35 FUNC    GLOBAL DEFAULT   11 _ZN8OrderingclEii

	* testsuite/odr_violation2.cc (Ordering::operator()): Make
	expression even more complex.
2020-05-01 10:06:31 -07:00
H.J. Lu
de6d6067f5 gold: Update ver_test_pr16504.sh
commit df3a023bd6
Author: Alan Modra <amodra@gmail.com>
Date:   Tue Jul 23 17:54:42 2019 +0930

    SHF_GNU_MBIND requires ELFOSABI_GNU

changed readelf to print IFUNC only for ELFOSABI_GNU.  Since

$ readelf -h ver_test_pr16504.so
...
 OS/ABI:                            UNIX - System V
...

we get

$ readelf -sW ver_test_pr16504.so
...
     3: 0000000000000378    13 <OS specific>: 10 GLOBAL DEFAULT    9 foo@@VER1
...

Update ver_test_pr16504.sh to also accept "<OS specific>: 10".

	* testsuite/ver_test_pr16504.sh: Updated.
2020-05-01 09:05:21 -07:00
H.J. Lu
48bc218262 gold: Increment plt_offset after setting TLSDESC PLT entry
Increment plt_offset after setting the reserved TLSDESC PLT entry.

	PR gold/25872
	* x86_64.cc (Output_data_plt_x86_64_bnd::do_write): Increment
	plt_offset after setting the reserved TLSDESC PLT entry.
	(Output_data_plt_x86_64_ibt<size>::do_write): Likewise.
2020-05-01 09:00:27 -07:00
H.J. Lu
e977e74712 gold: Handle local IFUNC symbol for APLT
Handle local IFUNC symbol for APLT like global IFUNC symbol.

	PR gold/25872
	* x86_64.cc (Output_data_plt_x86_64_bnd::do_address_for_local):
	Handle local IFUNC symbol.
	(Output_data_plt_x86_64_ibt::do_address_for_local): Likewise.
2020-05-01 08:59:32 -07:00
Tom de Vries
693196cba2 [gdb/testsuite] Fix gdb.ada/operator_bp.exp breakpoint location FAILs
When running test-case gdb.ada/operator_bp.exp with gcc-10, I run into:
...
FAIL: gdb.ada/operator_bp.exp: break "+"
FAIL: gdb.ada/operator_bp.exp: break "-"
FAIL: gdb.ada/operator_bp.exp: break "<"
FAIL: gdb.ada/operator_bp.exp: break "<="
FAIL: gdb.ada/operator_bp.exp: break ">"
FAIL: gdb.ada/operator_bp.exp: break ">="
FAIL: gdb.ada/operator_bp.exp: break "="
FAIL: gdb.ada/operator_bp.exp: break "and"
FAIL: gdb.ada/operator_bp.exp: break "or"
FAIL: gdb.ada/operator_bp.exp: break "xor"
FAIL: gdb.ada/operator_bp.exp: break "not"
...

The first FAIL is because two breakpoint locations are expected, but there are
more than 2:
...
(gdb) break "+"
Breakpoint 2 at 0x402c3c: "+". (6 locations)
(gdb) info break
Num     Type           Disp Enb Address            What
2       breakpoint     keep y   <MULTIPLE>
2.1                         y   0x0000000000402c3c in ops."+"
                                                   at operator_bp/ops.adb:25
2.2                         y   0x0000000000402e5b in ops."+"
                                                   at operator_bp/ops.adb:119
2.3                         y   0x0000000000414207 in
  system.storage_elements."+" at s-stoele.adb:82
2.4                         y   0x0000000000414404 in
  system.storage_elements."+" at s-stoele.adb:87
2.5                         y   0x0000000000414413 in
  system.storage_elements."+" at s-stoele.adb:87
2.6                         y   0x0000000000414430 in
  system.storage_elements."+" at s-stoele.adb:81
...

This can be traced back to a extra debug info in the executable:
...
$ readelf -w ops_test | grep system__storage_elements__Oadd
    <28104>   DW_AT_name        : system__storage_elements__Oadd__2
    <2812e>   DW_AT_name        : system__storage_elements__Oadd
...

Fix the FAILs by allowing more than the required amount of breakpoint
locations.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-05-01  Tom de Vries  <tdevries@suse.de>

	* gdb.ada/operator_bp.exp: Allow more than required amount of
	breakpoint.
2020-05-01 17:57:56 +02:00
Philippe Waroquiers
652fc23a30 Remove gdb-gdb.gdb breakpoint on disappeared function info_command.
The function info_command has disappeared, so this breakpoint does not
work anymore.
"info_command" was a function for the prefix command "info",
giving the list of "info" subcommands.
It is not very clear what the removed breakpoint and its associated
command list was supposed to do.

Removed and pushed as obvious, after discussion with Tom.
2020-05-01 16:47:05 +02:00
Hannes Domani
8dbb13755b Fix size recalculation of fortran arrays
My recent change regarding size calculation of arrays of stubbed types
didn't take array strides and associated/allocated type properties into
account, which basically broke fortran arrays.

Fixed by refactoring the array size calculation of
create_array_type_with_stride into a new function, and also use it for
the stubbed array size recalculation.

gdb/ChangeLog:

2020-05-01  Hannes Domani  <ssbssa@yahoo.de>

	* gdbtypes.c (update_static_array_size): New function.
	(create_array_type_with_stride): Use update_static_array_size.
	(check_typedef): Likewise.
2020-05-01 15:32:17 +02:00
Tom de Vries
53ae0aa9c6 [gdb/testsuite] Fix Wunused-result warning in until-reverse.c
When running test-case gdb.reverse/until-reverse.exp or
gdb.reverse/until-precsave.exp with gcc-10, we run into a Wunused-result
warning:
...
gdb compile failed, gdb.reverse/until-reverse.c: In function 'main':
gdb.reverse/until-reverse.c:40:14: warning: ignoring return value of \
  'malloc' declared with attribute 'warn_unused_result' [-Wunused-result]
   40 |       (void) malloc (1);
      |              ^~~~~~~~~~
...

Fix this by using the result of malloc as argument to a free call.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2020-05-01  Tom de Vries  <tdevries@suse.de>

	* gdb.reverse/until-reverse.c (main): Fix Wunused-result warning.
2020-05-01 11:04:22 +02:00
Alan Modra
a2714d6cca PR25900, RISC-V: null pointer dereference
PR 25900
	* elfnn-riscv.c (_bfd_riscv_relax_section): Check root.type before
	accessing root.u.def of symbols.  Also check root.u.def.section
	is non-NULL.  Reverse tests so as to make the logic positive.
2020-05-01 15:32:36 +09:30
Alan Modra
6083233224 objdump: long run time when using -D -z
The zero scan is silly when the result isn't used.

	* objdump.c (disassemble_bytes): Don't scan for zeros when
	disassembling zeros.  Translate "resuming at file offset" message.
	Formatting.  Replace some signed variables with unsigned.
2020-05-01 15:32:36 +09:30
Alan Modra
a8acd6eeb6 PR25882, .gnu.attributes are not checked for shared libraries
This allows backend merge_private_bfd_data to examine shared library
e_flags and/or .gnu.attributes.  ARM and PowerPC have done so when
using ld.gold for a long time.

(The tic6x change below is dead code due to the earlier FIXME,
but this is probably one of the changes needed there.)

	PR 25882
bfd/
	* elf32-tic6x.c (elf32_tic6x_merge_attributes): Don't transfer
	Tag_ABI_PIC or Tag_ABI_PID from dynamic objects to the output.
ld/
	* ldlang.c (lang_check): Call bfd_merge_private_bfd_data for
	shared libraries.
2020-05-01 15:32:36 +09:30
Alan Modra
6b728d3286 FIXME for merging of e_flags and .gnu.attributes
Code in the linker, present before the addition of .gnu.attributes
support, results in shared libraries not being considered by BFD when
merging e_flags and .gnu.attributes from input files to the output.
That doesn't seem correct to me, but I don't know enough about all the
various ABIs to change the behaviour with any confidence.  So this
patch merely punts on dynamic objects in merge_private_bfd_data target
functions, with a FIXME for maintainer attention.

I haven't excluded shared libraries from being considered where the
target merge_private_bfd_data (a) already has code dealing with shared
libraries, or (b) where that function just sets the output to the most
constraining arch/mach combination and other fairly trivial merges, or
(c) when the target has no shared library linker support.

In (a) are: arc, arm, aarch64, riscv, sparc.
In (b) are: bpf, cris, csky, m32r, m68k, mn10300, nios2, tilegx,
	    tilepro, vax, visium, xtensa.
In (c) are: bpf, cr16, h8300, iq2000, m32c, m68hc11, m68hc12, mcore,
	    mep, msp430, mt, rl78, rx, v850.

	PR 25882
	* elf32-bfin.c (elf32_bfin_merge_private_bfd_data): Add FIXME.
	* elf32-frv.c (frv_elf_merge_private_bfd_data): Likewise.
	* elfxx-mips.c (_bfd_mips_elf_merge_private_bfd_data): Likewise.
	* elf32-nds32.c (nds32_elf_merge_private_bfd_data): Likewise.
	* elf32-score.c (s3_elf32_score_merge_private_bfd_data): Likewise.
	* elf32-score7.c (s7_elf32_score_merge_private_bfd_data): Likewise.
	* elf32-sh.c (sh_elf_merge_private_data): Likewise.
	* elf32-tic6x.c (elf32_tic6x_merge_attributes): Likewise.
	* elf64-ia64-vms.c (elf64_ia64_merge_private_bfd_data): Likewise.
	* elfnn-ia64.c (elfNN_ia64_merge_private_bfd_data): Likewise.
2020-05-01 15:32:36 +09:30
Alan Modra
91ed9b71fa ppc32 merging of e_flags from dynamic objects
EF_PPC_RELOCATABLE and similar flags, if present in an input shared
library, don't have any relevance as far as the output file is
concerned.

Currently, dynamic objects aren't seen in merge_private_bfd_data.
This patch is in preparation for a change to that.

	PR 25882
	* elf32-ppc.c (ppc_elf_merge_private_bfd_data): Ignore e_flags
	from shared libraries.
2020-05-01 15:32:36 +09:30
Alan Modra
94a8e7b0ef Regen ld BLD-POTFILES.in
* po/BLD-POTFILES.in: Regenerate.
2020-05-01 15:32:36 +09:30
GDB Administrator
eb47d2fa97 Automatic date update in version.in 2020-05-01 00:00:16 +00:00
Kamil Rytarowski
117539e6d5 Add support for NetBSD thread events (create, exit)
Report LWP CREATE and LWP EXIT events and setup this on post_attach()
and post_startup_inferior().

Stop reinitializing the list of recognized threads in update_thread_list().

Handle LWP CREATE and EXIT events in nbsd_nat_target::wait().

gdb/ChangeLog:

        * nbsd-nat.c (nbsd_enable_proc_events)
        (nbsd_nat_target::post_startup_inferior): Add.
        (nbsd_nat_target::post_attach): Call `nbsd_enable_proc_events'.
        (nbsd_nat_target::update_thread_list): Rewrite.
        (nbsd_nat_target::wait): Handle "PTRACE_LWP_EXIT" and
        "PTRACE_LWP_CREATE".
        * nbsd-nat.h (nbsd_nat_target::post_startup_inferior): Add.
2020-04-30 21:53:12 +02:00
Tom de Vries
b2a0dd767a Revert "2020-04-29 Sterling Augustine <saugustine@google.com>"
This reverts commit 84ed7a4725.

The problem that the commit attempts to address has already been fixed in
commit 770479f223 "gdb: Fix toplevel types with -fdebug-types-section".

The commit itself is superfluous because it sets list_in_scope at a point that
it's already set (by start_symtab).
2020-04-30 18:51:49 +02:00
Philippe Waroquiers
102e38eba7 Remove duplicated creation of "frame" command and "f" alias.
"frame" and "f" are created twice by stack.c _initialize_stack.
Remove the second creation.
Regression tested on amd64/Debian.

2020-04-30  Philippe Waroquiers  <philippe.waroquiers@skynet.be>
	* stack.c (_initialize_stack): Remove duplicated creation
	of "frame" command and "f" alias.
2020-04-30 18:40:57 +02:00
Hannes Domani
7d186bc042 Implement debugging of WOW64 processes in gdbserver
gdbserver/ChangeLog:

2020-04-30  Hannes Domani  <ssbssa@yahoo.de>

	* configure.srv <x86_64-*-mingw*, x86_64-*-cygwin*> (srv_tgtobj):
	Add arch/i386.o.
	* win32-arm-low.cc (arm_num_regs): New function.
	(struct win32_target_ops): Use arm_num_regs.
	* win32-i386-low.cc (win32_get_current_dr): Adapt for WOW64
	processes.
	(i386_get_thread_context): Likewise.
	(i386_prepare_to_resume): Likewise.
	(i386_thread_added): Likewise.
	(i386_single_step): Likewise.
	(i386_fetch_inferior_register): Likewise.
	(i386_store_inferior_register): Likewise.
	(i386_arch_setup): Likewise.
	(i386_win32_num_regs): New function.
	(struct win32_target_ops): Use i386_win32_num_regs.
	* win32-low.cc (win32_get_thread_context): Adapt for WOW64
	processes.
	(win32_require_context): Likewise.
	(child_add_thread): Likewise.
	(do_initial_child_stuff): Likewise.
	(continue_one_thread): Likewise.
	(win32_process_target::resume): Likewise.
	(load_psapi): Likewise.
	(win32_add_all_dlls): Likewise.
	(maybe_adjust_pc): Likewise.
	(win32_process_target::qxfer_siginfo): Likewise.
	(initialize_low): Likewise.
	* win32-low.h (struct win32_target_ops): Change num_regs to
	callback function.
2020-04-30 18:30:20 +02:00
Hannes Domani
ee9d1e5f76 Calculate size of array of stubbed type
Sizes of stubbed types are calculated on demand in check_typedef, so the
same must also be done for arrays of stubbed types.

A stubbed type is usually a structure that has only been forward declared,
but can also happen if the structure has a virtual function that's not
inline in the class definition.

For these stubbed types, the size must be recalculated once the full
definition is available.

gdb/ChangeLog:

2020-04-30  Hannes Domani  <ssbssa@yahoo.de>

	PR gdb/18706
	* gdbtypes.c (check_typedef): Calculate size of array of
	stubbed type.

gdb/testsuite/ChangeLog:

2020-04-30  Hannes Domani  <ssbssa@yahoo.de>

	PR gdb/18706
	* gdb.cp/stub-array-size.cc: New test.
	* gdb.cp/stub-array-size.exp: New file.
	* gdb.cp/stub-array-size.h: New test.
	* gdb.cp/stub-array-size2.cc: New test.
2020-04-30 18:20:16 +02:00
Hannes Domani
d5cf82c0d7 Adjust array pretty printer tests to the new format
gdb/testsuite/ChangeLog:

2020-04-30  Hannes Domani  <ssbssa@yahoo.de>

	* gdb.python/py-format-string.exp: Adjust pretty_arrays expected
	output to the new format.
2020-04-30 17:02:14 +02:00
Alex Coplan
09c1e68a16 AArch64: add GAS support for UDF instruction
binutils * testsuite/binutils-all/aarch64/in-order-all.d: Update to use new
          disassembly.
        * testsuite/binutils-all/aarch64/out-of-order-all.d: Likewise.

ld/     * testsuite/ld-aarch64/erratum843419_tls_ie.d: Use udf in disassembly.
        * testsuite/ld-aarch64/farcall-b-section.d: Likewise.
        * testsuite/ld-aarch64/farcall-back.d: Likewise.
        * testsuite/ld-aarch64/farcall-bl-section.d: Likewise.

gas/   * config/tc-aarch64.c (fix_insn): Implement for AARCH64_OPND_UNDEFINED.
          (parse_operands): Implement for AARCH64_OPND_UNDEFINED.
        * testsuite/gas/aarch64/udf.s: New.
        * testsuite/gas/aarch64/udf.d: New.
        * testsuite/gas/aarch64/udf-invalid.s: New.
        * testsuite/gas/aarch64/udf-invalid.l: New.
        * testsuite/gas/aarch64/udf-invalid.d: New.

include * opcode/aarch64.h (enum aarch64_opnd): Add AARCH64_OPND_UNDEFINED.

opcodes * aarch64-opc.h (enum aarch64_field_kind): Add FLD_imm16_2.
        * aarch64-opc.c (fields): Add entry for FLD_imm16_2.
          (operand_general_constraint_met_p): validate AARCH64_OPND_UNDEFINED.
        * aarch64-tbl.h (aarch64_opcode_table): Add udf instruction, entry for
          FLD_imm16_2.
        * aarch64-asm-2.c: Regenerated.
        * aarch64-dis-2.c: Regenerated.
        * aarch64-opc-2.c: Regenerated.
2020-04-30 15:47:30 +01:00
Nick Clifton
8a8a117123 Add generic tests for linker support of the -shared or -pie options to tests 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-30 13:49:30 +01:00
Hannes Domani
627c7fb8ea Use thiscall calling convention for class members
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-30 14:36:55 +02:00
Yoshinori Sato
c578f16ef1 ld: Add rx-linux emulation. gas: Change ELF flags initial value in rx-linux
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-30 13:35:37 +01:00
Max Filippov
d548f47df4 xtensa: fix XTENSA_NDIFF handling for PR ld/25861
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-29 18:34:23 -07:00
Max Filippov
935f1f4ba3 xtensa: gas: support optional immediate simcall parameter
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-29 18:31:32 -07:00
Simon Marchi
ffc2844e96 gdb: silence shellcheck warning SC2162 (use read -r) in gdbarch.sh
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-29 20:35:36 -04:00
Simon Marchi
1207375d76 gdb: fix shellcheck warnings SC2154 (referenced but not assigned) in gdbarch.sh
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-29 20:35:35 -04:00
Simon Marchi
9fdb2916fe gdb: fix shellcheck warnings SC2034 (unused variable) in gdbarch.sh
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-29 20:35:35 -04:00
Simon Marchi
759cea5e3f gdb: fix shellcheck warnings SC2166 (&& and !! instead of -a and -o) in 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-29 20:35:34 -04:00
Simon Marchi
cb02ab2416 gdb: fix shellcheck warnings SC2006 (use $() instead of ``) in gdbarch.sh
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-29 20:35:34 -04:00
Simon Marchi
a6fc5ffc50 gdb: fix shellcheck warnings SC2086 (missing double quotes) in gdbarch.sh
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-29 20:35:34 -04:00
Simon Marchi
8d113d130e gdb: fix shellcheck warnings SC2059 (variables in printf format string) in 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-29 20:35:33 -04:00
Sterling Augustine
84ed7a4725 2020-04-29 Sterling Augustine <saugustine@google.com>
* dwarf2/read.c (setup_type_unit_groups): Set list_in_scope.
2020-04-29 17:28:19 -07:00
GDB Administrator
44e33ab45d Automatic date update in version.in 2020-04-30 00:00:11 +00:00
H.J. Lu
87c66b2e70 Sync config and libiberty with GCC
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-29 14:25:36 -07:00