Commit Graph

101625 Commits

Author SHA1 Message Date
Tankut Baris Aktemur f7e23710fc gdb: update the copyright year in async-event.[ch]
The async-event.[ch] files were introduced recently as a result of
splitting the event-loop.  I believe the copyright year update was
just an oversight.  So, this patch fixes that.

gdb/ChangeLog:
2020-05-13  Tankut Baris Aktemur  <tankut.baris.aktemur@intel.com>

	* async-event.c: Update the copyright year.
	* async-event.h: Update the copyright year.
2020-05-13 16:50:58 +02:00
Nick Clifton ba311c5b10 Have the linker's help text include the default setting of the --hash-style option, if relevent.
PR 25979
	* lexsup.c (elf_shlib_list_options): Include the default value for
	the hash style in the output text.
2020-05-13 10:59:02 +01:00
H.J. Lu 90d00bbd9c Sync config and libiberty with GCC
config/

	PR bootstrap/94998
	* cet.m4 (GCC_CET_HOST_FLAGS): Enable CET in cross compiler if
	possible.

libiberty/

	PR bootstrap/94998
	* configure: Regenerated.
2020-05-12 18:37:03 -07:00
GDB Administrator 09f20ec886 Automatic date update in version.in 2020-05-13 00:00:18 +00:00
Andrew Burgess 843f4d9357 gdb/testsuite: Disable path and duplicate checks when parallel testing
This commit disables the recently added checking for paths in test
names, and for duplicate test names, when the gdb tests are run in
parallel.

When running the gdb tests in parallel the extra result count lines
produced cause the dg-extract-results scripts to exit with an error.

The patches for the dg-extract-results scripts have been posted to the
gcc-patches mailing list here:

https://gcc.gnu.org/pipermail/gcc-patches/2020-May/545562.html

Once they are merged there then these changes can be merged over to
binutils-gdb, and this commit can be reverted.

gdb/testsuite/ChangeLog:

	* lib/check-test-names.exp: Disable when testing is being run in
	parallel.
2020-05-12 17:43:46 +01:00
Simon Marchi 02ff80c296 gdb: make two objfile functions return bool
gdb/ChangeLog:

	* objfiles.h (is_addr_in_objfile,
	shared_objfile_contains_address_p): Return bool.
	* objfile.c (is_addr_in_objfile,
	shared_objfile_contains_address_p): Return bool.
2020-05-12 11:17:01 -04:00
Tom de Vries c7c6634180 [gdb/testsuite] Fix incorrect string concat in jit-elf.exp
When running test-case gdb.base/jit-elf.exp with target board
cc-with-gdb-index, we get:
...
spawn -ignore SIGHUP gdb/contrib/cc-with-tweaks.sh -i gcc \
  -fno-stack-protector src/gdb/testsuite/gdb.base/jit-elf-main.c \
  -fdiagnostics-color=never -DATTACH=1 -DLOAD_ADDRESS=0x7000000 \
  -DLOAD_INCREMENT=0x1000000 -g -lm \
  -o outputs/gdb.base/jit-elf/jit-elf-main"-attach"^M
outputs/gdb.base/jit-elf/.tmp/jit-elf-main-attach: \
  No such file or directory.^M
output is:
outputs/gdb.base/jit-elf/.tmp/jit-elf-main-attach: \
  No such file or directory.^M

gdb compile failed, outputs/gdb.base/jit-elf/.tmp/jit-elf-main-attach: \
  No such file or directory.
UNTESTED: gdb.base/jit-elf.exp: failed to compile jit-elf-main"-attach"
...

The problem is a string concat in jit-elf.exp:
...
  ${main_binfile}"-attach"
...
which is intended to generate string 'jit-elf-main-attach' but instead
generates string 'jit-elf-main"-attach"'.

Fix this by using "${main_binfile}-attach" instead.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

	* gdb.base/jit-elf.exp: Fix string concat.
2020-05-12 14:59:01 +02:00
Tom de Vries 1b59ca1cf1 [gdb/testsuite] Fix tcl error in jit-elf-helpers.exp
When running test-case jit-elf.exp with target board cc-with-gdb-index, I run
into:
...
gdb compile failed, outputs/gdb.base/jit-elf/.tmp/jit-elf-main-attach: \
  No such file or directory.
ERROR: tcl error sourcing src/gdb/testsuite/gdb.base/jit-elf.exp.
ERROR: can't read "main_basename": no such variable
    while executing
"untested "failed to compile ${main_basename}.c""
    (procedure "compile_jit_main" line 7)
...

The problem is in compile_jit_main in lib/jit-elf-helpers.exp, where we try to
emit an untested message using global variable main_basename.c.

Fixing this by declaring the variable global results in duplicate test-names,
because the same source file is compiled more than once.

Instead, fix this by using the result name in the untested message.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

	* lib/jit-elf-helpers.exp: Don't use undefined variables in untested
	messages.
2020-05-12 14:41:47 +02:00
Gunther Nikl 533f049e00 [PATCH] bfd: Fix 64-bit relocation handling for a.out
* aoutx.h (NAME (aout, swap_std_reloc_out)): Reject an unsupported
	relocation size.
2020-05-12 12:18:09 +01:00
Tom de Vries b4991d292e [gdb/testsuite] Fix duplicate test-names in gdb.multi
In gdb.multi we have:
...
DUPLICATE: gdb.multi/multi-term-settings.exp: \
  inf1_how=run: inf2_how=run: info inferiors
DUPLICATE: gdb.multi/multi-term-settings.exp: \
  inf1_how=run: inf2_how=attach: info inferiors
