From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21516 invoked by alias); 6 Jan 2003 14:24:03 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 21465 invoked from network); 6 Jan 2003 14:24:00 -0000 Received: from unknown (HELO localhost.redhat.com) (24.157.209.173) by 209.249.29.67 with SMTP; 6 Jan 2003 14:24:00 -0000 Received: from redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 2C1763D44; Mon, 6 Jan 2003 09:23:44 -0500 (EST) Message-ID: <3E199170.4030409@redhat.com> Date: Mon, 06 Jan 2003 14:24:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.1) Gecko/20021211 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Kevin Buettner Cc: gdb-patches@sources.redhat.com Subject: Re: [PATCH] mips-tdep.c: Fix bug introduced at time of NUM_REGS multiarch References: <1021221063923.ZM27492@localhost.localdomain> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-01/txt/msg00205.txt.bz2 > I've just committed the patch below. As noted in the subject, it fixes > a bug that was introduced when I multiarched NUM_REGS a short time ago. > > * mips-tdep.c (heuristic_proc_desc): Clear memory associated with > ``temp_saved_regs'', not the pointer or other storage contiguous > to this pointer. > > Index: mips-tdep.c > =================================================================== > RCS file: /cvs/src/src/gdb/mips-tdep.c,v > retrieving revision 1.147 > diff -u -p -r1.147 mips-tdep.c > --- mips-tdep.c 13 Dec 2002 18:09:30 -0000 1.147 > +++ mips-tdep.c 21 Dec 2002 06:31:58 -0000 > @@ -2142,7 +2142,7 @@ heuristic_proc_desc (CORE_ADDR start_pc, > return NULL; > memset (&temp_proc_desc, '\0', sizeof (temp_proc_desc)); > temp_saved_regs = xrealloc (temp_saved_regs, SIZEOF_FRAME_SAVED_REGS); > - memset (&temp_saved_regs, '\0', SIZEOF_FRAME_SAVED_REGS); > + memset (temp_saved_regs, '\0', SIZEOF_FRAME_SAVED_REGS); > PROC_LOW_ADDR (&temp_proc_desc) = start_pc; > PROC_FRAME_REG (&temp_proc_desc) = SP_REGNUM; > PROC_PC_REG (&temp_proc_desc) = RA_REGNUM; Outch! BTW, it isn't as bad as: memcpy (&frame->saved_regs, new_regs, sizeof (frame->saved_regs)); which has been cloned a number of times and now appears in multiple targets. (frame->saved_regs is a pointer to the buffer). good catch, Andrew