This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] gdb/x86: Handle kernels using compact xsave format
- From: Pedro Alves <palves at redhat dot com>
- To: Andrew Burgess <andrew dot burgess at embecosm dot com>, gdb-patches at sourceware dot org
- Date: Mon, 26 Mar 2018 16:42:32 +0100
- Subject: Re: [PATCH] gdb/x86: Handle kernels using compact xsave format
- References: <20180314005707.9009-1-andrew.burgess@embecosm.com>
On 03/14/2018 12:57 AM, Andrew Burgess wrote:
>
>
[snip excellent description]
>
> gdb/ChangeLog:
>
> * i387-tdep.c (i387_supply_xsave): Supply initial values when
> registers have not been initialised by the kernel yet.
> (i387_collect_xsave): Update xstate_bv after check if any control
> registers have changed. Updating the control registers should
> result in xstate_bv being updated.
> - memcpy (FXSAVE_ADDR (tdep, regs, i), buf, 2);
> + p = FXSAVE_ADDR (tdep, regs, i);
> + if (memcmp (p, buf, 2) == 0)
> + {
> + xstate_bv |= X86_XSTATE_X87;
> + memcpy (p, buf, 2);
> + }
I don't understand this though -- if memcmp returns 0, then
p and buf hold the same bytes, so the memcpy is useless.
I think you meant to do "memcmp ... != 0" ?
Curious no test catches that.
Thanks,
Pedro Alves