• R/O
  • HTTP
  • SSH
  • HTTPS

List of commits

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


users/luisgpm/aarch64-mte-v2
RSS
Rev. Tiempo Autor
5d63830 users/luisgpm/aarch64-mte-v2 2020-06-26 01:23:39 Luis Machado

Add memory tagging testcases

Add an AArch64-specific test and a more generic memory tagging test that
other architectures can run.

Even though architectures not supporting memory tagging can run the memory
tagging tests, the runtime check will make the tests bail out early, as it
would make no sense to proceed without proper support.

gdb/testsuite/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* gdb.arch/aarch64-mte.c: New file.
* gdb.arch/aarch64-mte.exp: New test.
* gdb.base/memtag.c: New file.
* gdb.base/memtag.exp: New test.
* lib/gdb.exp (supports_memtag): New function.

a2bdbbe 2020-06-26 01:23:39 Luis Machado

Add NEWS entry.

Mention the new packets and memory tagging features.

gdb/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* NEWS: Mention memory tagging changes.

8d8848b 2020-06-26 01:23:39 Luis Machado

Document new "x" and "print" memory tagging extensions

Document the changes to the "print" and "x" commands to support memory
tagging.

gdb/doc/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* gdb.texinfo (Data): Document memory tagging changes to the "print"
command.
(Examining Memory): Document memory tagging changes to the "x"
command.
(Memory Tagging): Update with more information on changes to the "x"
and "print" commands.

4167e86 2020-06-26 01:23:39 Luis Machado

Extend "x" and "print" commands to support memory tagging

Extend the "x" and "print" commands to make use of memory tagging
functionality, if supported by the architecture.

The "print" command will point out any possible tag mismatches it finds
when dealing with pointers, in case such a pointer is tagged. No additional
modifiers are needed.

Suppose we have a pointer "p" with value 0x1234 (logical tag 0x0) and that we
have an allocation tag of 0x1 for that particular area of memory. This is the
expected output:

(gdb) p/x p
Logical tag (0x0) does not match the allocation tag (0x1).
$1 = 0x1234

The "x" command has a new 'm' modifier that will enable displaying of
allocation tags alongside the data dump. It will display one allocation
tag per line.

AArch64 has a tag granule of 16 bytes, which means we can have one tag for
every 16 bytes of memory. In this case, this is what the "x" command will
display with the new 'm' modifier:

(gdb) x/32bxm p
<Allocation Tag 0x1 for range [0x1230,0x1240)>
0x1234: 0x01 0x02 0x00 0x00 0x00 0x00 0x00 0x00
0x123c: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
<Allocation Tag 0x1 for range [0x1240,0x1250)>
0x1244: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x124c: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00

(gdb) x/4gxm a
<Allocation Tag 0x1 for range [0x1230,0x1240)>
0x1234: 0x0000000000000201 0x0000000000000000
<Allocation Tag 0x1 for range [0x1240,0x1250)>
0x1244: 0x0000000000000000 0x0000000000000000

gdb/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* printcmd.c (decode_format): Handle the 'm' modifier.
(do_examine): Display allocation tags when required/supported.
(should_validate_memtags): New function.
(print_command_1): Display memory tag mismatches.
* valprint.h (struct format_data) <print_tags>: New field.

8c6f8df 2020-06-26 01:23:39 Luis Machado

Documentation for the new mtag commands

Document the new "mtag" command prefix and all of its subcommands.

gdb/doc/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* gdb.textinfo (Memory Tagging): New subsection.
(AArch64 Memory Tagging Extension): New subsection.

0b4abec 2020-06-26 01:23:39 Luis Machado

New mtag commands

Add new commands under the "mtag" prefix to allow users to inspect, modify and
check memory tags in different ways.

The available subcommands are the following:

- mtag showltag <address>: Shows the logical tag for a particular address.

- mtag setltag <address> <tag>: Prints the address tagged with the logical tag
<tag>

- mtag showatag <address>: Shows the allocation tag for a particular address.

- mtag setatag <address> <length> <tags>: Sets one or more allocation tags to
the specified tags.

- mtag check <address>: Check if the logical tag in <address> matches its
allocation tag.

