Commit Graph

97934 Commits

Author SHA1 Message Date
Alan Modra 22f72c4868 PowerPC nops
This patch corrects ppc rs_align_code handling to choose the alignment
nops based on the machine in force at the alignment directive rather
than the machine at the end of file.

	* config/tc-ppc.h (ppc_nop_select): Declare.
	(NOP_OPCODE): Define.
	* config/tc-ppc.c (ppc_elf_end, ppc_xcoff_end): Zero ppc_cpu.
	(ppc_nop_encoding_for_rs_align_code): New enum.
	(ppc_nop_select): New function.
	(ppc_handle_align): Don't use ppc_cpu here.  Get nop type from frag.
	* testsuite/gas/ppc/groupnop.d,
	* testsuite/gas/ppc/groupnop.s: New test.
	* testsuite/gas/ppc/ppc.exp: Run it.
2019-06-25 13:04:40 +09:30
GDB Administrator 2e7c439dec Automatic date update in version.in 2019-06-25 00:00:35 +00:00
Jim Wilson 04b865dc2e RISC-V: Enable lui relaxation for CODE and MERGE sections.
2019-06-24  Ilia Diachkov  <ilia.diachkov@optimitech.com>
	bfd/
	* elfnn-riscv.c (_bfd_riscv_relax_lui): Delete early exit when
	SEC_MERGE or SEC_CODE flags are set.
	(_bfd_riscv_relax_section): New local symtype.  Set sym_sec and
	symtype consistently.  Don't include sec_addr (sym_sec) in symval.
	Add check for SEC_INFO_TYPE_MERGE and call _bfd_merged_section_offset.
	Add sec_addr (sym_sec) after handling merge sections.
2019-06-24 13:50:10 -07:00
H.J. Lu f93ab3a0b8 elf: Remove the property after reporting its removal
commit d2ef37ebd9
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Fri Dec 7 08:30:30 2018 -0800

    elf: Report property change when merging properties

failed to remove the property after reporting it has been removed.  This
patch corrects it.

bfd/

	PR ld/24721
	* elf-properties.c (elf_merge_gnu_property_list): Remove the
	property after reporting property removal.

ld/

	PR ld/24721
	* testsuite/ld-x86-64/x86-64.exp: Run PR ld/24721 tests.
	* testsuite/ld-x86-64/pr24721-x32.d: New file.
	* testsuite/ld-x86-64/pr24721.d: Likewise.
	* testsuite/ld-x86-64/pr24721.map: Likewise.
	* testsuite/ld-x86-64/pr24721a.s: Likewise.
	* testsuite/ld-x86-64/pr24721b.s: Likewise.
