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: [RFA] record.c - save some memory in record log.


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?





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