From: Michal Ludvig <mludvig@suse.cz>
To: Andreas Jaeger <aj@suse.de>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] Dwarf2 fix
Date: Mon, 13 May 2002 10:04:00 -0000 [thread overview]
Message-ID: <3CDFF205.8070505@suse.cz> (raw)
In-Reply-To: <hor8kgm210.fsf@gee.suse.de>
Andreas Jaeger wrote:
> Michal Ludvig <mludvig@suse.cz> 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
next prev parent reply other threads:[~2002-05-13 17:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-13 9:31 Michal Ludvig
2002-05-13 9:43 ` Andreas Jaeger
2002-05-13 10:04 ` Michal Ludvig [this message]
2002-05-13 10:21 ` Andreas Jaeger
2002-05-13 10:32 ` Michal Ludvig
2002-05-13 14:10 ` Andrew Cagney
2002-05-14 3:02 ` Michal Ludvig
2002-05-23 19:29 ` Andrew Cagney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3CDFF205.8070505@suse.cz \
--to=mludvig@suse.cz \
--cc=aj@suse.de \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox