• R/O
  • HTTP
  • SSH
  • HTTPS

List of commits

標籤
無標籤

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


All branches
RSS
修訂. 時間 作者
c9debfb 2020-06-17 17:25:09 Andrew Burgess

gdb: Convert language la_get_symbol_name_matcher field to a method

This commit changes the language_data::la_get_symbol_name_matcher
function pointer member variable into a member function of
language_defn.

There should be no user visible changes after this commit.

Before this commit access to the la_get_symbol_name_matcher function
pointer was through the get_symbol_name_matcher function, which looked
something like this (is pseudo-code):

<return-type>
get_symbol_name_matcher (language_defn *lang, <other args>)
{
if (current_language == ada)
current_language->la_get_symbol_name_matcher (<other args>);
else
lang->la_get_symbol_name_matcher (<other args>);
}

In this commit I moved the get_symbol_name_matcher as a non-virtual
function in the language_defn base class, I then add a new virtual
method that is only used from within get_symbol_name_matcher, this can
then be overridden by specific languages as needed. So we now have:

class language_defn
{
<return-type> get_symbol_name_matcher (<args>)
{
if (current_language == ada)
return current_language->get_symbol_name_matcher_inner (<args>);
else
return this->get_symbol_name_matcher_inner (<args>);
}

virtual <return-type> get_symbol_name_matcher_inner (<args>)
{
....
}
}

gdb/ChangeLog:

* ada-lang.c (ada_get_symbol_name_matcher): Update header comment.
(ada_language_data): Delete la_get_symbol_name_matcher
initializer.
(language_defn::get_symbol_name_matcher_inner): New member
function.
* c-lang.c (c_language_data): Delete la_get_symbol_name_matcher
initializer.
(cplus_language_data): Likewise.
(cplus_language::get_symbol_name_matcher_inner): New member
function.
(asm_language_data): Delete la_get_symbol_name_matcher initializer.
(minimal_language_data): Likewise.
* cp-support.h (cp_get_symbol_name_matcher): Update header comment.
* d-lang.c (d_language_data): Delete la_get_symbol_name_matcher
initializer.
* dictionary.c (iter_match_first_hashed): Update call to
get_symbol_name_matcher.
(iter_match_next_hashed): Likewise.
(iter_match_next_linear): Likewise.
* dwarf2/read.c (dw2_expand_symtabs_matching_symbol): Likewise.
* f-lang.c (f_language_data): Delete la_get_symbol_name_matcher
initializer.
(f_language::get_symbol_name_matcher_inner): New member function.
* go-lang.c (go_language_data): Delete la_get_symbol_name_matcher
initializer.
* language.c (default_symbol_name_matcher): Update header comment,
make static.
(language_defn::get_symbol_name_matcher): New definition.
(language_defn::get_symbol_name_matcher_inner): Likewise.
(get_symbol_name_matcher): Delete.
(unknown_language_data): Delete la_get_symbol_name_matcher
initializer.
(auto_language_data): Likewise.
* language.h (language_data): Delete la_get_symbol_name_matcher
field.
(language_defn::get_symbol_name_matcher): New member function.
(language_defn::get_symbol_name_matcher_inner): Likewise.
(default_symbol_name_matcher): Delete declaration.
* linespec.c (find_methods): Update call to
get_symbol_name_matcher.
* m2-lang.c (m2_language_data): Delete la_get_symbol_name_matcher
initializer.
* minsyms.c (lookup_minimal_symbol): Update call to
get_symbol_name_matcher.
(iterate_over_minimal_symbols): Likewise.
* objc-lang.c (objc_language_data): Delete
la_get_symbol_name_matcher initializer.
* opencl-lang.c (opencl_language_data): Likewise.
* p-lang.c (pascal_language_data): Likewise.
* psymtab.c (psymbol_name_matches): Update call to
get_symbol_name_matcher.
* rust-lang.c (rust_language_data): Delete
la_get_symbol_name_matcher initializer.
* symtab.c (symbol_matches_search_name): Update call to
get_symbol_name_matcher.
(compare_symbol_name): Likewise.

9a49ad8 2020-06-17 17:25:09 Andrew Burgess

gdb: Convert language la_compute_program field to a method

