From: Tom Tromey <tom@tromey.com>
To: Simon Marchi <simon.marchi@polymtl.ca>
Cc: Tom Tromey <tom@tromey.com>,
Philippe Waroquiers <philippe.waroquiers@skynet.be>,
gdb-patches@sourceware.org
Subject: Re: [RFA] Fix leaks in macro definitions.
Date: Tue, 15 Jan 2019 18:50:00 -0000 [thread overview]
Message-ID: <87d0oxoiv3.fsf@tromey.com> (raw)
In-Reply-To: <884d32995ce9ac8f412e22b5207d9a6d@polymtl.ca> (Simon Marchi's message of "Tue, 15 Jan 2019 12:49:04 -0500")
>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:
Simon> Ok. Fixing this in the splay tree code would be a quite long task
Simon> (reviewing all usages in binutils-gdb and gcc, I don't think this code
Simon> is available externally?), so I am ok with this patch which fixes the
Simon> issue in the mean time. Tom?
Actually, I just misunderstood the patch and/or the splay-tree API.
For some of the patch, the splay tree is doing the right thing.
This applies to the macro_define_* patches.
This though:
@@ -841,8 +850,10 @@ macro_undef (struct macro_source_file *source, int line,
arguments like '-DFOO -UFOO -DFOO=2'. */
if (source == key->start_file
&& line == key->start_line)
- splay_tree_remove (source->table->definitions, n->key);
-
+ {
+ splay_tree_remove (source->table->definitions, n->key);
+ macro_tree_delete_key (key);
+ }
else
{
/* This function is the only place a macro's end-of-scope
This one seems like it is definitely a splay-tree bug. The issue is
that it deletes a node but not the node's key.
I think it would be best by far to fix this in splay_tree_remove.
I agree it's hard, but working around this seems worse to me.
Tom
next prev parent reply other threads:[~2019-01-15 18:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-15 5:56 Philippe Waroquiers
2019-01-15 16:50 ` Simon Marchi
2019-01-15 17:16 ` Tom Tromey
2019-01-15 17:49 ` Simon Marchi
2019-01-15 18:50 ` Tom Tromey [this message]
2019-01-15 22:33 ` Tom Tromey
2019-01-15 19:46 ` Philippe Waroquiers
2019-01-15 22:34 ` Tom Tromey
2019-01-17 22:25 ` Tom Tromey
2019-01-19 17:32 ` Philippe Waroquiers
2019-01-19 20:05 ` Tom Tromey
2019-01-15 19:55 ` Philippe Waroquiers
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=87d0oxoiv3.fsf@tromey.com \
--to=tom@tromey.com \
--cc=gdb-patches@sourceware.org \
--cc=philippe.waroquiers@skynet.be \
--cc=simon.marchi@polymtl.ca \
/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