From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 469 invoked by alias); 18 Oct 2009 04:46:13 -0000 Received: (qmail 461 invoked by uid 22791); 18 Oct 2009 04:46:12 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-pz0-f192.google.com (HELO mail-pz0-f192.google.com) (209.85.222.192) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 18 Oct 2009 04:46:08 +0000 Received: by pzk30 with SMTP id 30so2783898pzk.24 for ; Sat, 17 Oct 2009 21:46:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.66.20 with SMTP id o20mr203444wfa.163.1255841167133; Sat, 17 Oct 2009 21:46:07 -0700 (PDT) In-Reply-To: <4ADA908C.1030808@vmware.com> References: <4AD761AD.40307@vmware.com> <4ADA908C.1030808@vmware.com> From: Hui Zhu Date: Sun, 18 Oct 2009 04:46:00 -0000 Message-ID: Subject: Re: [RFA] record.c - save some memory in record log. To: Michael Snyder Cc: "gdb-patches@sourceware.org" Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-10/txt/msg00412.txt.bz2 Thanks Michael, I am OK with it. Hui On Sun, Oct 18, 2009 at 11:50, Michael Snyder wrote: > Hui Zhu wrote: >> >> Thanks Michael, This patch is very cool. >> >> +struct record_reg_entry >> +{ >> + =A0unsigned short num; >> + =A0unsigned short len; >> + =A0union >> + =A0{ >> + =A0 =A0gdb_byte *ptr; >> + =A0 =A0gdb_byte buf[2 * sizeof (gdb_byte *)]; >> >> Why this part use "2 * sizeof (gdb_byte *)"? > > Oh, no strong reason. =A0I 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. > >> >> + =A0 =A0rec->u.reg.u.ptr =3D (gdb_byte *) xmalloc (MAX_REGISTER_SIZE); >> I suggest change MAX_REGISTER_SIZE to rec->u.reg.len. > > Ah, good idea, thanks. =A0I'll make that change. > > Any other comments? > >