Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Thiago Jung Bauermann via Gdb-patches <gdb-patches@sourceware.org>
To: Luis Machado <luis.machado@arm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 1/2] gdb/aarch64: Fix thread's gdbarch when SVE vector length changes
Date: Tue, 02 Aug 2022 04:15:49 +0000	[thread overview]
Message-ID: <87zggnuunp.fsf@linaro.org> (raw)
In-Reply-To: <3218f696-c2de-bcba-e73b-7409cf0a8b66@arm.com>


Hello Luis,

Luis Machado <luis.machado@arm.com> writes:

> Thanks for the patch.

Thank you for your prompt review!

> On 7/28/22 02:23, Thiago Jung Bauermann via Gdb-patches wrote:
>> --- a/gdb/aarch64-linux-nat.c
>> +++ b/gdb/aarch64-linux-nat.c
>> @@ -900,11 +900,16 @@ aarch64_linux_nat_target::thread_architecture (ptid_t ptid)
>>       /* We reach here if the vector length for the thread is different from its
>>        value at process start.  Lookup gdbarch via info (potentially creating a
>> -     new one), stashing the vector length inside id.  Use -1 for when SVE
>> -     unavailable, to distinguish from an unset value of 0.  */
>> +     new one) by using a target description that corresponds to the new vq value
>> +     and the current architecture features.  */
>> +
>> +  const struct target_desc *tdesc = gdbarch_target_desc (inf->gdbarch);
>> +  aarch64_features features = aarch64_features_from_target_desc (tdesc);
>> +  features.vq = vq;
>> +
>>     struct gdbarch_info info;
>>     info.bfd_arch_info = bfd_lookup_arch (bfd_arch_aarch64, bfd_mach_aarch64);
>> -  info.id = (int *) (vq == 0 ? -1 : vq);
>
> Even though we're removing this code, we're still actively using
> info.id in aarch64_gdbarch_init (). Will that work correctly?

Ah, well spotted. It will — the statements that check info.id become
dead code. Your comment made me notice that the line I remove above was
the only place in all of GDB that was setting info.id, and
aarch64_gdbarch_init () was the only place reading it.

So v2 will remove the id member of struct gdbarch_info altogether (and
thus the anonymous union it was part of) and simplify a bit the
vq-related code in aarch64_gdbarch_init ().

>> +  info.target_desc = aarch64_create_target_description (features);
>
> The current mechanism caches potentially multiple target description
> (to account for threads having different VL's). Instead of creating a
> fresh target description here,

Well spotted again. This was actually a thinko on my part. I thought
I was using the function that does the target description caching. In v2
this code will call aarch64_read_description () instead of
aarch64_create_target_description ().

> would it make more sense to figure out the features from this
> particular thread and then check if we have the right target
> description already?
>
> Maybe through aarch64_linux_nat_target::read_description ()?

This patch is figuring out the features from this particular thread by
looking at its current target description so I don't think it's
necessary to use aarch64_linux_nat_target::read_description (), unless
I'm misunderstanding your point.

I'll now work on your comments for the testcase patch and will respond
to it tomorrow.

-- 
Thiago

  reply	other threads:[~2022-08-02  4:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-28  1:23 [PATCH 0/2] Fix bug in aarch64-linux GDB when inferior changes SVE vector length Thiago Jung Bauermann via Gdb-patches
2022-07-28  1:23 ` [PATCH 1/2] gdb/aarch64: Fix thread's gdbarch when SVE vector length changes Thiago Jung Bauermann via Gdb-patches
2022-07-28 13:03   ` Luis Machado via Gdb-patches
2022-08-02  4:15     ` Thiago Jung Bauermann via Gdb-patches [this message]
2022-07-28  1:23 ` [PATCH 2/2] gdb/testsuite: Add test for AArch64 Scalable Vector Extension Thiago Jung Bauermann via Gdb-patches
2022-07-28 13:03   ` Luis Machado via Gdb-patches
2022-08-02 22:59     ` Thiago Jung Bauermann via Gdb-patches

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=87zggnuunp.fsf@linaro.org \
    --to=gdb-patches@sourceware.org \
    --cc=luis.machado@arm.com \
    --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