From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3774 invoked by alias); 17 Sep 2012 06:27:14 -0000 Received: (qmail 3709 invoked by uid 22791); 17 Sep 2012 06:27:11 -0000 X-SWARE-Spam-Status: No, hits=-6.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_OV,TW_TM X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 17 Sep 2012 06:26:55 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8H6QrjK019884 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 17 Sep 2012 02:26:53 -0400 Received: from host2.jankratochvil.net (ovpn-113-58.phx2.redhat.com [10.3.113.58]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q8H6Ql3b008595 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Mon, 17 Sep 2012 02:26:50 -0400 Date: Mon, 17 Sep 2012 06:27:00 -0000 From: Jan Kratochvil To: Vasyl Vavrychuk Cc: gdb-patches@sourceware.org Subject: [patch] Fix internal error on canonicalization of clang types [Re: why in cplus_demangle_operators operation sizeof is expected to be followed with space] Message-ID: <20120917062647.GA2514@host2.jankratochvil.net> References: <20120916080035.GA28890@host2.jankratochvil.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="s9fJI615cBHmzTOP" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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/msg00302.txt.bz2 --s9fJI615cBHmzTOP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1625 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++. */ --s9fJI615cBHmzTOP Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="type.S" Content-length: 4890 .file "type.C" .text .Ltext0: .globl _Z1fi .type _Z1fi, @function _Z1fi: .LFB0: .file 1 "type.C" # type.C:1 .loc 1 1 0 .cfi_startproc # BLOCK 2 seq:0 # PRED: ENTRY (fallthru) pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movq %rsp, %rbp .cfi_def_cfa_register 6 movl %edi, -4(%rbp) # type.C:1 .loc 1 1 0 popq %rbp .cfi_def_cfa 7, 8 # SUCC: EXIT [100.0%] ret .cfi_endproc .LFE0: .size _Z1fi, .-_Z1fi .Letext0: .section .debug_info,"",@progbits .Ldebug_info0: .long 1f-2f # Length of Compilation Unit Info 2: .value 0x4 # DWARF version number .long .Ldebug_abbrev0 # Offset Into Abbrev. Section .byte 0x8 # Pointer Size (in bytes) .uleb128 0x1 # (DIE (0xb) DW_TAG_compile_unit) .long .LASF0 # DW_AT_producer: "GNU C++ 4.7.1 20120720 (Red Hat 4.7.1-5) -mtune=generic -march=x86-64 -g" .byte 0x4 # DW_AT_language .long .LASF1 # DW_AT_name: "type.C" .long .LASF2 # DW_AT_comp_dir: "/home/jkratoch/t" .quad .Ltext0 # DW_AT_low_pc .quad .Letext0 # DW_AT_high_pc .long .Ldebug_line0 # DW_AT_stmt_list .uleb128 0x2 # (DIE (0x2d) DW_TAG_subprogram) # DW_AT_external .ascii "f\0" # DW_AT_name .byte 0x1 # DW_AT_decl_file (type.C) .byte 0x1 # DW_AT_decl_line .long .LASF3 # DW_AT_linkage_name: "_Z1fi" .quad .LFB0 # DW_AT_low_pc .quad .LFE0 # DW_AT_high_pc .uleb128 0x1 # DW_AT_frame_base .byte 0x9c # DW_OP_call_frame_cfa # DW_AT_GNU_all_call_sites .long 0x59 # DW_AT_sibling .uleb128 0x3 # (DIE (0x4c) DW_TAG_formal_parameter) .ascii "i\0" # DW_AT_name .byte 0x1 # DW_AT_decl_file (type.C) .byte 0x1 # DW_AT_decl_line .long 0x59 # DW_AT_type .uleb128 0x2 # DW_AT_location .byte 0x91 # DW_OP_fbreg .sleb128 -20 .byte 0 # end of children of DIE 0x2d .uleb128 0x4 # (DIE (0x59) DW_TAG_base_type) .byte 0x4 # DW_AT_byte_size .byte 0x5 # DW_AT_encoding #if 0 .ascii "int\0" # DW_AT_name #else .ascii "exact_unsigned_base_helper\0" # DW_AT_name #endif .byte 0 # end of children of DIE 0xb 1: .section .debug_abbrev,"",@progbits .Ldebug_abbrev0: .uleb128 0x1 # (abbrev code) .uleb128 0x11 # (TAG: DW_TAG_compile_unit) .byte 0x1 # DW_children_yes .uleb128 0x25 # (DW_AT_producer) .uleb128 0xe # (DW_FORM_strp) .uleb128 0x13 # (DW_AT_language) .uleb128 0xb # (DW_FORM_data1) .uleb128 0x3 # (DW_AT_name) .uleb128 0xe # (DW_FORM_strp) .uleb128 0x1b # (DW_AT_comp_dir) .uleb128 0xe # (DW_FORM_strp) .uleb128 0x11 # (DW_AT_low_pc) .uleb128 0x1 # (DW_FORM_addr) .uleb128 0x12 # (DW_AT_high_pc) .uleb128 0x1 # (DW_FORM_addr) .uleb128 0x10 # (DW_AT_stmt_list) .uleb128 0x17 # (DW_FORM_sec_offset) .byte 0 .byte 0 .uleb128 0x2 # (abbrev code) .uleb128 0x2e # (TAG: DW_TAG_subprogram) .byte 0x1 # DW_children_yes .uleb128 0x3f # (DW_AT_external) .uleb128 0x19 # (DW_FORM_flag_present) .uleb128 0x3 # (DW_AT_name) .uleb128 0x8 # (DW_FORM_string) .uleb128 0x3a # (DW_AT_decl_file) .uleb128 0xb # (DW_FORM_data1) .uleb128 0x3b # (DW_AT_decl_line) .uleb128 0xb # (DW_FORM_data1) .uleb128 0x6e # (DW_AT_linkage_name) .uleb128 0xe # (DW_FORM_strp) .uleb128 0x11 # (DW_AT_low_pc) .uleb128 0x1 # (DW_FORM_addr) .uleb128 0x12 # (DW_AT_high_pc) .uleb128 0x1 # (DW_FORM_addr) .uleb128 0x40 # (DW_AT_frame_base) .uleb128 0x18 # (DW_FORM_exprloc) .uleb128 0x2117 # (DW_AT_GNU_all_call_sites) .uleb128 0x19 # (DW_FORM_flag_present) .uleb128 0x1 # (DW_AT_sibling) .uleb128 0x13 # (DW_FORM_ref4) .byte 0 .byte 0 .uleb128 0x3 # (abbrev code) .uleb128 0x5 # (TAG: DW_TAG_formal_parameter) .byte 0 # DW_children_no .uleb128 0x3 # (DW_AT_name) .uleb128 0x8 # (DW_FORM_string) .uleb128 0x3a # (DW_AT_decl_file) .uleb128 0xb # (DW_FORM_data1) .uleb128 0x3b # (DW_AT_decl_line) .uleb128 0xb # (DW_FORM_data1) .uleb128 0x49 # (DW_AT_type) .uleb128 0x13 # (DW_FORM_ref4) .uleb128 0x2 # (DW_AT_location) .uleb128 0x18 # (DW_FORM_exprloc) .byte 0 .byte 0 .uleb128 0x4 # (abbrev code) .uleb128 0x24 # (TAG: DW_TAG_base_type) .byte 0 # DW_children_no .uleb128 0xb # (DW_AT_byte_size) .uleb128 0xb # (DW_FORM_data1) .uleb128 0x3e # (DW_AT_encoding) .uleb128 0xb # (DW_FORM_data1) .uleb128 0x3 # (DW_AT_name) .uleb128 0x8 # (DW_FORM_string) .byte 0 .byte 0 .byte 0 .section .debug_aranges,"",@progbits .long 0x2c # Length of Address Ranges Info .value 0x2 # DWARF Version .long .Ldebug_info0 # Offset of Compilation Unit Info .byte 0x8 # Size of Address .byte 0 # Size of Segment Descriptor .value 0 # Pad to 16 byte boundary .value 0 .quad .Ltext0 # Address .quad .Letext0-.Ltext0 # Length .quad 0 .quad 0 .section .debug_line,"",@progbits .Ldebug_line0: .section .debug_str,"MS",@progbits,1 .LASF1: .string "type.C" .LASF2: .string "/home/jkratoch/t" .LASF0: .string "GNU C++ 4.7.1 20120720 (Red Hat 4.7.1-5) -mtune=generic -march=x86-64 -g" .LASF3: .string "_Z1fi" .ident "GCC: (GNU) 4.7.1 20120720 (Red Hat 4.7.1-5)" .section .note.GNU-stack,"",@progbits --s9fJI615cBHmzTOP--