From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12115 invoked by alias); 20 Jan 2014 19:47:16 -0000 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 Received: (qmail 12105 invoked by uid 89); 20 Jan 2014 19:47:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e06smtp12.uk.ibm.com Received: from e06smtp12.uk.ibm.com (HELO e06smtp12.uk.ibm.com) (195.75.94.108) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 20 Jan 2014 19:47:14 +0000 Received: from /spool/local by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 20 Jan 2014 19:47:10 -0000 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 20 Jan 2014 19:47:07 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id E81771B0805F for ; Mon, 20 Jan 2014 19:46:31 +0000 (GMT) Received: from d06av10.portsmouth.uk.ibm.com (d06av10.portsmouth.uk.ibm.com [9.149.37.251]) by b06cxnps4074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s0KJktao3211572 for ; Mon, 20 Jan 2014 19:46:55 GMT Received: from d06av10.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s0KJl6ti007769 for ; Mon, 20 Jan 2014 12:47:07 -0700 Received: from br87z6lw.de.ibm.com (dyn-9-152-212-219.boeblingen.de.ibm.com [9.152.212.219]) by d06av10.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id s0KJl5VK007743; Mon, 20 Jan 2014 12:47:05 -0700 From: Andreas Arnez To: Pedro Alves Cc: Pedro Alves , Edjunior Barbosa Machado , Jan Kratochvil , gdb-patches@sourceware.org, Ulrich Weigand , Andreas Krebbel , Omair Javaid Subject: Re: [PATCH] Fix possible alignment issue with dw2-dir-file-name test case References: <87a9f65p73.fsf@br87z6lw.de.ibm.com> <52CFD97A.4040009@redhat.com> <87mwj352p5.fsf@br87z6lw.de.ibm.com> <20140110145327.GA23695@host2.jankratochvil.net> <52D014B7.6040305@redhat.com> <52D6FEA9.6010605@linux.vnet.ibm.com> <52D7EEA9.4030006@redhat.com> <874n5232yj.fsf@br87z6lw.de.ibm.com> <52D971DA.90807@redhat.com> <52D97460.1040206@gmail.com> Date: Mon, 20 Jan 2014 19:47:00 -0000 In-Reply-To: <52D97460.1040206@gmail.com> (Pedro Alves's message of "Fri, 17 Jan 2014 18:20:16 +0000") Message-ID: <87zjmq1lmv.fsf@br87z6lw.de.ibm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14012019-8372-0000-0000-00000862537A X-IsSubscribed: yes X-SW-Source: 2014-01/txt/msg00757.txt.bz2 On Fri, Jan 17 2014, Pedro Alves wrote: > BTW, > > (adding Omair) > > On 01/17/2014 05:58 PM, Andreas Arnez wrote: >> +/* Notes: (1) The '*_start' label below is needed because 'name' may >> + point to a function descriptor instead of to the actual code. (2) >> + The '.balign' should specify the highest possible function >> + alignment across all supported architectures, such that the label >> + never points into the alignment gap. */ >> + >> #define FUNC(name) \ >> - void \ >> + asm (".balign 8"); \ >> + asm (#name "_start: .globl " #name "_start\n"); \ >> + static void \ >> name (void) \ > > Not sure you were following the > "testsuite/gdb.dwarf2: Fix for dw2-ifort-parameter failure on ARM" > thread. Seems to me this exact same thing should be done to > dw2-ifort-parameter.c. I assume that test is currently failing > on ppc64 for the exact same reason, and that if it's not failing > on S390 with current gcc, it'll be by lucky alignment. I believe > this approach should fix Thumb there as well. Can you guys > coordinate on handling that test? Thanks. I haven't been following this thread, but the test case indeed fails on s390x (64 bit) -- not just with a new GCC. * On s390x, the test case fails like this: Breakpoint 1, 0x00000000800005d2 in func (param=) (gdb) p/x param Cannot access memory at address 0x0 Note that the debug info looks correct, and all addresses fit into four bytes. Still, the failure disappears when changing the DWARF pointer size to 8. Thus it seems that the address size mismatch causes confusion somewhere in GDB on big-endian systems. * On PPC64, 'func' and 'main' are function descriptors and don't point to the actual code. Thus the usage of these symbols in dw2-ifort-parameter-debug.S is broken (similar to what has been discussed in the thread, I think). But once this is fixed, the issue above is surfaced. For illustration, the patch below "fixes" both issues on PPC64. However, for a real fix I think we should find the root cause for the first issue (which I haven't dug much into yet). ----- Modified gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter-debug.S diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter-debug.S b/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter-debug.S index c7dd9be..7e65c70 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter-debug.S +++ b/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter-debug.S @@ -22,21 +22,21 @@ .Lcu1_start: .2byte 2 /* DWARF Version */ .4byte .Labbrev1_begin /* Offset into abbrev section */ - .byte 4 /* Pointer size */ + .byte 8 /* Pointer size */ /* CU die */ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */ .ascii "file1.txt\0" /* DW_AT_name */ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */ .byte 1 /* DW_AT_language (C) */ - .4byte func /* DW_AT_low_pc */ - .4byte main /* DW_AT_high_pc */ + .8byte func_start /* DW_AT_low_pc */ + .8byte func_end /* DW_AT_high_pc */ .uleb128 2 /* Abbrev: DW_TAG_subprogram */ .byte 1 /* DW_AT_external */ .ascii "func\0" /* DW_AT_name */ - .4byte func /* DW_AT_low_pc */ - .4byte main /* DW_AT_high_pc */ + .8byte func_start /* DW_AT_low_pc */ + .8byte func_end /* DW_AT_high_pc */ .uleb128 3 /* Abbrev: DW_TAG_formal_parameter */ .ascii "param\0" /* DW_AT_name */ @@ -44,7 +44,7 @@ .4byte .Ltype_int - .Lcu1_begin /* DW_AT_type */ .byte 2f - 1f /* DW_AT_location */ 1: .byte 3 /* DW_OP_addr */ - .4byte ptr /* */ + .8byte ptr /* */ .byte 0x6 /* DW_OP_deref */ 2: Modified gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.c diff --git a/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.c b/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.c index 361c44d..4474814 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.c +++ b/gdb/testsuite/gdb.dwarf2/dw2-ifort-parameter.c @@ -18,11 +18,17 @@ int value = 0xdeadf00d; int *ptr = &value; -void +asm (".section \".text\""); +asm (".balign 8"); +asm ("func_start: .globl func_start"); + +static void func (void) { } +asm ("func_end: .globl func_end"); + int main (void) {