These commands make use of the memory tagging gdbarch methods, and are still
available, but disabled, when memory tagging is not supported by the
architecture.

gdb/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* printcmd.c: Include gdbsupport/rsp-low.h.
(mtaglist): New static global.
(process_print_command_args): Factored out of
print_command_1.
(print_command_1): Use process_print_command_args.
(show_addr_not_tagged, show_memtag_unsupported, mtag_command)
(mtag_showtag_command, mtag_showltag_command, mtag_showatag_command)
(parse_setltag_input, mtag_setltag_command, parse_setatag_input)
(mtag_setatag_command, mtag_check_command): New functions.
(_initialize_printcmd): Add "mtag" prefix and subcommands.

gdbsupport/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* rsp-low.cc (fromhex): Change error message text to not be
RSP-specific.

653bc1f 2020-06-26 01:23:38 Luis Machado

AArch64: Add gdbserver MTE support

Adds the AArch64-specific memory tagging support (MTE) by implementing the
required hooks and checks.

gdbserver/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* Makefile.in (SFILES): Add /../gdb/nat/aarch64-mte-linux-ptrace.c.
* configure.srv (aarch64*-*-linux*): Add arch/aarch64-mte-linux.o and
nat/aarch64-mte-linux-ptrace.o.
* linux-aarch64-low.cc: Include nat/aarch64-mte-linux-ptrace.h.
(class aarch64_target) <supports_memory_tagging>
<fetch_memtags, store_memtags>: New method overrides.
(aarch64_target::supports_memory_tagging)
(aarch64_target::fetch_memtags)
(aarch64_target::store_memtags): New methods.

cd55085 2020-06-26 01:23:38 Luis Machado

AArch64: Report tag violation error information

Whenever a memory tag violation occurs, we get a SIGSEGV. Additional
information can be obtained through the siginfo data structure.

For AArch64 the Linux kernel may expose the fault address and tag
information, if we have a synchronous event. Otherwise there is
not fault address available.

gdb/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* aarch64-linux-tdep.c
(aarch64_linux_handle_segmentation_fault): New function.
(aarch64_linux_init_abi): Register
aarch64_linux_handle_segmentation_fault as segmentation fault hook.
* arch/aarch64-linux.h (SEGV_MTEAERR): Define.
(SEGV_MTESERR): Define.

dddcc4b 2020-06-26 01:23:38 Luis Machado

AArch64: Add unit testing for logical tag set/get operations

Add some unit testing to exercise setting/getting logical tags in the
AArch64 implementation.

gdb/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* aarch64-linux-tdep.c: Include gdbsupport/selftest.h.
(aarch64_linux_ltag_tests): New function.
(_initialize_aarch64_linux_tdep): Register aarch64_linux_ltag_tests.

74e76b7 2020-06-26 01:23:38 Luis Machado

AArch64: Implement the memory tagging gdbarch hooks

This patch implements the memory tagging gdbarch hooks for AArch64, for
the MTE feature.

gdb/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* aarch64-linux-tdep.c: Include target.h, arch-utils.h, value.h.
(aarch64_linux_get_atag, aarch64_linux_tagged_address_p)
(aarch64_linux_memtag_mismatch_p, aarch64_linux_set_memtags)
(aarch64_linux_get_memtag, aarch64_linux_memtag_to_string): New
functions.
(aarch64_linux_init_abi): Initialize MTE-related gdbarch hooks.
* arch/aarch64-mte-linux.c (make_ltag_bits, make_ltag)
(aarch64_linux_set_ltag, aarch64_linux_get_ltag): New functions.
* arch/aarch64-mte-linux.h (MTE_LOGICAL_TAG_START_BIT)
(MTE_LOGICAL_MAX_VALUE): Define.
(make_ltag_bits, make_ltag, aarch64_linux_set_ltag)
(aarch64_linux_get_ltag): New prototype.

0c7c65e 2020-06-26 01:23:38 Luis Machado

Refactor parsing of /proc/<pid>/smaps

The Linux kernel exposes the information about MTE-protected pages via the
proc filesystem, more specifically through the smaps file.

What we're looking for is a mapping with the 'mt' flag, which tells us that
mapping was created with a PROT_MTE flag and, thus, is capable of using memory
tagging.