This commit changes the language_data::la_compute_program function
pointer member variable into a member function of language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* ada-lang.c (ada_language_data): Delete la_compute_program
initializer.
* c-lang.c (c_language_data): Likewise.
(c_language::compute_program): New member function.
(cplus_language_data): Delete la_compute_program initializer.
(cplus_language::compute_program): New member function.
(asm_language_data): Delete la_compute_program initializer.
(minimal_language_data): Likewise.
* c-lang.h (c_compute_program): Update comment.
(cplus_compute_program): Likewise.
* compile/compile-c-support.c (c_compute_program): Likewise.
(cplus_compute_program): Likewise.
* compile/compile.c (compile_to_object): Update call to
la_compute_program.
* d-lang.c (d_language_data): Delete la_compute_program
initializer.
* f-lang.c (f_language_data): Likewise.
* go-lang.c (go_language_data): Likewise.
* language.c (unknown_language_data): Likewise.
(auto_language_data): Likewise.
* language.h (language_data): Delete la_compute_program field.
(language_defn::compute_program): New member function.
* m2-lang.c (m2_language_data): Delete la_compute_program
initializer.
* objc-lang.c (objc_language_data): Likewise.
* opencl-lang.c (opencl_language_data): Likewise.
* p-lang.c (pascal_language_data): Likewise.
* rust-lang.c (rust_language_data): Likewise.

eff93b4 2020-06-17 17:25:09 Andrew Burgess

gdb: Convert language la_class_name_from_physname field to a method

This commit changes the language_data::la_class_name_from_physname function
pointer member variable into a member function of language_defn.

There should be no user visible changes after this commit.

gdb/ChangeLog:

* ada-lang.c (ada_language_data) Delete
la_class_name_from_physname initializer.
* c-lang.c (c_language_data): Likewise.
(cplus_language_data): Likewise.
(cplus_language::class_name_from_physname): New member function.
(asm_language_data): Delete la_class_name_from_physname
initializer.
(minimal_language_data): Likewise.
* d-lang.c (d_language_data): Likewise.
* dwarf2/read.c (guess_partial_die_structure_name): Update to call
method on language_defn class.
(guess_full_die_structure_name): Likewise.
* f-lang.c (f_language_data): Delete la_class_name_from_physname
initializer.
* go-lang.c (go_language_data): Likewise.
* language.c (language_class_name_from_physname): Delete.
(unk_lang_class_name): Delete.
(unknown_language_data): Delete la_class_name_from_physname
initializer.
(auto_language_data): Likewise.
* language.h (language_data): Delete la_class_name_from_physname
field.
(language_defn::class_name_from_physname): New function.
(language_class_name_from_physname): Delete declaration.
* m2-lang.c (m2_language_data): Delete la_class_name_from_physname
initializer.
* objc-lang.c (objc_language_data): Likewise.
* opencl-lang.c (opencl_language_data): Likewise.
* p-lang.c (pascal_language_data): Likewise.
* rust-lang.c (rust_language_data): Likewise.

de54374 2020-06-17 09:02:20 Tom Tromey

Use macros for TUI window names

Christian pointed out that tui-layout.c hard-codes various window
names. This patch changes the code to use the macros from tui-data.h
instead. For each window, I searched for uses of the name; but I only
found any in tui-layout.c. This also adds a new macro to account for
the "status" window.

gdb/ChangeLog
2020-06-16 Tom Tromey <tom@tromey.com>

* tui/tui-data.h (STATUS_NAME): New macro.
* tui/tui-layout.c (tui_remove_some_windows)
(initialize_known_windows, tui_register_window)
(tui_layout_split::remove_windows, initialize_layouts)
(tui_new_layout_command): Don't use hard-coded window names.

a350efd 2020-06-17 09:02:20 Tom Tromey

Fix crash when exiting TUI with gdb -tui

PR tui/25348 points out that, when "gdb -tui" is used, then exiting
the TUI will cause a crash.

This happens because tui_setup_io stashes some readline variables --
but because this happens before readline is initialized, some of these
are NULL. Then, when exiting the TUI, the NULL values are "restored",
causing a crash in readline.

