[RFA] record.c - save some memory in record log.
Michael Snyder
msnyder@vmware.com
Sun Oct 18 16:11:00 GMT 2009
Hui Zhu wrote:
> Thanks Michael, I am OK with it.
Great! Committed, thanks!
> On Sun, Oct 18, 2009 at 11:50, Michael Snyder <msnyder@vmware.com> wrote:
>> Hui Zhu wrote:
>>> Thanks Michael, This patch is very cool.
>>>
>>> +struct record_reg_entry
>>> +{
>>> + unsigned short num;
>>> + unsigned short len;
>>> + union
>>> + {
>>> + gdb_byte *ptr;
>>> + gdb_byte buf[2 * sizeof (gdb_byte *)];
>>>
>>> Why this part use "2 * sizeof (gdb_byte *)"?
>> Oh, no strong reason. I just noticed that mem_entry is larger
>> than reg_entry, and since it is used in a union, that space is
>> otherwise going to waste.
>>
>> I do not assume that a target general register is the same size
>> as a host pointer -- only that the larger we make this buf, the
>> less likely that we have to use malloc.
>>
>>> + rec->u.reg.u.ptr = (gdb_byte *) xmalloc (MAX_REGISTER_SIZE);
>>> I suggest change MAX_REGISTER_SIZE to rec->u.reg.len.
>> Ah, good idea, thanks. I'll make that change.
>>
>> Any other comments?
>>
>>
>
More information about the Gdb-patches
mailing list