From: Luis Machado <luis.machado@arm.com>
To: Thiago Jung Bauermann <thiago.bauermann@linaro.org>,
gdb-patches@sourceware.org
Subject: Re: [PATCH 6/8] gdbserver/linux-aarch64: When inferior stops, update its target description
Date: Tue, 20 Sep 2022 09:48:43 +0100 [thread overview]
Message-ID: <e5635a0c-dcf3-30c1-01f0-8b0382908390@arm.com> (raw)
In-Reply-To: <20220908064151.3959930-7-thiago.bauermann@linaro.org>
On 9/8/22 07:41, Thiago Jung Bauermann via Gdb-patches wrote:
> Introduce new arch_update_tdesc method to the linux_process_target class.
>
> This allows aarch64-linux to probe the inferior's vq register and provide
> an updated target description reflecting the new vector length.
> ---
> gdbserver/linux-aarch64-low.cc | 21 +++++++++++++++++++++
> gdbserver/linux-low.cc | 18 ++++++++++++++++++
> gdbserver/linux-low.h | 5 +++++
> 3 files changed, 44 insertions(+)
>
> diff --git a/gdbserver/linux-aarch64-low.cc b/gdbserver/linux-aarch64-low.cc
> index 8c4306ab8794..cc90eae1e36b 100644
> --- a/gdbserver/linux-aarch64-low.cc
> +++ b/gdbserver/linux-aarch64-low.cc
> @@ -99,6 +99,9 @@ protected:
>
> void low_arch_setup () override;
>
> + gdb::optional<const struct target_desc *>
> + arch_update_tdesc (const thread_info *thread) override;
> +
> bool low_cannot_fetch_register (int regno) override;
>
> bool low_cannot_store_register (int regno) override;
> @@ -902,6 +905,24 @@ aarch64_target::low_arch_setup ()
> aarch64_linux_get_debug_reg_capacity (lwpid_of (current_thread));
> }
>
> +/* Implementation of linux target ops method "arch_update_tdesc". */
> +
> +gdb::optional<const struct target_desc *>
> +aarch64_target::arch_update_tdesc (const thread_info *thread)
> +{
> + gdb::optional<struct aarch64_features> features
> + = aarch64_get_arch_features (thread);
> +
> + if (!features.has_value())
> + return {};
> +
> + /* Adjust the register sets we should use for this particular set of
> + features. */
> + aarch64_adjust_register_sets(*features);
> +
> + return aarch64_linux_read_description (*features);
> +}
> +
> /* Implementation of linux target ops method "get_regs_info". */
>
> const regs_info *
> diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
> index d37eb120e114..2a7c6f166a65 100644
> --- a/gdbserver/linux-low.cc
> +++ b/gdbserver/linux-low.cc
> @@ -483,6 +483,12 @@ linux_process_target::arch_setup_thread (thread_info *thread)
> low_arch_setup ();
> }
>
> +gdb::optional<const struct target_desc *>
> +linux_process_target::arch_update_tdesc (const thread_info *thread)
> +{
> + return {};
> +}
> +
> int
> linux_process_target::handle_extended_wait (lwp_info **orig_event_lwp,
> int wstat)
> @@ -2354,6 +2360,18 @@ linux_process_target::filter_event (int lwpid, int wstat)
> return;
> }
> }
> + else
> + {
> + /* Give the arch code an opportunity to update the target
> + description. */
> + gdb::optional<const struct target_desc *> new_tdesc
> + = arch_update_tdesc (thread);
> + if (new_tdesc.has_value () && *new_tdesc != thread->tdesc)
> + {
> + regcache_release ();
> + thread->tdesc = *new_tdesc;
> + }
> + }
> }
>
> if (WIFSTOPPED (wstat) && child->must_set_ptrace_flags)
> diff --git a/gdbserver/linux-low.h b/gdbserver/linux-low.h
> index bd1ec31dc5a4..fba462744953 100644
> --- a/gdbserver/linux-low.h
> +++ b/gdbserver/linux-low.h
> @@ -602,6 +602,11 @@ class linux_process_target : public process_stratum_target
> /* Architecture-specific setup for the current thread. */
> virtual void low_arch_setup () = 0;
>
> + /* Allows arch-specific code to update the target description when the
> + inferior stops. */
> + virtual gdb::optional<const struct target_desc *>
> + arch_update_tdesc (const thread_info *thread);
> +
> /* Return false if we can fetch/store the register, true if we cannot
> fetch/store the register. */
> virtual bool low_cannot_fetch_register (int regno) = 0;
LGTM for the aarch64 parts. Someone else must approve the generic changes.
next prev parent reply other threads:[~2022-09-20 8:49 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-08 6:41 [PATCH 0/8] gdbserver improvements for AArch64 SVE support Thiago Jung Bauermann
2022-09-08 6:41 ` [PATCH 1/8] gdbserver: Add asserts in register_size and register_data functions Thiago Jung Bauermann
2022-09-20 7:36 ` Luis Machado
2022-11-26 1:36 ` Thiago Jung Bauermann
2022-09-08 6:41 ` [PATCH 2/8] gdbserver: Add thread parameter to linux_get_auxv and linux_get_hwcap Thiago Jung Bauermann
2022-09-20 7:43 ` Luis Machado
2022-11-26 1:37 ` Thiago Jung Bauermann
2022-09-08 6:41 ` [PATCH 3/8] gdb, gdbserver/aarch64-linux: Allow aarch64_sve_get_vq to return error Thiago Jung Bauermann
2022-09-20 8:07 ` Luis Machado
2022-11-26 1:42 ` Thiago Jung Bauermann
2022-09-08 6:41 ` [PATCH 4/8] gdbserver/linux-aarch64: Factor out function to get aarch64_features Thiago Jung Bauermann
2022-09-20 8:08 ` Luis Machado
2022-11-26 1:44 ` Thiago Jung Bauermann
2022-09-08 6:41 ` [PATCH 5/8] gdbserver: Move target description from being per-process to being per-thread Thiago Jung Bauermann
2022-09-20 11:21 ` Luis Machado
2022-11-26 1:47 ` Thiago Jung Bauermann
2022-09-08 6:41 ` [PATCH 6/8] gdbserver/linux-aarch64: When inferior stops, update its target description Thiago Jung Bauermann
2022-09-20 8:48 ` Luis Machado [this message]
2022-11-26 1:49 ` Thiago Jung Bauermann
2022-09-08 6:41 ` [PATCH 7/8] gdb/aarch64: Factor out most of the thread_architecture method Thiago Jung Bauermann
2022-09-20 8:52 ` Luis Machado
2022-11-26 1:49 ` Thiago Jung Bauermann
2022-09-08 6:41 ` [PATCH 8/8] gdb/aarch64: When remote debugging detect changes in the target description Thiago Jung Bauermann
2022-09-20 8:59 ` Luis Machado
2022-11-26 1:50 ` Thiago Jung Bauermann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e5635a0c-dcf3-30c1-01f0-8b0382908390@arm.com \
--to=luis.machado@arm.com \
--cc=gdb-patches@sourceware.org \
--cc=thiago.bauermann@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).