DUPLICATE: gdb.multi/multi-term-settings.exp: \
  inf1_how=run: inf2_how=tty: info inferiors
DUPLICATE: gdb.multi/multi-term-settings.exp: \
  inf1_how=attach: inf2_how=run: info inferiors
DUPLICATE: gdb.multi/multi-term-settings.exp: \
  inf1_how=attach: inf2_how=attach: attach
DUPLICATE: gdb.multi/multi-term-settings.exp: \
  inf1_how=attach: inf2_how=attach: info inferiors
DUPLICATE: gdb.multi/multi-term-settings.exp: \
  inf1_how=attach: inf2_how=tty: info inferiors
DUPLICATE: gdb.multi/multi-term-settings.exp: \
  inf1_how=tty: inf2_how=run: info inferiors
DUPLICATE: gdb.multi/multi-term-settings.exp: \
  inf1_how=tty: inf2_how=attach: info inferiors
DUPLICATE: gdb.multi/multi-term-settings.exp: \
  inf1_how=tty: inf2_how=tty: tty TTY
DUPLICATE: gdb.multi/multi-term-settings.exp: \
  inf1_how=tty: inf2_how=tty: info inferiors
...

Fix these using with_test_prefix.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

	* gdb.multi/multi-term-settings.exp: Use with_test_prefix.
2020-05-12 11:18:14 +02:00
Tom de Vries dbb0ab10dd [gdb/testsuite] Fix duplicate test-names in gdb.ada
In gdb.ada we have these duplicate test-names:
...
DUPLICATE: gdb.ada/catch_ex.exp: continuing to program completion
DUPLICATE: gdb.ada/mi_catch_ex.exp: breakpoint at main
DUPLICATE: gdb.ada/mi_catch_ex.exp: mi runto main
DUPLICATE: gdb.ada/mi_catch_ex_hand.exp: breakpoint at main
DUPLICATE: gdb.ada/mi_catch_ex_hand.exp: mi runto main
...

Fix these using with_test_prefix.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

	* gdb.ada/catch_ex.exp: Use with_test_prefix.
	* gdb.ada/mi_catch_ex.exp: Same.
	* gdb.ada/mi_catch_ex_hand.exp: Same.
2020-05-12 11:05:44 +02:00
Tom de Vries 7549fed824 [gdb/testsuite] Fix duplicate test-names in gdb.fortran
In gdb.fortran we have:
...
DUPLICATE: gdb.fortran/complex.exp: whatis $
DUPLICATE: gdb.fortran/complex.exp: whatis $
DUPLICATE: gdb.fortran/complex.exp: whatis $
DUPLICATE: gdb.fortran/complex.exp: whatis $
...

Fix this by using with_test_prefix.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

	* gdb.fortran/complex.exp: Use with_test_prefix.
2020-05-12 10:53:47 +02:00
Tom de Vries af2d5cd8e9 [gdb/testsuite] Fix duplicate test-names in gdb.trace
In gdb.trace we have these duplicates:
...
DUPLICATE: gdb.trace/passcount.exp: 4.20a: set all three passcounts to three
DUPLICATE: gdb.trace/passcount.exp: 4.6: set passcount to zero
DUPLICATE: gdb.trace/passcount.exp: 4.7: set passcount to large number (32767)
...

Fix these by fixing the test-names.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

	* gdb.trace/passcount.exp: Fix test-names.
2020-05-12 10:45:20 +02:00
Tom de Vries 7c121311ad [gdb/testsuite] Fix duplicate test-names in gdb.pascal
In gdb.pascal we have these duplicates:
...
DUPLICATE: gdb.pascal/gdb11492.exp: next
DUPLICATE: gdb.pascal/gdb11492.exp: print char_array
...

Fix these by using with_test_prefix.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

	* gdb.pascal/gdb11492.exp: Use with_test_prefix.
2020-05-12 10:37:04 +02:00
Tom de Vries c9f3b40e1a [gdb/testsuite] Fix duplicate test-names in gdb.{gdb,opt,xml}
There are 3 test directories with one duplicate test-name: gdb.gdb, gdb.opt
and gdb.xml.  The duplicates are:
...
DUPLICATE: gdb.gdb/complaints.exp: call complaint_internal ($cstr)
DUPLICATE: gdb.opt/inline-locals.exp: info locals above bar 2 \
  (PRMS: gdb/25695)
DUPLICATE: gdb.xml/tdesc-regs.exp: ptype $extrareg
...

Fix as appropriate.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

	* gdb.gdb/complaints.exp: Use with_test_prefix.
	* gdb.xml/tdesc-regs.exp: Same.
	* gdb.opt/inline-locals.exp: Fix test name.
2020-05-12 10:28:44 +02:00
Mihails Strasuns 2528f8ada6 [gdb/testsuite] add jit-elf-util.h and run jit function
Splits ELF related symbols into a separate jit-elf-util.h header and
enhances it with a few more.

Intention is to make adding new JIT tests possible without repeating
most of the common boilerplate.

As a test enhancement, jit-elf-main.c now calls the renamed function
after registering the jit object and ensures it returns an expected
result.

gdb/testsuite/ChangeLog:

2020-02-18  Mihails Strasuns  <mihails.strasuns@intel.com>

	* gdb.base/jit-elf-util.h: New header file.
	* gdb.base/jit-elf-main.c: Use jit-elf-util.h, add a call to
	  the renamed JIT function to verify its result.