We already parse that file for other purposes (core file
generation/filtering), so this patch refactors the code to make the parsing
of the smaps file reusable for memory tagging.

The function linux_address_in_memtag_page uses the refactored code to allow
querying for memory tag support in a particular address, and it gets used in the
next patch.

gdb/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* linux-tdep.c (struct smaps_vmflags) <memory_tagging>: New flag
bit.
(struct smaps_data): New struct.
(decode_vmflags): Handle the 'mt' flag.
(parse_smaps_data): New function, refactored from
linux_find_memory_regions_full.
(linux_address_in_memtag_page): New function.
(linux_find_memory_regions_full): Refactor into parse_smaps_data.
* linux-tdep.h (linux_address_in_memtag_page): New prototype.

e5f4e60 2020-06-26 01:23:38 Luis Machado

AArch64: Implement memory tagging target methods for AArch64

The patch implements the memory tagging target hooks for AArch64, so we
can handle MTE.

gdb/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* Makefile.in (ALL_64_TARGET_OBS): Add arch/aarch64-mte-linux.o.
(HFILES_NO_SRCDIR): Add arch/aarch64-mte-linux.h and
nat/aarch64-mte-linux-ptrace.h.
* aarch64-linux-nat.c: Include nat/aarch64-mte-linux-ptrace.h.
(aarch64_linux_nat_target) <supports_memory_tagging>: New method
override.
<fetch_memtags>: New method override.
<store_memtags>: New method override.
(aarch64_linux_nat_target::supports_memory_tagging): New method.
(aarch64_linux_nat_target::fetch_memtags): New method.
(aarch64_linux_nat_target::store_memtags): New method.
* arch/aarch64-mte-linux.c: New file.
* arch/aarch64-mte-linux.h: Include gdbsupport/common-defs.h.
(MTE_GRANULE_SIZE): Define.
(get_tag_granules): New prototype.
* configure.nat (NATDEPFILES): Add nat/aarch64-mte-linux-ptrace.o.
* configure.tgt (aarch64*-*-linux*): Add arch/aarch64-mte-linux.o.
* nat/aarch64-mte-linux-ptrace.c: New file.
* nat/aarch64-mte-linux-ptrace.h: New file.

5d523a6 2020-06-26 01:23:38 Luis Machado

AArch64: Add MTE ptrace requests

This patch adds the required ptrace request definitions into a new include
file that will be used by the next patches.

gdb/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* Makefile.in (HFILES_NO_SRCDIR): Add nat/aarch64-mte-linux-ptrace.h.
* nat/aarch64-mte-linux-ptrace.h: New file.

471cecc 2020-06-26 01:23:38 Luis Machado

AArch64: Add MTE register set support for GDB and gdbserver

AArch64 MTE support in the Linux kernel exposes a couple new read-only registers
through ptrace. This patch adds the required code to support them.

include/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* elf/common.h (NT_ARM_MTE): Define.

gdb/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* aarch64-linux-nat.c (fetch_mte_from_thread): New function.
(aarch64_linux_nat_target::fetch_registers): Update to call
fetch_mte_from_thread.
* aarch64-linux-tdep.c
(aarch64_linux_iterate_over_regset_sections): Handle MTE register
section.
* aarch64-tdep.c (aarch64_mte_register_names): New struct.
(aarch64_cannot_store_register): Handle MTE registers.
(aarch64_gdbarch_init): Initialize and setup MTE registers.
* aarch64-tdep.h (gdbarch_tdep) <mte_reg_base>: New field.
<has_mte>: New method.
* arch/aarch64-linux.h (AARCH64_LINUX_SIZEOF_MTE): Define.

gdbserver/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* linux-aarch64-low.cc (aarch64_store_mteregset): New function.
(aarch64_regsets): Add MTE register set entry.
(aarch64_sve_regsets): Add MTE register set entry.

156168c 2020-06-26 01:23:38 Luis Machado

AArch64: Add target description/feature for MTE registers

This patch adds a target description and feature "mte" for aarch64.

It includes a couple registers: sctlr and gcr. Both 64-bit in size.

The patch also adjusts the code that creates the target descriptions at
runtime based on CPU feature checks.

