From: Mark Wielaard <mark@klomp.org>
To: Pedro Alves <palves@redhat.com>
Cc: Markus Trippelsdorf <markus@trippelsdorf.de>,
gdb-patches@sourceware.org, Nathan Sidwell <nathan@acm.org>,
Ian Lance Taylor <iant@google.com>,
Nick Clifton <nickc@redhat.com>
Subject: Re: [PATCH] libiberty: Initialize d_printing in all cplus_demangle_* functions.
Date: Tue, 14 Mar 2017 09:05:00 -0000 [thread overview]
Message-ID: <1489482296.21350.77.camel@klomp.org> (raw)
In-Reply-To: <f341a66c-8a47-b38c-6355-818400e9f7c7@redhat.com>
On Tue, 2017-03-14 at 01:26 +0000, Pedro Alves wrote:
> And there's a cplus_demangle_fill_component function to fill
> these in. It's already used by cp-name-parser.y in other
> cases, via the fill_comp wrapper function.
>
> Using that seems to work, testing the patch below on x86_64 Fedora 23
> shows no regressions.
>
> From e55453c67bbe772ce001ea15b152f8dc44b8945e Mon Sep 17 00:00:00 2001
> From: Pedro Alves <palves@redhat.com>
> Date: Mon, 13 Mar 2017 22:54:09 +0000
> Subject: [PATCH] gdb/cp-name-parser.y: Eliminate make_empty, use
> cplus_demangle_fill_component
>
> The demangler exports the cplus_demangle_fill_component function that
> clients should use to initialize demangle_component components that
> use the "s_binary" union member. cp-name-parser.y uses it in some
> places, via the fill_comp wrapper, but not all. Several places
> instead use a GDB-specific "make_empty" function. Because this
> function does not call any of the demangler "fill" functions, we had
> to patch it recently to clear the allocated demangle_component's
> "d_printing" field, which is supposedly a "private" demangler field.
> To avoid such problems in the future, this commit switches those
> places to use "fill_comp" instead, and eliminates the "make_empty"
> function.
That looks good. But note that there is one behavioral change.
cplus_demangle_fill_component is defined as:
/* Fill in most component types with a left subtree and a right
subtree. Returns non-zero on success, zero on failure, such as an
unrecognized or inappropriate component type. */
And gdb/cp-name-parser.y fill_comp does:
i = cplus_demangle_fill_component (ret, d_type, lhs, rhs);
gdb_assert (i);
So you have an extra sanity check. Where before you might have silently
created a bogus demangle_component. Which I assume is what you want. But
it might depend on what gdb_assert precisely does and if the parser
input is normally "sane" or not.
Cheers,
Mark
next prev parent reply other threads:[~2017-03-14 9:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1489356354-27648-1-git-send-email-mark@klomp.org>
[not found] ` <20170313181150.GA287@x4>
[not found] ` <20170313182959.GC2167@stream>
[not found] ` <a3993cdc-dbb0-e377-3e46-a84d8cf971a0@redhat.com>
2017-03-13 20:35 ` Mark Wielaard
2017-03-14 1:26 ` Pedro Alves
2017-03-14 9:05 ` Mark Wielaard [this message]
2017-03-14 10:50 ` Pedro Alves
2017-03-27 14:28 ` [pushed/ob] cplus_demangle_fill_component: Handle DEMANGLE_COMPONENT_RVALUE_REFERENCE (Re: [PATCH] libiberty: Initialize d_printing in all cplus_demangle_* functions.) Pedro Alves
2017-03-27 14:36 ` [pushed] gdb/cp-name-parser.y: Eliminate make_empty, use cplus_demangle_fill_component " Pedro Alves
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=1489482296.21350.77.camel@klomp.org \
--to=mark@klomp.org \
--cc=gdb-patches@sourceware.org \
--cc=iant@google.com \
--cc=markus@trippelsdorf.de \
--cc=nathan@acm.org \
--cc=nickc@redhat.com \
--cc=palves@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