2020-05-12 09:52:46 +02:00
Mihails Strasuns aff4e759b8 [gdb/testsuite] define jit function name via macro
Replaces previous approach with patching resulting ELF binary after
loading - now that each test iteration works on a separately compiled
binary it is not necessary anymore.

Tests are still being ran without debug info to preserve original test
functionality but this change opens up the possibility to enable debug
info if needed too.

gdb/testsuite/ChangeLog:

2020-03-27  Mihails Strasuns  <mihails.strasuns@intel.com>

	* lib/jit-elf-helpers.exp: Supply -DFUNCTION_NAME macro
	  definition when compiling jit-elf-solib.co.
	* gdb.base/jit-elf-main.c: Stop patching jit function name.
	* gdb.base/jit-elf-solib.c: Use FUNCTION_NAME macro value as a
	  function name.
2020-05-12 09:52:46 +02:00
Mihails Strasuns 80ad340c90 [gdb/testsuite] use -Ttext-segment for jit-elf tests
Removes the need to manually relocate loaded ELF binary by using a fixed
constant as both mmap base address and as a requested first segment
address supplied to the linker.

In future will enable JIT tests with a valid DWARF debug info.  Current
tests still need to compile without a debug info though, because they do
a function name modification.

gdb/testsuite/ChangeLog:

2020-02-18  Mihails Strasuns  <mihails.strasuns@intel.com>

	* lib/jit-elf-helpers.exp: Supply -Ttext-segment linker flag and
	  define LOAD_ADDRESS/LOAD_INCREMENT macros for the compiled binaries.
	* gdb.base/jit-elf-main.c: Use LOAD_ADDRESS/LOAD_INCREMENT to
	  calculate the mmap address.
2020-05-12 09:52:46 +02:00
Mihails Strasuns f801207197 [gdb/testsuite] add lib/jit-elf-helpers.exp
New utility library to be used by jit-elf tests responsible for
compiling binary artifacts. In the next commit the compilation process
will become more complicated because of extra mandatory flag - keeping
it in one place will make tests less fragile.

gdb/testsuite/ChangeLog:

2020-02-18  Mihails Strasuns  <mihails.strasuns@intel.com>

	* lib/jit-elf-helpers.exp: New file.
	* gdb.base/jit-elf.exp: Updated to use jit-elf-helpers.exp.
	* gdb.base/jit-elf-so.exp: Updated to use jit-elf-helpers.exp.
2020-05-12 09:52:46 +02:00
Mihails Strasuns via Gdb-patches 9a94694506 [gdb/testsuite] use args as lib list for jit-elf tests
Old usage: jit-elf-main lib.so 2
New usage: jit-elf-main lib.so.1 lib.so.2

Refactoring necessary to support running tests over multiple jit
binaries rather than mapping the same binary muultiple times.

gdb/testsuite/ChangeLog:

2020-02-18  Mihails Strasuns  <mihails.strasuns@intel.com>

	* gdb.base/jit-elf-main.c: Read lib list from argc/argv.
	* gdb.base/jit-elf.exp: Compile N jit libraries and use the list.
	* gdb.base/jit-elf-so.exp: Ditto.
2020-05-12 09:52:46 +02:00
Tom de Vries 111b33f0b8 [gdb/testsuite] Fix duplicate test-names in gdb.dwarf2
We currently have these duplicate test-names in gdb.dwarf2:
...
$ grep ^DUPLICATE: gdb.sum
DUPLICATE: gdb.dwarf2/comp-unit-lang.exp: show language
DUPLICATE: gdb.dwarf2/data-loc.exp: get integer valueof "sizeof (int)"
DUPLICATE: gdb.dwarf2/data-loc.exp: get integer valueof "sizeof (void *)"
DUPLICATE: gdb.dwarf2/data-loc.exp: get integer valueof "sizeof (int)"
DUPLICATE: gdb.dwarf2/data-loc.exp: get integer valueof "sizeof (int)"
DUPLICATE: gdb.dwarf2/data-loc.exp: ptype foo.array_type
DUPLICATE: gdb.dwarf2/varval.exp: get integer valueof "sizeof (int)"
DUPLICATE: gdb.dwarf2/varval.exp: get integer valueof "sizeof (void *)"
DUPLICATE: gdb.dwarf2/implref-struct.exp: print-object=off: \
  set print object off
DUPLICATE: gdb.dwarf2/implref-struct.exp: print-object=on: \
  set print object on
DUPLICATE: gdb.dwarf2/dw2-bad-parameter-type.exp: ptype f
...

Fix as appropriate.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

	* gdb.dwarf2/comp-unit-lang.exp: Use with_test_prefix.
	* gdb.dwarf2/dw2-bad-parameter-type.exp: Same.
	* gdb.dwarf2/implref-struct.exp: Same.
	* gdb.dwarf2/varval.exp: Ensure get_sizeof is called once per type.
	* gdb.dwarf2/data-loc.exp: Same.  Remove duplicate test.
2020-05-12 09:47:15 +02:00
Simon Marchi ebf470809e gdb: change duplicate test name in gdb.base/jit-so.exp
When running gdb.base/jit-so.exp, we see duplicate test names:

$ grep PASS testsuite/gdb.sum | sort | uniq -c | sort -n
      ...
      2 PASS: gdb.base/jit-so.exp: one_jit_test-1: info function jit_function
      2 PASS: gdb.base/jit-so.exp: one_jit_test-2: info function jit_function

Give an explicit name to one test to avoid this.

gdb/testsuite/ChangeLog:

	* gdb.base/jit-so.exp (one_jit_test): Change test name.