gdb/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* aarch64-linux-nat.c
(aarch64_linux_nat_target::read_description): Take MTE flag into
account.
Slight refactor to hwcap flag checking.
* aarch64-linux-tdep.c
(aarch64_linux_core_read_description): Likewise.
* aarch64-tdep.c (tdesc_aarch64_list): Add one more dimension for
MTE.
(aarch64_read_description): Add mte_p parameter and update to use it.
Update the documentation.
(aarch64_gdbarch_init): Update call to aarch64_read_description.
* aarch64-tdep.h (aarch64_read_description): Add mte_p parameter.
* arch/aarch64.c: Include ../features/aarch64-mte.c.
(aarch64_create_target_description): Add mte_p parameter and update
the code to use it.
* arch/aarch64.h (aarch64_create_target_description): Add mte_p
parameter.
* features/Makefile (FEATURE_XMLFILES): Add aarch64-mte.xml.
* features/aarch64-mte.c: New file, generated.
* features/aarch64-mte.xml: New file.

gdbserver/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* linux-aarch64-ipa.cc (get_ipa_tdesc): Update call to
aarch64_linux_read_description.
(initialize_low_tracepoint): Likewise.
* linux-aarch64-low.cc (aarch64_target::low_arch_setup): Take MTE flag
into account.
* linux-aarch64-tdesc.cc (tdesc_aarch64_list): Add one more dimension
for MTE.
(aarch64_linux_read_description): Add mte_p parameter and update to
use it.
* linux-aarch64-tdesc.h (aarch64_linux_read_description): Add mte_p
parameter.

04af192 2020-06-26 01:23:38 Luis Machado

AArch64: Add MTE CPU feature check support

This patch is a preparation for the next patches implementing MTE. It just adds
a HWCAP2 constant for MTE, creates a new generic arch/aarch64-mte-linux.h file
and includes that file in the source files that will use it.

gdb/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* Makefile.in (HFILES_NO_SRCDIR): Add arch/aarch64-mte-linux.h.
* aarch64-linux-nat.c: Include arch/aarch64-mte-linux.h.
* aarch64-linux-tdep.c: Likewise
* arch/aarch64-mte-linux.h: New file.

gdbserver/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* linux-aarch64-low.cc: Include arch/aarch64-mte-linux.h.

d0c98d5 2020-06-26 01:23:38 Luis Machado

Documentation for memory tagging remote packets

Document the remote packet changes to support memory tagging.

gdb/doc/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* gdb.texinfo (General Query Packets): Document qMemTags and
QMemTags.
Document the "memory-tagging" feature.

6f5bfe5 2020-06-26 01:23:38 Luis Machado

Unit tests for gdbserver memory tagging remote packets

Add some unit testing to exercise the functions handling the qMemTags and
QMemTags packets as well as feature support.

gdbserver/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* server.cc (test_memory_tagging_functions): New function.
(captured_main): Register test_memory_tagging_functions.

9ffb838 2020-06-26 01:23:38 Luis Machado

GDBserver remote packet support for memory tagging

This patch adds the generic remote bits to gdbserver so it can check for memory
tagging support and handle fetch tags and store tags requests.

gdbserver/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* remote-utils.cc (decode_m_packet_params): Renamed from ...
(decode_m_packet): ... this, which now calls decode_m_packet_params.
(decode_M_packet): Use decode_m_packet_params.
* remote-utils.h (decode_m_packet_params): New prototype.
* server.cc (create_fmemtags_reply, parse_smemtags_request): New
functions.
(handle_general_set): Handle the QMemTags packet.
(parse_fmemtags_request): New function.
(handle_query): Handle the qMemTags packet and advertise memory
tagging support.
(captured_main): Initialize memory tagging flag.
* server.h (struct client_state): Initialize memory tagging flag.
* target.cc (process_stratum_target::supports_memory_tagging)
(process_stratum_target::fetch_memtags)
(process_stratum_target::store_memtags): New methods.
* target.h: Include gdbsupport/byte-vector.h.
(class process_stratum_target) <supports_memory_tagging>
<fetch_memtags, store_memtags>: New class virtual methods.
(target_supports_memory_tagging): Define.

ebd61ee 2020-06-26 01:23:38 Luis Machado

Unit testing for GDB-side remote memory tagging handling

