From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 40223 invoked by alias); 16 May 2016 14:12:11 -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 39304 invoked by uid 89); 16 May 2016 14:12:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=fragment, MODE_INT, mode_int, nickcredhatcom X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 16 May 2016 14:12:09 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8C85485547; Mon, 16 May 2016 14:12:08 +0000 (UTC) Received: from littlehelper.redhat.com (vpn1-7-139.ams2.redhat.com [10.36.7.139]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u4GEC5n9021955 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 16 May 2016 10:12:07 -0400 From: Nick Clifton To: gcc-patches@gcc.gnu.org Cc: gdb-patches@sourceware.org Subject: RFA: Generate normal DWARF DW_LOC descriptors for non integer mode pointers Date: Mon, 16 May 2016 14:12:00 -0000 Message-ID: <87h9dyt7m3.fsf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2016-05/txt/msg00249.txt.bz2 Hi Guys, Currently dwarf2out.c:mem_loc_descriptor() has some special case code to handle the situation where an address is held in a register whose mode is not of type MODE_INT. It generates a DW_OP_GNU_regval_type expression which may later on be converted into a frame pointer based expression. This is a problem for targets which use a partial integer mode for their pointers (eg the msp430). In such cases the conversion to a frame pointer based expression could be wrong if the frame pointer is not being used. For example the GDB testfile gdb/testsuite/gdb.base/advance.c contains this code fragment: int main () { int result; int b, c; c = 5; b = 3; /* advance this location */ func (c); /* stop here after leaving current frame */ which compiles to these instructions: suba #6, r1 mov #5, 4(r1) mov #3, 2(r1) mov 4(r1), r12 calla #0 ; (Note that only r1 - the stack pointer - is used. r4 - the frame pointer - is not). The debug information produced for the "c" local variable looks like this: Abbrev Number: 3 (DW_TAG_variable) DW_AT_name : c DW_AT_decl_file : 1 DW_AT_decl_line : 40 DW_AT_type : <0x37> DW_AT_location : 5 byte block: f5 4 21 32 1c (DW_OP_GNU_regval_type: 4 (r4) <0x21>; DW_OP_lit2; DW_OP_minus) ie it says that "c" is stored in memory location "r4 - 2", which is wrong since register r4 is not even used in this function. The patch below addresses this problem by allowing the normal, register based descriptor to be produced when the mode is Pmode. With this patch applied the unexpected failure count in the GDB testsuite for the MSP430's -mlarge multilib changes from 2253 to 367. There are no regressions, for MSP430 or x86_64, and no changes to the GCC testsuite results for either target. OK to apply ? Cheers Nick gcc/ChangeLog 2016-05-16 Nick Clifton * dwarf2out.c (mem_loc_descriptor): Convert REG based addresses whose mode is Pmode into basereg descriptors even if Pmode is not an integer mode. Index: gcc/dwarf2out.c =================================================================== --- gcc/dwarf2out.c (revision 236283) +++ gcc/dwarf2out.c (working copy) @@ -13396,7 +13396,11 @@ break; case REG: - if (GET_MODE_CLASS (mode) != MODE_INT + if ((GET_MODE_CLASS (mode) != MODE_INT + /* Targets which have pointers that use a partial integer mode + (eg the msp430x) still want their debug information to be + based on the normal DWARF base register notation. */ + && mode != Pmode) || (GET_MODE_SIZE (mode) > DWARF2_ADDR_SIZE && rtl != arg_pointer_rtx && rtl != frame_pointer_rtx