This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] gdb/x86: Handle kernels using compact xsave format


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]