Include some unit testing for the functions handling the new qMemTags and
QMemTags packets.

gdb/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* remote: Include gdbsupport/selftest.h.
(test_memory_tagging_functions): New function.
(_initialize_remote): Register test_memory_tagging_functions.

455ae69 2020-06-26 01:23:38 Luis Machado

Add GDB-side remote target support for memory tagging

This patch adds memory tagging support to GDB's remote side, with
packet string checks, new packet support and an implementation of
the two new tags methods fetch_atags and store_atags.

gdb/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* remote.c (PACKET_memory_tagging_feature): New enum.
(remote_memory_tagging_p): New function.
(remote_protocol_features): New "memory-tagging" entry.
(remote_target::remote_query_supported): Handle memory tagging
support.
(remote_target::supports_memory_tagging): Implement.
(create_fmemtags_request, parse_fmemtags_reply)
(create_smemtags_request): New functions.
(remote_target::fetch_memtags): Implement.
(remote_target::store_memtags): Implement.
(_initialize_remote): Add new "memory-tagging-feature"
config command.

f8eaa6c 2020-06-26 01:23:38 Luis Machado

New gdbarch memory tagging hooks

This patch adds a couple gdbarch hooks:

gdbarch_tagged_address_p checks if a particular address is tagged or not.

gdbarch_address_tag returns the tag for a particular address, if tagged.

I've used struct value as opposed to straight CORE_ADDR so other architectures
can use the infrastructure without having to rely on fixed types.

gdb/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* arch-utils.c (default_memtag_to_string, +default_tagged_address_p)
(default_memtag_mismatch_p, default_set_memtags)
(default_get_memtag): New functions.
* arch-utils.h (default_memtag_to_string, default_tagged_address_p)
(default_memtag_mismatch_p, default_set_memtags)
(default_get_memtag): New prototypes.
* gdbarch.c: Regenerate.
* gdbarch.h: Regenerate.
* gdbarch.sh (memtag_to_string, tagged_address_p, memtag_mismatch_p)
(set_memtags, get_memtag, memtag_granule_size): New gdbarch hooks.
(enum memtag_type): New enum.

193b282 2020-06-26 01:23:38 Luis Machado

New target methods for memory tagging support

This patch starts adding some of the generic pieces to accomodate memory
tagging.

We have three new target methods:

- supports_memory_tagging: Checks if the target supports memory tagging. This
defaults to false for targets that don't support memory tagging.

- fetch_memtags: Fetches the allocation tags associated with a particular
memory range [address, address + length).

The default is to return 1 without returning any tags. This should only
be called if memory tagging is supported.

- store_memtags: Stores a set of allocation tags for a particular memory
range [address, address + length).

The default is to return 1, which indicates an error. This should only
be called if memory tagging is supported.

It also adds a control option for enabling/disabling memory tagging
manually: set memory-tagging on/off.

The default is "on", with GDB making its use conditional to the
architecture supporting memory tagging.

gdb/ChangeLog:

YYYY-MM-DD Luis Machado <luis.machado@linaro.org>

* printcmd.c (memtag): New static global.
(show_memtag): New function.
(_initialize_printcmd): Add set/show memory-tagging command.
* remote.c (remote_target) <supports_memory_tagging>: New method
override.
<fetch_memtags>: New method override.
<store_memtags>: New method override.
(remote_target::supports_memory_tagging): New method.
(remote_target::fetch_memtags): New method.
(remote_target::store_memtags): New method.
* target-delegates.c
(dummy_target) <supports_memory_tagging>: New method override.
<fetch_memtags>: New method override.
<store_memtags>: New method override.
(debug_target) <supports_memory_tagging>: New method override.
<fetch_memtags>: New method override.
<store_memtags>: New method override.
(target_ops::supports_memory_tagging): New method.
(target_ops::fetch_memtags): New method.
(target_ops::store_memtags): New method.
(dummy_target::supports_memory_tagging): New method.
(dummy_target::fetch_memtags): New method.
(dummy_target::store_memtags): New method.
(debug_target::supports_memory_tagging): New method.
(debug_target::fetch_memtags): New method.
(debug_target::store_memtags): New method.
* target.h (struct target_ops) <supports_memory_tagging>: New virtual
method.
<fetch_memtags: New virtual method.
<store_memtags>: New virtual method.
(target_supports_memory_tagging): Define.
(target_fetch_memtags): Define.
(target_store_memtags): Define.

