Pedro Alves [Tue, 22 May 2018 17:22:10 +0000 (18:22 +0100)]
Handle "show remote memory-write-packet-size" when not connected
Currently "show remote memory-write-packet-size" says that the packet
size is limited to whatever is stored in the remote_state global, even
if not connected to a target.
When we get to support multiple instances of remote targets, there
won't be a remote_state global anymore, so that must be replaced by
something else.
Since it doesn't make sense to print the limit of the packet size of a
non-existing connection, this patch makes us say that the limit will
be further reduced when we connect.
The text is taken from the command's online help, which says:
"The actual limit is further reduced dependent on the target."
Note that a value of "0" is special, as per "help set remote
memory-write-packet-size":
~~~
Specify the number of bytes in a packet or 0 (zero) for the
default packet size.
~~~
I've tweaked "show remote memory-write-packet-size" to include
"(default)" in the output in that case, like this:
(gdb) show remote memory-write-packet-size
The memory-write-packet-size is 0 (default). The actual limit will be further reduced dependent on the target.
While working on this, I noticed that an explicit "set remote
write-packet-size 0" does not makes GDB go back to the exact same
state as the default state when GDB starts up:
(gdb) show remote memory-write-packet-size
The memory-write-packet-size is 0. [...]
^^
(gdb) set remote memory-write-packet-size 0
(gdb) show remote memory-write-packet-size
The memory-write-packet-size is 16384. [...]
^^^^^
The "16384" number comes from DEFAULT_MAX_MEMORY_PACKET_SIZE.
This happens because git commit
a5c0808e221c ("gdb: remove packet size
limit") at
<https://sourceware.org/ml/gdb-patches/2015-08/msg00743.html>, added
this:
/* So that the query shows the correct value. */
if (size <= 0)
size = DEFAULT_MAX_MEMORY_PACKET_SIZE;
to set_memory_packet_size, but despite what the comment suggests, that
also has the side-effect of recording DEFAULT_MAX_MEMORY_PACKET_SIZE
in config->size.
Finally, DEFAULT_MAX_MEMORY_PACKET_SIZE only makes sense for "set
remote memory-write-packet-size fixed", so I've renamed it
accordingly, to make it a little bit clearer.
gdb/ChangeLog:
2018-05-22 Pedro Alves <palves@redhat.com>
* remote.c (DEFAULT_MAX_MEMORY_PACKET_SIZE): Rename to ...
(DEFAULT_MAX_MEMORY_PACKET_SIZE_FIXED): ... this.
(get_fixed_memory_packet_size): New.
(get_memory_packet_size): Use it.
(set_memory_packet_size): Don't override the config size with
DEFAULT_MAX_MEMORY_PACKET_SIZE.
(show_memory_packet_size): Use get_fixed_memory_packet_size.
Don't refer to get_memory_packet_size if not connected to a remote
target. Show "(default)" if configured size is 0.
gdb/testsuite/ChangeLog:
2018-05-22 Pedro Alves <palves@redhat.com>
* gdb.base/remote.exp: Adjust expected output of "show remote
memory-write-packet-size". Add tests for "set remote
memory-write-packet-size 0" and "set remote
memory-write-packet-size fixed/limit".
Pedro Alves [Tue, 22 May 2018 17:22:09 +0000 (18:22 +0100)]
remote: Move discard_pending_stop_replies call
This helps because discard_pending_stop_replies will later become a
method of remote_target. Otherwise, when we have multiple instances
of remote_target, we'd have to make discard_pending_stop_replies find
the inferior's target_ops, and upcast it to remote_target (if indeed a
remote) to find the pending stop replies queue to clear.
gdb/ChangeLog:
2018-05-22 Pedro Alves <palves@redhat.com>
* remote.c (remote_target::mourn_inferior): Move
discard_pending_stop_replies call here from ...
(_initialize_remote): ... here.
Pedro Alves [Tue, 22 May 2018 17:22:09 +0000 (18:22 +0100)]
remote: Small cleanup in compare_section_command
The set_general_process call in compare_sections_command isn't
actually needed. remote_target::verify_memory and
remote_target::xfer_partial already handle making sure the remote is
pointing at the right process or thread.
Getting this out of the way helps a bit with further elimination of
the remote_state global, because we have to handle the case of a user
invoking the command even if not connect to a remote target.
gdb/ChangeLog:
2018-05-22 Pedro Alves <palves@redhat.com>
* remote.c (compare_section_command): Remove set_general_process
call.
Pedro Alves [Tue, 22 May 2018 17:22:08 +0000 (18:22 +0100)]
remote: remote_arch_state pointers -> remote_arch_state objects
The previous patch made the map store pointers to remote_arch_state
instead of objects directly, simply because struct remote_arch_state
is still incomplete where struct remote_state is declared. This patch
thus moves the remote_arch_state declaration higher up in the file,
and makes the map store remote_arch_state objects directly instead of
pointers to objects.
gdb/ChangeLog:
2018-05-22 Pedro Alves <palves@redhat.com>
* remote.c (struct packet_reg, struct remote_arch_state):
Move higher up in the file.
(remote_state) <m_arch_states>: Store remote_arch_state values
instead of remote_arch_state pointers.
(remote_state::get_remote_arch_state): Adjust.
Pedro Alves [Tue, 22 May 2018 17:22:08 +0000 (18:22 +0100)]
remote: multiple remote_arch_state instances per arch
Currently, we associate gdbarch-related remote protocol state on a
per-gdbarch data object. Things like the size of the g/G packet, and
the max remote packet size. If we'll support being connected to
different remote servers at the same time, then we need to cope with
each having their own packet sizes, even if they are each debugging
programs of the same architecture. I.e., a single instance of
remote_arch_state per arch is not sufficient.
This patch moves the remote_arch_state object to a map of
gdbarch-to-remote_arch_state saved in the remote_state structure.
Usually there will only be one entry in the map, though we may see
more with stubs that support multi-process and/or archs with multiple
ABIs (e.g, one remote_arch_state for 64-bit inferiors and another for
32-bit inferiors).
gdb/ChangeLog:
2018-05-22 Pedro Alves <palves@redhat.com>
* remote.c: Include <unordered_map>.
(remote_state): Now a class.
(remote_state) <get_remote_arch_state>: Declare method.
<get_remote_arch_state>: New field.
(remote_arch_state) <remote_arch_state>: Declare ctor.
<regs>: Now a unique_ptr.
(remote_gdbarch_data_handle): Delete.
(get_remote_arch_state): Delete.
(remote_state::get_remote_arch_state): New.
(get_remote_state): Adjust to call remote_state's
get_remote_arch_state method.
(init_remote_state): Delete, bits factored out to ...
(remote_arch_state::remote_arch_state): ... this new method.
(get_remote_packet_size, get_memory_packet_size)
(process_g_packet, remote_target::fetch_registers)
(remote_target::prepare_to_store, store_registers_using_G)
(remote_target::store_registers, remote_target::get_trace_status):
Adjust to call remote_state's method.
(_initialize_remote): Remove reference to
remote_gdbarch_data_handle.
Pedro Alves [Tue, 22 May 2018 17:22:07 +0000 (18:22 +0100)]
remote: Make readahead_cache a C++ class
The idea here is eliminate the get_remote_state calls from within
readahead_cache_invalidate, readahead_cache_invalidate_fd,
remote_hostio_pread_from_cache by making those functions be class
methods instead. Later on we'll have one readahead_cache instance per
remote connection, and this change makes that easier.
gdb/ChangeLog:
2018-05-22 Pedro Alves <palves@redhat.com>
* remote.c (struct readahead_cache) <invalidate, invalidate_fd,
pread>: New method declarations.
(remote_target::open_1): Adjust.
(readahead_cache_invalidate): Rename to ...
(readahead_cache::invalidate): ... this, and adjust to be a class
method.
(readahead_cache_invalidate_fd): Rename to ...
(readahead_cache::invalidate_fd): ... this, and adjust to be a
class method.
(remote_hostio_pwrite): Adjust.
(remote_hostio_pread_from_cache): Rename to ...
(readahead_cache::pread): ... this, and adjust to be a class
method.
(remote_hostio_close): Adjust.
Pedro Alves [Tue, 22 May 2018 17:22:07 +0000 (18:22 +0100)]
remote: Eliminate remote_hostio_close_cleanup
gdb/ChangeLog:
2018-05-22 Pedro Alves <palves@redhat.com>
* remote.c (remote_hostio_close_cleanup): Delete.
(class scoped_remote_fd): New.
(remote_file_put, remote_file_get): Use it.
Pedro Alves [Tue, 22 May 2018 17:22:06 +0000 (18:22 +0100)]
remote: struct remote_state, use op new, fix leaks
A bit of C++ification. Also plugs a few leaks, since currently
nothing is freeing a few fields of remote_state. They're now freed in
the added destructor.
gdb/ChangeLog:
2018-05-22 Pedro Alves <palves@redhat.com>
(struct vCont_action_support): Use bool and initialize all fields.
(struct readahead_cache): Initialize all fields.
(remote_state): Use bool and initialize all fields.
(remote_state::remote_state, remote_state::~remote_state): New.
(new_remote_state): Delete.
(_initialize_remote): Use new to allocate remote_state.
Pedro Alves [Tue, 22 May 2018 16:35:38 +0000 (17:35 +0100)]
Support UTF-8 identifiers in C/C++ expressions (PR gdb/22973)
Factor out cp_ident_is_alpha/cp_ident_is_alnum out of
gdb/cp-name-parser.y and use it in the C/C++ expression parser too.
New test included.
gdb/ChangeLog:
2018-05-22 Pedro Alves <palves@redhat.com>
張俊芝 <zjz@zjz.name>
PR gdb/22973
* c-exp.y: Include "c-support.h".
(parse_number, c_parse_escape, lex_one_token): Use TOLOWER instead
of tolower. Use c_ident_is_alpha to scan names.
* c-lang.c: Include "c-support.h".
(convert_ucn, convert_octal, convert_hex, convert_escape): Use
ISXDIGIT instead of isxdigit and ISDIGIT instead of isdigit.
* c-support.h: New file, with bits factored out from ...
* cp-name-parser.y: ... this file.
Include "c-support.h".
(cp_ident_is_alpha, cp_ident_is_alnum): Deleted, moved to
c-support.h and renamed.
(symbol_end, yylex): Adjust.
gdb/testsuite/ChangeLog:
2018-05-22 Pedro Alves <palves@redhat.com>
PR gdb/22973
* gdb.base/utf8-identifiers.c: New file.
* gdb.base/utf8-identifiers.exp: New file.
Pedro Franco de Carvalho [Tue, 22 May 2018 14:09:06 +0000 (11:09 -0300)]
[PowerPC] Recognize isa205 in linux core files
Currently the ppc linux core file target doesn't return target
descriptions with the lager FPSCR introduced in isa205.
This patch changes the core file target so that the auxv is read from
the core file to determine the size of FPSCR, so that the appropriate
target description is selected.
gdb/ChangeLog:
2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* arch/ppc-linux-common.c (ppc_linux_has_isa205): Change the
parameter type to CORE_ADDR.
* arch/ppc-linux-common.h (ppc_linux_has_isa205): Change the
parameter type in declaration to CORE_ADDR.
* ppc-linux-tdep.c (ppc_linux_core_read_description): Call
target_auxv_search to get AT_HWCAP and use the result to get the
target description.
* ppc-linux-nat.c (ppc_linux_get_hwcap): Change the return type
to CORE_ADDR. Remove the cast of the return value to unsigned
long. Fix error predicate of target_auxv_search.
(ppc_linux_nat_target::read_description): Change the type of the
hwcap variable to CORE_ADDR.
gdb/testsuite/ChangeLog:
2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* gdb.arch/powerpc-fpscr-gcore.exp: New file.
Pedro Franco de Carvalho [Tue, 22 May 2018 14:09:05 +0000 (11:09 -0300)]
[PowerPC] Fix inclusion of dfp pseudoregs in tdep
Previously, decimal floating point pseudoregisters were always included
in the target if it had a floating point unit.
This patch changes this to only include them if the target description
indicates that they are present, i.e. if the FPSCR register has more
than 32 bits.
gdb/ChangeLog:
2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* rs6000-tdep.c (rs6000_gdbarch_init): Assign 1 to have_dfp only
if the size of fpscr is larger than 32 bits.
Pedro Franco de Carvalho [Tue, 22 May 2018 14:09:05 +0000 (11:09 -0300)]
[PowerPC] Fix VSX registers in linux core files
The functions used by the VSX regset to collect and supply registers
from core files where incorrect. This patch changes the regset to use
the standard regset collect/supply functions to fix this. The native
target is also changed to use the same regset.
gdb/ChangeLog:
2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* ppc-linux-tdep.c (ppc_linux_vsxregset): New function.
(ppc32_linux_vsxregmap): New global.
(ppc32_linux_vsxregset): Initialize with ppc32_linux_vsxregmap,
regcache_supply_regset, and regcache_collect_regset.
* ppc-linux-tdep.h (ppc_linux_vsxregset): Declare.
* ppc-linux-nat.c (supply_vsxregset, fill_vsxregset): Remove.
(fetch_vsx_register, store_vsx_register): Remove.
(fetch_vsx_registers): Add regno parameter. Get regset using
ppc_linux_vsxregset. Use regset to supply registers.
(store_vsx_registers): Add regno parameter. Get regset using
ppc_linux_vsxregset. Use regset to collect registers.
(fetch_register): Call fetch_vsx_registers instead of
fetch_vsx_register.
(store_register): Call store_vsx_registers instead of
store_vsx_register.
(fetch_ppc_registers): Call fetch_vsx_registers with -1 for the
new regno parameter.
(store_ppc_registers): Call store_vsx_registers with -1 for the
new regno parameter.
* rs6000-tdep.c (ppc_vsx_support_p, ppc_supply_vsxreget)
(ppc_collect_vsxregset): Remove.
gdb/testsuite/ChangeLog:
2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* gdb.arch/powerpc-vsx-gcore.exp: New file.
Pedro Franco de Carvalho [Tue, 22 May 2018 14:09:05 +0000 (11:09 -0300)]
[PowerPC] Fix access to VSCR in linux targets
The 4-byte VSCR register is found inside a 16-byte field in the regset
returned by ptrace and in core files. The position of VSCR depends on
the endianess of the target, which was previously assumed to be
big-endian for the purpose of getting VSCR. This patch removes this
assumption to fix access to VSCR in little-endian mode.
gdb/ChangeLog:
2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* ppc-tdep.h (struct ppc_reg_offsets): Remove vector register
offset fields.
* ppc-fbsd-tdep.c (ppc32_fbsd_reg_offsets): Remove initializers
for vector register offset fields.
(ppc64_fbsd_reg_offsets): Likewise.
* ppc-nbsd-tdep.c (_initialize_ppcnbsd_tdep): Remove assignment
to vector register offset fields.
* ppc-obsd-tdep.c (_initialize_ppcnbsd_tdep): Remove assignment
to vector register offset fields.
* ppc-obsd-nat.c (_initialize_ppcobsd_nat): Remove assignment to
vector register offset fields.
* rs6000-aix-tdep.c (rs6000_aix32_reg_offsets): Remove
initializers for vector register offset fields.
(rs6000_aix64_reg_offsets): Likewise.
* rs6000-tdep.c (ppc_vrreg_offset): Remove.
(ppc_supply_vrregset): Remove.
(ppc_collect_vrregset): Remove.
* ppc-linux-tdep.c (ppc_linux_collect_vrregset): New function.
(ppc_linux_vrregset) : New function.
(ppc32_le_linux_vrregmap, ppc32_be_linux_vrregmap)
(ppc32_le_linux_vrregset, ppc32_be_linux_vrregset): New globals.
(ppc32_linux_vrregset): Remove.
(ppc_linux_iterate_over_regset_sections): Call ppc_linux_vrregset
and use result instead of ppc32_linux_vrregset.
(ppc32_linux_reg_offsets): Remove initializers for vector register
offset fields.
(ppc64_linux_reg_offsets): Likewise.
* ppc-linux-tdep.h (ppc_linux_vrregset): New declaration.
* ppc-linux-nat.c: Include regset.h.
(gdb_vrregset_t): Adjust comment to account for little-endian
mode.
(supply_vrregset, fill_vrregset): Remove.
(fetch_altivec_register, store_altivec_register): Remove.
(fetch_altivec_registers): Add regno parameter. Get regset using
ppc_linux_vrregset. Use regset to supply registers.
(store_altivec_registers): Add regno parameter. Get regset using
ppc_linux_vrregset. Use regset to collect registers.
(fetch_register): Call fetch_altivec_registers instead of
fetch_altivec_register.
(store_register): Call store_altivec_registers instead of
store_altivec_register.
(fetch_ppc_registers): Call fetch_altivec_registers with -1 for
the new regno parameter.
(store_ppc_registers): Call store_altivec_registers with -1 for
the new regno parameter.
gdb/gdbserver/ChangeLog:
2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* linux-ppc-low.c (ppc_fill_vrregset): Add vscr_offset variable.
Set vscr_offset to 0 in little-endian mode and 12 in big-endian
mode. Call collect_register_by_name with vscr using
vscr_offset. Zero-pad vscr and vrsave fields in collector buffer.
(ppc_store_vrregset): Add and set vscr_offset variable as in
ppc_fill_vrregset. Call supply_register_by_name with vscr using
vscr_offset.
Pedro Franco de Carvalho [Tue, 22 May 2018 14:09:05 +0000 (11:09 -0300)]
[PowerPC] Consolidate linux vector regset sizes
This patch defines constants for the sizes of the two vector
regsets (vector-scalar registers and regular vector registers).
The native, gdbserver and core file targets are changed to use these
constants.
The Linux ptrace calls return (or read) a smaller regset than the one
found in core files for vector registers, because ptrace uses a single
4-byte quantity for vrsave at the end of the regset, while the
core-file regset uses a full 16-byte field for vrsave. For simplicity,
the larger size is used in both cases, and so a buffer with 12 unused
additional bytes is passed to ptrace in the native target.
gdb/ChangeLog:
2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* arch/ppc-linux-common.h (PPC_LINUX_SIZEOF_VRREGSET)
(PPC_LINUX_SIZEOF_VSXREGSET): Define.
* ppc-linux-nat.c (SIZEOF_VSXREGS, SIZEOF_VRREGS): Remove.
(gdb_vrregset_t): Change array type size to
PPC_LINUX_SIZEOF_VRREGSET.
(gdb_vsxregset_t): Change array type size to
PPC_LINUX_SIZEOF_VSXREGSET.
* ppc-linux-tdep.c (ppc_linux_iterate_over_regset_sections):
Change integer literals to PPC_LINUX_SIZEOF_VRREGSET and
PPC_LINUX_SIZEOF_VSXREGSET.
gdb/gdbserver/ChangeLog:
2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* linux-ppc-low.c (SIZEOF_VSXREGS, SIZEOF_VRREGS): Remove.
(ppc_arch_setup): Change SIZEOF_VRREGS and SIZEOF_VSXREGS to
PPC_LINUX_SIZEOF_VRREGSET and PPC_LINUX_SIZEOF_VSXREGSET.
Pedro Franco de Carvalho [Tue, 22 May 2018 14:09:05 +0000 (11:09 -0300)]
[PowerPC] Disable regsets using zero sizes in gdbserver
Currently the linux-ppc-low.c fill/store functions for extended
regsets check whether they should execute by using the global hwcap
variable.
This patch explicitly sets the regset sizes to zero when needed to
disable them instead, so that the fill/store functions are not called
in the first place by regsets_fetch_inferior_registers in linux-low.c.
gdb/gdbserver/ChangeLog:
2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* linux-ppc-low.c (ppc_fill_vsxregset): Remove ppc_hwcap check.
(ppc_store_vsxregset): Likewise.
(ppc_fill_vrregset): Likewise.
(ppc_store_vrregset): Likewise.
(ppc_fill_evrregset): Likewise.
(ppc_store_evrregset): Likewise.
(ppc_regsets): Set VSX/VR/EVR regset sizes to 0.
(ppc_arch_setup): Iterate through ppc_regsets and set sizes when
needed.
Pedro Franco de Carvalho [Tue, 22 May 2018 14:09:05 +0000 (11:09 -0300)]
[PowerPC] Consolidate wordsize getter between native and gdbserver
This patch moves the native target wordsize getter for ppc linux to
nat/ so that it can be used to simplify ppc_arch_setup in
gdbserver. The ptrace call used to get MSR for this is ultimately the
same as before, but it is no longer necessary to create a temporary
regcache to call fetch_inferior_registers.
gdb/ChangeLog:
2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* configure.nat <linux powerpc>: Add ppc-linux.o to NATDEPFILES.
* ppc-linux-nat.c (ppc_linux_target_wordsize): Move to
nat/ppc-linux.c.
(ppc_linux_nat_target::auxv_parse): Get thread id tid. Call
ppc_linux_target_wordsize with tid.
(ppc_linux_nat_target::read_description): Call ppc_linux_target
wordsize with tid.
* nat/ppc-linux.c: Include nat/gdb_ptrace.h.
(ppc64_64bit_inferior_p): Add static and inline specifiers.
(ppc_linux_target_wordsize): Move here from ppc-linux-nat.c. Add
tid parameter. Remove static specifier.
* nat/ppc-linux.h (ppc64_64bit_inferior_p): Remove declaration.
(ppc_linux_target_wordsize): New declaration.
gdb/gdbserver/ChangeLog:
2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* linux-ppc-low.c (ppc_arch_setup): Remove code for getting the
wordsize of the inferior. Call ppc_linux_target_wordsize.
Pedro Franco de Carvalho [Tue, 22 May 2018 14:09:05 +0000 (11:09 -0300)]
[PowerPC] Consolidate linux target description selection
Share target description declarations and selection among ppc linux
native targets, core files, gdbserver and IPA.
To avoid complicated define guards, gdbserver and IPA now have
declarations for all descriptions, including 64-bit generated
descriptions when compiled in 32-bit mode. These have always been
linked into the gdbserver and IPA binaries. Because they might be
uninitialized, the selection function checks that the selected
description is initialized.
gdb/ChangeLog:
2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* arch/ppc-linux-common.c: New file.
* arch/ppc-linux-common.h: New file.
* arch/ppc-linux-tdesc.h: New file.
* configure.tgt (powerpc*-*-linux*): Add arch/ppc-linux-common.o.
* Makefile.in (ALL_TARGET_OBS): Add arch/ppc-linux-common.o.
(HFILES_NO_SRCDIR): Add arch/ppc-linux-common.h and
arch/ppc-linux-tdesc.h.
* ppc-linux-nat.c: Include arch/ppc-linux-common.h and
arch/ppc-linux-tdesc.h.
(ppc_linux_nat_target::read_description): Remove target
description matching code. Fill a ppc_linux_features struct and
call ppc_linux_match_description with it. Move comment about ISA
2.05 to ppc-linux-common.c.
* ppc-linux-tdep.c: Include arch/ppc-linux-common.h and
arch/ppc-linux-tdesc.h.
(ppc_linux_core_read_description): Remove target description
matching code. Fill a ppc_linux_features struct and call
ppc_linux_match_description with it.
* ppc-linux-tdep.h (tdesc_powerpc_32l, tdesc_powerpc_64l)
(tdesc_powerpc_altivec32l, tdesc_powerpc_altivec64l)
(tdesc_powerpc_cell32l, tdesc_powerpc_cell64l)
(tdesc_powerpc_vsx32l, tdesc_powerpc_vsx64l)
(tdesc_powerpc_isa205_32l, tdesc_powerpc_isa205_64l)
(tdesc_powerpc_isa205_altivec32l, tdesc_powerpc_isa205_altivec64l)
(tdesc_powerpc_isa205_vsx32l, tdesc_powerpc_isa205_vsx64l)
(tdesc_powerpc_e500l): Remove.
gdb/gdbserver/ChangeLog:
2018-05-22 Pedro Franco de Carvalho <pedromfc@linux.vnet.ibm.com>
* configure.srv (srv_tgtobj): Add arch/ppc-linux-common.o.
* Makefile.in (SFILES): Add arch/ppc-linux-common.c.
* linux-ppc-tdesc.h: Rename to linux-ppc-tdesc-init.h.
* linux-ppc-tdesc-init.h (tdesc_powerpc_32l, tdesc_powerpc_64l)
(tdesc_powerpc_altivec32l, tdesc_powerpc_altivec64l)
(tdesc_powerpc_cell32l, tdesc_powerpc_cell64l)
(tdesc_powerpc_vsx32l, tdesc_powerpc_vsx64l)
(tdesc_powerpc_isa205_32l, tdesc_powerpc_isa205_64l)
(tdesc_powerpc_isa205_altivec32l, tdesc_powerpc_isa205_altivec64l)
(tdesc_powerpc_isa205_vsx32l, tdesc_powerpc_isa205_vsx64l)
(tdesc_powerpc_e500l): Remove.
* linux-ppc-ipa.c: Include arch/ppc-linux-tdesc.h and
linux-ppc-tdesc-init.h. Don't include linux-ppc-tdesc.h.
* linux-ppc-low.c: Include arch/ppc-linux-common.h,
arch/ppc-linux-tdesc.h, and linux-ppc-tdesc-init.h. Don't include
linux-ppc-tdesc.h.
(ppc_arch_setup): Remove target description matching code. Fill a
ppc_linux_features struct and call ppc_linux_match_description
with it.
Joel Brobecker [Tue, 22 May 2018 14:04:15 +0000 (10:04 -0400)]
fix "stale cleanup" internal-warning when using "catch assert" command
Trying to insert a catchpoint on all Ada assertions now triggers
the following internal warning regardless of the situation. For
instance, not even debugging any program:
(gdb) catch assert
/[...]/gdb/common/cleanups.c:264: internal-warning:
restore_my_cleanups has found a stale cleanup
This is due to a small bug in the following C++-ification commit:
commit
bc18fbb575437dd10089ef4619e46c0b9a93097d
Author: Tom Tromey <tom@tromey.com>
Date: Fri May 18 15:58:50 2018 -0600
Subject: Change ada_catchpoint::excep_string to be a std::string
The stale cleanup in question is the following one in top.c:execute_command:
cleanup_if_error = make_bpstat_clear_actions_cleanup ();
This cleanup is expected to be discarded if there are no exception.
There were no GDB exception; however, a C++ exception was triggered,
because we passed NULL as the excep_string argument when calling
create_ada_exception_catchpoint, which is a reference to a const
string. So we get a C++ exception during the std::string constructor,
which propagates up, causing the cleanup to unexpectedly remain
in the cleanup chain.
This patch fixes the immediate issue of the incorrect call to
create_ada_exception_catchpoint.
gdb/ChangeLog:
* ada-lang.c (catch_assert_command): Pass empty string instead
of NULL for excep_string argument.
Tested on x86_64-linux, fixes the following failures:
* catch_assert_if.exp: insert catchpoint on failed assertions with condition
* catch_ex.exp: insert catchpoint on failed assertions
This also fixes about a dozen UNRESOLVED tests that are a consequence
of the two tests above failing and crashing GDB.
Alan Modra [Tue, 22 May 2018 09:04:18 +0000 (18:34 +0930)]
PR23207, hppa ld SIGSEGVs on invalid object files
The last patch was enough to cure the testcase, but not the original
object file. This patch does the same for hppa as is done for ppc64,
simply test for the section belonging to a group. I've also
restricted stubs to load, alloc, code sections.
PR 23207
* elf32-hppa.c (hppa_get_stub_entry): Return NULL when link_sec
is NULL.
(elf32_hppa_size_stubs): Only create stubs for load, alloc, code
sections.
(final_link_relocate): Revert last change.
Alan Modra [Mon, 21 May 2018 11:59:25 +0000 (21:29 +0930)]
PR23207, hppa ld SIGSEGVs on invalid object files
We don't create PLT call stubs for anything in non-alloc sections,
so it doesn't pay to go looking for them. The problem is that
non-alloc sections aren't processed by group_sections and thus don't
get a link_sec set up for them.
PR 23207
* elf32-hppa.c (final_link_relocate): Don't look for plt call
stubs in non-alloc sections.
H.J. Lu [Tue, 22 May 2018 03:41:11 +0000 (20:41 -0700)]
ld: Adjust tic6x tests
Adjust tic6x tests for removing local symbol, __c6xabi_DSBT_BASE, defined
by PROVIDE_HIDDEN in linker script from dynamic symbol table.
PR ld/23201
* testsuite/ld-tic6x/shlib-1.rd: Adjusted.
* testsuite/ld-tic6x/shlib-1b.rd: Likewise.
* testsuite/ld-tic6x/shlib-1r.rd: Likewise.
* testsuite/ld-tic6x/shlib-1rb.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1b.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1r.rd: Likewise.
* testsuite/ld-tic6x/shlib-app-1rb.rd: Likewise.
* testsuite/ld-tic6x/shlib-noindex.rd: Likewise.
* testsuite/ld-tic6x/static-app-1.rd: Likewise.
* testsuite/ld-tic6x/static-app-1b.rd: Likewise.
* testsuite/ld-tic6x/static-app-1r.rd: Likewise.
* testsuite/ld-tic6x/static-app-1rb.rd: Likewise.
H.J. Lu [Tue, 22 May 2018 03:39:09 +0000 (20:39 -0700)]
ld: Hide symbols defined by HIDDEN/PROVIDE_HIDDEN
There should be no difference in output for symbols defined by HIDDEN
or PROVIDE_HIDDEN assignments whether they are explicitly marked as
hidden or not. This patch adds a new BFD function, bfd_link_hide_symbol,
to hide symbols defined by HIDDEN and PROVIDE_HIDDEN assignments.
bfd
PR ld/23201
* aout-target.h (MY_bfd_link_hide_symbol): New.
* aout-tic30.c (MY_bfd_link_hide_symbol): Likewise.
* binary.c (binary_bfd_link_hide_symbol): Likewise.
* coff-alpha.c (_bfd_ecoff_bfd_link_hide_symbol): Likewise.
* coff-mips.c (_bfd_ecoff_bfd_link_hide_symbol): Likewise.
* coff-rs6000.c (_bfd_xcoff_bfd_link_hide_symbol): Likewise.
* coffcode.h (coff_bfd_link_hide_symbol): Likewise.
* elf-bfd.h (_bfd_elf_link_hide_symbol): Likewise.
* elfxx-target.h (bfd_elfNN_bfd_link_hide_symbol): Likewise.
* i386msdos.c (msdos_bfd_link_hide_symbol): Likewise.
* ihex.c (ihex_bfd_link_hide_symbol): Likewise.
* libbfd-in.h (_bfd_nolink_bfd_link_hide_symbol): Likewise.
* linker.c (_bfd_generic_link_hide_symbol): Likewise.
(bfd_link_hide_symbol): Likewise.
* mach-o-target.c (bfd_mach_o_bfd_link_hide_symbol): Likewise.
* mmo.c (mmo_bfd_link_hide_symbol): Likewise.
* pef.c (bfd_pef_bfd_link_hide_symbol): Likewise.
* plugin.c (bfd_plugin_bfd_link_hide_symbol): Likewise.
* ppcboot.c (ppcboot_bfd_link_hide_symbol): Likewise.
* som.c (som_bfd_link_hide_symbol): Likewise.
* srec.c (srec_bfd_link_hide_symbol): Likewise.
* tekhex.c (tekhex_bfd_link_hide_symbol): Likewise.
* vms-alpha.c (vms_bfd_link_hide_symbol): Likewise.
(alpha_vms_bfd_link_hide_symbol): Likewise.
* xsym.c (bfd_sym_bfd_link_hide_symbol): Likewise.
* coff64-rs6000.c (rs6000_xcoff64_vec): Add
_bfd_generic_link_hide_symbol.
(rs6000_xcoff64_aix_vec): Likewise.
* elflink.c (bfd_elf_record_link_assignment): Don't make forced
local symbol dynamic.
(_bfd_elf_link_hide_symbol): New function.
* elfxx-x86.c (_bfd_x86_elf_link_symbol_references_local): Don't
check root.ldscript_def.
* targets.c (bfd_target): Add _bfd_link_hide_symbol.
(BFD_JUMP_TABLE_LINK): Add NAME##_bfd_link_hide_symbol.
* bfd-in2.h: Regenerated.
* libbfd.h: Likewise.
ld/
PR ld/23201
* ldexp.c (exp_fold_tree_1): Call bfd_link_hide_symbol to hide
a symbol.
* testsuite/ld-elf/provide-hidden-dynabs.nd: Removed.
* testsuite/ld-elf/provide-hidden-dynsec.nd: Likewise.
* testsuite/ld-elf/provide-hidden.exp: Replace
provide-hidden-dynsec.nd with provide-hidden-sec.nd and
provide-hidden-dyn.nd. Replace provide-hidden-dynabs.nd with
provide-hidden-abs.nd and provide-hidden-dyn.nd.
* testsuite/ld-i386/pr23189.d: Expect no dynamic relocation.
* testsuite/ld-x86-64/pr23189.d: Likewise.
H.J. Lu [Tue, 22 May 2018 02:25:19 +0000 (19:25 -0700)]
Mark section in a section group with SHF_GROUP
All sections in a section group should be marked with SHF_GROUP. But
some tools generate broken objects without SHF_GROUP. This patch fixes
them up for objcopy and strip.
PR binutils/23199
* elf.c (setup_group): Mark section in a section group with
SHF_GROUP.
Maciej W. Rozycki [Tue, 22 May 2018 00:52:35 +0000 (01:52 +0100)]
MIPS/Linux: Disable n32 USR `ptrace' accesses to 64-bit registers
On the MIPS target DSP ASE registers can only be accessed with the
PTRACE_PEEKUSR and PTRACE_POKEUSR `ptrace' requests. With the n32 ABI
these requests only pass 32-bit data quantities, which are narrower than
the width of DSP accumulator registers, which are 64-bit.
Generic code is prepared to transfer registers wider than the `ptrace'
data type by offsetting into the USR address space, by the data width
transferred. That however does not work with the MIPS target, because
of how the API has been defined, where USR register addresses are
actually indices rather than offsets. Consequently given address `a'
using `a + 4' accesses the fourth next register rather than the upper
half of the original register.
With native debugging this causes clobbered register contents, as well
as access failures as locations beyond the available USR space are
addressed:
(gdb) info registers
zero at v0 v1
R0
0000000000000000 0000000000000001 0000000000000001 0000000000000000
a0 a1 a2 a3
R4
0000000010019158 0000000000000000 0000000000000011 0000000010019160
a4 a5 a6 a7
R8
0000000010019160 fffffffffff00000 fffffffffffffff8 0000000000000000
t0 t1 t2 t3
R12
0000000010019150 0000000000000001 0000000000000001 000000000000000f
s0 s1 s2 s3
R16
0000000077ee6f20 0000000010007bb0 0000000000000000 0000000000000000
s4 s5 s6 s7
R20
000000000052e668 000000000052f008 0000000000000000 0000000000000000
t8 t9 k0 k1
R24
0000000000000001 0000000010019010 0000000000000000 0000000000000000
gp sp s8 ra
R28
0000000010020280 000000007fff4c10 000000007fff4c10 0000000010004f48
status lo hi badvaddr
0000000000109cf3 0000000000943efe 000000000000000e 000000001001900c
cause pc
0000000000800024 0000000010004f48
fcsr fir hi1 lo1
0e800000 00f30000 0000000004040404 0101010105050505
hi2 lo2 hi3 lo3
0202020255aa33cc Couldn't read register (#75): Input/output error.
(gdb)
With `gdbserver' this makes debugging impossible due to a fatal failure:
(gdb) target remote :2346
Remote debugging using :2346
Reading symbols from .../sysroot/mips-r2-hard/lib32/ld.so.1...done.
0x77fc3d50 in __start () from .../sysroot/mips-r2-hard/lib32/ld.so.1
(gdb) continue
Continuing.
warning: Remote failure reply: E01
Remote communication error. Target disconnected.: Connection reset by peer.
(gdb)
Correct the problem by marking any register in the MIPS backend whose
width exceeds the width of the `ptrace' data type unavailable for the
purpose of PTRACE_PEEKUSR and PTRACE_POKEUSR requests:
(gdb) info registers
zero at v0 v1
R0
0000000000000000 0000000000000001 0000000000000001 0000000000000000
a0 a1 a2 a3
R4
0000000010019158 0000000000000000 0000000000000011 0000000010019160
a4 a5 a6 a7
R8
0000000010019160 fffffffffff00000 fffffffffffffff8 0000000000000000
t0 t1 t2 t3
R12
0000000010019150 0000000000000001 0000000000000001 000000000000000f
s0 s1 s2 s3
R16
0000000077ee6f20 0000000010007bb0 0000000000000000 0000000000000000
s4 s5 s6 s7
R20
000000000052e5c8 000000000052f008 0000000000000000 0000000000000000
t8 t9 k0 k1
R24
0000000000000001 0000000010019010 0000000000000000 0000000000000000
gp sp s8 ra
R28
0000000010020280 000000007fff4be0 000000007fff4be0 0000000010004f48
status lo hi badvaddr
0000000000109cf3 0000000000943efe 000000000000000e 000000001001900c
cause pc
0000000000800024 0000000010004f48
fcsr fir hi1 lo1
0e800000 00f30000 <unavailable> <unavailable>
hi2 lo2 hi3 lo3
<unavailable> <unavailable> <unavailable> <unavailable>
dspctl restart
55aa33cc 0000000000000000
(gdb)
as there is no way to access full contents of these registers with the
limited API available anyway.
This obviously does not affect general-purpose registers (which use the
PTRACE_GETREGS and PTRACE_SETREGS requests for access) or floating-point
general registers (which use PTRACE_GETFPREGS and PTRACE_SETFPREGS).
And $dspctl, being 32-bit, remains accessible too, which is important
for BPOSGE32 branch decoding in single-stepping.
For DSP accumulator access with the n32 ABI a new `ptrace' API is required
on the kernel side.
gdb/
* mips-linux-nat.c (mips64_linux_register_addr): Return -1 if
the width of the requested register exceeds the width of the
`ptrace' data type.
gdb/gdbserver/
* linux-mips-low.c (mips_cannot_fetch_register): Return 1 if the
width of the requested register exceeds the width of the
`ptrace' data type.
(mips_cannot_store_register): Likewise.
GDB Administrator [Tue, 22 May 2018 00:00:37 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Mon, 21 May 2018 23:55:08 +0000 (00:55 +0100)]
MIPS/gdbserver: Fix issues with $zero register reads
Consistently supply hardwired $zero as a zeroed register, correcting
issues with the PTRACE_GETREGS path that currently copies the value of
$restart into $zero as illustrated by this program:
$ cat read.c
int
main (void)
{
char buf[1024];
ssize_t size;
size = read (0, buf, sizeof (buf));
return size;
}
$
and this corresponding debug session:
(gdb) break main
Breakpoint 1 at 0x120000970: file read.c, line 9.
(gdb) target remote :2346
Remote debugging using :2346
Reading symbols from .../sysroot/mips-r2-hard/lib64/ld.so.1...done.
0x000000fff7fca5a0 in __start ()
from .../sysroot/mips-r2-hard/lib64/ld.so.1
(gdb) continue
Continuing.
Breakpoint 1, main () at read.c:9
9 size = read (0, buf, sizeof (buf));
(gdb) info registers
zero at v0 v1
R0
0000000000000000 0000000000000001 000000fff7ffe710 0000000000000000
a0 a1 a2 a3
R4
0000000000000001 000000ffffffeb88 000000ffffffeb98 0000000000000000
a4 a5 a6 a7
R8
000000fff7fc8800 000000fff7fc38f0 000000ffffffeb80 2f2f2f2f2f2f2f2f
t0 t1 t2 t3
R12
0000000000000437 0000000000000002 000000fff7ffd000 0000000120000a00
s0 s1 s2 s3
R16
000000fff7fc7068 0000000120000b90 0000000000000000 0000000000000000
s4 s5 s6 s7
R20
0000000000521d88 0000000000522608 0000000000000000 0000000000000000
t8 t9 k0 k1
R24
0000000000000000 0000000120000970 0000000000000000 0000000000000000
gp sp s8 ra
R28
000000fff7fc8800 000000ffffffea50 0000000000000000 000000fff7e4088c
status lo hi badvaddr
0000000000109cf3 0000000000005ea5 0000000000000211 000000fff7eadf00
cause pc
0000000000800024 0000000120000970
fcsr fir restart
00000000 00f30000 0000000000000000
(gdb) continue
Continuing.
^C
Program received signal SIGINT, Interrupt.
0x000000fff7f084ac in __GI___libc_read (fd=0, buf=0xffffffe640, nbytes=1024)
at ../sysdeps/unix/sysv/linux/read.c:27
27 return SYSCALL_CANCEL (read, fd, buf, nbytes);
(gdb) info registers
zero at v0 v1
R0
0000000000001388 0000000000000001 0000000000000200 000000fff7ffe710
a0 a1 a2 a3
R4
0000000000000000 000000ffffffe640 0000000000000400 0000000000000001
a4 a5 a6 a7
R8
000000fff7fc8800 000000fff7fc38f0 000000ffffffeb80 2f2f2f2f2f2f2f2f
t0 t1 t2 t3
R12
00000000000005e3 0000000000000002 000000fff7ffd000 000000012000099c
s0 s1 s2 s3
R16
000000fff7fc7068 0000000120000b90 0000000000000000 0000000000000000
s4 s5 s6 s7
R20
0000000000521d88 0000000000522608 0000000000000000 0000000000000000
t8 t9 k0 k1
R24
0000000000000000 000000fff7f2da20 0000000000000000 0000000000000000
gp sp s8 ra
R28
000000fff7fc8800 000000ffffffe600 0000000000000000 000000012000099c
status lo hi badvaddr
0000000000109cf3 00000000000001e6 00000000000000be 000000fff7f08470
cause pc
0000000000800020 000000fff7f084ac
fcsr fir restart
00000000 00f30000 0000000000001388
(gdb)
and with the PTRACE_PEEKUSR path that does not supply this register at
all, causing issues analogous to ones addressed for the native MIPS
backend with commit
4e6ff0e1b86f ("MIPS/Linux/native: Supply $zero for
the !PTRACE_GETREGS case"):
(gdb) info registers
zero at v0 v1
R0 <unavailable>
0000000000000001 0000000000000001 0000000000000000
a0 a1 a2 a3
R4
00000001200212b0 0000000000000000 0000000000000021 000000012001a260
a4 a5 a6 a7
R8
000000012001a260 0000000000000004 800000010cab1680 fffffffffffffff8
t0 t1 t2 t3
R12
0000000000000000 000000fff7edab68 0000000000000001 0000000000000000
s0 s1 s2 s3
R16
000000fff7ee2068 0000000120008b80 0000000000000000 0000000000000000
s4 s5 s6 s7
R20
000000000052e5c8 000000000052f008 0000000000000000 0000000000000000
t8 t9 k0 k1
R24
0000000000000000 00000001200027c0 0000000000000000 0000000000000000
gp sp s8 ra
R28
00000001200212b0 000000ffffffc880 000000ffffffc880 0000000120005ee8
status lo hi badvaddr
<unavailable>
0000000000943efe 000000000000000e 000000012001a008
cause pc
0000000000800024 0000000120005ee8
fcsr fir restart
0e800000 00f30000 0000000000000000
(gdb)
and (under certain circumstances):
(gdb) next
Register 0 is not available
(gdb)
The problem with PTRACE_GETREGS happens because `mips_store_gregset'
supplies the contents of register slot #0, occupied by $restart, to
$zero. The problem with PTRACE_PEEKUSR happens because for $zero
`mips_cannot_fetch_register' returns one, and no alternative way to
supply that register has been defined.
Correct `mips_store_gregset' then for the PTRACE_GETREGS case and add
`mips_fetch_register' for the PTRACE_PEEKUSR case.
gdb/gdbserver/
* linux-mips-low.c (mips_fetch_register): New function. Update
preceding comment.
(mips_store_gregset): Supply 0 rather than $restart for $zero.
(the_low_target): Wire `mips_fetch_register'.
Peter Bergner [Mon, 21 May 2018 22:31:07 +0000 (17:31 -0500)]
Remove fake operand handling for extended mnemonics.
opcodes/
* ppc-opc.c (insert_bat, extract_bat, insert_bba, extract_bba,
insert_rbs, extract_rbs, insert_xb6s, extract_xb6s): Delete functions.
(insert_bab, extract_bab, insert_btab, extract_btab,
insert_rsb, extract_rsb, insert_xab6, extract_xab6): New functions.
(BAT, BBA VBA RBS XB6S): Delete macros.
(BTAB, BAB, VAB, RAB, RSB, XAB6): New macros.
(BB, BD, RBX, XC6): Update for new macros.
(powerpc_opcodes) <evmr, evnot, vmr, vnot, crnot, crclr, crset,
crmove, not, not., mr, mr., xxspltd, xxswapd, xvmovsp, xvmovdp,
e_crnot, e_crclr, e_crset, e_crmove>: Likewise.
* ppc-dis.c (print_insn_powerpc): Delete handling of fake operands.
include/
* opcode/ppc.h (PPC_OPERAND_FAKE): Delete macro.
gas/
* config/tc-ppc.c (md_assemble): Delete handling of fake operands.
* testsuite/gas/ppc/common.s (crmove, cror, or., or, nor., nor): Add
test of extended mnemonics.
* testsuite/gas/ppc/common.d: Likewise. Don't match instruction offset.
* testsuite/gas/ppc/spe.s (evor, evnor): Add test of extended mnemonics.
* testsuite/gas/ppc/spe.d: Likewise. Don't match instruction offset.
Tom Tromey [Mon, 21 May 2018 19:28:16 +0000 (13:28 -0600)]
Remove output_command_const
I happened to notice that output_command_const still exists, but is
not needed any more -- commands are always const-correct now. This
patch removes this leftover.
2018-05-21 Tom Tromey <tom@tromey.com>
* printcmd.c (output_command): Remove.
(output_command_const): Rename to output_command.
* valprint.h (output_command): Rename from output_command_const.
* tracepoint.c (trace_dump_actions): Call output_command.
Tom Tromey [Fri, 18 May 2018 21:58:50 +0000 (15:58 -0600)]
Change ada_catchpoint::excep_string to be a std::string
This changes ada_catchpoint::excep_string to be a std::string and then
fixes up all t he users.
This found a memory leak in catch_ada_exception_command_split, where
"cond" was copied but never freed.
I changed the type of the "cond_string" argument to
catch_ada_exception_command_split to follow the rule that out
parameters should be pointers and not references.
This patch enables the removal of some cleanups and also the function
ada_get_next_arg.
ChangeLog
2018-05-21 Tom Tromey <tom@tromey.com>
* mi/mi-cmd-catch.c (mi_cmd_catch_assert)
(mi_cmd_catch_exception, mi_cmd_catch_handlers): Update.
* ada-lang.h (create_ada_exception_catchpoint): Update.
* ada-lang.c (struct ada_catchpoint) <excep_string>: Now a
std::string.
(create_excep_cond_exprs, ~ada_catchpoint)
(should_stop_exception, print_one_exception)
(print_mention_exception, print_recreate_exception): Update.
(ada_get_next_arg): Remove.
(catch_ada_exception_command_split): Use std::string. Change type
of "excep_string", "cond_string".
(catch_ada_exception_command): Update.
(create_ada_exception_catchpoint): Change type of excep_string.
(ada_exception_sal): Remove excep_string parameter.
(~ada_catchpoint): Remove.
Tom Tromey [Fri, 18 May 2018 21:42:27 +0000 (15:42 -0600)]
Remove cleanup from ada_collect_symbol_completion_matches
ada_collect_symbol_completion_matches installs a null_cleanup but not
any other cleanups. This patch removes it.
ChangeLog
2018-05-21 Tom Tromey <tom@tromey.com>
* ada-lang.c (ada_collect_symbol_completion_matches): Remove
cleanup.
Tom Tromey [Fri, 18 May 2018 21:41:33 +0000 (15:41 -0600)]
Remove cleanup from ada-lang.c
This removes a cleanup from ada-lang.c by having
ada_exception_message_1 return a unique_xmalloc_ptr.
ChangeLog
2018-05-21 Tom Tromey <tom@tromey.com>
* ada-lang.c (ada_exception_message_1, ada_exception_message):
Return unique_xmalloc_ptr.
(print_it_exception): Update.
Tom Tromey [Fri, 18 May 2018 20:23:27 +0000 (14:23 -0600)]
Remove a cleanup from trace_dump_actions
This changes trace_dump_actions to use std::string, removing a
cleanup.
Tested by the buildbot.
ChangeLog
2018-05-21 Tom Tromey <tom@tromey.com>
* tracepoint.c (trace_dump_actions): Use std::string.
Tom Tromey [Fri, 18 May 2018 20:30:25 +0000 (14:30 -0600)]
Use std::string in reread_symbols
This removes a cleanup from reread_symbols by using std::string. This
fixes a memory leak, because this cleanup is ordinarily discarded, not
run.
Tested by the buildbot.
ChangeLog
2018-05-21 Tom Tromey <tom@tromey.com>
* symfile.c (reread_symbols): Use std::string for original_name.
Tom Tromey [Fri, 18 May 2018 20:07:57 +0000 (14:07 -0600)]
Use std::unique_ptr in dwarf2_read_debug_names
This changes dwarf2_read_debug_names to use std::unique_ptr from the
outset. This simplifies the code that installs the resulting map into
dwarf2_per_objfile.
Tested by the buildbot.
ChangeLog
2018-05-21 Tom Tromey <tom@tromey.com>
* dwarf2read.c (dwarf2_read_debug_names): Use std::unique_ptr.
(mapped_index_base): Use DISABLE_COPY_AND_ASSIGN. Default
constructor.
Simon Marchi [Mon, 21 May 2018 03:18:29 +0000 (23:18 -0400)]
Fix copy-pasto, allocate objfile_per_bfd_storage with obstack_new
I realized after pushing that I made a copy-pasto, I had:
# define HAVE_IS_TRIVIALLY_COPYABLE 1
instead of
# define HAVE_IS_TRIVIALLY_CONSTRUCTIBLE 1
with the consequence that IsMallocable was always std::true_type (and
was therefore not enforcing anything). Fixing that mistake triggered a
build failure:
/home/simark/src/binutils-gdb/gdb/objfiles.c:150:12: required from here
/home/simark/src/binutils-gdb/gdb/common/poison.h:228:3: error: static assertion failed: Trying to use XOBNEW with a non-POD data type.
I am not sure why I did not see this when I originally wrote the patch
(but I saw and fixed other failures). In any case, I swapped XOBNEW
with obstack_new to get rid of it.
Regtested on the buildbot.
gdb/ChangeLog:
* common/traits.h (HAVE_IS_TRIVIALLY_COPYABLE): Rename the wrong
instance to...
(HAVE_IS_TRIVIALLY_CONSTRUCTIBLE): ... this.
* objfiles.c (get_objfile_bfd_data): Allocate
objfile_per_bfd_storage with obstack_new when allocating on
obstack.
Simon Marchi [Mon, 21 May 2018 01:07:03 +0000 (21:07 -0400)]
Use XOBNEW/XOBNEWVEC/OBSTACK_ZALLOC when possible
Since XOBNEW/XOBNEWVEC/OBSTACK_ZALLOC are now poisoned to prevent using
them with non-trivially-constructible objects, it is worth using them
over plain obstack_alloc. This patch changes the locations I could find
where we can do that change easily.
gdb/ChangeLog:
* ada-lang.c (cache_symbol): Use XOBNEW and/or XOBNEWVEC and/or
OBSTACK_ZALLOC.
* dwarf2-frame.c (dwarf2_build_frame_info): Likewise.
* hppa-tdep.c (hppa_init_objfile_priv_data): Likewise.
* mdebugread.c (mdebug_build_psymtabs): Likewise.
(add_pending): Likewise.
(parse_symbol): Likewise.
(parse_partial_symbols): Likewise.
(psymtab_to_symtab_1): Likewise.
(new_psymtab): Likewise.
(elfmdebug_build_psymtabs): Likewise.
* minsyms.c (terminate_minimal_symbol_table): Likewise.
* objfiles.c (get_objfile_bfd_data): Likewise.
(objfile_register_static_link): Likewise.
* psymtab.c (allocate_psymtab): Likewise.
* stabsread.c (read_member_functions): Likewise.
* xcoffread.c (xcoff_end_psymtab): Likewise.
Simon Marchi [Mon, 21 May 2018 01:06:03 +0000 (21:06 -0400)]
Introduce obstack_new, poison other "typed" obstack functions
Since we use obstacks with objects that are not default constructible,
we sometimes need to manually call the constructor by hand using
placement new:
foo *f = obstack_alloc (obstack, sizeof (foo));
f = new (f) foo;
It's possible to use allocate_on_obstack instead, but there are types
that we sometimes want to allocate on an obstack, and sometimes on the
regular heap. This patch introduces a utility to make this pattern
simpler if allocate_on_obstack is not an option:
foo *f = obstack_new<foo> (obstack);
Right now there's only one usage (in tdesc_data_init).
To help catch places where we would forget to call new when allocating
such an object on an obstack, this patch also poisons some other methods
of allocating an instance of a type on an obstack:
- OBSTACK_ZALLOC/OBSTACK_CALLOC
- XOBNEW/XOBNEW
- GDBARCH_OBSTACK_ZALLOC/GDBARCH_OBSTACK_CALLOC
Unfortunately, there's no way to catch wrong usages of obstack_alloc.
By pulling on that string though, it tripped on allocating struct
template_symbol using OBSTACK_ZALLOC. The criterion currently used to
know whether it's safe to "malloc" an instance of a struct is whether it
is a POD. Because it inherits from struct symbol, template_symbol is
not a POD. This criterion is a bit too strict however, it should still
safe to allocate memory for a template_symbol and memset it to 0. We
didn't use is_trivially_constructible as the criterion in the first
place only because it is not available in gcc < 5. So here I considered
two alternatives:
1. Relax that criterion to use std::is_trivially_constructible and add a
bit more glue code to make it work with gcc < 5
2. Continue pulling on the string and change how the symbol structures
are allocated and initialized
I managed to do both, but I decided to go with #1 to keep this patch
simpler and more focused. When building with a compiler that does not
have is_trivially_constructible, the check will just not be enforced.
gdb/ChangeLog:
* common/traits.h (HAVE_IS_TRIVIALLY_COPYABLE): Define if
compiler supports std::is_trivially_constructible.
* common/poison.h: Include obstack.h.
(IsMallocable): Define to is_trivially_constructible if the
compiler supports it, define to true_type otherwise.
(xobnew): New.
(XOBNEW): Redefine.
(xobnewvec): New.
(XOBNEWVEC): Redefine.
* gdb_obstack.h (obstack_zalloc): New.
(OBSTACK_ZALLOC): Redefine.
(obstack_calloc): New.
(OBSTACK_CALLOC): Redefine.
(obstack_new): New.
* gdbarch.sh: Include gdb_obstack in gdbarch.h.
(gdbarch_obstack): New declaration in gdbarch.h, definition in
gdbarch.c.
(GDBARCH_OBSTACK_CALLOC, GDBARCH_OBSTACK_ZALLOC): Use
obstack_calloc/obstack_zalloc.
(gdbarch_obstack_zalloc): Remove.
* target-descriptions.c (tdesc_data_init): Use obstack_new.
GDB Administrator [Mon, 21 May 2018 00:00:50 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 20 May 2018 00:01:18 +0000 (00:01 +0000)]
Automatic date update in version.in
Philippe Waroquiers [Sat, 19 May 2018 06:54:44 +0000 (08:54 +0200)]
Remove useless variable int i in backtrace_command_1
value of int i was not used in the loop or after the loop.
Pushed as obvious.
Philippe Waroquiers [Sat, 19 May 2018 06:38:57 +0000 (08:38 +0200)]
Fix reference in comment: SRC_AND_LOC instead of LOC_AND_SRC
Pushed as obvious
GDB Administrator [Sat, 19 May 2018 00:00:39 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Fri, 18 May 2018 21:23:41 +0000 (14:23 -0700)]
x86: Don't set eh->local_ref to 1 for versioned symbol
bfd_hide_sym_by_version can't be used to check if a versioned symbol is
hidden. It has to be synced with _bfd_elf_link_assign_sym_version to
get the correct answer.
bfd/
PR ld/23194
* elfxx-x86.c (_bfd_x86_elf_link_symbol_references_local): Don't
set eh->local_ref to 1 if a symbol is versioned and there is a
version script.
ld/
PR ld/23194
* testsuite/ld-i386/i386.exp: Run pr23194.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-i386/pr23194.d: New file.
* testsuite/ld-i386/pr23194.map: Likewise.
* testsuite/ld-i386/pr23194.s: Likewise.
* testsuite/ld-x86-64/pr23194.d: Likewise.
* testsuite/ld-x86-64/pr23194.map: Likewise.
* testsuite/ld-x86-64/pr23194.s: Likewise.
H.J. Lu [Fri, 18 May 2018 21:13:26 +0000 (14:13 -0700)]
ld: Run pr23189 for all targets
Since the pr23189 test isn't Linux specific, run it for all targets.
* testsuite/ld-i386/i386.exp: Run pr23189 for all targets.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
Tom Tromey [Wed, 16 May 2018 20:33:15 +0000 (14:33 -0600)]
Allocate dwz_file with new
This adds a constructor to struct dwz_file and arranges for it to be
allocated with "new" and wrapped in a unique_ptr. This cuts down on
the amount of manual memory management that must be done.
Regression tested by the buildbot.
gdb/ChangeLog
2018-05-18 Tom Tromey <tom@tromey.com>
* dwarf2read.c (struct dwz_file): Add constructor, initializers.
<dwz_bfd>: Now a gdb_bfd_ref_ptr.
(~dwarf2_per_objfile): Update
(dwarf2_get_dwz_file): Use new.
* dwarf2read.h (struct dwarf2_per_objfile) <dwz_file>: Now a
unique_ptr.
Jim Wilson [Fri, 18 May 2018 21:03:18 +0000 (14:03 -0700)]
RISC-V: Add RV32E support.
Kito Cheng <kito.cheng@gmail.com>
Monk Chiang <sh.chiang04@gmail.com>
bfd/
* elfnn-riscv.c (_bfd_riscv_elf_merge_private_bfd_data): Handle
EF_RISCV_RVE.
binutils/
* readelf.c (get_machine_flags): Handle EF_RISCV_RVE.
gas/
* config/tc-riscv.c (rve_abi): New.
(riscv_set_options): Add rve field. Initialize it.
(riscv_set_rve) New function.
(riscv_set_arch): Support 'e' ISA subset.
(reg_lookup_internal): If rve, check register is available.
(riscv_set_abi): New parameter rve.
(md_parse_option): Pass new argument to riscv_set_abi.
(riscv_after_parse_args): Call riscv_set_rve. If rve_abi, set
EF_RISCV_RVE.
* doc/c-riscv.texi (-mabi): Document new ilp32e argument.
include/
* elf/riscv.h (EF_RISCV_RVE): New define.
Tom Tromey [Thu, 17 May 2018 06:04:53 +0000 (00:04 -0600)]
Allocate dwp_file with new
This adds a constructor and initializer to dwp_file and changes it to
be allocated with "new". This removes a bit of manual refcount
management.
Tested by the buildbot.
gdb/ChangeLog
2018-05-18 Tom Tromey <tom@tromey.com>
* dwarf2read.h (struct dwarf2_per_objfile) <dwp_file>: Now a
unique_ptr.
* dwarf2read.c (struct dwp_file): Add constructor and
initializers.
(open_and_init_dwp_file): Return a unique_ptr.
(dwarf2_per_objfile, create_dwp_hash_table)
(create_dwo_unit_in_dwp_v1, create_dwo_unit_in_dwp_v2)
(lookup_dwo_unit_in_dwp): Update.
(open_and_init_dwp_file, get_dwp_file): Update.
Tom Tromey [Thu, 17 May 2018 22:43:53 +0000 (16:43 -0600)]
Use new to allocate mapped_index
This changes struct mapped_index to be allocated with new. This
simplifies the creation a bit (see dwarf2_read_index) and also removes
a somewhat ugly explicit destructor call from ~dwarf2_per_objfile.
Tested by the buildbot.
gdb/ChangeLog
2018-05-18 Tom Tromey <tom@tromey.com>
* dwarf2read.c (dwarf2_per_objfile): Update.
(struct mapped_index): Add initializers.
(dwarf2_read_index): Use new.
(dw2_symtab_iter_init): Update.
* dwarf2read.h (struct dwarf2_per_objfile) <index_table>: Now a
unique_ptr.
Jim Wilson [Fri, 18 May 2018 20:05:21 +0000 (13:05 -0700)]
RISC-V: Fix ld-elf/pr22269* testcases.
bfd/
* elfnn-riscv.c (allocate_dynrelocs): Discard dynamic relocations if
UNDEFWEAK_NO_DYNAMIC_RELOC is true.
(riscv_elf_relocate_section): Don't generate dynamic relocation if
UNDEFWEAK_NO_DYNAMIC_RELOC is true.
(riscv_elf_finish_dynamic_symbol): Likewise.
Simon Marchi [Fri, 18 May 2018 20:02:44 +0000 (16:02 -0400)]
Remove mapped_index::total_size
It is unused.
gdb/ChangeLog:
* dwarf2read.c (mapped_index) <total_size>: Remove.
Simon Marchi [Fri, 18 May 2018 19:47:56 +0000 (15:47 -0400)]
format_pieces-selftests.c: Silence ARI warnings
Silence this:
unittests/format_pieces-selftests.c:51: warning: code: Do not use printf("%ll"), instead use printf("%s",phex()) to dump a `long long' value
unittests/format_pieces-selftests.c:56: warning: code: Do not use printf("%ll"), instead use printf("%s",phex()) to dump a `long long' value
gdb/ChangeLog:
* unittests/format_pieces-selftests.c (test_format_specifier):
Add ARI comments.
Tom Tromey [Sat, 12 May 2018 23:04:50 +0000 (17:04 -0600)]
Show padding in ptype/o output
I was recently using ptype/o to look at the layout of some objects in
gdb. I noticed that trailing padding was not shown -- but I wanted to
be able to look at that, too.
This patch changes ptype/o to also print trailing holes.
Tested on x86-64 Fedora 26.
gdb/ChangeLog
2018-05-18 Tom Tromey <tom@tromey.com>
* c-typeprint.c (maybe_print_hole): New function.
(c_print_type_struct_field_offset): Update.
(c_type_print_base_struct_union): Call maybe_print_hole.
gdb/testsuite/ChangeLog
2018-05-18 Tom Tromey <tom@tromey.com>
* gdb.base/ptype-offsets.exp: Update.
John Darrington [Fri, 18 May 2018 14:26:18 +0000 (15:26 +0100)]
Add support for the Freescale s12z processor.
bfd * Makefile.am: Add s12z files.
* Makefile.in: Regenerate.
* archures.c: Add bfd_s12z_arch.
* bfd-in.h: Add exports of bfd_putb24 and bfd_putl24.
* bfd-in2.h: Regenerate.
* config.bfd: Add s12z target.
* configure.ac: Add s12z target.
* configure: Regenerate.
* cpu-s12z.c: New file.
* elf32-s12z.c: New file.
* libbfd.c (bfd_putb24): New function.
(bfd_putl24): New function.
* libbfd.h: Regenerate.
* reloc.c: Add s12z relocations.
(bfd_get_reloc_size): Handle size 5 relocs.
* targets.c: Add s12z_elf32_vec.
opcodes * Makefile.am: Add support for s12z architecture.
* configure.ac: Likewise.
* disassemble.c: Likewise.
* disassemble.h: Likewise.
* Makefile.in: Regenerate.
* configure: Regenerate.
* s12z-dis.c: New file.
* s12z.h: New file.
include * elf/s12z.h: New header.
ld * Makefile.am: Add support for s12z architecture.
* configure.tgt: Likewise.
* Makefile.in: Regenerate.
* emulparams/m9s12zelf.sh: New file.
* scripttempl/elfm9s12z.sc: New file.
* testsuite/ld-discard/static.d: Expect to fail for the s12z
target.
* testsuite/ld-elf/endsym.d: Likewise.
* testsuite/ld-elf/merge.d: Likewise.
* testsuite/ld-elf/pr14926.d: Skip for the s12z target.
* testsuite/ld-elf/sec64k.exp: Likewise.
* testsuite/ld-s12z: New directory.
* testsuite/ld-s12z/opr-linking.d: New file.
* testsuite/ld-s12z/opr-linking.s: New file.
* testsuite/ld-s12z/relative-linking.d: New file.
* testsuite/ld-s12z/relative-linking.s: New file.
* testsuite/ld-s12z/z12s.exp: New file.
gas * Makefile.am: Add support for s12z target.
* Makefile.in: Regenerate.
* NEWS: Mention the new support.
* config/tc-s12z.c: New file.
* config/tc-s12z.h: New file.
* configure.tgt: Add s12z support.
* doc/Makefile.am: Likewise.
* doc/Makefile.in: Regenerate.
* doc/all.texi: Add s12z documentation.
* doc/as.textinfo: Likewise.
* doc/c-s12z.texi: New file.
* testsuite/gas/s12z: New directory.
* testsuite/gas/s12z/abs.d: New file.
* testsuite/gas/s12z/abs.s: New file.
* testsuite/gas/s12z/adc-imm.d: New file.
* testsuite/gas/s12z/adc-imm.s: New file.
* testsuite/gas/s12z/adc-opr.d: New file.
* testsuite/gas/s12z/adc-opr.s: New file.
* testsuite/gas/s12z/add-imm.d: New file.
* testsuite/gas/s12z/add-imm.s: New file.
* testsuite/gas/s12z/add-opr.d: New file.
* testsuite/gas/s12z/add-opr.s: New file.
* testsuite/gas/s12z/and-imm.d: New file.
* testsuite/gas/s12z/and-imm.s: New file.
* testsuite/gas/s12z/and-opr.d: New file.
* testsuite/gas/s12z/and-opr.s: New file.
* testsuite/gas/s12z/and-or-cc.d: New file.
* testsuite/gas/s12z/and-or-cc.s: New file.
* testsuite/gas/s12z/bfext-special.d: New file.
* testsuite/gas/s12z/bfext-special.s: New file.
* testsuite/gas/s12z/bfext.d: New file.
* testsuite/gas/s12z/bfext.s: New file.
* testsuite/gas/s12z/bit-manip.d: New file.
* testsuite/gas/s12z/bit-manip.s: New file.
* testsuite/gas/s12z/bit.d: New file.
* testsuite/gas/s12z/bit.s: New file.
* testsuite/gas/s12z/bra-expression-defined.d: New file.
* testsuite/gas/s12z/bra-expression-defined.s: New file.
* testsuite/gas/s12z/bra-expression-undef.d: New file.
* testsuite/gas/s12z/bra-expression-undef.s: New file.
* testsuite/gas/s12z/bra.d: New file.
* testsuite/gas/s12z/bra.s: New file.
* testsuite/gas/s12z/brclr-symbols.d: New file.
* testsuite/gas/s12z/brclr-symbols.s: New file.
* testsuite/gas/s12z/brset-clr-opr-imm-rel.d: New file.
* testsuite/gas/s12z/brset-clr-opr-imm-rel.s: New file.
* testsuite/gas/s12z/brset-clr-opr-reg-rel.d: New file.
* testsuite/gas/s12z/brset-clr-opr-reg-rel.s: New file.
* testsuite/gas/s12z/brset-clr-reg-imm-rel.d: New file.
* testsuite/gas/s12z/brset-clr-reg-imm-rel.s: New file.
* testsuite/gas/s12z/brset-clr-reg-reg-rel.d: New file.
* testsuite/gas/s12z/brset-clr-reg-reg-rel.s: New file.
* testsuite/gas/s12z/clb.d: New file.
* testsuite/gas/s12z/clb.s: New file.
* testsuite/gas/s12z/clr-opr.d: New file.
* testsuite/gas/s12z/clr-opr.s: New file.
* testsuite/gas/s12z/clr.d: New file.
* testsuite/gas/s12z/clr.s: New file.
* testsuite/gas/s12z/cmp-imm.d: New file.
* testsuite/gas/s12z/cmp-imm.s: New file.
* testsuite/gas/s12z/cmp-opr-inc.d: New file.
* testsuite/gas/s12z/cmp-opr-inc.s: New file.
* testsuite/gas/s12z/cmp-opr-rdirect.d: New file.
* testsuite/gas/s12z/cmp-opr-rdirect.s: New file.
* testsuite/gas/s12z/cmp-opr-reg.d: New file.
* testsuite/gas/s12z/cmp-opr-reg.s: New file.
* testsuite/gas/s12z/cmp-opr-rindirect.d: New file.
* testsuite/gas/s12z/cmp-opr-rindirect.s: New file.
* testsuite/gas/s12z/cmp-opr-sxe4.d: New file.
* testsuite/gas/s12z/cmp-opr-sxe4.s: New file.
* testsuite/gas/s12z/cmp-opr-xys.d: New file.
* testsuite/gas/s12z/cmp-opr-xys.s: New file.
* testsuite/gas/s12z/cmp-s-imm.d: New file.
* testsuite/gas/s12z/cmp-s-imm.s: New file.
* testsuite/gas/s12z/cmp-s-opr.d: New file.
* testsuite/gas/s12z/cmp-s-opr.s: New file.
* testsuite/gas/s12z/cmp-xy.d: New file.
* testsuite/gas/s12z/cmp-xy.s: New file.
* testsuite/gas/s12z/com-opr.d: New file.
* testsuite/gas/s12z/com-opr.s: New file.
* testsuite/gas/s12z/complex-shifts.d: New file.
* testsuite/gas/s12z/complex-shifts.s: New file.
* testsuite/gas/s12z/db-tb-cc-opr.d: New file.
* testsuite/gas/s12z/db-tb-cc-opr.s: New file.
* testsuite/gas/s12z/db-tb-cc-reg.d: New file.
* testsuite/gas/s12z/db-tb-cc-reg.s: New file.
* testsuite/gas/s12z/dbCC.d: New file.
* testsuite/gas/s12z/dbCC.s: New file.
* testsuite/gas/s12z/dec-opr.d: New file.
* testsuite/gas/s12z/dec-opr.s: New file.
* testsuite/gas/s12z/dec.d: New file.
* testsuite/gas/s12z/dec.s: New file.
* testsuite/gas/s12z/div.d: New file.
* testsuite/gas/s12z/div.s: New file.
* testsuite/gas/s12z/eor.d: New file.
* testsuite/gas/s12z/eor.s: New file.
* testsuite/gas/s12z/exg.d: New file.
* testsuite/gas/s12z/exg.s: New file.
* testsuite/gas/s12z/ext24-ld-xy.d: New file.
* testsuite/gas/s12z/ext24-ld-xy.s: New file.
* testsuite/gas/s12z/inc-opr.d: New file.
* testsuite/gas/s12z/inc-opr.s: New file.
* testsuite/gas/s12z/inc.d: New file.
* testsuite/gas/s12z/inc.s: New file.
* testsuite/gas/s12z/inh.d: New file.
* testsuite/gas/s12z/inh.s: New file.
* testsuite/gas/s12z/jmp.d: New file.
* testsuite/gas/s12z/jmp.s: New file.
* testsuite/gas/s12z/jsr.d: New file.
* testsuite/gas/s12z/jsr.s: New file.
* testsuite/gas/s12z/ld-imm-page2.d: New file.
* testsuite/gas/s12z/ld-imm-page2.s: New file.
* testsuite/gas/s12z/ld-imm.d: New file.
* testsuite/gas/s12z/ld-imm.s: New file.
* testsuite/gas/s12z/ld-immu18.d: New file.
* testsuite/gas/s12z/ld-immu18.s: New file.
* testsuite/gas/s12z/ld-large-direct.d: New file.
* testsuite/gas/s12z/ld-large-direct.s: New file.
* testsuite/gas/s12z/ld-opr.d: New file.
* testsuite/gas/s12z/ld-opr.s: New file.
* testsuite/gas/s12z/ld-s-opr.d: New file.
* testsuite/gas/s12z/ld-s-opr.s: New file.
* testsuite/gas/s12z/ld-small-direct.d: New file.
* testsuite/gas/s12z/ld-small-direct.s: New file.
* testsuite/gas/s12z/lea-immu18.d: New file.
* testsuite/gas/s12z/lea-immu18.s: New file.
* testsuite/gas/s12z/lea.d: New file.
* testsuite/gas/s12z/lea.s: New file.
* testsuite/gas/s12z/mac.d: New file.
* testsuite/gas/s12z/mac.s: New file.
* testsuite/gas/s12z/min-max.d: New file.
* testsuite/gas/s12z/min-max.s: New file.
* testsuite/gas/s12z/mod.d: New file.
* testsuite/gas/s12z/mod.s: New file.
* testsuite/gas/s12z/mov.d: New file.
* testsuite/gas/s12z/mov.s: New file.
* testsuite/gas/s12z/mul-imm.d: New file.
* testsuite/gas/s12z/mul-imm.s: New file.
* testsuite/gas/s12z/mul-opr-opr.d: New file.
* testsuite/gas/s12z/mul-opr-opr.s: New file.
* testsuite/gas/s12z/mul-opr.d: New file.
* testsuite/gas/s12z/mul-opr.s: New file.
* testsuite/gas/s12z/mul-reg.d: New file.
* testsuite/gas/s12z/mul-reg.s: New file.
* testsuite/gas/s12z/mul.d: New file.
* testsuite/gas/s12z/mul.s: New file.
* testsuite/gas/s12z/neg-opr.d: New file.
* testsuite/gas/s12z/neg-opr.s: New file.
* testsuite/gas/s12z/not-so-simple-shifts.d: New file.
* testsuite/gas/s12z/not-so-simple-shifts.s: New file.
* testsuite/gas/s12z/opr-18u.d: New file.
* testsuite/gas/s12z/opr-18u.s: New file.
* testsuite/gas/s12z/opr-expr.d: New file.
* testsuite/gas/s12z/opr-expr.s: New file.
* testsuite/gas/s12z/opr-ext-18.d: New file.
* testsuite/gas/s12z/opr-ext-18.s: New file.
* testsuite/gas/s12z/opr-idx-24-reg.d: New file.
* testsuite/gas/s12z/opr-idx-24-reg.s: New file.
* testsuite/gas/s12z/opr-idx3-reg.d: New file.
* testsuite/gas/s12z/opr-idx3-reg.s: New file.
* testsuite/gas/s12z/opr-idx3-xysp-24.d: New file.
* testsuite/gas/s12z/opr-idx3-xysp-24.s: New file.
* testsuite/gas/s12z/opr-indirect-expr.d: New file.
* testsuite/gas/s12z/opr-indirect-expr.s: New file.
* testsuite/gas/s12z/opr-symbol.d: New file.
* testsuite/gas/s12z/opr-symbol.s: New file.
* testsuite/gas/s12z/or-imm.d: New file.
* testsuite/gas/s12z/or-imm.s: New file.
* testsuite/gas/s12z/or-opr.d: New file.
* testsuite/gas/s12z/or-opr.s: New file.
* testsuite/gas/s12z/p2-mul.d: New file.
* testsuite/gas/s12z/p2-mul.s: New file.
* testsuite/gas/s12z/page2-inh.d: New file.
* testsuite/gas/s12z/page2-inh.s: New file.
* testsuite/gas/s12z/psh-pul.d: New file.
* testsuite/gas/s12z/psh-pul.s: New file.
* testsuite/gas/s12z/qmul.d: New file.
* testsuite/gas/s12z/qmul.s: New file.
* testsuite/gas/s12z/rotate.d: New file.
* testsuite/gas/s12z/rotate.s: New file.
* testsuite/gas/s12z/s12z.exp: New file.
* testsuite/gas/s12z/sat.d: New file.
* testsuite/gas/s12z/sat.s: New file.
* testsuite/gas/s12z/sbc-imm.d: New file.
* testsuite/gas/s12z/sbc-imm.s: New file.
* testsuite/gas/s12z/sbc-opr.d: New file.
* testsuite/gas/s12z/sbc-opr.s: New file.
* testsuite/gas/s12z/shift.d: New file.
* testsuite/gas/s12z/shift.s: New file.
* testsuite/gas/s12z/simple-shift.d: New file.
* testsuite/gas/s12z/simple-shift.s: New file.
* testsuite/gas/s12z/single-ops.d: New file.
* testsuite/gas/s12z/single-ops.s: New file.
* testsuite/gas/s12z/specd6.d: New file.
* testsuite/gas/s12z/specd6.s: New file.
* testsuite/gas/s12z/st-large-direct.d: New file.
* testsuite/gas/s12z/st-large-direct.s: New file.
* testsuite/gas/s12z/st-opr.d: New file.
* testsuite/gas/s12z/st-opr.s: New file.
* testsuite/gas/s12z/st-s-opr.d: New file.
* testsuite/gas/s12z/st-s-opr.s: New file.
* testsuite/gas/s12z/st-small-direct.d: New file.
* testsuite/gas/s12z/st-small-direct.s: New file.
* testsuite/gas/s12z/st-xy.d: New file.
* testsuite/gas/s12z/st-xy.s: New file.
* testsuite/gas/s12z/sub-imm.d: New file.
* testsuite/gas/s12z/sub-imm.s: New file.
* testsuite/gas/s12z/sub-opr.d: New file.
* testsuite/gas/s12z/sub-opr.s: New file.
* testsuite/gas/s12z/tfr.d: New file.
* testsuite/gas/s12z/tfr.s: New file.
* testsuite/gas/s12z/trap.d: New file.
* testsuite/gas/s12z/trap.s: New file.
binutils* readelf.c: Add support for s12z architecture.
* testsuite/lib/binutils-common.exp (is_elf_format): Excluse s12z
targets.
H.J. Lu [Fri, 18 May 2018 13:43:19 +0000 (06:43 -0700)]
x86: Don't set eh->local_ref to 1 for linker defined symbols
Since symbols created by HIDDEN and PROVIDE_HIDDEN assignments in
linker script may be marked as defined, but not hidden, we can't
set eh->local_ref to 1 in _bfd_x86_elf_link_symbol_references_local.
Also R_386_GOT32X should be handled as just like R_386_GOT32 when
relocating a section. The input R_386_GOT32X relocations, which
can be relaxed, should have been converted to R_386_PC32, R_386_32
or R_386_GOTOFF.
bfd/
PR ld/23189
* elf32-i386.c (elf_i386_relocate_section): Handle R_386_GOT32X
like R_386_GOT32.
* elfxx-x86.c (_bfd_x86_elf_link_symbol_references_local): Don't
set eh->local_ref to 1 for linker defined symbols.
ld/
PR ld/23189
* testsuite/ld-i386/i386.exp: Run pr23189.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-i386/pr23189.d: New file.
* testsuite/ld-i386/pr23189.s: Likewise.
* testsuite/ld-i386/pr23189.t: Likewise.
* testsuite/ld-x86-64/pr23189.d: Likewise.
* testsuite/ld-x86-64/pr23189.s: Likewise.
* testsuite/ld-x86-64/pr23189.t: Likewise.
Alan Modra [Fri, 18 May 2018 07:39:45 +0000 (17:09 +0930)]
PR23199, Invalid SHT_GROUP entry leads to group confusion
This patch prevents elf_next_in_group list pointer confusion when
SHT_GROUP sections specify other SHT_GROUP sections in their list of
group sections.
PR 23199
* elf.c (setup_group): Formatting. Check that SHT_GROUP entries
don't point at other SHT_GROUP sections. Set shdr corresponding
to invalid entry, to NULL rather than section 0. Identify
SHT_GROUP section index when reporting an error. Cope with NULL
shdr pointer.
Alan Modra [Fri, 18 May 2018 02:05:18 +0000 (11:35 +0930)]
ATTRIBUTE_HIDDEN for libbfd.h
* libbfd-in.h (ATTRIBUTE_HIDDEN): Define and use throughout.
* configure.ac (HAVE_HIDDEN): Check compiler support for hidden
visibility.
* libbfd.h: Regenerate.
* configure: Regenerate.
* config.in: Regenerate.
Alan Modra [Thu, 17 May 2018 23:00:50 +0000 (08:30 +0930)]
libbfd.h and libcoff.h include guards
* libbfd-in.h: Add include guard.
* libcoff-in.h: Likewise.
* doc/Makefile.am (libbfd.h, libcoff.h): Append another #endif.
* doc/Makefile.in: Regenerate.
* libbfd.h: Regenerate.
* libcoff.h: Regenerate.
Alan Modra [Thu, 17 May 2018 23:01:13 +0000 (08:31 +0930)]
opcodes sources should not include libbfd.h
* nfp-dis.c: Don't #include libbfd.h.
(init_nfp3200_priv): Use bfd_get_section_contents.
(nit_nfp6000_mecsr_sec): Likewise.
GDB Administrator [Fri, 18 May 2018 00:00:41 +0000 (00:00 +0000)]
Automatic date update in version.in
Keith Seitz [Thu, 17 May 2018 19:15:11 +0000 (12:15 -0700)]
Don't elide all inlined frames
This patch essentially causes GDB to treat inlined frames like "normal"
frames from the user's perspective. This means, for example, that when a
user sets a breakpoint in an inlined function, GDB will now actually stop
"in" that function.
Using the test case from breakpoints/17534,
3 static inline void NVIC_EnableIRQ(int IRQn)
4 {
5 volatile int y;
6 y = IRQn;
7 }
8
9 __attribute__( ( always_inline ) ) static inline void __WFI(void)
10 {
11 __asm volatile ("nop");
12 }
13
14 int main(void) {
15
16 x= 42;
17
18 if (x)
19 NVIC_EnableIRQ(16);
20 else
21 NVIC_EnableIRQ(18);
(gdb) b NVIC_EnableIRQ
Breakpoint 1 at 0x4003e4: NVIC_EnableIRQ. (2 locations)
(gdb) r
Starting program: 17534
Breakpoint 1, main () at 17534.c:19
19 NVIC_EnableIRQ(16);
Because skip_inline_frames currently skips every inlined frame, GDB "stops"
in the caller. This patch adds a new parameter to skip_inline_frames
that allows us to pass in a bpstat stop chain. The breakpoint locations
on the stop chain can be used to determine if we've stopped inside an inline
function (due to a user breakpoint). If we have, we do not elide the frame.
With this patch, GDB now reports that the inferior has stopped inside the
inlined function:
(gdb) r
Starting program: 17534
Breakpoint 1, NVIC_EnableIRQ (IRQn=16) at 17534.c:6
6 y = IRQn;
Many thanks to Jan and Pedro for guidance on this.
gdb/ChangeLog:
* breakpoint.c (build_bpstat_chain): New function, moved from
bpstat_stop_status.
(bpstat_stop_status): Add optional parameter, `stop_chain'.
If no stop chain is passed, call build_bpstat_chain to build it.
* breakpoint.h (build_bpstat_chain): Declare.
(bpstat_stop_status): Move documentation here from breakpoint.c.
* infrun.c (handle_signal_stop): Before eliding inlined frames,
build the stop chain and pass it to skip_inline_frames.
Pass this stop chain to bpstat_stop_status.
* inline-frame.c: Include breakpoint.h.
(stopped_by_user_bp_inline_frame): New function.
(skip_inline_frames): Add parameter `stop_chain'.
Move documention to inline-frame.h.
If non-NULL, use stopped_by_user_bp_inline_frame to determine
whether the frame should be elided.
* inline-frame.h (skip_inline_frames): Add parameter `stop_chain'.
Add moved documentation and update for new parameter.
gdb/testsuite/ChangeLog:
* gdb.ada/bp_inlined_func.exp: Update inlined frame locations
in expected breakpoint stop locations.
* gdb.dwarf2/implptr.exp (implptr_test_baz): Use up/down to
move to proper scope to test variable values.
* gdb.opt/inline-break.c (inline_func1, not_inline_func1)
(inline_func2, not_inline_func2, inline_func3, not_inline_func3):
New functions.
(main): Call not_inline_func3.
* gdb.opt/inline-break.exp: Start inferior and set breakpoints at
inline_func1, inline_func2, and inline_func3. Test that when each
breakpoint is hit, GDB properly reports both the stop location
and the backtrace. Repeat tests for temporary breakpoints.
Simon Marchi [Thu, 17 May 2018 17:05:59 +0000 (13:05 -0400)]
Make format_pieces recognize the \e escape sequence
I noticed that the printf command did not recognize the \e escape
sequence, used amongst other things to use colors:
(gdb) printf "This is \e[32mgreen\e[m!\n"
Unrecognized escape character \e in format string.
This patch makes format_pieces recognize it, which makes that command
print the expected result in glorious color.
I wrote a really simple unit test for format_pieces.
format_pieces::operator[] is unused so I removed it. I added
format_piece::operator==, which is needed to compare vectors of
format_piece.
gdb/ChangeLog:
PR cli/14975
* Makefile.in (SUBDIR_UNITTESTS_SRCS): Add
unittests/format_pieces-selftests.c.
* common/format.h (format_piece) <operator==>: New.
(format_pieces) <operator[]>: Remove.
* common/format.c (format_pieces::format_pieces): Handle \e.
* unittests/format_pieces-selftests.c: New.
Tom Tromey [Thu, 12 Apr 2018 14:24:41 +0000 (08:24 -0600)]
Fix for dwz-related crash
PR symtab/23010 reports a crash that occurs when using -readnow
on a dwz-generated debuginfo file.
The crash occurs because the DWARF has a partial CU with no language
set, and then a full CU that references this partial CU using
DW_AT_abstract_origin.
In this case, the partial CU is read by dw2_expand_all_symtabs using
language_minimal; but then this conflicts with the creation of the
block's symbol table in the C++ CU.
This patch fixes the problem by arranging for partial CUs not to be
read by -readnow. I tend to think that it doesn't make sense to read
a partial CU in isolation -- they should only be read when imported
into some other CU.
In conjunction with some other patches I am going to post, this also
fixes the Rust -readnow crash that Jan reported.
There are two problems with this patch:
1. It is difficult to reason about. There are many cases where I've
patched the code to call init_cutu_and_read_dies with the flag set
to "please do read partial units" -- but I find it difficult to be
sure that this is always correct.
2. It is still missing a standalone test case. This seemed hard.
2018-05-17 Tom Tromey <tom@tromey.com>
PR symtab/23010:
* dwarf2read.c (load_cu, dw2_do_instantiate_symtab)
(dw2_instantiate_symtab): Add skip_partial parameter.
(dw2_find_last_source_symtab, dw2_map_expand_apply)
(dw2_lookup_symbol, dw2_expand_symtabs_for_function)
(dw2_expand_all_symtabs, dw2_expand_symtabs_with_fullname)
(dw2_expand_symtabs_matching_one)
(dw2_find_pc_sect_compunit_symtab)
(dw2_debug_names_lookup_symbol)
(dw2_debug_names_expand_symtabs_for_function): Update.
(init_cutu_and_read_dies): Add skip_partial parameter.
(process_psymtab_comp_unit, build_type_psymtabs_1)
(process_skeletonless_type_unit, load_partial_comp_unit)
(psymtab_to_symtab_1): Update.
(load_full_comp_unit): Add skip_partial parameter.
(process_imported_unit_die, dwarf2_read_addr_index)
(follow_die_offset, dwarf2_fetch_die_loc_sect_off)
(dwarf2_fetch_constant_bytes, dwarf2_fetch_die_type_sect_off)
(read_signatured_type): Update.
Nick Clifton [Thu, 17 May 2018 15:24:42 +0000 (16:24 +0100)]
Updated simplified Chinese translation for the opcodes directory.
opcodes * po/zh_CN.po: Updated simplified Chinese translation.
Simon Marchi [Thu, 17 May 2018 13:52:08 +0000 (09:52 -0400)]
value.c: Remove unused variables
Obvious patch to remove unused local variables (found by adding
-Wunused). I didn't touch this one in value_fetch_lazy, because
check_typedef could have a desired side-effect.
3743 struct type *type = check_typedef (value_type (val));
gdb/ChangeLog:
* value.c (release_value): Remove unused variable.
(record_latest_value): Likewise.
(access_value_history): Likewise.
(preserve_values): Likewise.
Tom Tromey [Wed, 16 May 2018 17:39:09 +0000 (11:39 -0600)]
Initialize py_type_printers in ext_lang_type_printers
When running gdb in the build directory without passing
--data-directory, I noticed I could provoke a crash by:
$ ./gdb -nx ./gdb
(gdb) ptype/o struct dwarf2_per_objfile
... and then trying to "q" out at the pagination prompt.
valgrind complained about an uninitialized use of py_type_printers.
Initializing this member fixes the bug.
I believe this bug can occur even when the gdb Python libraries are
available, for example if get_type_recognizers fails.
Tested by hand on x86-64 Fedora 26. No test case because it seemed
difficult to guarantee failures.
gdb/ChangeLog
2018-05-17 Tom Tromey <tom@tromey.com>
* extension.h (struct ext_lang_type_printers) <py_type_printers>:
Initialize.
GDB Administrator [Thu, 17 May 2018 00:00:42 +0000 (00:00 +0000)]
Automatic date update in version.in
Maciej W. Rozycki [Wed, 16 May 2018 19:43:30 +0000 (20:43 +0100)]
PR gdb/22286: linux-nat-trad: Support arbitrary register widths
Update `fetch_register' and `store_register' code to support arbitrary
register widths rather than only ones that are a multiply of the size of
the `ptrace' data type used with PTRACE_PEEKUSR and PTRACE_POKEUSR
requests to access registers. Remove associated assertions, correcting
an issue with accessing the DSPControl (`$dspctl') register on n64 MIPS
native targets:
(gdb) print /x $dspctl
.../gdb/linux-nat-trad.c:50: internal-error: void linux_nat_trad_target::fetch_register(regcache*, int): Assertion `(size % sizeof (PTRACE_TYPE_RET)) == 0' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n) n
This is a bug, please report it. For instructions, see:
<http://www.gnu.org/software/gdb/bugs/>.
.../gdb/linux-nat-trad.c:50: internal-error: void linux_nat_trad_target::fetch_register(regcache*, int): Assertion `(size % sizeof (PTRACE_TYPE_RET)) == 0' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Create a core file of GDB? (y or n) n
Command aborted.
(gdb)
All registers are now reported correctly and their architectural
hardware widths respected:
(gdb) print /x $dspctl
$1 = 0x55aa33cc
(gdb) info registers
zero at v0 v1
R0
0000000000000000 0000000000000001 000000fff7ffeb20 0000000000000000
a0 a1 a2 a3
R4
0000000000000001 000000ffffffeaf8 000000ffffffeb08 0000000000000000
a4 a5 a6 a7
R8
000000fff7ee3800 000000fff7ede8f0 000000ffffffeaf0 2f2f2f2f2f2f2f2f
t0 t1 t2 t3
R12
0000000000000437 0000000000000002 000000fff7ffd000 0000000120000ad0
s0 s1 s2 s3
R16
000000fff7ee2068 0000000120000e60 0000000000000000 0000000000000000
s4 s5 s6 s7
R20
0000000000521ec8 0000000000522608 0000000000000000 0000000000000000
t8 t9 k0 k1
R24
0000000000000000 0000000120000d9c 0000000000000000 0000000000000000
gp sp s8 ra
R28
0000000120019030 000000ffffffe990 000000ffffffe990 000000fff7d5b88c
status lo hi badvaddr
0000000000109cf3 0000000000005ea5 0000000000000211 000000fff7fc6fe0
cause pc
0000000000800024 0000000120000dbc
fcsr fir hi1 lo1
00000000 00f30000 0000000000000000 0101010101010101
hi2 lo2 hi3 lo3
0202020202020202 0303030303030303 0404040404040404 0505050505050505
dspctl restart
55aa33cc 0000000000000000
(gdb)
NB due to the lack of access to 64-bit DSP hardware all DSP register
values in the dumps are artificial and have been created with a debug
change applied to the kernel handler of the `ptrace' syscall.
The use of `store_unsigned_integer' and `extract_unsigned_integer'
unconditionally in all cases rather than when actual data occupies a
part of the data quantity exchanged with `ptrace' makes code perhaps
marginally slower, however I think avoiding it is not worth code
obfuscation it would cause. If this turns out unfounded, then there
should be no problem with optimizing this code later.
gdb/
PR gdb/22286
* linux-nat-trad.c (linux_nat_trad_target::fetch_register):
Also handle registers whose width is not a multiple of
PTRACE_TYPE_RET.
(linux_nat_trad_target::store_register): Likewise.
Maciej W. Rozycki [Wed, 16 May 2018 19:43:29 +0000 (20:43 +0100)]
NDS32/GAS: Correct an `expr' global shadowing error for pre-4.8 GCC
Remove `-Wshadow' compilation errors:
cc1: warnings being treated as errors
.../gas/config/tc-nds32.c: In function 'md_assemble':
.../gas/config/tc-nds32.c:5212: error: declaration of 'expr' shadows a global declaration
.../gas/expr.h:180: error: shadowed declaration is here
make[4]: *** [tc-nds32.o] Error 1
which for versions of GCC before 4.8 prevent support for NDS32 targets
from being built. See also GCC PR c/53066.
gas/
* tc-nds32.c (md_assemble): Rename `expr' local variable to
`insn_expr'.
Maciej W. Rozycki [Wed, 16 May 2018 19:43:29 +0000 (20:43 +0100)]
NDS32/BFD: Fix build error in `nds32_convert_32_to_16'
Fix:
cc1: warnings being treated as errors
.../bfd/elf32-nds32.c: In function 'nds32_convert_32_to_16':
.../bfd/elf32-nds32.c:6816: error: 'insn_type' may be used uninitialized in this function
make[4]: *** [elf32-nds32.lo] Error 1
seen with GCC 4.1.2 and 4.4.7.
bfd/
* elf32-nds32.c (nds32_convert_32_to_16): Preset `insn_type'.
Tom Tromey [Fri, 11 May 2018 18:36:19 +0000 (12:36 -0600)]
Make "cbfd" a gdb_bfd_ref_ptr
This changes program_space::cbfd to be a gdb_bfd_ref_ptr. This makes
it somewhat less error-prone to use, because now it manages the
reference counting automatically.
Tested by the buildbot.
2018-05-16 Tom Tromey <tom@tromey.com>
* gdbcore.h (core_bfd): Redefine.
* corelow.c (core_target::close): Update.
(core_target_open): Update.
* progspace.h (struct program_space) <cbfd>: Now a
gdb_bfd_ref_ptr.
Tom Tromey [Tue, 14 Jun 2016 11:46:56 +0000 (12:46 +0100)]
Use a distinguishing name for minidebug objfile
One part of PR cli/19551 is that the mini debug info objfile reuses the
name of the main objfile from which it comes. This can be seen because
gdb claims to be reading symbols from the same file two times, like:
Reading symbols from /bin/gdb...Reading symbols from /bin/gdb...(no debugging symbols found)...done.
I think this would be less confusing if the minidebug objfile were given
a different name. That is what this patch implements. It also arranges
for the minidebug objfile to be marked OBJF_NOT_FILENAME.
After this patch the output looks like:
Reading symbols from /bin/gdb...Reading symbols from .gnu_debugdata for /usr/libexec/gdb...(no debugging symbols found)...done.
Tested by the buildbot.
gdb/ChangeLog
2018-05-16 Tom Tromey <tom@tromey.com>
PR cli/19551:
* symfile-add-flags.h (enum symfile_add_flags)
<SYMFILE_NOT_FILENAME>: New constant.
* symfile.c (read_symbols): Use SYMFILE_NOT_FILENAME. Get
objfile name from BFD.
(symbol_file_add_with_addrs): Check SYMFILE_NOT_FILENAME.
* minidebug.c (find_separate_debug_file_in_section): Put
".gnu_debugdata" into BFD's file name.
Simon Marchi [Wed, 16 May 2018 16:41:19 +0000 (12:41 -0400)]
regcache.c: Remove unused typedefs
gdb/ChangeLog:
* regcache.c (regcache_read_ftype, regcache_write_ftype):
Remove.
Alan Modra [Wed, 16 May 2018 02:03:48 +0000 (11:33 +0930)]
PR22458, failure to choose a matching ELF target
https://sourceware.org/ml/binutils/2013-05/msg00271.html was supposed
to banish "file format is ambiguous" errors for ELF. It didn't,
because the code supposedly detecting formats that implement
match_priority didn't work. That was due to not placing all matching
targets into the vector of matching targets. ELF objects should all
match the generic ELF target (priority 2), plus one or more machine
specific targets (priority 1), and perhaps a single machine specific
target with OS/ABI set (priority 0, best match). So the armel object
in the testcase actually matches elf32-littlearm,
elf32-littlearm-symbian, and elf32-littlearm-vxworks (all priority 1),
and elf32-little (priority 2). As the PR reported, elf32-little
wasn't seen as matching. Fixing that part of the problem wasn't too
difficult but matching the generic ELF target as well as the ARM ELF
targets resulted in ARM testsuite failures.
These proved to be the annoying reordering of stubs that occurs from
time to time due to the stub names containing the section id.
Matching another target causes more sections to be created in
elf_object_p. If section ids change, stub names change, which results
in different hashing and can therefore result in different hash table
traversal and stub creation order. That particular problem is fixed
by resetting section_id to the initial state before attempting each
target match, and taking a snapshot of its value after a successful
match.
PR 22458
* format.c (struct bfd_preserve): Add section_id.
(bfd_preserve_save, bfd_preserve_restore): Save and restore
_bfd_section_id.
(bfd_reinit): Set _bfd_section_id.
(bfd_check_format_matches): Put all matches of any priority into
matching_vector. Save initial section id and start each attempted
match at that section id.
* libbfd-in.h (_bfd_section_id): Declare.
* section.c (_bfd_section_id): Rename from section_id and make
global. Adjust uses.
(bfd_get_next_section_id): Delete.
* elf64-ppc.c (ppc64_elf_setup_section_lists): Replace use of
bfd_get_section_id with _bfd_section_id.
* libbfd.h: Regenerate.
* bfd-in2.h: Regenerate.
Tamar Christina [Wed, 16 May 2018 11:13:42 +0000 (12:13 +0100)]
Fix disassembly mask for vector sdot on AArch64.
This patch corrects the disassembly masks for by element dot product
instructions. The bit 10 was wrong and supposed to be 1.
This caused incorrect disassembly of instructions in the unallocated space to
disassemble as dot product instructions.
No encoding errors can arrise from this issue.
opcodes/
PR binutils/23109
* aarch64-tbl.h (aarch64_opcode_table): Correct sdot and udot.
* aarch64-dis-2.c: Regenerate.
GDB Administrator [Wed, 16 May 2018 00:00:40 +0000 (00:00 +0000)]
Automatic date update in version.in
Tamar Christina [Tue, 15 May 2018 15:37:20 +0000 (16:37 +0100)]
Implement Read/Write constraints on system registers on AArch64
This patch adds constraints for read and write only system registers with the
msr and mrs instructions. The code will treat having both flags set and none
set as the same. These flags add constraints that must be matched up. e.g. a
system register with a READ only flag set, can only be used with mrs. If The
constraint fails a warning is emitted.
Examples of the warnings generated:
test.s: Assembler messages:
test.s:5: Warning: specified register cannot be written to at operand 1 -- `msr dbgdtrrx_el0,x3'
test.s:7: Warning: specified register cannot be read from at operand 2 -- `mrs x3,dbgdtrtx_el0'
test.s:8: Warning: specified register cannot be written to at operand 1 -- `msr midr_el1,x3'
and disassembly notes:
0000000000000000 <main>:
0:
d5130503 msr dbgdtrtx_el0, x3
4:
d5130503 msr dbgdtrtx_el0, x3
8:
d5330503 mrs x3, dbgdtrrx_el0
c:
d5330503 mrs x3, dbgdtrrx_el0
10:
d5180003 msr midr_el1, x3 ; note: writing to a read-only register.
Note that because dbgdtrrx_el0 and dbgdtrtx_el0 have the same encoding, during
disassembly the constraints are use to disambiguate between the two. An exact
constraint match is always prefered over partial ones if available.
As always the warnings can be suppressed with -w and also be made errors using
warnings as errors.
binutils/
PR binutils/21446
* doc/binutils.texi (-M): Document AArch64 options.
gas/
PR binutils/21446
* testsuite/gas/aarch64/illegal-sysreg-2.s: Fix pmbidr_el1 test.
* testsuite/gas/aarch64/illegal-sysreg-2.l: Likewise.
* testsuite/gas/aarch64/illegal-sysreg-2.d: Likewise.
* testsuite/gas/aarch64/sysreg-diagnostic.s: New.
* testsuite/gas/aarch64/sysreg-diagnostic.l: New.
* testsuite/gas/aarch64/sysreg-diagnostic.d: New.
include/
PR binutils/21446
* opcode/aarch64.h (F_SYS_READ, F_SYS_WRITE): New.
opcodes/
PR binutils/21446
* aarch64-asm.c (opintl.h): Include.
(aarch64_ins_sysreg): Enforce read/write constraints.
* aarch64-dis.c (aarch64_ext_sysreg): Likewise.
* aarch64-opc.h (F_DEPRECATED, F_ARCHEXT, F_HASXT): Moved here.
(F_REG_READ, F_REG_WRITE): New.
* aarch64-opc.c (aarch64_print_operand): Generate notes for
AARCH64_OPND_SYSREG.
(F_DEPRECATED, F_ARCHEXT, F_HASXT): Move to aarch64-opc.h.
(aarch64_sys_regs): Add constraints to currentel, midr_el1, ctr_el0,
mpidr_el1, revidr_el1, aidr_el1, dczid_el0, id_dfr0_el1, id_pfr0_el1,
id_pfr1_el1, id_afr0_el1, id_mmfr0_el1, id_mmfr1_el1, id_mmfr2_el1,
id_mmfr3_el1, id_mmfr4_el1, id_isar0_el1, id_isar1_el1, id_isar2_el1,
id_isar3_el1, id_isar4_el1, id_isar5_el1, mvfr0_el1, mvfr1_el1,
mvfr2_el1, ccsidr_el1, id_aa64pfr0_el1, id_aa64pfr1_el1,
id_aa64dfr0_el1, id_aa64dfr1_el1, id_aa64isar0_el1, id_aa64isar1_el1,
id_aa64mmfr0_el1, id_aa64mmfr1_el1, id_aa64mmfr2_el1, id_aa64afr0_el1,
id_aa64afr0_el1, id_aa64afr1_el1, id_aa64zfr0_el1, clidr_el1,
csselr_el1, vsesr_el2, erridr_el1, erxfr_el1, rvbar_el1, rvbar_el2,
rvbar_el3, isr_el1, tpidrro_el0, cntfrq_el0, cntpct_el0, cntvct_el0,
mdccsr_el0, dbgdtrrx_el0, dbgdtrtx_el0, osdtrrx_el1, osdtrtx_el1,
mdrar_el1, oslar_el1, oslsr_el1, dbgauthstatus_el1, pmbidr_el1,
pmsidr_el1, pmswinc_el0, pmceid0_el0, pmceid1_el0.
* aarch64-tbl.h (aarch64_opcode_table): Add constraints to
msr (F_SYS_WRITE), mrs (F_SYS_READ).
Tamar Christina [Tue, 15 May 2018 15:34:54 +0000 (16:34 +0100)]
Allow non-fatal errors to be emitted and for disassembly notes be placed on AArch64
This patch adds a new platform option "notes" that can be used to indicate if
disassembly notes should be placed in the disassembly as comments.
These notes can contain information about a failing constraint such as reading
from a write-only register. The disassembly will not be blocked because of this
but -M notes will emit a comment saying that the operation is not allowed.
For assembly this patch adds a new non-fatal status for errors. This is
essentially a warning. The reason for not creating an actual warning type is
that this causes the interaction between the ordering of warnings and errors to
be problematic. Currently the error buffer is almost always filled because of
the way operands are matched during assembly. An earlier template may have put
an error there that would only be displayed if no other template matches or
generates a higher priority error. But by definition a warning is lower
priority than a warning, so the error (which is incorrect if another template
matched) will supersede the warning. By treating warnings as errors and only
later relaxing the severity this relationship keeps working and the existing
reporting infrastructure can be re-used.
binutils/
PR binutils/21446
* doc/binutils.texi (-M): Document AArch64 options.
* NEWS: Document notes and warnings.
gas/
PR binutils/21446
* config/tc-aarch64.c (print_operands): Indicate no notes.
(output_operand_error_record): Support non-fatal errors.
(output_operand_error_report, warn_unpredictable_ldst, md_assemble):
Likewise.
include/
PR binutils/21446
* opcode/aarch64.h (aarch64_operand_error): Add non_fatal.
(aarch64_print_operand): Support notes.
opcodes/
PR binutils/21446
* aarch64-dis.c (no_notes: New.
(parse_aarch64_dis_option): Support notes.
(aarch64_decode_insn, print_operands): Likewise.
(print_aarch64_disassembler_options): Document notes.
* aarch64-opc.c (aarch64_print_operand): Support notes.
Tamar Christina [Tue, 15 May 2018 15:11:42 +0000 (16:11 +0100)]
Modify AArch64 Assembly and disassembly functions to be able to fail and report why.
This patch if the first patch in a series to add the ability to add constraints
to system registers that an instruction must adhere to in order for the register
to be usable with that instruction.
These constraints can also be used to disambiguate between registers with the
same encoding during disassembly.
This patch adds a new flags entry in the sysreg structures and ensures it is
filled in and read out during assembly/disassembly. It also adds the ability for
the assemble and disassemble functions to be able to gracefully fail and re-use
the existing error reporting infrastructure.
The return type of these functions are changed to a boolean to denote success or
failure and the error structure is passed around to them. This requires
aarch64-gen changes so a lot of the changes here are just mechanical.
gas/
PR binutils/21446
* config/tc-aarch64.c (parse_sys_reg): Return register flags.
(parse_operands): Fill in register flags.
gdb/
PR binutils/21446
* aarch64-tdep.c (aarch64_analyze_prologue,
aarch64_software_single_step, aarch64_displaced_step_copy_insn):
Indicate not interested in errors.
include/
PR binutils/21446
* opcode/aarch64.h (aarch64_opnd_info): Change sysreg to struct.
(aarch64_decode_insn): Accept error struct.
opcodes/
PR binutils/21446
* aarch64-asm.h (aarch64_insert_operand, aarch64_##x): Return boolean
and take error struct.
* aarch64-asm.c (aarch64_ext_regno, aarch64_ins_reglane,
aarch64_ins_reglist, aarch64_ins_ldst_reglist,
aarch64_ins_ldst_reglist_r, aarch64_ins_ldst_elemlist,
aarch64_ins_advsimd_imm_shift, aarch64_ins_imm, aarch64_ins_imm_half,
aarch64_ins_advsimd_imm_modified, aarch64_ins_fpimm,
aarch64_ins_imm_rotate1, aarch64_ins_imm_rotate2, aarch64_ins_fbits,
aarch64_ins_aimm, aarch64_ins_limm_1, aarch64_ins_limm,
aarch64_ins_inv_limm, aarch64_ins_ft, aarch64_ins_addr_simple,
aarch64_ins_addr_regoff, aarch64_ins_addr_offset, aarch64_ins_addr_simm,
aarch64_ins_addr_simm10, aarch64_ins_addr_uimm12,
aarch64_ins_simd_addr_post, aarch64_ins_cond, aarch64_ins_sysreg,
aarch64_ins_pstatefield, aarch64_ins_sysins_op, aarch64_ins_barrier,
aarch64_ins_prfop, aarch64_ins_hint, aarch64_ins_reg_extended,
aarch64_ins_reg_shifted, aarch64_ins_sve_addr_ri_s4xvl,
aarch64_ins_sve_addr_ri_s6xvl, aarch64_ins_sve_addr_ri_s9xvl,
aarch64_ins_sve_addr_ri_s4, aarch64_ins_sve_addr_ri_u6,
aarch64_ins_sve_addr_rr_lsl, aarch64_ins_sve_addr_rz_xtw,
aarch64_ins_sve_addr_zi_u5, aarch64_ext_sve_addr_zz,
aarch64_ins_sve_addr_zz_lsl, aarch64_ins_sve_addr_zz_sxtw,
aarch64_ins_sve_addr_zz_uxtw, aarch64_ins_sve_aimm,
aarch64_ins_sve_asimm, aarch64_ins_sve_index, aarch64_ins_sve_limm_mov,
aarch64_ins_sve_quad_index, aarch64_ins_sve_reglist,
aarch64_ins_sve_scale, aarch64_ins_sve_shlimm, aarch64_ins_sve_shrimm,
aarch64_ins_sve_float_half_one, aarch64_ins_sve_float_half_two,
aarch64_ins_sve_float_zero_one, aarch64_opcode_encode): Likewise.
* aarch64-dis.h (aarch64_extract_operand, aarch64_##x): Likewise.
* aarch64-dis.c (aarch64_ext_regno, aarch64_ext_reglane,
aarch64_ext_reglist, aarch64_ext_ldst_reglist,
aarch64_ext_ldst_reglist_r, aarch64_ext_ldst_elemlist,
aarch64_ext_advsimd_imm_shift, aarch64_ext_imm, aarch64_ext_imm_half,
aarch64_ext_advsimd_imm_modified, aarch64_ext_fpimm,
aarch64_ext_imm_rotate1, aarch64_ext_imm_rotate2, aarch64_ext_fbits,
aarch64_ext_aimm, aarch64_ext_limm_1, aarch64_ext_limm, decode_limm,
aarch64_ext_inv_limm, aarch64_ext_ft, aarch64_ext_addr_simple,
aarch64_ext_addr_regoff, aarch64_ext_addr_offset, aarch64_ext_addr_simm,
aarch64_ext_addr_simm10, aarch64_ext_addr_uimm12,
aarch64_ext_simd_addr_post, aarch64_ext_cond, aarch64_ext_sysreg,
aarch64_ext_pstatefield, aarch64_ext_sysins_op, aarch64_ext_barrier,
aarch64_ext_prfop, aarch64_ext_hint, aarch64_ext_reg_extended,
aarch64_ext_reg_shifted, aarch64_ext_sve_addr_ri_s4xvl,
aarch64_ext_sve_addr_ri_s6xvl, aarch64_ext_sve_addr_ri_s9xvl,
aarch64_ext_sve_addr_ri_s4, aarch64_ext_sve_addr_ri_u6,
aarch64_ext_sve_addr_rr_lsl, aarch64_ext_sve_addr_rz_xtw,
aarch64_ext_sve_addr_zi_u5, aarch64_ext_sve_addr_zz,
aarch64_ext_sve_addr_zz_lsl, aarch64_ext_sve_addr_zz_sxtw,
aarch64_ext_sve_addr_zz_uxtw, aarch64_ext_sve_aimm,
aarch64_ext_sve_asimm, aarch64_ext_sve_index, aarch64_ext_sve_limm_mov,
aarch64_ext_sve_quad_index, aarch64_ext_sve_reglist,
aarch64_ext_sve_scale, aarch64_ext_sve_shlimm, aarch64_ext_sve_shrimm,
aarch64_ext_sve_float_half_one, aarch64_ext_sve_float_half_two,
aarch64_ext_sve_float_zero_one, aarch64_opcode_decode): Likewise.
(determine_disassembling_preference, aarch64_decode_insn,
print_insn_aarch64_word, print_insn_data): Take errors struct.
(print_insn_aarch64): Use errors.
* aarch64-asm-2.c: Regenerate.
* aarch64-dis-2.c: Regenerate.
* aarch64-gen.c (print_operand_inserter): Use errors and change type to
boolean in aarch64_insert_operan.
(print_operand_extractor): Likewise.
* aarch64-opc.c (aarch64_print_operand): Use sysreg struct.
Maciej W. Rozycki [Tue, 15 May 2018 15:26:07 +0000 (16:26 +0100)]
MIPS/Linux/native: Supply $zero for the !PTRACE_GETREGS case
With native MIPS/Linux targets the $zero register is inaccessible, with
its supposed context slot provided by the OS occupied by the $restart
register. The PTRACE_GETREGS path takes care of it by artificially
supplying the hardwired contents of $zero in `mips_supply_gregset' or
`mips64_supply_gregset', as applicable, however the PTRACE_PEEKUSER
fallback does not, making the register unavailable, e.g.:
(gdb) info registers
zero at v0 v1 a0 a1 a2 a3
R0 <unavl>
00000001 00000001 d2f1a9fc 00000000 00000000 00417158 00417150
t0 t1 t2 t3 t4 t5 t6 t7
R8
00000004 00000000 fffffff8 00000000 00000000 00000000 00000001 00000007
s0 s1 s2 s3 s4 s5 s6 s7
R16
00000000 00405e30 00000000 00500000 00000000 0052ec08 00000000 00000000
t8 t9 k0 k1 gp sp s8 ra
R24
00000000 00417008 00000000 00000000 0041e220 7fff4ce0 7fff4ce0 00405d0c
status lo hi badvaddr cause pc
<unavl>
00441cf1 00000017 00417004 00800024 00405d10
fcsr fir restart
00800000 00f30000 00000000
(gdb)
or (under certain circumstances):
(gdb) stepi
Register 0 is not available
(gdb)
This is specifically because `mips_linux_register_addr' and
`mips64_linux_register_addr', both correctly return -1 for
MIPS_ZERO_REGNUM, and therefore `linux_nat_trad_target::fetch_registers'
faithfully marks this register as unavailable.
Supply this register artificially then in the PTRACE_PEEKUSER case as
well, correcting this issue.
gdb/
* mips-linux-nat.c (mips_linux_nat_target::fetch_registers):
Supply the MIPS_ZERO_REGNUM register.
Maciej W. Rozycki [Tue, 15 May 2018 15:02:59 +0000 (16:02 +0100)]
MIPS: Make `mask_address_var' static
Make the `mask_address_var' variable static, it is not used outside
mips-tdep.c and having no target name embedded within it causes a risk
of a namespace clash.
gdb/
* mips-tdep.c (mask_address_var): Make variable static.
Maciej W. Rozycki [Tue, 15 May 2018 14:54:36 +0000 (15:54 +0100)]
testsuite: Fix a `server_pid' access crash in gdb.server/server-kill.exp
Fix a commit
f90183d7e31b ("Get GDBserver pid on remote target") bug and
correctly handle the case where the PID of `gdbserver' could not have
been retrieved. If that happens, $server_pid is unset causing:
FAIL: gdb.server/server-kill.exp: p server_pid
ERROR: tcl error sourcing .../gdb/testsuite/gdb.server/server-kill.exp.
ERROR: can't read "server_pid": no such variable
while executing
"if {$server_pid == "" } {
return -1
}"
(file ".../gdb/testsuite/gdb.server/server-kill.exp" line 49)
invoked from within
"source .../gdb/testsuite/gdb.server/server-kill.exp"
("uplevel" body line 1)
invoked from within
"uplevel #0 source .../gdb/testsuite/gdb.server/server-kill.exp"
invoked from within
"catch "uplevel #0 source $test_file_name""
Verify that the variable exists then rather than trying to access it.
gdb/testsuite/
* gdb.server/server-kill.exp: Verify whether `server_pid' exists
rather then trying to access it in determining whether the PID
of `gdbserver' could have been retrieved.
Christophe Guillon [Tue, 15 May 2018 12:27:45 +0000 (12:27 +0000)]
Fix uninitialised memory acccess in COFF bfd backend
2018-05-15 Christophe Guillon <christophe.guillon@st.com>
* coffcode.h (coff_bigobj_swap_aux_in): Make sure that all fields
of the aux structure are initialised.
Change-Id: I81be255ac6611afbe00995fac550e98e6a07e5df
Francois H. Theron [Tue, 15 May 2018 12:28:06 +0000 (13:28 +0100)]
Fix error messages in the NFP sources when building for 32-bit targets.
bfd * targets.c: Wrap nfp_elf64_vec in BFD64 ifdef.
include * opcode/nfp.h: Use uint64_t instead of bfd_vma.
opcodes * nfp-dis.c: Use uint64_t for instruction variables, not bfd_vma.
Nick Clifton [Tue, 15 May 2018 12:16:16 +0000 (13:16 +0100)]
Add a new Portuguese translation for the bfd sub-directory.
* po/pt.po: New Portuguese translation.
* configure.ac (ALL_LINGUAS): Add pt.
* configure: Regenerate.
Alan Modra [Tue, 15 May 2018 10:08:53 +0000 (19:38 +0930)]
Restore LDFLAGS in notes.exp
Fixes an spu-elf test regression due to using the wrong flags.
* testsuite/ld-elf/notes.exp: Restore LDFLAGS.
Alan Modra [Tue, 15 May 2018 06:30:57 +0000 (16:00 +0930)]
Recognize more targets as ELF for testing
Also use the correct rel strip-13 variant for more ARM targets.
* testsuite/lib/binutils-common.exp (is_elf_format): Add chorus,
cloudabi, fuchsia, kaos and nto. Merge netbsdelf* into *elf*,
and *uclinux* into *linux*.
* testsuite/binutils-all/objcopy.exp: Accept armeb for rel
strip-13 test, exclude arm-vxworks and arm-windiss.
GDB Administrator [Tue, 15 May 2018 00:00:27 +0000 (00:00 +0000)]
Automatic date update in version.in
Tom Tromey [Mon, 14 May 2018 15:34:00 +0000 (09:34 -0600)]
Clear rust_unions in rust_union_quirks
It turns out that a dwarf2_cu can remain allocated after psymtab
expansion is done, and so it makes sense to clear rust_unions when
done processing it.
Tested on x86-64 Fedora 27.
2018-05-14 Tom Tromey <tom@tromey.com>
* dwarf2read.c (rust_union_quirks): Clear rust_unions.
Nick Clifton [Mon, 14 May 2018 14:32:43 +0000 (15:32 +0100)]
Stop generating GNU build notes for linkonce sections.
gas * write.c (maybe_generate_build_notes): Generate notes on a
per-code-section basis. Skip linkonce sections.
ld * testsuite/ld-elf/notes.exp: New file: Run new test.
* testsuite/ld-elf/note1_1.s: New file: Source file for test.
* testsuite/ld-elf/note1_2.s: New file: Source file for test.
* testsuite/ld-elf/note1.r: New file: Expected readelf output.
Nick Clifton [Mon, 14 May 2018 12:05:02 +0000 (13:05 +0100)]
Fix a problem in the assembler when checking for overlapping input and output files on non-POSIX compliant systems.
PR 23153
* as.c (main): When checking for an output file that is also an
input file, also check that the inode is not zero.
H.J. Lu [Mon, 14 May 2018 10:55:37 +0000 (03:55 -0700)]
x86; Allow IFUNC pointer defined in PDE
If IFUNC symbol is defined in position-dependent executable, we should
change it to the normal function and set its address to its PLT entry
which should be resolved by R_*_IRELATIVE at run-time. All external
references should be resolved to its PLT in executable.
bfd/
PR ld/23169
* elf-ifunc.c (_bfd_elf_allocate_ifunc_dyn_relocs): Don't issue
an error on IFUNC pointer defined in PDE.
* elf32-i386.c (elf_i386_finish_dynamic_symbol): Call
_bfd_x86_elf_link_fixup_ifunc_symbol.
* elf64-x86-64.c (elf_x86_64_finish_dynamic_symbol): Likewise.
* elfxx-x86.c (_bfd_x86_elf_link_fixup_ifunc_symbol): New
function.
* elfxx-x86.h (_bfd_x86_elf_link_fixup_ifunc_symbol): New.
ld/
PR ld/23169
* testsuite/ld-ifunc/ifunc-9-i386.d: New file.
* testsuite/ld-ifunc/ifunc-9-x86-64.d: Likewise.
* testsuite/ld-ifunc/pr23169a.c: Likewise.
* testsuite/ld-ifunc/pr23169a.rd: Likewise.
* testsuite/ld-ifunc/pr23169b.c: Likewise.
* testsuite/ld-ifunc/pr23169b.c: Likewise.
* testsuite/ld-ifunc/pr23169c.rd: Likewise.
* testsuite/ld-ifunc/pr23169c.rd: Likewise.
* testsuite/ld-ifunc/ifunc-9-x86.d: Removed.
* testsuite/ld-ifunc/ifunc.exp: Run PR ld/23169 tests.
H.J. Lu [Mon, 14 May 2018 10:47:47 +0000 (03:47 -0700)]
x86: Mark __bss_start, _end and _edata locally defined
__bss_start, _end and _edata are defined by linker to mark regions
within executables and shared libraries. All references within
executables should be locally resolved.
This patch doesn't change how their references within shared libraries
are resolved.
bfd/
PR ld/23162
* elfxx-x86.c (elf_x86_linker_defined): New function.
(_bfd_x86_elf_link_check_relocs): Use it to mark __bss_start,
_end and _edata locally defined within executables.
ld/
PR ld/23162
* testsuite/ld-elf/pr23162.map: New file.
* testsuite/ld-elf/pr23162.rd: Likewise.
* testsuite/ld-elf/pr23162a.c: Likewise.
* testsuite/ld-elf/pr23162b.c: Likewise.
* testsuite/ld-elf/shared.exp: Run PR ld/23162 tests.
GDB Administrator [Mon, 14 May 2018 00:00:25 +0000 (00:00 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 13 May 2018 00:01:08 +0000 (00:01 +0000)]
Automatic date update in version.in
Alan Modra [Sat, 12 May 2018 06:51:22 +0000 (16:21 +0930)]
score gcc-8 warning fixes
Rather than just silencing the gcc-8 warnings, I decided to rewrite
the buffer handling in the two functions where gcc was warning.
The rest of the file could do with the same treatment.
* config/tc-score.c (s3_do_macro_bcmp): Don't use fixed size
buffers.
(s3_do_macro_bcmpz): Likewise.
Alan Modra [Fri, 11 May 2018 05:04:48 +0000 (14:34 +0930)]
PR20659, Objcopy and change section lma failing
Sections may well belong in multiple segments. The testcase in the PR
saw an allocated section being assigned to an ABIFLAGS segment, then
not being assigned to a LOAD segment because it had already been
handled. To fix that particular problem this patch sets and tests
segment_mark only for LOAD segments. I kept the segment_mark test for
LOAD segments because I think there may otherwise be a problem with
zero size sections.
A few other problems showed up with the testcase. Some targets align
.dynamic, resulting in the test failing with "section .dynamic lma
0x800000c0 adjusted to 0x800000cc" and similar messages. I've tried
to handle that with some more hacks to the segment lma, which do the
right thing for the testcase, but may well fail in other situations.
I've also removed the tests of segment lma (p_paddr) and code involved
in deciding that an adjusted segment no longer covers the file or
program headers. Those test can't be correct in the face of objcopy
--change-section-lma. It may be necessary to reinstate the tests but
do them modulo page size, but we'll see how this goes.
PR 20659
bfd/
* elf.c (rewrite_elf_program_header): Use segment_mark only for
PT_LOAD headers. Delete first_matching_lma and first_suggested_lma.
Instead make matching_lma and suggested_lma pointers to the
sections. Align section vma and lma calculated from segment.
Don't clear includes_phdrs or includes_filehdr based on p_paddr
test. Try to handle alignment padding before first section by
adjusting new segment lma down. Adjust PT_PHDR map p_paddr.
ld/
* testsuite/ld-elf/changelma.d,
* testsuite/ld-elf/changelma.lnk,
* testsuite/ld-elf/changelma.s: New test.
GDB Administrator [Sat, 12 May 2018 00:00:35 +0000 (00:00 +0000)]
Automatic date update in version.in
Andrew Burgess [Thu, 10 May 2018 23:45:55 +0000 (00:45 +0100)]
gdb/x86: Fix write out of mxcsr register for xsave targets
In commit:
commit
8ee22052f690c007556b97eed59f49350ece5ca9
Author: Andrew Burgess <andrew.burgess@embecosm.com>
Date: Thu May 3 17:46:14 2018 +0100
gdb/x86: Handle kernels using compact xsave format
in two places FXSAVE_ADDR was used instead of FXSAVE_MXCSR_ADDR to get
the address of the mxcsr register within the xsave buffer. This will
mean we are potentially accessing the wrong location within the xsave
buffer.
There are no tests included with this patch. The first mistake would
only trigger an issue if/when the user tries to manually set the mxcsr
register to a value that matches the random (value off stack) value
that is in the xsave buffer, in this case the change by the user will
go unnoticed by GDB, and the default value of mxcsr will be preserved.
The second mistake only happens on the code path where all x87
registers are being written out of the register cache. I'm not sure
how to trigger that code path.
gdb/ChangeLog:
* i387-tdep.c (i387_collect_xsave): Use FXSAVE_MXCSR_ADDR not
FXSAVE_ADDR for the mxcsr register.
Max Filippov [Wed, 25 Apr 2018 18:23:38 +0000 (11:23 -0700)]
gdb: xtensa: drop gdb_target definition
gdb_target definitions were removed from configure.tgt in 2007, before
xtensa port was merged. Remove it from the xtensa target as well.
gdb/
2018-05-11 Max Filippov <jcmvbkbc@gmail.com>
* configure.tgt (xtensa*-*-linux*): Drop gdb_target definition.
Pedro Alves [Fri, 11 May 2018 18:18:02 +0000 (19:18 +0100)]
Fix email address in ChangeLog entry
tromey@redhat.com -> palves@redhat.com