From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8560 invoked by alias); 13 May 2002 17:21:18 -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 8550 invoked from network); 13 May 2002 17:21:17 -0000 Received: from unknown (HELO Cantor.suse.de) (213.95.15.193) by sources.redhat.com with SMTP; 13 May 2002 17:21:17 -0000 Received: from Hermes.suse.de (Charybdis.suse.de [213.95.15.201]) by Cantor.suse.de (Postfix) with ESMTP id F36B51E2CA for ; Mon, 13 May 2002 19:21:16 +0200 (MEST) X-Authentication-Warning: gee.suse.de: aj set sender to aj@suse.de using -f To: Michal Ludvig Cc: gdb-patches@sources.redhat.com Subject: Re: [RFA] Dwarf2 fix References: <3CDFEA7C.7050104@suse.cz> <3CDFF205.8070505@suse.cz> From: Andreas Jaeger Date: Mon, 13 May 2002 10:21:00 -0000 In-Reply-To: <3CDFF205.8070505@suse.cz> (Michal Ludvig's message of "Mon, 13 May 2002 19:04:05 +0200") Message-ID: User-Agent: Gnus/5.090007 (Oort Gnus v0.07) XEmacs/21.4 (Artificial Intelligence, i386-suse-linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-05/txt/msg00475.txt.bz2 Michal Ludvig writes: > Andreas Jaeger wrote: >> Michal Ludvig writes: > >>> context_cpy (struct context *dst, struct context *src) >>> { >>> int regs_size = sizeof (struct context_reg) * NUM_REGS; >>>+ struct context_reg *dreg; >>> >>>+ dreg = dst->reg; >>> *dst = *src; >>>+ dst->reg = dreg; >>>+ >>> memcpy (dst->reg, src->reg, regs_size); >>> } > > > Can you add a comment here, why this is needed? > > Structure dst contains a pointer to an array of registers of a given > frame as well as src does. This array was already allocated before dst > was passed to context_cpy but the pointer to it was overriden by > '*dst = *src' and the array was lost. This led to the situation, that > I've had a copy of src placed in dst, but both of them pointed to the > same regs array and thus I've sometimes blindly rewritten it. > Now I save the pointer before I copy src to dst, return it back after > that and copy the registers into their new place finally. thanks for the explanation. I wanted to see a comment in the code... Andreas -- Andreas Jaeger SuSE Labs aj@suse.de private aj@arthur.inka.de http://www.suse.de/~aj