From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19495 invoked by alias); 18 Oct 2009 16:11:12 -0000 Received: (qmail 19485 invoked by uid 22791); 18 Oct 2009 16:11:11 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from smtp-outbound-1.vmware.com (HELO smtp-outbound-1.vmware.com) (65.115.85.69) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 18 Oct 2009 16:11:07 +0000 Received: from jupiter.vmware.com (mailhost5.vmware.com [10.16.68.131]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 386B64001D; Sun, 18 Oct 2009 09:11:03 -0700 (PDT) Received: from [10.20.94.141] (msnyder-server.eng.vmware.com [10.20.94.141]) by jupiter.vmware.com (Postfix) with ESMTP id 2AD51DC05F; Sun, 18 Oct 2009 09:11:03 -0700 (PDT) Message-ID: <4ADB3CB4.4030409@vmware.com> Date: Sun, 18 Oct 2009 16:11:00 -0000 From: Michael Snyder User-Agent: Thunderbird 1.5.0.12 (X11/20080411) MIME-Version: 1.0 To: Hui Zhu CC: "gdb-patches@sourceware.org" Subject: Re: [RFA] record.c - save some memory in record log. References: <4AD761AD.40307@vmware.com> <4ADA908C.1030808@vmware.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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/msg00415.txt.bz2 Hui Zhu wrote: > Thanks Michael, I am OK with it. Great! Committed, thanks! > 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 >>> +{ >>> + 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? >> >> >