From: Alan Hayward <Alan.Hayward@arm.com>
To: Simon Marchi <simon.marchi@ericsson.com>
Cc: GDB Patches <gdb-patches@sourceware.org>, nd <nd@arm.com>
Subject: Re: [PATCH v2 1/3] Add min size to regset section iterations
Date: Tue, 07 Aug 2018 11:01:00 -0000 [thread overview]
Message-ID: <13DC373A-4E12-46C4-AA97-C11E82224056@arm.com> (raw)
In-Reply-To: <045ba9b9-6f37-0eeb-5609-f895e29f894f@ericsson.com>
Thanks for the reviews.
> On 6 Aug 2018, at 19:27, Simon Marchi <simon.marchi@ericsson.com> wrote:
>
> On 2018-07-30 05:25 AM, Alan Hayward wrote:
>> When using the regset section iteration functions, the size parameter is used
>> in different ways.
>>
>> With collect, size is used to create the buffer in which to write the regset.
>> (see linux-tdep.c::linux_collect_regset_section_cb).
>>
>> With supply, size is used to confirm the existing regset is the correct size.
>> If REGSET_VARIABLE_SIZE is set then the regset can be bigger than size.
>> Effectively, size is the minimum possible size of the regset.
>> (see corelow.c::get_core_register_section).
>>
>> There are currently no targets with both REGSET_VARIABLE_SIZE and a collect
>> function.
>>
>> To allow support of collects for REGSET_VARIABLE_SIZE we need two sizes.
>> Min_size is the minimum allowed size for the regset, and size is used as the
>> size to use when creating new regsets. For all targets that are not
>> REGSET_VARIABLE_SIZE then these two sizes are equal.
>
> Hi Alan,
>
> I am still a bit confused by how these two sizes are used. Please document
> carefully what they each mean, for both the collect and supply case.
>
> Part of my confusion comes the fact that for Aarch64 SVE, we seem to know
> in advance the exact size the SVE register section should have, based on
> vq (which we read in aarch64_linux_core_read_vq). In this case, the single
> size parameter would be enough for collecting and supplying, since it's the
> exact size (not a minimum size).
>
It’s probably clearer if I explain the SVE specific case:
With SVE when we read the section from the core file it will give us one of two things:
1) SVE header followed by a full SVE register dump (size dependant on register size)
Or
2) SVE header followed by a neon register dump (I usually refer to this as a fpsimd dump).
The second is a shortcut used by the kernel if the process hadn't run any SVE code, and
all the SVE state is null. This structure is significantly smaller than the SVE dump.
In the common gdb supply code, it will assert if the size of the section read from the core
file is smaller than the given size. So for SVE I need to set the size to the fpsimd size
to prevent this.
Ok, I could peak ahead into the core file to see what type of dump it is. But, at the
point of the _iterate_over_regset_sections() we don’t have any access to the core file.
In the common collect code, it uses the size to allocate memory for writing the dump into.
For this we always want to write out a full SVE dump, so need the size of the first dump.
If that makes sense now, I can rework it into the comments.
>> diff --git a/gdb/corelow.c b/gdb/corelow.c
>> index 059ce2f6eb..32a054ee3e 100644
>> --- a/gdb/corelow.c
>> +++ b/gdb/corelow.c
>> @@ -107,6 +107,7 @@ public:
>> const struct regset *regset,
>> const char *name,
>> int min_size,
>> + int size,
>> int which,
>> const char *human_name,
>> bool required);
>> @@ -570,12 +571,13 @@ core_target::get_core_register_section (struct regcache *regcache,
>> const struct regset *regset,
>> const char *name,
>> int min_size,
>> + int size,
>> int which,
>> const char *human_name,
>> bool required)
>> {> struct bfd_section *section;
>> - bfd_size_type size;
>> + bfd_size_type core_size;
>
> I would suggest naming this "section_size", or "reg_section_size". At first I thought it meant
> the size of the whole core file. You could push this rename as an obvious patch right now to
> reduce the noise in this patch, since it's a good change on its own.
Agreed. Will do.
>
> Simon
next prev parent reply other threads:[~2018-08-07 11:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-30 9:26 [PATCH v2 0/3] Core file support for Aarch64 SVE Alan Hayward
2018-07-30 9:25 ` [PATCH v2 2/3] Detect SVE when reading aarch64 core files Alan Hayward
2018-08-06 18:28 ` Simon Marchi
2018-07-30 9:26 ` [PATCH v2 1/3] Add min size to regset section iterations Alan Hayward
2018-08-06 18:27 ` Simon Marchi
2018-08-07 11:01 ` Alan Hayward [this message]
2018-08-07 16:05 ` Simon Marchi
2018-08-08 8:19 ` Alan Hayward
2018-08-08 13:34 ` Simon Marchi
2018-08-09 18:29 ` Simon Marchi
2018-08-09 18:53 ` Simon Marchi
2018-07-30 9:26 ` [PATCH v2 3/3] Parse SVE registers in aarch64 core file reading/writing Alan Hayward
2018-08-06 18:29 ` Simon Marchi
2018-08-06 10:10 ` [PING][PATCH v2 0/3] Core file support for Aarch64 SVE Alan Hayward
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=13DC373A-4E12-46C4-AA97-C11E82224056@arm.com \
--to=alan.hayward@arm.com \
--cc=gdb-patches@sourceware.org \
--cc=nd@arm.com \
--cc=simon.marchi@ericsson.com \
/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