This patch fixes the problem by ensuring that readline is initialized
first. Back in commit 11061048d ("Give a name to the TUI SingleKey
keymap"), a call to rl_initialize was removed from
tui_initialize_readline; this patch resurrects the call, but moves it
to the end of the function, so as not to remove the ability to modify
the SingleKey map from .inputrc.

gdb/ChangeLog
2020-06-16 Tom Tromey <tom@tromey.com>

PR tui/25348:
* tui/tui.c (tui_ensure_readline_initialized): Rename from
tui_initialize_readline. Only run once. Call rl_initialize.
* tui/tui.h (tui_ensure_readline_initialized): Rename from
tui_initialize_readline.
* tui/tui-io.c (tui_setup_io): Call
tui_ensure_readline_initialized.
* tui/tui-interp.c (tui_interp::init): Update.

39ec049 2020-06-17 09:02:20 Tom Tromey

Fix C-x 1 from gdb prompt

Pedro pointed out on irc that C-x 1 from the gdb prompt will cause a
crash. This happened because of a bug in remove_windows -- it would
always remove all the windows from the layout. This patch fixes this
bug, and also arranges to have C-x 1 preserve the status window.

gdb/ChangeLog
2020-06-16 Tom Tromey <tom@tromey.com>

* tui/tui-layout.c (tui_layout_split::remove_windows): Fix logic.
Also preserve the status window.

a1e294c 2020-06-17 09:00:45 GDB Administrator

Automatic date update in version.in

24720f6 2020-06-17 09:00:31 GDB Administrator

Automatic date update in version.in

1ce22ee 2020-06-17 09:00:15 GDB Administrator

Automatic date update in version.in

d2d1ea2 2020-06-17 08:48:38 Tom Tromey

Fix crash when TUI window creation fails

If a TUI window is written in Python, and if the window construction
function fails, then gdb will crash. This patch fixes the crash.

gdb/ChangeLog
2020-06-16 Tom Tromey <tom@tromey.com>

* python/py-tui.c (tui_py_window::~tui_py_window): Handle case
where m_window==nullptr.

gdb/testsuite/ChangeLog
2020-06-16 Tom Tromey <tom@tromey.com>

* gdb.python/tui-window.py (failwin): New function. Register it
as a TUI window type.
* gdb.python/tui-window.exp: Create new "fail" layout. Test it.

708a2ff 2020-06-17 02:07:15 Cui,Lili

x86: Correct noavx512_vp2intersect

* config/tc-i386.c (cpu_arch): Correct noavx512_vp2intersect
cpu_arch to CPU_ANY_VP2INTERSECT_FLAGS.
* doc/c-i386.texi: Add avx512_vp2intersect.

5f89899 2020-06-16 22:14:13 Alan Modra

Re: Use __asm__ rather than asm in ld testsuite

* testsuite/ld-elf/pr19553c.c: Replace asm with __asm__.
* testsuite/ld-elfvers/vers27b.c: Likewise.

dc57be6 users/luisgpm/aarch64-mte-v1 2020-06-16 21:58:33 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.

d0b2679 2020-06-16 21:58:33 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.

62ccae8 2020-06-16 21:58:33 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.

47b87d1 2020-06-16 21:58:33 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 our any possible tag mismatches it finds
when dealing with pointers and such a pointer is tagged. No additional
modifiers are needed.

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.

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.

bfebd6b 2020-06-16 21:58:33 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.

ec86fe6 2020-06-16 21:58:32 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.
(cast_non_lval_void_ptr, 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.

bb45427 2020-06-16 21:58:32 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.

46650d3 2020-06-16 21:58:32 Luis Machado

Unit tests for memory tagging for gdbserver.

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.

de52b1c 2020-06-16 21:58:32 Luis Machado

Add gdbserver memory tagging 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-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.

a8accd9 2020-06-16 21:58:32 Luis Machado

GDBserver memory tagging remote packet support

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.

c966d00 2020-06-16 21:58:32 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.

729866d 2020-06-16 21:58:32 Luis Machado

Add GDB-side MTE remote target support

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.

a08d973 2020-06-16 21:58:32 Luis Machado

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.

9e45a85 2020-06-16 21:58:32 Luis Machado

Add unit testing for logical tag set/get

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.

2c7d3af 2020-06-16 21:58:32 Luis Machado

Add gdbarch hooks to detect and return tagged addresses

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>

* aarch64-linux-tdep.c: Include target.h, arch-utils.h, value.h and
arch/aarch64-linux.h.
(make_ltag_bits, make_ltag, aarch64_linux_set_ltag)
(aarch64_linux_get_ltag, aarch64_linux_get_atag)
(value_valid_for_memtag, 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-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.
* arch/aarch64-linux.h (MTE_LOGICAL_TAG_START_BIT): Define.
(MTE_LOGICAL_MAX_VALUE): Define.
* 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.

25d36f4 2020-06-16 21:58:32 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.

122990c 2020-06-16 21:58:32 Luis Machado

Add target methods to fetch/store allocation tags and control switch

This patch starts adding some of the generic pieces to accomodate memory
tagging, of which ARM MTE is an implementation of.

We have three new target methods:

- supports_memory_tagging: Checks if the target supports memory tagging. This
default to false for target 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>

* Makefile.in (HFILES_NO_SRCDIR): Add 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-linux.c (get_tag_granules): New function.
* arch/aarch64-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.
* nat/aarch64-mte-linux-ptrace.c: New file.
* nat/aarch64-mte-linux-ptrace.h: New file.
* 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.

bacb994 2020-06-16 21:58:32 Luis Machado

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.

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.
* nat/aarch64-linux.h (NT_ARM_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.