From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18148 invoked by alias); 1 Jun 2003 07:49:32 -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 18115 invoked from network); 1 Jun 2003 07:49:30 -0000 Received: from unknown (HELO mx1.redhat.com) (66.187.233.31) by sources.redhat.com with SMTP; 1 Jun 2003 07:49:30 -0000 Received: from int-mx2.corp.redhat.com (nat-pool-rdu-dmz.redhat.com [172.16.52.200] (may be forged)) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h517nUH12710 for ; Sun, 1 Jun 2003 03:49:30 -0400 Received: from potter.sfbay.redhat.com (potter.sfbay.redhat.com [172.16.27.15]) by int-mx2.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h517nTT23548; Sun, 1 Jun 2003 03:49:29 -0400 Received: from dot.sfbay.redhat.com (dot.sfbay.redhat.com [172.16.24.7]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id h517nS023769; Sun, 1 Jun 2003 00:49:28 -0700 Received: (from rth@localhost) by dot.sfbay.redhat.com (8.11.6/8.11.6) id h517lXM12228; Sun, 1 Jun 2003 00:47:33 -0700 X-Authentication-Warning: dot.sfbay.redhat.com: rth set sender to rth@redhat.com using -f Date: Sun, 01 Jun 2003 07:49:00 -0000 From: Richard Henderson To: kettenis@gnu.org, gdb-patches@sources.redhat.com Subject: Re: dwarf2-frame clobbers memory Message-ID: <20030601074733.GA12207@redhat.com> References: <20030601033621.GA12145@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030601033621.GA12145@redhat.com> User-Agent: Mutt/1.4i X-SW-Source: 2003-06/txt/msg00011.txt.bz2 On Sat, May 31, 2003 at 08:36:21PM -0700, Richard Henderson wrote: > At the following traceback, memmove is overwriting the "help" > command, which results in a segv on the next command. Is this > enough to track down the problem? Nevermind, found it. Let us remember how pointer arithmetic works. ;-) r~ * dwarf2-frame.c (dwarf2_frame_state_alloc_regs): Fix ptr arithmetic. Index: dwarf2-frame.c =================================================================== RCS file: /cvs/src/src/gdb/dwarf2-frame.c,v retrieving revision 1.1 diff -c -p -d -r1.1 dwarf2-frame.c *** dwarf2-frame.c 31 May 2003 19:18:05 -0000 1.1 --- dwarf2-frame.c 1 Jun 2003 07:45:41 -0000 *************** dwarf2_frame_state_alloc_regs (struct dw *** 163,169 **** xrealloc (rs->reg, num_regs * size); /* Initialize newly allocated registers. */ ! memset (rs->reg + rs->num_regs * size, 0, (num_regs - rs->num_regs) * size); rs->num_regs = num_regs; } --- 166,172 ---- xrealloc (rs->reg, num_regs * size); /* Initialize newly allocated registers. */ ! memset (rs->reg + rs->num_regs, 0, (num_regs - rs->num_regs) * size); rs->num_regs = num_regs; }