Re: [PATCH] x86-64: fix ZMM register state tracking

Simon Marchi
2018-09-10T13:01:51Z

On 2018-09-10 07:25, Jan Beulich wrote:
>>>> Simon Marchi <simon.marchi@ericsson.com> 09/08/18 1:13 AM >>>
>> Would it be possible to update or create a test to exercise that?
>> arch-specific tests are in testsuite/gdb.arch.
>
> I'm sure it would be possible, but while I was happy to invest the time
> to
> fix the actual bug (because it affects work I'm doing), I'm afraid I
> don't have
> the time to learn how gdb test cases are to be constructed (I'm
> familiar
> only with the binutils / gas side of things).

I understand. If you can provide:

- a minimal source file (C + assembly in this case, I suppose)
- GDB commands to reproduce the bug
- actual and expected output

I can take care of turning it in a GDB test case.

>> On 2018-09-05 02:22 PM, Jan Beulich wrote:
>>> --- a/gdb/i387-tdep.c
>>> +++ b/gdb/i387-tdep.c
>>> @@ -923,7 +923,8 @@ i387_supply_xsave (struct regcache *regc
>>> enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
>>> struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
>>> const gdb_byte *regs = (const gdb_byte *) xsave;
>>> - int i;
>>> + int i, zmm_endlo_regnum = I387_ZMM0H_REGNUM (tdep)
>>> + + std::min (tdep->num_zmm_regs, 16);
>>
>> The GNU standard requires to parenthesis when breaking lines:
>>
>> int i, zmm_endlo_regnum = (I387_ZMM0H_REGNUM (tdep)
>> + std::min (tdep->num_zmm_regs, 16));
>
> This is easy enough to fix (perhaps even without the need to send a v2,
> but just before/while committing?); I don't think this is a rule being
> enforced on the binutils side, so I simply wasn't aware.

Yeah, no problem, I can do it. It's suggested in the GNU coding
standards, so I think it would apply to binutils too:

https://www.gnu.org/prep/standards/html_node/Formatting.html

Search for "Adding a set of parentheses".

Simon