2019-06-24 11:08:57 -07:00
Tom de Vries 164e3873cf [gdb/testsuite] Fix label reference in implptr-64bit.exp
When running gdb.dwarf2/implptr-64bit.exp with board cc-with-dwz-m, we run into:
...
dwz: dwz.c:2363: checksum_die: \
  Assertion `\
    ((!op_multifile && !rd_multifile && !fi_multifile) || cu != die_cu (ref)) \
    && (!op_multifile || cu->cu_chunk == die_cu (ref)->cu_chunk)' failed.
cc-with-tweaks.sh: line 218: 13030 Aborted  \
  $DWZ -m ${output_file}.dwz "$output_file" ${output_file}.alt > /dev/null
...
In other words, PR dwz/24170.

The trigger for the dwz PR is when intra-CU references are encoded using
section-relative encoding DW_FORM_ref_addr, but could have been encoded using
CU-relative encoding DW_FORM_ref4.

Fix the intra-CU '%' label reference in implptr-64bit.exp.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-06-24  Tom de Vries  <tdevries@suse.de>

	* gdb.dwarf2/implptr-64bit.exp: Fix intra-CU '%' label reference.
2019-06-24 18:26:10 +02:00
Tom de Vries 824eacee59 [gdb/testsuite] Fix DW_AT_decl_file in gdb.trace tests
When running gdb.trace/{entry-values.exp,unavailable-dwarf-piece.exp} with
board cc-with-dwz, we run into two failures related to the DW_AT_decl_file
attribute:
- The encoding DW_FOR_sdata is used for DW_AT_decl_file, while the attribute
  is required to have a an "unsigned integer constant" value.
- The DW_AT_decl_file attributes refer to a file with index one, while there's
  no such file.

Fix this by using DW_FOR_udata and the value 0, meaning "no file specified".

Tested on x86_64-linux with board native-gdbserver.

gdb/testsuite/ChangeLog:

2019-06-24  Tom de Vries  <tdevries@suse.de>

	* gdb.trace/entry-values.exp: Use DW_FORM_udata instead of
	DW_FOR_sdata for DW_AT_decl_file.  Use 0 for DW_AT_decl_file.
	* gdb.trace/unavailable-dwarf-piece.exp: Same.
2019-06-24 13:29:23 +02:00
Tom de Vries 385b97d3ac [gdb/testsuite] Fix inter-cu refs in inlined_subroutine-inheritance.exp
When running gdb.dwarf2/inlined_subroutine-inheritance.exp with board
cc-with-dwz, we run into:
...
dwz: inlined_subroutine-inheritance: Couldn't find DIE referenced by \
  DW_AT_abstract_origin
...

The problem is that the DW_AT_abstract_origin attributes refer to DIEs in
other CUs, while the references are encoded using the cu-relative encoding
DW_FORM_ref4.

Fix this by forcing the references to use DW_FORM_ref_addr.

Tested on x86_64-linux.

Tested with commit c24bdb023c "Introduce dwarf2_cu::get_builder" reverted,
and verified that the test-case fails in the same way before and after this
patch.

gdb/testsuite/ChangeLog:

2019-06-24  Tom de Vries  <tdevries@suse.de>

	* gdb.dwarf2/inlined_subroutine-inheritance.exp:
2019-06-24 12:20:39 +02:00
GDB Administrator a33f989b4e Automatic date update in version.in 2019-06-24 00:00:31 +00:00
Alan Modra bb22a41815 PR24704, Internal error building skiboot for powerpc64-linux-gnu
While the skiboot linker script bears some culpability in this PR,
it's also true that the GOT indirect to GOT relative optimisation for
16-bit offsets isn't safe.  At least, it isn't safe to remove the GOT
entry based on distance between the GOT pointer and symbol calculated
from the preliminary layout.  So this patch removes that optimisation,
and reduces the range allowed for 32-bit and 34-bit offsets.

	PR 24704
bfd/
	* elf64-ppc.c (R_PPC64_GOT16_DS): Don't set has_gotrel.
	(ppc64_elf_edit_toc): Don't remove R_PPC64_GOT16_DS got entries.
	Reduce range of offsets allowed for other GOT relocs.
ld/
	* testsuite/ld-powerpc/elfv2exe.d: Update.
	* testsuite/ld-powerpc/elfv2so.d: Update.
2019-06-23 23:11:27 +09:30
Alan Modra 14b2a8e424 PR24689 again, string table corruption
Depending on optimisation level and gcc version, git commit 890f750a3b
introduces a false positive warning that i_shdrp may be used
uninitialized.

	PR 24689
	* elfcode.h (elf_object_p): Warning fix.
2019-06-23 14:24:45 +09:30
GDB Administrator a8d21e9ef0 Automatic date update in version.in 2019-06-23 00:00:55 +00:00
Tom Tromey f95675e12d Remove tui_first_data_element_no_in_line
tui_first_data_element_no_in_line is never used.  This patch removes
it.  Tested by rebuilding, and by grep.

gdb/ChangeLog
2019-06-22  Tom Tromey  <tom@tromey.com>

	* tui/tui-windata.h (tui_first_data_element_no_in_line): Don't
	declare.
	* tui/tui-windata.c (tui_first_data_element_no_in_line): Remove.
2019-06-22 15:28:08 -06:00
Tom Tromey 5bff081c10 Remove two unused functions from the TUI
This removes two unused functions from the TUI.  According to
"git grep -G", they have never been used.

gdb/ChangeLog
2019-06-22  Tom Tromey  <tom@tromey.com>

	* tui/tui-data.h (tui_del_window, tui_del_data_windows): Don't
	declare.
	* tui/tui-data.c (tui_del_window, tui_del_data_windows): Remove.
2019-06-22 15:22:49 -06:00
Tom de Vries 47e3f47487 [gdb] Fix s390x -m31 build
When building gdb on s390x with -m31, we run into this Wformat
warning (which Werror turns into an error):
...
gdb/dwarf2read.c: In function \
  'void create_addrmap_from_aranges(dwarf2_per_objfile*, \
                                    dwarf2_section_info*)':
gdb/dwarf2read.c:3277:22: error: format '%zu' expects argument of type \
  'size_t', but argument 3 has type 'int' [-Werror=format=]
    warning (_("Section .debug_aranges in %s entry at offset %zu "
...

The Wformat warning is triggered in this statement:
...
          warning (_("Section .debug_aranges in %s entry at offset %zu "
                     "length %s exceeds section length %s, "
                     "ignoring .debug_aranges."),
                   objfile_name (objfile), entry_addr - section->buffer,
                   plongest (bytes_read + entry_length),
                   pulongest (section->size));
...
where 'entry_addr - section->buffer' is of type ptrdiff_t and '%zu' prints an
unsigned with the same size as size_t/ssize_t.

On s390x with -m31, we have:
- size_t   : unsigned long int (32-bit)
- ptrdiff_t: int               (32-bit)

Wformat warns against this because even though long int and int have the same
size, the types are not compatible.

[ The Wformat warning is to similar to what we would get for x86_64 -m32
(where long and int are also the same size) and:
...
int i;
printf ("%ld", i);
... ]

Fix this by using '%s' and plongest instead of '%zu' to print ptrdiff_t.

Build and reg-tested on x86_64.

gdb/ChangeLog:

2019-06-22  Tom de Vries  <tdevries@suse.de>

	* dwarf2read.c (create_addrmap_from_aranges)
	(read_debug_names_from_section): Print ptrdiff_t using '%s' and plongest
	instead of '%zu'.
2019-06-22 10:59:37 +02:00
GDB Administrator 5ec331ef74 Automatic date update in version.in 2019-06-22 00:00:20 +00:00
Tom de Vries c596f180a1 [gdb/testsuite] Compile index-cache.c with -Wl,--build-id
When testing gdb.base/index-cache.exp using a gcc build without
--enable-linker-build-id we get:
...
FAIL: gdb.base/index-cache.exp: \
  test_cache_enabled_miss: at least one file was created
FAIL: gdb.base/index-cache.exp: \
  test_cache_enabled_miss: couldn't get executable build id
FAIL: gdb.base/index-cache.exp: \
test_cache_enabled_hit: check index-cache stats
...

With "set debug index-cache on" we find:
...
(gdb) file index-cache
Reading symbols from index-cache...
index cache: objfile index-cache has no build id
...

The problem is that a build-id is required for the index-cache functionality.

Fix this by compiling index-cache.c with -Wl,--build-id.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-06-21  Tom de Vries  <tdevries@suse.de>

	* gdb.base/index-cache.exp: Add additional_flags=-Wl,--build-id.
2019-06-21 23:56:18 +02:00
H.J. Lu ad692897c1 i386: Break i386-dis-evex.h into small files
Break i386-dis-evex.h into small files such that each file is included
just once.

	* i386-dis-evex.h: Break into ...
	* i386-dis-evex-len.h: New file.
	* i386-dis-evex-mod.h: Likewise.
	* i386-dis-evex-prefix.h: Likewise.
	* i386-dis-evex-reg.h: Likewise.
	* i386-dis-evex-w.h: Likewise.
	* i386-dis.c: Include i386-dis-evex-reg.h, i386-dis-evex-prefix.h,
	i386-dis-evex.h, i386-dis-evex-len.h, i386-dis-evex-w.h and
	i386-dis-evex-mod.h.
2019-06-21 13:18:41 -07:00
Simon Marchi fd5866f6aa dwarf2read: Get rid of VEC (dwarf2_section_info_def)
This patch removes uses of VEC (dwarf2_section_info_def) in favor of
std::vector<dwarf2_section_info>.  The conversion is relatively
straightforward, no function changes are intended.

gdb/ChangeLog:

	* dwarf2read.h (dwarf2_section_info_def): Remove.
	(DEF_VEC_O (dwarf2_section_info_def)): Remove.
	* dwarf2read.c (struct dwo_sections) <types>: Change type to
	std::vector<dwarf2_section_info>.
	(struct dwo_file) <~dwo_file>: Remove.
	(dwarf2_per_objfile::~dwarf2_per_objfile): Don't manually free
	types field.
	(dwarf2_per_objfile::locate_sections): Adjust to std::vector.
	(dwarf2_read_debug_names): Likewise.
	(create_debug_types_hash_table): Change parameter type to
	array_view, adjust code accordingly.
	(dwarf2_locate_dwo_sections): Adjust to std::vector.
	(partial_die_info::fixup): Likewise.
	(determine_prefix): Likewise.
	* dwarf-index-write.c (write_psymtabs_to_index): Adjust.
2019-06-21 14:11:15 -04:00
Simon Marchi fb1eb2f94a dwarf2read: Make dwo_file::dbfd a gdb_bfd_ref_ptr
This removes the manual call to gdb_bfd_ref in favor of gdb_bfd_ref_ptr.

gdb/ChangeLog:

	* dwarf2read.c (struct dwo_file) <dbfd>: Change type to
	gdb_bfd_ref_ptr.
	<~dwo_file>: Remove call to gdb_bfd_unref.
	(open_and_init_dwo_file): Move gdb_bfd_ref_ptr into dbfd field. Call
	gdb_bfd_ref_ptr::get.
2019-06-21 14:11:13 -04:00
Simon Marchi 51ac9db596 dwarf2read: C++ify dwo_file
This patch changes dwo_file to be allocated/deallocated with new/delete,
so that we can start using C++ features in it, and in struct
dwo_sections.

The free_dwo_file function becomes the destructor of struct dwo_file
(and will disappear in upcoming patches, which will use gdb_bfd_ref_ptr
for dbfd and an std::vector for sections.types).

gdb/ChangeLog:

	* dwarf2read.h (struct dwarf2_per_objfile) <dwo_files>: Change
	type to htab_up.
	* dwarf2read.c (struct dwo_file): Initialize fields.
	<~dwo_file>: New.
	(free_dwo_file): Remove, move content to ~dwo_file.
	(struct dwo_file_deleter): Remove.
	(dwo_file_up>: Remove custom deleter.
	(free_dwo_files): Remove.
	(dwarf2_per_objfile::~dwarf2_per_objfile): Don't explicitly free
	dwo_files.
	(process_skeletonless_type_units): Call unique_ptr::get.
	(allocate_dwo_file_hash_table): Add deleter to created hash
	table.  Change return type to htab_up.
	(lookup_dwo_file_slot): Don't memset dwo_file, call
	unique_ptr::get.
	(create_dwo_unit_in_dwp_v1): Allocate dwo_file with new.
	(create_dwo_unit_in_dwp_v2): Likewise.
	(open_and_init_dwo_file): Likewise.
	(free_dwo_file_from_slot): Remove.
2019-06-21 14:10:14 -04:00
Simon Marchi dc4ccb6f7f dwarf2read: Use bool for dwarf2_section_info fields
Use bool instead of char where applicable in dwarf2_section_info.

No functional changes intended.

gdb/ChangeLog:

	* dwarf2read.h (struct dwarf2_section_info) <readin,
	is_virtual>: Change type to bool.
	* dwarf2read.c (dwarf2_read_section, create_dwp_v2_section): Use
	true instead of 1.
2019-06-21 14:10:13 -04:00
Tom de Vries b13a7d03c2 [gdb/testsuite] Mark ptype_union.exp as unsupported for cc-with-gdb-index
When testing gdb with board cc-with-gdb-index, we run into:
...
FAIL: gdb.ada/ptype_union.exp: ptype global
FAIL: gdb.ada/ptype_union.exp: print global
...

The index is not supported for Ada (PR24713), and cc-with-gdb-index does not
add an index for Ada test-cases.  However, this test-case compiles C sources,
for which cc-with-gdb-index does add an index.  In gdb we load the executable
containing the index and set the language to Ada, resulting in gdb trying to
handle something that is not supported.

Fix the fail by marking this unsupported.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-06-21  Tom de Vries  <tdevries@suse.de>

	PR testsuite/24518
	PR ada/24713
	* gdb.ada/ptype_union.exp: Mark as unsupported if executable contains
	index.
2019-06-21 17:03:27 +02:00
Andreas Schwab be74b5b714 Add gnulib to gdb release tarball
* src-release.sh (GDB_SUPPORT_DIRS): Add gnulib.
2019-06-21 15:20:34 +02:00
Gary Benson 70175d8d62 Fix gnulib/update-gnulib.sh
This commit fixes two paths in update-gnulib.sh that weren't updated
when gnulib was moved to toplevel.

gnulib/ChangeLog:

	* update-gnulib.sh: Adjust paths.
2019-06-21 13:23:59 +01:00
Nick Alcock cf02c44dfd libctf: fix ctf_open endianness problems with raw CTF files
ctf_open (or, rather, ctf_fdopen, which underlies it) has several
endianness problems, even though it was written after the
endian-swapping code was implemented, so should have been endian-aware.

Even though the comment right above the relevant check says that it wil
check for CTF magic in any endianness, it only checks in the native
endianness, so opening raw LE CTF files on BE, or vice-versa, will fail.
It also checks the CTF version by hand, without ever endianness-swapping
the header, so that too will fail, and is entirely redundant because
ctf_simple_open does the job properly in any case.  We have a similar
problem in the next if block, which checks for raw CTF archives: we are
checking in the native endianness while we should be doing a le64toh()
on it to check in little-endian form only: so opening CTF archives
created on the local machine will fail if the local machine is
big-endian.

Adding insult to injury, if ctf_simple_open then fails, we go on and try
to turn it into a single-element CTF archive regardless, throwing the
error away.  Since this involves dereferencing null pointers it is not
likely to work very well.

libctf/
	* ctf-open-bfd.c: Add swap.h and ctf-endian.h.
	(ctf_fdopen): Check for endian-swapped raw CTF magic, and
	little-endian CTF archive magic.  Do not check the CTF version:
	ctf_simple_open does that in endian-safe ways.  Do not dereference
	null pointers on open failure.
2019-06-21 13:04:02 +01:00
Nick Alcock 7cee18263c libctf: endianness fixes
Testing of the first code to generate CTF_K_SLICEs on big-endian
revealed a bunch of new problems in this area.  Most importantly, the
trick we did earlier to avoid wasting two bytes on padding in the
ctf_slice_t is best avoided: because it leads to the whole file after
that point no longer being naturally aligned, all multibyte accesses
from then on must use memmove() to avoid unaligned access on platforms
where that is fatal.  In future, this is planned, but for now we are
still doing direct access in many places, so we must revert to making
ctf_slice_t properly aligned for storage in an array.

Rather than wasting bytes on padding, we boost the size of cts_offset
and cts_bits.  This is still a waste of space (we cannot have offsets or
bits in bitfields > 256) but it cannot be avoided for now, and slices
are not so common that this will be a serious problem.

A possibly-worse endianness problem fixed at the same time involves
a codepath used only for foreign-endian, uncompressed CTF files, where
we were not copying the actual CTF data into the buffer, leading to
libctf reading only zeroes (or, possibly, uninitialized garbage).

Finally, when we read in a CTF file, we copy the header and work from
the copy.  We were flipping the endianness of the header copy, and of
the body of the file buffer, but not of the header in the file buffer
itself: so if we write the file back out again we end up with an
unreadable frankenfile with header and body of different endiannesses.
Fix by flipping both copies of the header.

include/
	* ctf.h (ctf_slice_t): Make cts_offset and cts_bits unsigned
	short, so following structures are properly aligned.

libctf/
	* ctf-open.c (get_vbytes_common): Return the new slice size.
	(ctf_bufopen): Flip the endianness of the CTF-section header copy.
	Remember to copy in the CTF data when opening an uncompressed
	foreign-endian CTF file.  Prune useless variable manipulation.
2019-06-21 13:04:02 +01:00
Nick Alcock 0b4fa56e07 libctf: unidentified type kinds on open are a sign of file corruption
If we see a CTF type with a kind we do not recognize in its ctt_info
during opening, we cannot skip it and continue opening the file: if the
type kind is unknown, we do not know how long its vlen is, and we cannot
have skipped past it: so if we continue reading we will almost certainly
read in part of the vlen as if it were a new ctf_type_t.

Avoid this trouble by considering unknown type kinds to be a reason to
return ECTF_CORRUPT, just like everything else that reads in type kinds
does.

libctf/
	* ctf-open.c (ctf_types): Fail when unidentified type kinds are
	seen.
2019-06-21 13:04:02 +01:00
Nick Alcock 364620bf63 libctf: dump header offsets into the debugging output
This is an essential first piece of info needed to debug both libctf
writing and reading problems, and we weren't recording it anywhere!

(This is a short-term fix: fairly soon, we will record all of this in a
form that outlives ctf_bufopen, and then ctf_dump() will be able to dump
it like it can everything else.)

libctf/
	* ctf-open.c (ctf_bufopen): Dump header offsets into the debugging
	output.
2019-06-21 13:04:02 +01:00
Nick Alcock 65365aa856 libctf: drop mmap()-based CTF data allocator
This allocator has the ostensible benefit that it lets us mprotect() the
memory used for CTF storage: but in exchange for this it adds
considerable complexity, since we have to track allocation sizes
ourselves for use at freeing time, note whether the data we are storing
was ctf_data_alloc()ed or not so we know if we can safely mprotect()
it... and while the mprotect()ing has found few bugs, it *has* been the
cause of more than one due to errors in all this tracking leading to us
mprotect()ing bits of the heap and stuff like that.

We are about to start composing CTF buffers from pieces so that we can
do usage-based optimizations on the strtab.  This means we need
realloc(), which needs nonportable mremap() and *more* tracking of the
*original* allocation size, and the complexity and bureaucracy of all of
this is just too high for its negligible benefits.

Drop the whole thing and just use malloc() like everyone else.  It knows
better than we do when it is safe to use mmap() under the covers,
anyway.

While we're at it, don't leak the entire buffer if ctf_compress_write()
fails to compress it.

libctf/
	* ctf-subr.c (_PAGESIZE): Remove.
	(ctf_data_alloc): Likewise.
	(ctf_data_free): Likewise.
	(ctf_data_protect): Likewise.
	* ctf-impl.h: Remove declarations.
	* ctf-create.c (ctf_update): No longer call ctf_data_protect: use
	ctf_free, not ctf_data_free.
	(ctf_compress_write): Use ctf_data_alloc, not ctf_alloc.  Free
	the buffer again on compression error.
	* ctf-open.c (ctf_set_base): No longer track the size: call
	ctf_free, not ctf_data_free.
	(upgrade_types): Likewise.  Call ctf_alloc, not ctf_data_alloc.
	(ctf_bufopen): Likewise.  No longer call ctf_data_protect.
2019-06-21 13:04:02 +01:00
Nick Alcock 2486542803 libctf: handle errors on dynhash insertion better
We were missing several cases where dynhash insertion might fail, likely
due to OOM but possibly for other reasons.  Pass the errors on.

libctf/
	* ctf-create.c (ctf_dtd_insert): Pass on error returns from
	ctf_dynhash_insert.
	(ctf_dvd_insert): Likewise.
	(ctf_add_generic): Likewise.
	(ctf_add_variable): Likewise.
	* ctf-impl.h: Adjust declarations.
2019-06-21 13:04:01 +01:00
Alan Modra 890f750a3b PR24689, string table corruption
The testcase in the PR had a e_shstrndx section of type SHT_GROUP.
hdr->contents were initialized by setup_group rather than being read
from the file, thus last byte was not zero and string dereference ran
off the end of the buffer.

	PR 24689
	* elfcode.h (elf_object_p): Check type of e_shstrndx section.
2019-06-21 12:04:41 +09:30
GDB Administrator 2a81e61405 Automatic date update in version.in 2019-06-21 00:00:20 +00:00
Tom de Vries 7d10623d3b [gdbserver] Fix s390x -m31 gdbserver build
When building gdb on s390x with -m31, we run into this error:
...
gdb/gdbserver/linux-s390-ipa.c: \
  In function 'const target_desc* get_ipa_tdesc(int)':
gdb/gdbserver/linux-s390-ipa.c:371:18: error: 's390_te_ft_collect_regmap' \
  was not declared in this scope
       SET_REGMAP(s390_te_ft_collect_regmap, 0);

The offending line is part of this code snippet:
...
    case S390_TDESC_GS:
      SET_REGMAP(s390_te_ft_collect_regmap, 0);
      return tdesc_s390_gs_linux64;
...
introduced in commit ce29f8439f "S390: Make IPA recognize tdescs with guarded
storage".

The snippet is part of an #ifdef __s390x__ construct, in the false branch, and
in the true branch we find a snippet introduced by the same commit:
...
    case S390_TDESC_GS:
      SET_REGMAP(s390x_te_ft_collect_regmap, 0);
      return tdesc_s390x_gs_linux64;
...
which is paired with a comment update for s390x_te_ft_collect_regmap:
...
-/* Used for s390x-te-linux64, s390x-tevx-linux64.  */
+/* Used for s390x-te-linux64, s390x-tevx-linux64, and
+   s390x-gs-linux64.  */

 static const int s390x_te_ft_collect_regmap[] = {
...

A similar comment update is added in the same commit for
s390_te_linux64_ft_collect_regmap:
...
-/* Used for s390-te-linux64, s390-tevx-linux64.  */
+/* Used for s390-te-linux64, s390-tevx-linux64, and s390-gs-linux64.  */

 static const int s390_te_linux64_ft_collect_regmap[] = {
...
but not paired with any update.

Fix the build breaker by making the offending SET_REGMAP use the regmap
indicated by the comment.
...
-      SET_REGMAP(s390_te_ft_collect_regmap, 0);
+      SET_REGMAP(s390_te_linux64_ft_collect_regmap, 0);
...

Build on s390x-linux with -m31.

gdb/gdbserver/ChangeLog:

2019-06-20  Tom de Vries  <tdevries@suse.de>

	* linux-s390-ipa.c (get_ipa_tdesc)[!__s390x__]: Use
	s390_te_linux64_ft_collect_regmap for S390_TDESC_GS.
2019-06-20 11:31:36 +02:00
Tom Tromey e6a1c5cbcb Don't declare tui_init_content_element
I noticed that tui_init_content_element is declared but never defined.
This removes the declaration.  Tested by rebuilding.  (I should have
merged this with the previous patch but I had forgotten that I found
two of these.)

gdb/ChangeLog
2019-06-19  Tom Tromey  <tom@tromey.com>

	* tui/tui-data.h (tui_init_content_element): Don't declare.
2019-06-19 22:24:30 -06:00
Tom Tromey 6f6ffbeb5a Don't declare tui_init_win_info
I noticed that tui_init_win_info is declared but never defined.  This
removes the declaration.  Tested by rebuilding.

gdb/ChangeLog
2019-06-19  Tom Tromey  <tom@tromey.com>

	* tui/tui-data.h (tui_init_win_info): Don't declare.
2019-06-19 22:13:44 -06:00
GDB Administrator 698dc1d7a2 Automatic date update in version.in 2019-06-20 00:00:18 +00:00
H.J. Lu f0a6222e30 i386: Check vector length for EVEX broadcast instructions
Since not all vector lengths are supported by EVEX broadcast instructions,
decode them only with supported vector lengths.

gas/

	PR binutils/24700
	* testsuite/gas/i386/disassem.s: Add test for vbroadcasti32x8
	with invalid vector length.
	* testsuite/gas/i386/x86-64-disassem.s: Likewise.
	* testsuite/gas/i386/disassem.d: Updated.
	* testsuite/gas/i386/x86-64-disassem.d: Likewise.

opcodes/

	PR binutils/24700
	* i386-dis-evex.h (evex_table): Update EVEX_W_0F3819_P_2,
	EVEX_W_0F381A_P_2, EVEX_W_0F381B_P_2, EVEX_W_0F385A_P_2 and
	EVEX_W_0F385B_P_2.
	(evex_len_table): Add EVEX_LEN_0F3819_P_2_W_0,
	EVEX_LEN_0F3819_P_2_W_1, EVEX_LEN_0F381A_P_2_W_0,
	EVEX_LEN_0F381A_P_2_W_1, EVEX_LEN_0F381B_P_2_W_0,
	EVEX_LEN_0F381B_P_2_W_1, EVEX_LEN_0F385A_P_2_W_0,
	EVEX_LEN_0F385A_P_2_W_1, EVEX_LEN_0F385B_P_2_W_0 and
	EVEX_LEN_0F385B_P_2_W_1.
	* i386-dis.c (EVEX_LEN_0F3819_P_2_W_0): New enum.
	(EVEX_LEN_0F3819_P_2_W_1): Likewise.
	(EVEX_LEN_0F381A_P_2_W_0): Likewise.
	(EVEX_LEN_0F381A_P_2_W_1): Likewise.
	(EVEX_LEN_0F381B_P_2_W_0): Likewise.
	(EVEX_LEN_0F381B_P_2_W_1): Likewise.
	(EVEX_LEN_0F385A_P_2_W_0): Likewise.
	(EVEX_LEN_0F385A_P_2_W_1): Likewise.
	(EVEX_LEN_0F385B_P_2_W_0): Likewise.
	(EVEX_LEN_0F385B_P_2_W_1): Likewise.
2019-06-19 10:01:42 -07:00
Tom de Vries 8d6a48df54 [gdb] Fix clang buildbreaker
Building gdb with clang, I run into:
...
src/gdb/gdbserver/linux-low.c:6190:41: error: comparison of unsigned \
  expression < 0 is always false [-Werror,-Wtautological-compare]
          if (debug_write ("sigchld_handler\n",
                           sizeof ("sigchld_handler\n") - 1) < 0)
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~
...

This regression is introduced by commit a7e559cc08 "gdbserver: Ensure all
debug output uses debug functions", which replaces calls to write with result
type ssize_t with calls to debug_write with result type size_t.

Fix this by making debug_write return ssize_t.

Build and reg-tested on x86_64-linux.

gdb/gdbserver/ChangeLog:

2019-06-19  Tom de Vries  <tdevries@suse.de>

	* debug.h (debug_write): Change return type to ssize_t.
	* debug.c (debug_write): Same.
2019-06-19 17:17:38 +02:00
Tom de Vries f23f598e28 [gdb] Fix build breaker with gcc 4.8
When compiling with gcc 4.8, we run into:
...
/usr/include/c++/4.8/bits/unordered_map.h💯18: required from \
  ‘class std::unordered_map<sect_offset, std::vector<sect_offset> >’
src/gdb/dwarf2read.h:260:5:   required from here
/usr/include/c++/4.8/bits/hashtable_policy.h:1070:12: error: invalid use of \
  incomplete type ‘struct std::hash<sect_offset>’
...

Fix this by setting the Hash template parameter of the unordered_map to
gdb::hash_enum<sect_offset>, rather than using the default
std::hash<sect_offset>.

Build and reg-tested on x86_64-linux with gcc 4.8.

gdb/ChangeLog:

2019-06-19  Tom de Vries  <tdevries@suse.de>

	* dwarf2read.h (abstract_to_concrete): Change type to
	std::unordered_map<sect_offset, std::vector<sect_offset>,
	gdb::hash_enum<sect_offset>>.
2019-06-19 16:56:23 +02:00
Tom Tromey 899277ae52 Add intro comment to length_cond.exp
Pedro pointed out that the new length_cond.exp test did not have an
intro comment.  This adds one.

gdb/testsuite/ChangeLog
2019-06-19  Tom Tromey  <tromey@adacore.com>

	* gdb.ada/length_cond.exp: Add intro comment.
2019-06-19 08:32:35 -06:00
Tom Tromey 680e1beed3 Fix crash when setting breakpoint condition
gdb could crash when setting a breakpoint condition on a breakpoint
when using the Ada language.  The problem occurred because the
ada_evaluate_subexp would try to evaluate the array to compute its
attributes, but evaluating can't really be done at this time.

This patch fixes the problem by arranging not to try to evaluate in
EVAL_AVOID_SIDE_EFFECTS mode when computing an attribute.

Tested on x86-64 Fedora 29.  Because this is Ada-specific, and because
Joel approved it internally, I am checking it in.

gdb/ChangeLog
2019-06-19  Tom Tromey  <tromey@adacore.com>

	* ada-lang.c (ada_evaluate_subexp) <case OP_ATR_FIRST>: Handle
	EVAL_AVOID_SIDE_EFFECTS specially.

gdb/testsuite/ChangeLog
2019-06-19  Tom Tromey  <tromey@adacore.com>

	* gdb.ada/length_cond.exp: New file.
	* gdb.ada/length_cond/length_cond.adb: New file.
	* gdb.ada/length_cond/pck.adb: New file.
	* gdb.ada/length_cond/pck.ads: New file.
2019-06-19 06:06:02 -06:00
Tom Tromey dcf3792354 Instantiate a single source highlighter
It occurred to me that there's no reason to make a new source
highlighter each time gdb needs to highlight some source code.
Instead, a single one can be created and then simply reused each time.

This patch implements this idea.  Tested on x86-64 Fedora 29.

gdb/ChangeLog
2019-06-19  Tom Tromey  <tromey@adacore.com>

	* source-cache.c (highlighter): New global.
	(source_cache::get_source_lines): Create a highlighter on demand.
2019-06-19 05:34:51 -06:00
Alan Modra 6f5601c4d0 PR24697, R_PPC_EMB_SDA21 relocation
PR 24697
	* elf32-ppc.c (ppc_elf_relocate_section): Don't read insn for
	R_PPC_EMB_RELSDA.  Mask low bit of R_PPC_EMB_SDA21 r_offset.
2019-06-19 14:01:19 +09:30
Alan Modra 4a4e7361d6 PowerPC64 notoc calls
Calls from functions that don't have a valid toc pointer in r2 (these
calls are marked with _NOTOC relocs) to functions that require r2
valid must go via the callee global entry point.  This patch corrects
the condition the linker was using to detect functions that require r2
to be valid.  Values of both zero and one in st_other local entry bits
mean a function doesn't care about r2.

	* elf64-ppc.c (ppc64_elf_inline_plt): Correct st_other test for
	functions that require r2 valid to use local entry.
	(ppc64_elf_size_stubs, ppc64_elf_relocate_section): Likewise.
2019-06-19 14:01:05 +09:30
GDB Administrator 312413cb84 Automatic date update in version.in 2019-06-19 00:00:31 +00:00
Andrew Burgess 494986d596 gdb: Remove use of deprecated_interactive_hook
The deprecated_interactive_hook is not used within GDB.  It is used in
gdbtk, however this patch removes that use:

  https://sourceware.org/ml/insight/2019-q2/msg00001.html

So I think there is no longer a reason to keep this hook around.

This patch removes it.  There should be no user visible changes after
this commit.

gdb/ChangeLog:

	* defs.h (deprecated_interactive_hook): Delete declaration.
	* interps.c (clear_interpreter_hooks): Remove use of
	deprecated_interactive_hook.
	* top.c (deprecated_interactive_hook): Delete definition.
	* utils.c (maybe_quit): Remove use of deprecated_interactive_hook.
2019-06-18 22:18:33 +01:00
Tom de Vries 0ed4690a67 [gdb/testsuite] Use -fuse-ld=gold in fission.exp
The target board fission.exp requires the gold linker (because it supports
--gdb-index).

When running the target board on a system where the default linker is not
gold, most tests will fail to compile.

Fix this by adding "-fuse-ld=gold" ( supported in gcc since version 4.8).

gdb/testsuite/ChangeLog:

2019-06-18  Tom de Vries  <tdevries@suse.de>

	* boards/fission.exp (debug_flags): Add "-fuse-ld=gold".
2019-06-18 19:03:38 +02:00
Tom de Vries 3360b6e796 [gdb] Fix abstract_to_concrete type
The test-case varval.exp fails here:
...
FAIL: gdb.dwarf2/varval.exp: print varval2
...
with boards readnow/cc-with-gdb-index/cc-with-debug-names, as well as if gdb
is build with -fsanitize=address -lasan.

The problem is that the abstract_to_concrete map in which we track the
association of abstract to concrete DIEs (for DW_OP_GNU_variable_value
support) has type std::unordered_map<die_info_ptr, std::vector<die_info_ptr>>,
and the die_info_ptrs that we register in the map may be invalid by the time
that we start to lookup DIEs in the map.

Fix this by using the sect_offset instead to identify the DIEs in the map.

Build and tested on x86_64-linux.

gdb/ChangeLog:

2019-06-18  Tom de Vries  <tdevries@suse.de>

	PR gdb/24515
	* dwarf2read.h (abstract_to_concrete): Change type from
	std::unordered_map<die_info_ptr, std::vector<die_info_ptr>> to
	std::unordered_map<sect_offset, std::vector<sect_offset>>.
	* dwarf2read.c (read_variable): Update.
	(dwarf2_fetch_die_loc_sect_off): Update.
2019-06-18 18:59:51 +02:00
Simon Marchi 4ed4690fc2 doc: fix false claim about second argument to gdb
Section "Invoking GDB" of the manual states that if you try to launch
gdb with:

  gdb program 1234

it will try to attach to the process with id 1234, unless there is a
file named 1234 in the current working directory, in which case it will
try to open that file as a core.  In fact, when the second argument
starts with a digit, GDB tries to attach to process 1234 first, before
trying to open file 1234 as a core.  So that last remark is not true and
therefore this patch removes it.

The same remark is present in the man page, so it is removed there too.

Section "Choosing Files" correctly states:

  If the second argument begins with a decimal digit, GDB will first
  attempt to attach to it as a process, and if that fails, attempt to
  open it as a corefile.

so it is unchanged.

Finally, the man page has an additional detail compared to section
"Invoking GDB", regarding the use of the -p switch, so I added the same
detail to the "Invoking GDB" section.

gdb/doc/ChangeLog:

	* gdb.texinfo (Invoking GDB): Remove sentence about how GDB
	deals with a file that has the same name as the specified pid to
	attach to.  Add example using -p option.
	(gdb man): Remove same sentence as in previous item.
2019-06-18 12:40:13 -04:00
Tom Tromey d20ed5fd57 Add comment to list0.h
Pedro suggested adding a comment to list0.h to explain the control
character.

Tested on x86-64 Fedora 29.

gdb/testsuite/ChangeLog
2019-06-18  Tom Tromey  <tromey@adacore.com>

	* gdb.base/list0.h: Add comment explaining control character.
2019-06-18 09:28:57 -06:00