[PATCH 3/4] gdb, gdbserver: Allocate only a sane amount of buffer when fetching registers.

Willgerodt, Felix felix.willgerodt@intel.com
Mon May 9 07:04:22 GMT 2022


> -----Original Message-----
> From: John Baldwin <jhb@FreeBSD.org>
> Sent: Freitag, 6. Mai 2022 18:09
> To: Willgerodt, Felix <felix.willgerodt@intel.com>; gdb-
> patches@sourceware.org
> Subject: Re: [PATCH 3/4] gdb, gdbserver: Allocate only a sane amount of
> buffer when fetching registers.
> 
> On 5/6/22 5:12 AM, Felix Willgerodt via Gdb-patches wrote:
> > A couple of functions blindly allocate a buffer of the size of
> > I386_MAX_REGISTER_SIZE.  With the addition of AMX, this size has
> increased
> > drastically from 64 bytes to 8192.  This changes these buffer allocations
> > to only use the actual amount needed, similar to how it is already done in
> > amd64-tdep.c (amd64_pseudo_register_read_value).
> >
> > For the i387_collect_xsave and i387_cache_to_xsave functions any
> feedback is
> > welcome.  I opted to take the middle ground and only distinguish
> > between "AMX" and "Not-AMX".  That might be unnecessary optimization,
> > we could alternatively be okay with using an 8kB buffer unconditionally or
> > be okay with having many smaller buffer allocations.
> 
> I think these changes make sense, but I think it might be nice to have some
> sort of named constant (I386_NOAMX_REGISTER_SIZE perhaps) instead of a
> bare
> 64.

Thanks for your feedback. I have implemented that locally, naming the define
I386_NO_AMX_REGISTER_SIZE.

Felix
Intel Deutschland GmbH
Registered Address: Am Campeon 10, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de <http://www.intel.de>
Managing Directors: Christin Eisenschmid, Sharon Heck, Tiffany Doon Silva  
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


More information about the Gdb-patches mailing list