From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22964 invoked by alias); 16 Sep 2012 06:58:22 -0000 Received: (qmail 22955 invoked by uid 22791); 16 Sep 2012 06:58:21 -0000 X-SWARE-Spam-Status: No, hits=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,TW_BF 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; Sun, 16 Sep 2012 06:58:07 +0000 Received: by pbbro12 with SMTP id ro12so8655031pbb.0 for ; Sat, 15 Sep 2012 23:58:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.204.169 with SMTP id kz9mr14358173pbc.39.1347778687303; Sat, 15 Sep 2012 23:58:07 -0700 (PDT) Received: by 10.66.220.70 with HTTP; Sat, 15 Sep 2012 23:58:07 -0700 (PDT) Date: Sun, 16 Sep 2012 06:58:00 -0000 Message-ID: Subject: why in cplus_demangle_operators operation sizeof is expected to be followed with space From: Vasyl Vavrychuk To: gdb@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2012-09/txt/msg00042.txt.bz2 I debug C++ code compiled with clang and I get error cp-name-parser.y:221: internal-error: make_operator: Assertion `i' failed. I added some printouts in GDB code, please find the result cp_canonicalize_string(exact_unsigned_base_helper) cp_demangled_name_to_comp(exact_unsigned_base_helper) make_operator(name = 'sizeof', args = 1) cp-name-parser.y:221: internal-error: make_operator: Assertion `i' failed. Which led to the following obvious patch to fix the problem libiberty/cp-demangle.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index 258aaa7..593fe0b 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -1632,8 +1632,8 @@ const struct demangle_operator_info cplus_demangle_operators[] = { "rm", NL ("%"), 2 }, { "rs", NL (">>"), 2 }, { "sc", NL ("static_cast"), 2 }, - { "st", NL ("sizeof "), 1 }, - { "sz", NL ("sizeof "), 1 }, + { "st", NL ("sizeof"), 1 }, + { "sz", NL ("sizeof"), 1 }, { "tr", NL ("throw"), 0 }, { "tw", NL ("throw "), 1 }, { NULL, NULL, 0, 0 } -- 1.7.11.4 But I dont understand why in the first place some entries in cplus_demangle_operators are followed by space. Full stack trace is below #0 0xb7780424 in __kernel_vsyscall () #1 0x468f793f in raise () from /lib/libc.so.6 #2 0x468f9293 in abort () from /lib/libc.so.6 #3 0x0828138c in dump_core () at utils.c:742 #4 0x082837fc in internal_vproblem (ap=0xbfd7d32c "qP8\b\344\266\067\b\t\367\065\b7", fmt=0x835d06c "%s: Assertion `%s' failed.", line=221, file=0x8382f4e "cp-name-parser.y", problem=0x84e8bf0 ) at utils.c:900 #5 internal_vproblem (problem=0x84e8bf0 , file=0x8382f4e "cp-name-parser.y", line=221, fmt=0x835d06c "%s: Assertion `%s' failed.", ap=0xbfd7d32c "qP8\b\344\266\067\b\t\367\065\b7") at utils.c:801 #6 0x0828391f in internal_verror (file=file@entry=0x8382f4e "cp-name-parser.y", line=line@entry=221, fmt=fmt@entry=0x835d06c "%s: Assertion `%s' failed.", ap=ap@entry=0xbfd7d32c "qP8\b\344\266\067\b\t\367\065\b7") at utils.c:925 #7 0x08283957 in internal_error (file=file@entry=0x8382f4e "cp-name-parser.y", line=line@entry=221, string=0x835d06c "%s: Assertion `%s' failed.") at utils.c:935 #8 0x0812c8e0 in make_operator (name=, args=) at cp-name-parser.y:221 #9 make_operator (name=0x837ccca "sizeof", args=1) at cp-name-parser.y:214 #10 0x0812cc10 in d_unary (name=, lhs=0xcd1dbb4) at cp-name-parser.y:1309 #11 0x0812f78a in cpname_parse () at cp-name-parser.y:1187 #12 0x08130321 in cp_demangled_name_to_comp (demangled_name=demangled_name@entry=0xaeaeb53c
, errmsg=errmsg@entry=0x0) at cp-name-parser.y:2084 #13 0x08291ca2 in cp_canonicalize_string (string=string@entry=0xaeaeb53c
) at cp-support.c:512 #14 0x0820d06b in dwarf2_canonicalize_name (name=0xaeaeb53c
, obstack=obstack@entry=0xbb5ef64, cu=) at dwarf2read.c:15943 #15 0x082172e8 in load_partial_dies (reader=reader@entry=0xbfd7ea6c, info_ptr=, info_ptr@entry=0xaf7f97af
, building_psymtab=building_psymtab@entry=1) at dwarf2read.c:12582 #16 0x0821c4f2 in process_psymtab_comp_unit_reader (reader=0xbfd7ea6c, info_ptr=0xaf7f97af
, comp_unit_die=0xe3e8290, has_children=1, data=0xbfd7eaec) at dwarf2read.c:4805 #17 0x082121a3 in init_cutu_and_read_dies (this_cu=this_cu@entry=0xe408f68, abbrev_table=abbrev_table@entry=0x0, use_existing_cu=use_existing_cu@entry=0, keep=keep@entry=0, die_reader_func=die_reader_func@entry=0x821c1f0 , data=data@entry=0xbfd7eaec) at dwarf2read.c:4589 #18 0x08214950 in process_psymtab_comp_unit (this_cu=0xe408f68, want_partial_unit=0) at dwarf2read.c:4887 #19 0x08222df9 in dwarf2_build_psymtabs_hard (objfile=0xbb5ef28) at dwarf2read.c:5382 #20 dwarf2_build_psymtabs (objfile=0xbb5ef28) at dwarf2read.c:3709 #21 0x08193e38 in require_partial_symbols (objfile=objfile@entry=0xbb5ef28, verbose=verbose@entry=0) at psymtab.c:88 #22 0x0819a4c8 in syms_from_objfile (objfile=0xbb5ef28, addrs=, offsets=0x0, num_offsets=0, add_flags=8) at symfile.c:1002 #23 0x0819a645 in symbol_file_add_with_addrs_or_offsets (abfd=abfd@entry=0x2, add_flags=8, add_flags@entry=0, addrs=addrs@entry=0xacf03a0, flags=2, parent=0x0, num_offsets=0, offsets=0x0) at symfile.c:1105 #24 0x0819a981 in symbol_file_add_from_bfd (abfd=0x2, add_flags=0, add_flags@entry=8, addrs=addrs@entry=0xacf03a0, flags=flags@entry=2, parent=parent@entry=0x0) at symfile.c:1195 #25 0x08295c2e in solib_read_symbols (so=so@entry=0xa173f60, flags=flags@entry=8) at solib.c:613 #26 0x08296115 in solib_add (pattern=pattern@entry=0x0, from_tty=from_tty@entry=0, target=0x8506760 , readsyms=1) at solib.c:924 #27 0x0815389e in handle_solib_event () at breakpoint.c:5340 #28 0x08153bea in bpstat_stop_status (aspace=0xa040398, bp_addr=bp_addr@entry=1183538640, ptid=..., ws=ws@entry=0xbfd7efc8) at breakpoint.c:5230 #29 0x081b1580 in handle_inferior_event (ecs=ecs@entry=0xbfd7efb8) at infrun.c:4179 #30 0x081b335d in wait_for_inferior () at infrun.c:2704 #31 0x081b368c in proceed (addr=1183478000, siggnal=siggnal@entry=GDB_SIGNAL_0, step=step@entry=0) at infrun.c:2285 #32 0x081a7801 in run_command_1 (args=0x0, from_tty=, tbreak_at_main=) at infcmd.c:635 #33 0x0827f661 in execute_command (p=0x9f929dd "", p@entry=0x9f929d8 "", from_tty=1) at top.c:486 #34 0x081c807f in command_handler (command=0x9f929d8 "") at event-top.c:429 #35 0x081c8a6a in command_line_handler (rl=0xa087688 "") at event-top.c:630 #36 0x082c3e6a in rl_callback_read_char () at callback.c:220 #37 0x081c80e8 in rl_callback_read_char_wrapper (client_data=0x0) at event-top.c:163 #38 0x081c71d4 in handle_file_event (data=...) at event-loop.c:827 #39 0x081c7329 in process_event () at event-loop.c:401 #40 process_event () at event-loop.c:351 #41 0x081c7754 in gdb_do_one_event () at event-loop.c:465 ---Type to continue, or q to quit--- #42 0x081c78a7 in start_event_loop () at event-loop.c:490 #43 0x081c1562 in captured_command_loop (data=data@entry=0x0) at main.c:226 #44 0x081bff47 in catch_errors (func=func@entry=0x81c1550 , func_args=func_args@entry=0x0, errstring=errstring@entry=0x8365d9e "", mask=mask@entry=6) at exceptions.c:546 #45 0x081c1e6c in captured_main (data=data@entry=0xbfd7f400) at main.c:999 #46 0x081bff47 in catch_errors (func=func@entry=0x81c1730 , func_args=func_args@entry=0xbfd7f400, errstring=errstring@entry=0x8365d9e "", mask=mask@entry=6) at exceptions.c:546 #47 0x081c2940 in gdb_main (args=0xbfd7f400) at main.c:1008 #48 0x080915d3 in main (argc=2, argv=0xbfd7f4b4) at gdb.c:34