From: Vladimir Prus <ghost@cs.msu.su>
To: Nick Roberts <nickrob@snap.net.nz>
Cc: gdb-patches@sources.redhat.com
Subject: Re: Fix crash in -var-delete
Date: Thu, 08 Nov 2007 07:08:00 -0000 [thread overview]
Message-ID: <200711081008.03657.ghost@cs.msu.su> (raw)
In-Reply-To: <18226.40498.13190.723249@kahikatea.snap.net.nz>
On Thursday 08 November 2007 08:27:14 Nick Roberts wrote:
> > @@ -1292,6 +1292,8 @@ delete_variable_1 (struct cpstack **resu
> > for (i = 0; i < VEC_length (varobj_p, var->children); ++i)
> > {
> > varobj_p child = VEC_index (varobj_p, var->children, i);
> > + if (!child)
> > + continue;
> > if (!remove_from_parent_p)
> > child->parent = NULL;
>
> Should child not get removed from the list of its parents' children when
> deleted first time round? Then checking for child shouldn't be necessary.
This would have worked previously, when children of varobj were in a linked
list, and search was done by field name. However, that approach did not
work when a field of structure had no name, which is quite possible in C and
C++. So how, children of a varobj are stored as a vector. Each child knows
its index in parent, and when a child is removed the corresponding entry
in parent's vector is set to NULL. I presume it's possible to store list
of children as vector of (index,child) pair, which would allow removing
a child completely, but the complexity involved in that will outweight
the complexity of checking for NULL child here.
- Volodya
prev parent reply other threads:[~2007-11-08 7:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-07 19:58 Vladimir Prus
2007-11-07 20:00 ` Daniel Jacobowitz
2007-11-07 20:07 ` Vladimir Prus
2007-11-07 20:55 ` Joel Brobecker
2007-11-08 8:39 ` Vladimir Prus
2007-11-08 19:19 ` Joel Brobecker
2007-11-08 5:27 ` Nick Roberts
2007-11-08 7:08 ` Vladimir Prus [this message]
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=200711081008.03657.ghost@cs.msu.su \
--to=ghost@cs.msu.su \
--cc=gdb-patches@sources.redhat.com \
--cc=nickrob@snap.net.nz \
/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