bb6e55f 2020-06-26 00:56:12 Rainer Orth

Remove obsolete gdbarch_static_transform_name

gdbarch_static_transform_name is completely Solaris-specific or rather
specific to the Studio compilers. Studio cc has deprecated Stabs support
in the 12.4 release back in 2015, GCC has defaulted to DWARF-2 on Solaris
7+ since 2004 and Stabs themselves are pretty much obsolete, so the whole
code can go.

Tested on sparcv9-sun-solaris2.11 and x86_64-pc-linux-gnu with
--enable-targets=all.

* sol2-tdep.c (sol2_static_transform_name): Remove.
(sol2_init_abi): Don't register it.
* gdbarch.sh (static_transform_name): Remove.
* gdbarch.c, gdbarch.h: Regenerate.

* dbxread.c (read_dbx_symtab) <'S'>: Remove call to
gdbarch_static_transform_name.
* mdebugread.c (parse_partial_symbols) <'S'>: Likewise.
* stabsread.c (define_symbol) <'X'>: Remove.
(define_symbol) <'S'>: Remove gdbarch_static_transform_name
handling.
<'V'>: Likewise.
* xcoffread.c (scan_xcoff_symtab): Remove gdbarch.
<'S'>: Remove call to gdbarch_static_transform_name.

c6d3683 2020-06-26 00:48:14 Rainer Orth

Use fork instead of vfork on Solaris

The gdb.mi/mi-exec-run.exp test never completed/timed out on Solaris for
quite some time:

FAIL: gdb.mi/mi-exec-run.exp: inferior-tty=main: mi=main: force-fail=1: run failure detected (timeout)

This is for gdb trying to exec mi-exec-run.nox, a copy of mi-exec-run
with execute permissions removed.

The process tree at this point looks like this:

21254 /vol/gcc/bin/expect -- /vol/gcc/share/dejagnu/runtest.exp GDB_PARALLEL=yes --outdir=outputs/gdb.mi/mi-exec-run-vfork gdb.mi/mi-exec-run.exp
21300 <defunct>
21281 <defunct>
21294 $obj/gdb/testsuite/../../gdb/gdb -nw -nx -data-directory $obj/gdb/testsuite/../data-directory -i=mi
21297 $obj/gdb/testsuite/../../gdb/gdb -nw -nx -data-directory $obj/gdb/testsuite/../data-directory -i=mi

The parent gdb hangs here:

21294: $obj/gdb/testsuite/../../gdb/gdb -nw
------------ lwp# 1 / thread# 1 ---------------
0000000000000000 SYS#0 ()
0000000000daeccd procfs_target::create_inferior(char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char**, int) () + 97 (procfs.c:2853)
0000000000ca63a7 run_command_1(char const*, int, run_how) () + 349 (basic_string.h:187)
0000000000ca6516 start_command(char const*, int) () + 26 (infcmd.c:584)
0000000000b3ca8e do_const_cfunc(cmd_list_element*, char const*, int) () + f (cli-decode.c:96)
0000000000b3ed77 cmd_func(cmd_list_element*, char const*, int) () + 32 (cli-decode.c:2113)
0000000000f2d219 execute_command(char const*, int) () + 455 (top.c:657)
0000000000d4ad77 mi_execute_cli_command(char const*, int, char const*) () + 242 (basic_string.h:187)
0000000000d4ae80 mi_cmd_exec_run(char const*, char**, int) () + ba (mi-main.c:473)

with these process flags

21294: $obj/gdb/testsuite/../../gdb/gdb -nw
data model = _LP64 flags = VFORKP|ORPHAN|MSACCT|MSFORK
sigpend = 0x00004103,0x00000000,0x00000000
/1: flags = 0
sigmask = 0xffbffeff,0xffffffff,0x000000ff
cursig = SIGKILL
/2: flags = DETACH|STOPPED|ASLEEP lwp_park(0x0,0x0,0x0)
why = PR_SUSPENDED
sigmask = 0x000a2002,0x00000000,0x00000000
[...]

