From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32183 invoked by alias); 17 Sep 2012 08:29:23 -0000 Received: (qmail 32174 invoked by uid 22791); 17 Sep 2012 08:29:19 -0000 X-SWARE-Spam-Status: No, hits=-5.5 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-pb0-f41.google.com (HELO mail-pb0-f41.google.com) (209.85.160.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 17 Sep 2012 08:28:53 +0000 Received: by pbbro12 with SMTP id ro12so9904758pbb.0 for ; Mon, 17 Sep 2012 01:28:53 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.189.164 with SMTP id gj4mr11586190pbc.48.1347870533345; Mon, 17 Sep 2012 01:28:53 -0700 (PDT) Received: by 10.66.220.70 with HTTP; Mon, 17 Sep 2012 01:28:52 -0700 (PDT) In-Reply-To: <20120917062647.GA2514@host2.jankratochvil.net> References: <20120916080035.GA28890@host2.jankratochvil.net> <20120917062647.GA2514@host2.jankratochvil.net> Date: Mon, 17 Sep 2012 08:29:00 -0000 Message-ID: Subject: Re: [patch] Fix internal error on canonicalization of clang types [Re: why in cplus_demangle_operators operation sizeof is expected to be followed with space] From: Vasyl Vavrychuk To: Jan Kratochvil Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-09/txt/msg00307.txt.bz2 Problem happening for the file #include #include int main(int argc, char* argv[]) { boost::uuids::random_generator gen; return EXIT_SUCCESS; } clang++ -g -O0 sizeof-space-test.cpp readelf -wi a.out|grep exact_unsigned_base_helper <4072> DW_AT_name : (indirect string, offset: 0x3f3e): exact_unsigned_base_helper but if compiled with g++ there is no such typename in dwarf g++ -g -O0 sizeof-space-test.cpp readelf -wi a.out|grep exact_unsigned_base_helper Sorry, but I didn't succeed in further reducing mentioned test file. On Mon, Sep 17, 2012 at 9:26 AM, Jan Kratochvil wrote: > On Mon, 17 Sep 2012 07:49:16 +0200, Vasyl Vavrychuk wrote: >> This looks to be not a symbol but type name. > > OK, reproduced [attached], patched DWARF of "int" in C++: void f(int i) {} > > >> But I have found it directly in the binary. Line containing this text looks like > > readelf -wi > <1><59>: Abbrev Number: 4 (DW_TAG_base_type) > <5c> DW_AT_name : exact_unsigned_base_helper > > >> Do you think the problem is in clang? Could you point out some >> specification, so I can reference it while contacting clang people. > > Itanium C++ ABI does not say anything about spacing: > http://www.swag.uwaterloo.ca/acd/docs/ItaniumC++ABI.htm > (the original URL is 404 now) > > I guess so far it is only agreed upon between GCC and GDB, it is true GDB > should accept any valid spacing of the language, this is also what > cp_canonicalize_string is there for. > > Your patch would belons to the GCC mailing lists where libiberty/ is > maintained. > > But I find more correct patch the one below. > > For a testcase could you provide a minimal C++ code to produce such type? > > No regressions on {x86_64,x86_64-m32,i686}-fedora18-linux-gnu. > > > Thanks, > Jan > > > gdb/ > 2012-09-17 Jan Kratochvil > > Fix internal error on canonicalization of clang types. > * cp-name-parser.y (exp): Use "sizeof ". > > diff --git a/gdb/cp-name-parser.y b/gdb/cp-name-parser.y > index 6767fa5..c57ce64 100644 > --- a/gdb/cp-name-parser.y > +++ b/gdb/cp-name-parser.y > @@ -1183,7 +1183,7 @@ exp : FLOAT > ; > > exp : SIZEOF '(' type ')' %prec UNARY > - { $$ = d_unary ("sizeof", $3); } > + { $$ = d_unary ("sizeof ", $3); } > ; > > /* C++. */