From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1408 invoked by alias); 13 May 2002 17:04:10 -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 1380 invoked from network); 13 May 2002 17:04:07 -0000 Received: from unknown (HELO maxipes.logix.cz) (217.11.251.37) by sources.redhat.com with SMTP; 13 May 2002 17:04:07 -0000 Received: (qmail 12914 invoked from network); 13 May 2002 17:04:06 -0000 Received: from styx.suse.cz (HELO suse.cz) (hajzl@213.210.157.162) by broucek.logix.cz with SMTP; 13 May 2002 17:04:06 -0000 Message-ID: <3CDFF205.8070505@suse.cz> Date: Mon, 13 May 2002 10:04:00 -0000 From: Michal Ludvig Organization: SuSE CR User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0rc2) Gecko/20020510 X-Accept-Language: cs, cz, en MIME-Version: 1.0 To: Andreas Jaeger CC: gdb-patches@sources.redhat.com Subject: Re: [RFA] Dwarf2 fix References: <3CDFEA7C.7050104@suse.cz> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2002-05/txt/msg00474.txt.bz2 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. Michal Ludvig -- * SuSE CR, s.r.o * mludvig@suse.cz * +420 2 9654 5373 * http://www.suse.cz