while the child sits at

21297: $obj/gdb/testsuite/../../gdb/gdb -nw
00007fffbf078a0b execve (7fffbffff756, 7fffbfffec58, 7fffbfffec90, 0)
00007fffbef84cf6 execvpex () + f6
00007fffbef84f45 execvp () + 15
0000000000d60a44 fork_inferior(char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char**, void (*)(), gdb::function_view<void (int)>, void (*)(), char const*, void (*)(char const*, char* const*, char* const*)) () + 47f (fork-inferior.c:423)
0000000000daeccd procfs_target::create_inferior(char const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char**, int) () + 97 (procfs.c:2853)
0000000000ca63a7 run_command_1(char const*, int, run_how) () + 349 (basic_string.h:187)
0000000000ca6516 start_command(char const*, int) () + 26 (infcmd.c:584)
0000000000b3ca8e do_const_cfunc(cmd_list_element*, char const*, int) () + f (cli-decode.c:96)
0000000000b3ed77 cmd_func(cmd_list_element*, char const*, int) () + 32 (cli-decode.c:2113)
0000000000f2d219 execute_command(char const*, int) () + 455 (top.c:657)
0000000000d4ad77 mi_execute_cli_command(char const*, int, char const*) () + 242 (basic_string.h:187)
0000000000d4ae80 mi_cmd_exec_run(char const*, char**, int) () + ba (mi-main.c:473)

with

21297: $obj/gdb/testsuite/../../gdb/gdb -nw
data model = _LP64 flags = MSACCT|MSFORK
exitset = 0x00000000 0x04000000 0x00000000 0x00000000
0x00000000 0x00000000 0x00000000 0x00000000
/1: flags = STOPPED|ISTOP execve(0x7fffbffff756,0x7fffbfffec58,0x7fffbfffec90,0x0)
why = PR_SYSEXIT what = execve

We have a deadlock here: the execve in the child cannot return until the
parent has handled the PR_SYSEXIT while the parent cannot run with a
vfork'ed child as documented in proc(4):

The child of a vfork(2) borrows the parent's address space. When a
vfork(2) is executed by a traced process, all watched areas established
for the parent are suspended until the child terminates or performs an
exec(2). Any watched areas established independently in the child are
cancelled when the parent resumes after the child's termination or
exec(2). PCWATCH fails with EBUSY if applied to the parent of a
vfork(2) before the child has terminated or performed an exec(2). The
PR_VFORKP flag is set in the pstatus structure for such a parent
process.

In that situation, the parent cannot be killed even with SIGKILL (as
runtest will attempt once the timeout occurs; the pending signal can be
seen in the pflags output above), so the whole test hangs until one
manually kills the child process.

Fortunately, there's an easy way out: when using fork instead of vfork,
the problem doesn't occur, and this is what the current patch does: it
calls fork_inferior with a dummy pre_trace_fun arg.

Tested on amd64-pc-solaris2.11 and sparcv9-sun-solaris2.11.

* procfs.c (procfs_pre_trace): New function.
(procfs_target::create_inferior): Pass it to fork_inferior.

a7e6196 2020-06-25 20:54:42 Rainer Orth

Don't include *sol2-tdep.o on Linux/sparc*

Linux/sparc* currently links Solaris-specific files (sparc-sol2-tdep.o,
sparc64-sol2-tdep.o, sol2-tdep.o) for no apparent reason. It has no
business doing so, and none of the functions/variables defined there are
used explicitly. If support for the Solaris OSABI were desired, this
should be done using --enable-targets instead.

Since neither sparc{32,64}_sol2_init_abi currently declared in common
headers (sparc*-tdep.h) are used outside their source files, they are made
static and the declarations removed.

Tested on sparcv9-sun-solaris2.11 and sparc64-unknown-linux-gnu.

* configure.tgt <sparc-*-linux*> (gdb_target_obs): Remove
sparc-sol2-tdep.o, sol2-tdep.o, sparc64-sol2-tdep.o.
<sparc64-*-linux*> (gdb_target_obs): Remove sparc64-sol2-tdep.o,
sol2-tdep.o, sparc-sol2-tdep.o.
* sparc-sol2-tdep.c (sparc32_sol2_init_abi): Make static.
* sparc-tdep.h (sparc32_sol2_init_abi): Remove.
* sparc64-sol2-tdep.c (sparc64_sol2_init_abi): Make static.
* sparc64-tdep.h (sparc64_sol2_init_abi): Remove.

