Re: [PATCH v2 10/10] Remove reg2 section from Aarch64 SVE cores

Alan Hayward
2018-06-11T16:37:00Z

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2325 bytes --]

> On 11 Jun 2018, at 03:47, Simon Marchi <simark@simark.ca> wrote:
>
> On 2018-06-06 11:16 AM, Alan Hayward wrote:
>> reg2 sections in SVE binaries will cause gdb to segfault on loading
>> due to miscalculating the register size.
>>
>> For now, simply remove reg2 from SVE core files. This results in
>> core files without any vector/float register. Full core support
>> for SVE will come in a later set of patches.
>>
>> 2018-06-06 Alan Hayward <alan.hayward@arm.com>
>>
>> gdb/
>> * aarch64-linux-tdep.c
>> (aarch64_linux_iterate_over_regset_sections): Check for SVE.
>> ---
>> gdb/aarch64-linux-tdep.c | 7 +++++--
>> 1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c
>> index 96dc8a1132..b05bb49ae8 100644
>> --- a/gdb/aarch64-linux-tdep.c
>> +++ b/gdb/aarch64-linux-tdep.c
>> @@ -227,10 +227,13 @@ aarch64_linux_iterate_over_regset_sections (struct gdbarch *gdbarch,
>> void *cb_data,
>> const struct regcache *regcache)
>> {
>> + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
>> +
>> cb (".reg", AARCH64_LINUX_SIZEOF_GREGSET, &aarch64_linux_gregset,
>> NULL, cb_data);
>> - cb (".reg2", AARCH64_LINUX_SIZEOF_FPREGSET, &aarch64_linux_fpregset,
>> - NULL, cb_data);
>> + if (!tdep->has_sve ())
>> + cb (".reg2", AARCH64_LINUX_SIZEOF_FPREGSET, &aarch64_linux_fpregset,
>> + NULL, cb_data);
>> }
>>
>> /* Implement the "core_read_description" gdbarch method. SVE not yet
>>
>
> IIUC, this doesn't remove existing features? If a program was using the neon
> registers, they will still be available?
>
> If so, this LGTM.
>

With this patch, on SVE systems, gdb will create cores without any sve OR neon
registers. Whilst not ideal that’s better than gdb segfaulting.

...However, this got me thinking.

SVE core files produced by the kernel will have both FP and SVE sections, even
though the FP section is essentially redundant. So, gdb does need to support
that.

I'm working my way through fixing that. It’ll mostly be a change to regcache
to handle mismatched register sizes to core file slot sizes. I’ll drop this patch
for now, and will hopefully have a new patch posted Tuesday.

Alan.\x16º&Öéj×!zÊÞ¶êç×5ãYb²Ö«r\x18\x1dn–­r\x17¬