From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18186 invoked by alias); 23 Dec 2016 18:18:35 -0000 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 Received: (qmail 18154 invoked by uid 89); 23 Dec 2016 18:18:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=11b, zec12, zEC12, synthetic X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 23 Dec 2016 18:18:32 +0000 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uBNIDmOP093572 for ; Fri, 23 Dec 2016 13:18:30 -0500 Received: from e06smtp08.uk.ibm.com (e06smtp08.uk.ibm.com [195.75.94.104]) by mx0b-001b2d01.pphosted.com with ESMTP id 27h5mxqpgj-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 23 Dec 2016 13:18:30 -0500 Received: from localhost by e06smtp08.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 23 Dec 2016 18:18:28 -0000 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp08.uk.ibm.com (192.168.101.138) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 23 Dec 2016 18:18:25 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 4281F1B08023; Fri, 23 Dec 2016 18:20:57 +0000 (GMT) Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id uBNIIP9E15401358; Fri, 23 Dec 2016 18:18:25 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D52C052041; Fri, 23 Dec 2016 17:17:00 +0000 (GMT) Received: from oc1027705133.ibm.com (unknown [9.152.212.51]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id A2B975203F; Fri, 23 Dec 2016 17:17:00 +0000 (GMT) From: Andreas Arnez To: Jan Kratochvil Cc: GDB Development , Tom Tromey Subject: Re: Should a DW_OP_implicit_value be taken from the left end? References: <20161221213927.GA2306@host1.jankratochvil.net> Date: Fri, 23 Dec 2016 18:18:00 -0000 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16122318-0032-0000-0000-00000260ED35 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16122318-0033-0000-0000-00001E42D4F3 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-12-23_14:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1612230293 X-IsSubscribed: yes X-SW-Source: 2016-12/txt/msg00032.txt.bz2 --=-=-= Content-Type: text/plain Content-length: 2213 Thanks for looking into this. On Wed, Dec 21 2016, Jan Kratochvil wrote: > When looking at the patch I think the patch may be wrong, I think the > endianity should affect at least also the lines: > > case DWARF_VALUE_LITERAL: > ... > ldata = ctx.data + byte_offset; > n -= byte_offset; Right, that's another issue. If we revert the change for DW_OP_implicit_value, it doesn't matter anymore, but the same bug occurs with DW_OP_stack_value as well. I'll handle that separately. > I really do not mind reverting the patch if you think so, that is up to the > maintainers. Note that I don't intend to revert the whole patch, only the part affecting DW_OP_implicit_value (DWARF_VALUE_LITERAL). > But when you ask me I miss here stating what the current GCC version does > produce. Is GDB behavior fixed with current GCC by your proposed patch > revert? If it breaks do you plan to change/fix also GCC? Does the GDB > testsuite (particulerly the entryval testcases) have no regressions on s390*? Right, the test suite has no regressions on s390*. And GCC can indeed emit DWARF code that breaks with current GDB on s390x; and the proposed patch would fix that. See attachment for an example. > From my mail you reference I understand it as that my patch did fix some > entryval testcases with GCC that time. Unfortunately the entryval testcases > are provided as .S files prebuilt by GCC that time and they are difficult to > reproduce with newer GCC as -O2 -g code changes too much with different GCC > version, breaking various compiled code assumptions of the .exp file. Your patch certainly fixed a real problem with DW_OP_stack_value, but I doubt that the changes to the handling of DW_OP_implicit_value did. In the patch description you stated: "I am not completely sure with the DWARF standard understanding for DW_OP_implicit_value (DWARF_VALUE_LITERAL) but I think it also should be fixed (if such DWARF is valid at all)." And Tom Tromey answered: "I think I asked about this when implementing this DWARF addition in gdb, but I can't find the messages right now." Is there any any other information about the rationale of that change? -- Andreas --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=implvalue.c Content-Description: implvalue.c Content-length: 603 /* DWARF test case that gets the compiler to emit DW_OP_implicit_value as well as multiple instances of DW_OP_implicit_pointer, each pointing into the implicit value with varying offsets. */ volatile int v; static void bar (char *a, char *b, char *c, char *d) { v = *a + *b + *c + *d; } int main () { __int128 u = (((__int128) 0x11223344556677 << 64) | 0x8899aabbccddeeff); char *a = (char *) &u; bar (a, a + 4, a + 8, a + 12); /* Ensure that a location list is needed for u, so DW_AT_const_value can not be used. */ u = ~u; bar (a, a + 4, a + 8, a + 12); return 0; } --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=implvalue.debug Content-Description: readelf -wio output Content-length: 6366 Contents of the .debug_info section: Compilation Unit @ offset 0x0: Length: 0x159 (32-bit) Version: 4 Abbrev Offset: 0x0 Pointer Size: 8 <0>: Abbrev Number: 1 (DW_TAG_compile_unit) DW_AT_producer : (indirect string, offset: 0x21): GNU C11 7.0.0 20161222 (experimental) -march=zEC12 -mno-vx -mzarch -m64 -g -O3 <10> DW_AT_language : 12 (ANSI C99) <11> DW_AT_name : (indirect string, offset: 0x10): implvalue.c <15> DW_AT_comp_dir : (indirect string, offset: 0x0): /home/arnez/tmp <19> DW_AT_ranges : 0x0 <1d> DW_AT_low_pc : 0x0 <25> DW_AT_stmt_list : 0x0 <1><29>: Abbrev Number: 2 (DW_TAG_variable) <2a> DW_AT_name : v <2c> DW_AT_decl_file : 1 <2d> DW_AT_decl_line : 5 <2e> DW_AT_type : <0x43> <32> DW_AT_external : 1 <32> DW_AT_location : 9 byte block: 3 0 0 0 0 10 0 20 3c (DW_OP_addr: 1000203c) <1><3c>: Abbrev Number: 3 (DW_TAG_base_type) <3d> DW_AT_byte_size : 4 <3e> DW_AT_encoding : 5 (signed) <3f> DW_AT_name : int <1><43>: Abbrev Number: 4 (DW_TAG_volatile_type) <44> DW_AT_type : <0x3c> <1><48>: Abbrev Number: 5 (DW_TAG_subprogram) <49> DW_AT_external : 1 <49> DW_AT_name : (indirect string, offset: 0x1c): main <4d> DW_AT_decl_file : 1 <4e> DW_AT_decl_line : 14 <4f> DW_AT_type : <0x3c> <53> DW_AT_low_pc : 0x10000418 <5b> DW_AT_high_pc : 0x18 <63> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa) <65> DW_AT_GNU_all_call_sites: 1 <65> DW_AT_sibling : <0x11b> <2><69>: Abbrev Number: 6 (DW_TAG_variable) <6a> DW_AT_name : u <6c> DW_AT_decl_file : 1 <6d> DW_AT_decl_line : 16 <6e> DW_AT_type : <0x11b> <72> DW_AT_location : 0x0 (location list) <2><76>: Abbrev Number: 7 (DW_TAG_variable) <77> DW_AT_name : a <79> DW_AT_decl_file : 1 <7a> DW_AT_decl_line : 17 <7b> DW_AT_type : <0x122> <7f> DW_AT_location : 6 byte block: f2 0 0 0 69 0 (DW_OP_GNU_implicit_pointer: <0x69> 0) <2><86>: Abbrev Number: 8 (DW_TAG_inlined_subroutine) <87> DW_AT_abstract_origin: <0x12f> <8b> DW_AT_low_pc : 0x10000418 <93> DW_AT_high_pc : 0xc <9b> DW_AT_call_file : 1 <9c> DW_AT_call_line : 19 <9d> DW_AT_sibling : <0xd2> <3>: Abbrev Number: 9 (DW_TAG_formal_parameter) DW_AT_abstract_origin: <0x137> DW_AT_location : 6 byte block: f2 0 0 0 69 0 (DW_OP_GNU_implicit_pointer: <0x69> 0) <3>: Abbrev Number: 9 (DW_TAG_formal_parameter) DW_AT_abstract_origin: <0x140> DW_AT_location : 6 byte block: f2 0 0 0 69 4 (DW_OP_GNU_implicit_pointer: <0x69> 4) <3>: Abbrev Number: 9 (DW_TAG_formal_parameter) DW_AT_abstract_origin: <0x149> DW_AT_location : 6 byte block: f2 0 0 0 69 8 (DW_OP_GNU_implicit_pointer: <0x69> 8) <3>: Abbrev Number: 9 (DW_TAG_formal_parameter) DW_AT_abstract_origin: <0x152> DW_AT_location : 6 byte block: f2 0 0 0 69 c (DW_OP_GNU_implicit_pointer: <0x69> 12) <3>: Abbrev Number: 0 <2>: Abbrev Number: 10 (DW_TAG_inlined_subroutine) DW_AT_abstract_origin: <0x12f> DW_AT_low_pc : 0x10000424 DW_AT_high_pc : 0x6 DW_AT_call_file : 1 DW_AT_call_line : 24 <3>: Abbrev Number: 9 (DW_TAG_formal_parameter) DW_AT_abstract_origin: <0x137> DW_AT_location : 6 byte block: f2 0 0 0 69 0 (DW_OP_GNU_implicit_pointer: <0x69> 0) <3>: Abbrev Number: 9 (DW_TAG_formal_parameter) DW_AT_abstract_origin: <0x140> DW_AT_location : 6 byte block: f2 0 0 0 69 4 (DW_OP_GNU_implicit_pointer: <0x69> 4) <3><101>: Abbrev Number: 9 (DW_TAG_formal_parameter) <102> DW_AT_abstract_origin: <0x149> <106> DW_AT_location : 6 byte block: f2 0 0 0 69 8 (DW_OP_GNU_implicit_pointer: <0x69> 8) <3><10d>: Abbrev Number: 9 (DW_TAG_formal_parameter) <10e> DW_AT_abstract_origin: <0x152> <112> DW_AT_location : 6 byte block: f2 0 0 0 69 c (DW_OP_GNU_implicit_pointer: <0x69> 12) <3><119>: Abbrev Number: 0 <2><11a>: Abbrev Number: 0 <1><11b>: Abbrev Number: 11 (DW_TAG_base_type) <11c> DW_AT_byte_size : 16 <11d> DW_AT_encoding : 5 (signed) <11e> DW_AT_name : (indirect string, offset: 0x70): __int128 <1><122>: Abbrev Number: 12 (DW_TAG_pointer_type) <123> DW_AT_byte_size : 8 <124> DW_AT_type : <0x128> <1><128>: Abbrev Number: 11 (DW_TAG_base_type) <129> DW_AT_byte_size : 1 <12a> DW_AT_encoding : 8 (unsigned char) <12b> DW_AT_name : (indirect string, offset: 0x79): char <1><12f>: Abbrev Number: 13 (DW_TAG_subprogram) <130> DW_AT_name : bar <134> DW_AT_decl_file : 1 <135> DW_AT_decl_line : 8 <136> DW_AT_prototyped : 1 <136> DW_AT_inline : 1 (inlined) <2><137>: Abbrev Number: 14 (DW_TAG_formal_parameter) <138> DW_AT_name : a <13a> DW_AT_decl_file : 1 <13b> DW_AT_decl_line : 8 <13c> DW_AT_type : <0x122> <2><140>: Abbrev Number: 14 (DW_TAG_formal_parameter) <141> DW_AT_name : b <143> DW_AT_decl_file : 1 <144> DW_AT_decl_line : 8 <145> DW_AT_type : <0x122> <2><149>: Abbrev Number: 14 (DW_TAG_formal_parameter) <14a> DW_AT_name : c <14c> DW_AT_decl_file : 1 <14d> DW_AT_decl_line : 8 <14e> DW_AT_type : <0x122> <2><152>: Abbrev Number: 14 (DW_TAG_formal_parameter) <153> DW_AT_name : d <155> DW_AT_decl_file : 1 <156> DW_AT_decl_line : 8 <157> DW_AT_type : <0x122> <2><15b>: Abbrev Number: 0 <1><15c>: Abbrev Number: 0 Contents of the .debug_loc section: Offset Begin End Expression 00000000 0000000010000418 0000000010000424 (DW_OP_implicit_value 16 byte block: 0 11 22 33 44 55 66 77 88 99 aa bb cc dd ee ff ) 00000024 0000000010000424 000000001000042a (DW_OP_implicit_value 16 byte block: ff ee dd cc bb aa 99 88 77 66 55 44 33 22 11 0 ) 00000048 --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=implvalue.gdblog Content-Description: GDB session Content-length: 676 Reading symbols from implvalue...done. (gdb) b main Breakpoint 1 at 0x10000418: file implvalue.c, line 15. (gdb) r Starting program: /home/arnez/tmp/implvalue Breakpoint 1, main () at implvalue.c:19 (gdb) si 0x000000001000041e in bar (a=, b=, c=, d=) at implvalue.c:15 (gdb) p/x (char [4]) {*a, *b, *c, *d} $1 = {0xff, 0xff, 0xff, 0xff} (gdb) p/x *(char (*)[16]) a $2 = {0x0, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff} (gdb) p/x (char [8]) {a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7]} $3 = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff} --=-=-=--