d412e69 2020-06-25 20:43:46 Rainer Orth

Move common handlers to sol2_init_abi

There's some overlap and duplication between 32 and 64-bit Solaris/SPARC
and x86 tdep files, in particular

sol2_core_pid_to_str
*_sol2_sigtramp_p
sol2_skip_solib_resolver
*_sol2_static_transform_name (forgotten on amd64)
set_gdbarch_sofun_address_maybe_missing (likewise)

This patch avoids this by centralizing common code in sol2-tdep.c.
While sparc_sol2_pc_in_sigtramp and sparc_sol2_static_transform_name
were declared in the shared sparc-tdep.h, they were only used in Solaris
files.

Tested on amd64-pc-solaris2.11, i386-pc-solaris2.11,
sparcv9-sun-solaris2.11, and sparc-sun-solaris2.11, and
sparc64-unknown-linux-gnu.

* amd64-sol2-tdep.c (amd64_sol2_sigtramp_p): Remove.
(amd64_sol2_init_abi): Use sol2_sigtramp_p.
Call sol2_init_abi.
Remove calls to set_gdbarch_skip_solib_resolver,
set_gdbarch_core_pid_to_str.
* i386-sol2-tdep.c (i386_sol2_sigtramp_p): Remove.
(i386_sol2_static_transform_name): Remove.
(i386_sol2_init_abi): Call sol2_init_abi.
Remove calls to set_gdbarch_sofun_address_maybe_missing,
set_gdbarch_static_transform_name,
set_gdbarch_skip_solib_resolver, set_gdbarch_core_pid_to_str.
Use sol2_sigtramp_p.
* sol2-tdep.c (sol2_pc_in_sigtramp): New function.
(sol2_sigtramp_p): New function.
(sol2_static_transform_name): New function.
(sol2_skip_solib_resolver, sol2_core_pid_to_str): Make static.
(sol2_init_abi): New function.
* sol2-tdep.h (sol2_sigtramp_p, sol2_init_abi): Declare.
(sol2_skip_solib_resolver, sol2_core_pid_to_str): Remove.
* sparc-sol2-tdep.c (sparc_sol2_pc_in_sigtramp): Remove.
(sparc32_sol2_sigtramp_frame_sniffer): Just call sol2_sigtramp_p.
(sparc_sol2_static_transform_name): Remove.
(sparc32_sol2_init_abi): Call sol2_init_abi.
Remove calls to set_gdbarch_sofun_address_maybe_missing,
set_gdbarch_static_transform_name,
set_gdbarch_skip_solib_resolver,
set_gdbarch_core_pid_to_str.
* sparc-tdep.h (sparc_sol2_pc_in_sigtramp)
(sparc_sol2_static_transform_name): Remove
* sparc64-sol2-tdep.c (sparc64_sol2_sigtramp_frame_sniffer): Just
call sol2_sigtramp_p.
(sparc64_sol2_init_abi): Call sol2_init_abi.
Remove calls to set_gdbarch_sofun_address_maybe_missing,
set_gdbarch_static_transform_name,
set_gdbarch_skip_solib_resolver, set_gdbarch_core_pid_to_str.

42cc830 2020-06-25 19:29:24 Nick Clifton

Update the Swedish translation in the gprof/ subdirectory.

* po/sv.po: Updated Swedish translation.

6248d9d 2020-06-25 19:16:42 Nick Clifton

Remove the use of the register keyword in the libiberty.h header file - it is deprecated and incompatible with C++17.

* libiberty.h (bsearch_r): Remove use of the register keyword from
the prototype.

b59d128 2020-06-25 19:11:51 Nick Clifton

Stop the assembler from generating R_ARM_THM_JMP11 relocations as these are not supported by the kernel.

PR 26141
* config/tc-arm.c (arm_force_relocation): Force resolution of
BFD_RELOC_THUMB_PCREL_BRANCH12 relocations.
* testsuite/gas/arm/plt-1.d: Adjust expected disassembly.