2020-05-11 20:10:35 -04:00
GDB Administrator a1becf61f7 Automatic date update in version.in 2020-05-12 00:00:11 +00:00
Alan Modra d5b7ebe806 Regen ld/Makefile.in
Missed from c578f16ef1.
2020-05-12 09:19:26 +09:30
Tom Tromey 4fd6c7e872 Restore info_command and breakpoint
As discussed on gdb-patches, this restores info_command and the
breakpoint on info_command in gdb-gdb.gdb.  This reverts a tiny part
of 0743fc83c0 ("Replace most calls to help_list and cmd_show_list"),
as well as 652fc23a30 ("Remove gdb-gdb.gdb breakpoint on disappeared
function info_command.").

gdb/ChangeLog
2020-05-11  Tom Tromey  <tromey@adacore.com>

	* cli/cli-cmds.c (info_command): Restore.
	(_initialize_cli_cmds): Use add_prefix_command for "info".
	* gdb-gdb.gdb.in: Restore breakpoint on info_command.
2020-05-11 15:30:40 -06:00
Andrew Burgess d30dcd1288 gdb/testsuite: Detect and warn about duplicate test names
Building on the previous commit, this patch detects when two tests
have the same test name and causes Dejagnu to print a new result type
'# of duplicate test names' in the result summary.  A line starting
with 'DUPLICATE: ' is also added to the gdb.sum and gdb.log files.

The DUPLICATE markers will be printed the second time a duplicate test
name is seen, and every time after that.  So you might see:

  PASS: gdb.base/sometest.exp: foo
  PASS: gdb.base/sometest.exp: bar
  PASS: gdb.base/sometest.exp: foo
  DUPLICATE: gdb.base/sometest.exp: foo
  PASS: gdb.base/sometest.exp: baz
  PASS: gdb.base/sometest.exp: foo
  DUPLICATE: gdb.base/sometest.exp: foo

However, the results will report a duplicate count of 1, indicating
that just one test name (foo) was duplicated.

Currently if the tests are run in parallel mode the new result type is
not merged into the combined summary file so users will need to run in
non-parallel mode to check this result.  Similarly, the 'DUPLICATE: '
markers will not be merged into the final gdb.sum file.  A later
commit will fix this.

gdb/testsuite/ChangeLog:

	* lib/check-test-names.exp (all_test_names): New module variable.
	(counts): Add 'duplicates' field.
	(_check_duplicates): New procedure.
	(check): Also check for duplicates.
	(do_log_summary): Print duplicates count.
	(do_reset_vars): Reset counter for duplicate test names, and
	discard all know test names.
2020-05-11 22:27:04 +01:00
Andrew Burgess 34584c091b gdb/testsuite: Detect and warn if paths are used in test names
A new library is introduced that hooks into the core of Dejagnu and
detects when a test's name includes either the source or build paths.
If any offending test names are detected then Dejagnu will print a
new result type, '# of paths in test names'.  Users should treat this
result type just like other bad results types, and aim not to increase
this number.

As well as displaying the total number of offending tests as part of
the final results, a new marker is included in both the gdb.log and
gdb.sum files, this marker starts with 'PATH: ', so an offending test
would be expected to appear like this:

  PASS: gdb.base/sometest.exp: Loaded /path/to/build/testsuite/foo.exe
  PATH: gdb.base/sometest.exp: Loaded /path/to/build/testsuite/foo.exe

This should make it easier to track down offending tests.

Currently for a local run on my machine, I don't see any offending
test names, but it is possible that different targets, or different
configurations, might currently be breaking the no paths rule.

In order to get this working I have needed to wrap two core Dejagnu
functions, log_summary, and reset_vars.  Relying on core functions
that are not part of any API is always going to be risky, given the
relatively slow rate of Dejagnu change this is probably OK for now,
and we can possibly upstream some changes to Dejagnu that would allow
this functionality to be supported in a more official way later on.

Currently if the tests are run in parallel mode the new result type is
not merged into the combined summary file so users will need to run in
non-parallel mode to check this result.  Similarly, the 'PATH: '
markers will not be merged into the combined summary file.  A later
commit will fix this.

gdb/testsuite/ChangeLog:

	* lib/gdb.exp: Include check-test-names.exp library.
	* lib/check-test-names.exp: New file.
2020-05-11 22:26:52 +01:00
Tom Tromey 5eb68a39a2 Fix Ada value printing on PPC64
The val_print removal patches introduced an Ada regression on PPC64
(probably any big-endian system).

The issue comes because value_field does not understand that Ada
wrapper fields can be bitfields that wrap a non-scalar type.  In this
case the value is already left-justified, so the justification done
there does the wrong thing.

Perhaps it would be good, eventually, to change value_field to
understand this case.  In the meantime this implements an Ada-specific
solution.

gdb/ChangeLog
2020-05-11  Tom Tromey  <tromey@adacore.com>

	* ada-lang.c (ada_value_primitive_field): Now public.
	* ada-lang.h (ada_value_primitive_field): Declare.
	* ada-valprint.c (print_field_values): Use
	ada_value_primitive_field for wrapper fields.
2020-05-11 14:57:49 -06:00
Tom de Vries e000211765 [gdb/testsuite] Change kfail into xfail in gdb.ada/packed_tagged.exp
Test-case gdb.ada/packed_tagged.exp contains a kfail:
...
setup_kfail "gnat compiler bug" *-*-*
...

Kfails are used to indicate problems in gdb, xfails are used to indicate
problems in the environment.

A bug in the gnat compiler is a problem in the environment rather than gdb.

Fix this by changing the kfail into an xfail.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

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

	* gdb.ada/packed_tagged.exp: Change kfail into xfail.
2020-05-11 22:30:18 +02:00
Keith Seitz 53f539a3d7 Fix gdb.ada/attr_ref_and_charlit.exp typo
... introduced by my last commit:

-gdb_test "print s'last"  " = 3"
+    gdb_test "print s'last"  " = 3Z

gdb/testsuite/ChangeLog
2020-05-11  Keith Seitz  <keiths@redhat.com>

	* gdb.ada/attr_ref_and_charlit.exp: Fix typo.
2020-05-11 12:22:25 -07:00
Tom de Vries 113ee09a64 [gdb/testsuite] Fix gdb.cp/cpexprs-debug-types.exp inclusion
When running tests using RUNTESTFLAGS="cpexprs.exp cpexprs-debug-types.exp",
we have:
...
Running src/gdb/testsuite/gdb.cp/cpexprs-debug-types.exp ...
Running src/gdb/testsuite/gdb.cp/cpexprs.exp ...
...

In the first test-case, we have -fdebug-types-section as expected:
...
Running src/gdb/testsuite/gdb.cp/cpexprs-debug-types.exp ...
g++ -fno-stack-protector -fdiagnostics-color=never \
  -fdebug-types-section \
  -c -g \
  -o outputs/gdb.cp/cpexprs-debug-types/cpexprs-debug-types0.o \
  src/gdb/testsuite/gdb.cp/cpexprs.cc
...
but in the second test-case, we have also have -fdebug-types-section:
...
Running src/gdb/testsuite/gdb.cp/cpexprs.exp ...
g++ -fno-stack-protector -fdiagnostics-color=never \
  -fdebug-types-section \
  -c -g -g \
  -o outputs/gdb.cp/cpexprs/cpexprs0.o \
  src/gdb/testsuite/gdb.cp/cpexprs.cc
...

This is due to using a global variable flags, which is set in
cpexprs-debug-types.exp and tested for existence in cpexprs.exp.

Fix this by using a more robust inclusion mechanism, that is:
- move the bulk of the test-case cpexprs.exp to cpexprs.exp.in,
- include it from cpexprs.exp and cpexprs-debug-types.exp, and
- set flags in both .exp files

gdb/testsuite/ChangeLog:

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

	* gdb.cp/cpexprs.exp: Move everything except flags setting ...
	* gdb.cp/cpexprs.exp.in: .. here.
	* gdb.cp/cpexprs-debug-types.exp: Include cpexprs.exp.in instead of
	cpexprs.exp.
2020-05-11 20:36:11 +02:00
Keith Seitz ba3e70b008 Clean-up gdb.ada test names
This patch fixes all duplicate and tail parentheses test names.
These can really hinder automated test analysis such as used by
the buildbot.

Before:
$ cat testsuite/gdb.sum | egrep "^(PASS|FAIL|XPASS|XFAIL|KPASS|KFAIL)" \
  | sort | uniq -c | sort -n | grep -v " 1 "
      2 PASS: gdb.ada/attr_ref_and_charlit.exp: print s'last
      2 PASS: gdb.ada/bp_on_var.exp: set breakpoint pending off
      2 PASS: gdb.ada/complete.exp: complete p pck.inne
      2 PASS: gdb.ada/fun_overload_menu.exp: multiple matches for f (f (1, null))
      2 PASS: gdb.ada/type_coercion.exp: p q
      2 PASS: gdb.ada/unc_arr_ptr_in_var_rec.exp: print My_P_Object.Ptr when no longer null
      3 PASS: gdb.ada/fun_overload_menu.exp: 1

After:
<empty>

For parentheses, I've audited all occurrences of trailing parentheses.
Most offenders are of the form:

   gdb_test "p func (..)" $expected_result

I've either added a unique test name or simply removed the whitespace
between the function name and the argument list.

gdb/testsuite/ChangeLog
2020-05-11  Keith Seitz  <keiths@redhat.com>

	* gdb.ada/arrayparam.exp: Resolve duplicate and tail parentheses
	test names.
	* gdb.ada/arrayptr.exp: Likewise.
	* gdb.ada/assign_arr.exp: Likewise.
	* gdb.ada/attr_ref_and_charlit.exp: Likewise.
	* gdb.ada/bp_on_var.exp: Likewise.
	* gdb.ada/call_pn.exp: Likewise.
	* gdb.ada/complete.exp: Likewise.
	* gdb.ada/fun_overload_menu.exp: Likewise.
	* gdb.ada/funcall_param.exp: Likewise.
	* gdb.ada/funcall_ref.exp: Likewise.
	* gdb.ada/packed_array_assign.exp: Likewise.
	* gdb.ada/same_component_name.exp: Likewise.
	* gdb.ada/type_coercion.exp: Likewise.
	* gdb.ada/unc_arr_ptr_in_var_rec.exp: Likewise.
	* gdb.ada/variant_record_packed_array.exp: Likewise.
2020-05-11 10:28:17 -07:00
Tom de Vries 7666722fce [gdb/symtab] Save modules in .debug_names
When running test-case gdb.fortran/info-modules.exp with target board
debug-names, I run into:
...
FAIL: gdb.fortran/info-modules.exp: info modules: check for entry \
  'info-types-2.f90', '18', 'mod2'
...

In more detail, comparing the behaviour of the executable without and with
.debug_names section, we have:
...
-$ gdb -batch info-modules -ex "info modules"
+$ gdb -batch info-modules.debugnames -ex "info modules"
 All defined modules:

-File /data/gdb_versions/devel/src/gdb/testsuite/gdb.fortran/info-types-2.f90:
-18:     mod2
-
 File /data/gdb_versions/devel/src/gdb/testsuite/gdb.fortran/info-types.f90:
 16:     mod1
...

This is due to the fact that the .debug_names section does not contain
DW_TAG_module entries.

Fix this in debug_names::psymbol_tag.

Build and tested on x86_64-linux with target board debug-names.

gdb/ChangeLog:

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

	* dwarf2/index-write.c (debug_names::psymbol_tag): Handle
	MODULE_DOMAIN.
2020-05-11 17:13:49 +02:00
Tom de Vries 3ee6bb113a [gdb/symtab] Fix incomplete CU list assert in .debug_names
Consider the following two-file test-case:
...
$ cat main.c
extern int foo (void);

int
main (void)
{
  int sum, a, b;
  sum = a + b + foo ();
  return sum;
}
$ cat foo.c
int
foo (void)
{
  return 3;
}
...

Compiled like this:
...
$ clang-10 -gdwarf-5 -gpubnames -c main.c
$ clang-10 -gdwarf-5 -c foo.c
$ clang-10 -gdwarf-5 -gpubnames main.o foo.o
...

When loading this exec into gdb, we run into this assert:
...
$ gdb a.out
Reading symbols from a.out...

warning: Section .debug_aranges in a.out entry at offset 0 \
  debug_info_offset 0 does not exists, ignoring .debug_aranges.
src/gdb/dwarf2/read.c:6949: \
  internal-error: cutu_reader::cutu_reader(dwarf2_per_cu_data*, \
  		                           abbrev_table*, int, bool): \
  Assertion `this_cu->length == cu->header.get_length ()' failed.
...

The problem is that the determined length of the CU:
...
(gdb) p /x this_cu->length
$4 = 0x26a
...
does not match the actual length:
...
(gdb) p /x cu->header.get_length ()
$5 = 0x59
...

The length of the CU is determined in create_cus_from_debug_names_list, and
set based on this list in the .debug_names section:
...
  Compilation Unit offsets [
    CU[0]: 0x000000c7
  ]
...
and it is assumed that this is a complete list, so the size of the CU is
calculated using the end of the .debug_section at 0x331, making it 0x331 -
0xc7 == 0x26a.

However, the CU list is not complete:
...
$ llvm-dwarfdump -debug-info a.out \
  | grep "Compile Unit" \
  | sed 's/Compile Unit.*//'
0x00000000:
0x0000002e:
0x000000a5:
0x000000c7:
0x00000120:
0x00000157:
0x0000030f:
...
In particular, because the CU for foo.c is there at 0x120 (the rest of the CUs
is due to openSUSE having debug info for various linked in objects).

Fix the assert by not assuming to know the length of CUs in
create_cus_from_debug_names_list (if the .debug_names is not produced by GDB),
and setting it to 0, and setting it later to the actual length.

Note that this does not fix the .debug_aranges warning, that's PR25969.

Build and tested on x86_64-linux, with native and debug-names.

gdb/ChangeLog:

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

	PR symtab/25941
	* dwarf2/read.c (create_cus_from_debug_names_list): Initialize CUs
	with length 0, if not gdb-produced.
	(cutu_reader::cutu_reader): Set CU length to actual length if 0.

gdb/testsuite/ChangeLog:

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

	PR symtab/25941
	* gdb.dwarf2/clang-debug-names.exp.in: New include exp file, factored
	out of ...
	* gdb.dwarf2/clang-debug-names.exp: ... here.
	* gdb.dwarf2/clang-debug-names-2.exp: New file.  Include
	clang-debug-names.exp.in.
	* gdb.dwarf2/clang-debug-names-2-foo.c: New test.
	* gdb.dwarf2/clang-debug-names-2.c: New test.
2020-05-11 15:03:54 +02:00
Alan Modra 3b646889b0 Power10 VSX scalar min-max-compare quad precision operations
opcodes/
	* ppc-opc (powerpc_opcodes): Add xscmpeqqp, xscmpgeqp, xscmpgtqp,
	xsmaxcqp, xsmincqp.
gas/
	* testsuite/gas/ppc/scalarquad.d,
	* testsuite/gas/ppc/scalarquad.s: New test.
	* testsuite/gas/ppc/ppc.exp: Run it.
2020-05-11 21:08:38 +09:30
Alan Modra 9cc4ce8831 Power10 VSX load/store rightmost element operations
opcodes/
	* ppc-opc.c (powerpc_opcodes): Add lxvrbx, lxvrhx, lxvrwx, lxvrdx,
	stxvrbx, stxvrhx, stxvrwx, stxvrdx.
gas/
	* testsuite/gas/ppc/rightmost.d,
	* testsuite/gas/ppc/rightmost.s: New test.
	* testsuite/gas/ppc/ppc.exp: Run it.
2020-05-11 21:08:37 +09:30
Alan Modra 5d57bc3ff9 Power10 test lsb by byte operation
opcodes/
	* ppc-opc.c (powerpc_opcodes): Add xvtlsbb.
gas/
	* testsuite/gas/ppc/xvtlsbb.d,
	* testsuite/gas/ppc/xvtlsbb.s: New test.
	* testsuite/gas/ppc/ppc.exp: Run it.
2020-05-11 21:08:37 +09:30
Alan Modra 66ef5847c3 Power10 string operations
opcodes/
	* ppc-opc.c (powerpc_opcodes): Add vstribl, vstribr, vstrihl, vstrihr,
	vclrlb, vclrrb, vstribl., vstribr., vstrihl., vstrihr..
gas/
	* testsuite/gas/ppc/stringop.d,
	* testsuite/gas/ppc/stringop.s: New test.
	* testsuite/gas/ppc/ppc.exp: Run it.
2020-05-11 21:08:37 +09:30
Peter Bergner 4f3e9537c4 Power10 Set boolean extension
opcodes/
	* ppc-opc.c (powerpc_opcodes) <setbc, setbcr, setnbc, setnbcr>: New
	mnemonics.
gas/
	* testsuite/gas/ppc/set_bool.d,
	* testsuite/gas/ppc/set_bool.s: New test.
	* testsuite/gas/ppc/ppc.exp: Run it.
2020-05-11 21:08:37 +09:30
Alan Modra ec40e91c77 Power10 bit manipulation operations
opcodes/
	* ppc-opc.c (UIM8, P_U8XX4_MASK): Define.
	(powerpc_opcodes): Add vgnb, vcfuged, vpextd, vpdepd, vclzdm,
	vctzdm, cntlzdm, pdepd, pextd, cfuged, cnttzdm.
	(prefix_opcodes): Add xxeval.
gas/
	* testsuite/gas/ppc/bitmanip.d,
	* testsuite/gas/ppc/bitmanip.s: New test.
	* testsuite/gas/ppc/ppc.exp: Run it.
2020-05-11 21:08:37 +09:30
Alan Modra d7e97a765e Power10 VSX PCV generate operations
opcodes/
	* ppc-opc.c (powerpc_opcodes): Add xxgenpcvbm, xxgenpcvhm,
	xxgenpcvwm, xxgenpcvdm.
gas/
	* testsuite/gas/ppc/genpcv.d,
	* testsuite/gas/ppc/genpcv.s: New test.
	* testsuite/gas/ppc/ppc.exp: Run it.
2020-05-11 21:08:37 +09:30
Alan Modra fdefed7c26 Power10 VSX Mask Manipulation Operations
opcodes/
	* ppc-opc.c (MP, VXVAM_MASK): Define.
	(VXVAPS_MASK): Use VXVA_MASK.
	(powerpc_opcodes): Add mtvsrbmi, vexpandbm, vexpandhm, vexpandwm,
	vexpanddm, vexpandqm, vextractbm, vextracthm, vextractwm,
	vextractdm, vextractqm, mtvsrbm, mtvsrhm, mtvsrwm, mtvsrdm, mtvsrqm,
	vcntmbb, vcntmbh, vcntmbw, vcntmbd.
gas/
	* testsuite/gas/ppc/maskmanip.d,
	* testsuite/gas/ppc/maskmanip.s: New test.
	* testsuite/gas/ppc/ppc.exp: Run it.
2020-05-11 21:08:37 +09:30
Alan Modra aa3c112fab Power10 Reduced precision outer product operations
include/
	* opcode/ppc.h (PPC_OPERAND_ACC): Define.  Renumber following
	PPC_OPERAND defines.
opcodes/
	* ppc-opc.c (insert_xa6a, extract_xa6a, insert_xb6a, extract_xb6a):
	New functions.
	(powerpc_operands): Define ACC, PMSK8, PMSK4, PMSK2, XMSK, YMSK,
	YMSK2, XA6a, XA6ap, XB6a entries.
	(PMMIRR, P_X_MASK, P_XX1_MASK, P_GER_MASK): Define
	(P_GER2_MASK, P_GER4_MASK, P_GER8_MASK, P_GER64_MASK): Define.
	(PPCVSX4): Define.
	(powerpc_opcodes): Add xxmfacc, xxmtacc, xxsetaccz,
	xvi8ger4pp, xvi8ger4, xvf16ger2pp, xvf16ger2, xvf32gerpp, xvf32ger,
	xvi4ger8pp, xvi4ger8, xvi16ger2spp, xvi16ger2s, xvbf16ger2pp,
	xvbf16ger2, xvf64gerpp, xvf64ger, xvi16ger2, xvf16ger2np,
	xvf32gernp, xvi8ger4spp, xvi16ger2pp, xvbf16ger2np, xvf64gernp,
	xvf16ger2pn, xvf32gerpn, xvbf16ger2pn, xvf64gerpn, xvf16ger2nn,
	xvf32gernn, xvbf16ger2nn, xvf64gernn, xvcvbf16sp, xvcvspbf16.
	(prefix_opcodes): Add pmxvi8ger4pp, pmxvi8ger4, pmxvf16ger2pp,
	pmxvf16ger2, pmxvf32gerpp, pmxvf32ger, pmxvi4ger8pp, pmxvi4ger8,
	pmxvi16ger2spp, pmxvi16ger2s, pmxvbf16ger2pp, pmxvbf16ger2,
	pmxvf64gerpp, pmxvf64ger, pmxvi16ger2, pmxvf16ger2np, pmxvf32gernp,
	pmxvi8ger4spp, pmxvi16ger2pp, pmxvbf16ger2np, pmxvf64gernp,
	pmxvf16ger2pn, pmxvf32gerpn, pmxvbf16ger2pn, pmxvf64gerpn,
	pmxvf16ger2nn, pmxvf32gernn, pmxvbf16ger2nn, pmxvf64gernn.
gas/
	* config/tc-ppc.c (pre_defined_registers): Add accumulators.
	(md_assemble): Check acc specified in correct operand.
	* testsuite/gas/ppc/outerprod.d,
	* testsuite/gas/ppc/outerprod.s,
	* testsuite/gas/ppc/vsx4.d,
	* testsuite/gas/ppc/vsx4.s: New tests.
	* testsuite/gas/ppc/ppc.exp: Run them.
2020-05-11 21:08:37 +09:30
Alan Modra 6edbfd3beb Power10 SIMD permute class operations
opcodes/
	* ppc-opc.c (insert_imm32, extract_imm32): New functions.
	(insert_xts, extract_xts): New functions.
	(IMM32, UIM3, IX, UIM5, SH3, XTS, P8RR): Define.
	(P_XX4_MASK, P_UXX4_MASK, VSOP, P_VS_MASK, P_VSI_MASK): Define.
	(VXRC_MASK, VXSH_MASK): Define.
	(powerpc_opcodes): Add vinsbvlx, vsldbi, vextdubvlx, vextdubvrx,
	vextduhvlx, vextduhvrx, vextduwvlx, vextduwvrx, vextddvlx,
	vextddvrx, vinshvlx, vinswvlx, vinsw, vinsbvrx, vinshvrx,
	vinswvrx, vinsd, vinsblx, vsrdbi, vinshlx, vinswlx, vinsdlx,
	vinsbrx, vinshrx, vinswrx, vinsdrx, lxvkq.
	(prefix_opcodes): Add xxsplti32dx, xxspltidp, xxspltiw, xxblendvb,
	xxblendvh, xxblendvw, xxblendvd, xxpermx.
gas/
	* testsuite/gas/ppc/simd_perm.d,
	* testsuite/gas/ppc/simd_perm.s: New test.
	* testsuite/gas/ppc/ppc.exp: Run it.
2020-05-11 21:08:37 +09:30
Alan Modra c7d7aea2f5 Power10 128-bit binary integer operations
opcodes/
	* ppc-opc.c (powerpc_opcodes): Add vrlq, vdivuq, vmsumcud, vrlqmi,
	vmuloud, vcmpuq, vslq, vdivsq, vcmpsq, vrlqnm, vcmpequq, vmulosd,
	vsrq, vdiveuq, vcmpgtuq, vmuleud, vsraq, vdivesq, vcmpgtsq, vmulesd,
	vcmpequq., vextsd2q, vmoduq, vcmpgtuq., vmodsq, vcmpgtsq., xscvqpuqz,
	xscvuqqp, xscvqpsqz, xscvsqqp, dcffixqq, dctfixqq.
gas/
	* testsuite/gas/ppc/int128.d,
	* testsuite/gas/ppc/int128.s: New test.
	* testsuite/gas/ppc/ppc.exp: Run it.
2020-05-11 21:08:37 +09:30
Alan Modra 94ba9882d5 Power10 VSX 32-byte storage access
bfd/
	* elf64-ppc.c (xlate_pcrel_opt): Handle lxvp and stxvp.
opcodes/
	* ppc-opc.c (insert_xtp, extract_xtp): New functions.
	(XTP, DQXP, DQXP_MASK): Define.
	(powerpc_opcodes): Add lxvp, stxvp, lxvpx, stxvpx.
	(prefix_opcodes): Add plxvp and pstxvp.
gas/
	* testsuite/gas/ppc/vsx_32byte.d,
	* testsuite/gas/ppc/vsx_32byte.s: New test.
	* testsuite/gas/ppc/ppc.exp: Run it.
ld/
	* testsuite/ld-powerpc/pcrelopt.s: Add lxvp and stxvp.
	* testsuite/ld-powerpc/pcrelopt.d: Update.
2020-05-11 21:08:37 +09:30
Alan Modra f4791f1afa Power10 vector integer multiply, divide, modulo insns
opcodes/
	* ppc-opc.c (powerpc_opcodes): Add vdivuw, vdivud, vdivsw, vmulld,
	vdivsd, vmulhuw, vdiveuw, vmulhud, vdiveud, vmulhsw, vdivesw,
	vmulhsd, vdivesd, vmoduw, vmodud, vmodsw, vmodsd.
gas/
	* testsuite/gas/ppc/vec_mul.s,
	* testsuite/gas/ppc/vec_mul.d: New test.
	* testsuite/gas/ppc/ppc.exp: Run it.
2020-05-11 21:08:37 +09:30
Peter Bergner 3ff0a5ba64 Power10 byte reverse instructions
opcodes/
	* ppc-opc.c (powerpc_opcodes) <brd, brh, brw>: New mnemonics.
gas/
	* testsuite/gas/ppc/byte_rev.d,
	* testsuite/gas/ppc/byte_rev.s: New test.
	* testsuite/gas/ppc/ppc.exp: Run it.
2020-05-11 21:08:36 +09:30
Peter Bergner afef4fe975 Power10 Copy/Paste Extensions
opcodes/
	* opcodes/ppc-opc.c (insert_l1opt, extract_l1opt): New functions.
	(L1OPT): Define.
	(powerpc_opcodes) <paste.>: Add L operand for cpu POWER10.
gas/
	* testsuite/gas/ppc/power10.d: Add paste. tests.
	* testsuite/gas/ppc/power10.s: Likewise.
2020-05-11 21:08:36 +09:30
Peter Bergner 1224c05de4 Power10 Add new L operand to the slbiag instruction
opcodes/
	* ppc-opc.c (powerpc_opcodes) <slbiag>: Add variant with L operand.
gas/
	* testsuite/gas/ppc/power10.s: New test.
	* testsuite/gas/ppc/power10.d: Likewise.
	* testsuite/gas/ppc/ppc.exp: Run it.
2020-05-11 21:08:36 +09:30