From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31279 invoked by alias); 11 May 2011 19:28:35 -0000 Received: (qmail 31270 invoked by uid 22791); 11 May 2011 19:28:34 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST X-Spam-Check-By: sourceware.org Received: from mail-qy0-f175.google.com (HELO mail-qy0-f175.google.com) (209.85.216.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 11 May 2011 19:28:19 +0000 Received: by qyk35 with SMTP id 35so2578235qyk.20 for ; Wed, 11 May 2011 12:28:18 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.43.76 with SMTP id v12mr2378432qce.178.1305142098637; Wed, 11 May 2011 12:28:18 -0700 (PDT) Received: by 10.229.182.7 with HTTP; Wed, 11 May 2011 12:28:18 -0700 (PDT) In-Reply-To: <20110505092038.GJ17079@tyan-ft48-01.lab.bos.redhat.com> References: <20110505092038.GJ17079@tyan-ft48-01.lab.bos.redhat.com> Date: Wed, 11 May 2011 22:14:00 -0000 Message-ID: Subject: Re: [PATCH] Fix up typed DWARF stack support for POINTERS_EXTEND_UNSIGNED targets (PR debug/48853) From: "H.J. Lu" To: Jakub Jelinek Cc: Jason Merrill , Richard Henderson , gcc-patches@gcc.gnu.org, Steve Ellcey Content-Type: multipart/mixed; boundary=0016e64bdb7a2bb57804a3051361 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-05/txt/msg00864.txt.bz2 --0016e64bdb7a2bb57804a3051361 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-length: 4868 On Thu, May 5, 2011 at 2:20 AM, Jakub Jelinek wrote: > Hi! > > My typed DWARF stack changes apparently broke ia64-hpux and H.J.'s out of > tree x32 target. =A0There are several issues: > 1) for SUBREG mem_loc_descriptor's 3rd argument was wrong, found by code > =A0 inspection > 2) CONST/SYMBOL_REF/LABEL_REF when in MEM addresses on POINTERS_EXTEND_UN= SIGNED > =A0 targets are often Pmode, which is unfortunately larger than DWARF2_AD= DR_SIZE > =A0 and my conditional would just return NULL in that case instead of > =A0 emitting DW_OP_addr. > 3) and, when mem_loc_descriptor is called from unwind code, Pmodes larger > =A0 than DWARF2_ADDR_SIZE would result in the new DW_OP_GNU_*_type etc. o= ps > =A0 which are not allowed in .eh_frame/.debug_frame > The following patch ought to fix that, bootstrapped/regtested on > x86_64-linux and i686-linux and Steve tested it on ia64-hpux and H.J. on = his > port. =A0Ok for trunk? > > 2011-05-05 =A0Jakub Jelinek =A0 > > =A0 =A0 =A0 =A0PR debug/48853 > =A0 =A0 =A0 =A0* dwarf2out.c (mem_loc_descriptor) : Pass mem= _mode > =A0 =A0 =A0 =A0instead of mode as 3rd argument to recursive call. > =A0 =A0 =A0 =A0(mem_loc_descriptor) : If POINTERS_EXTEND_UNSIGN= ED, don't > =A0 =A0 =A0 =A0emit DW_OP_GNU_regval_type if mode is Pmode and mem_mode i= s not > =A0 =A0 =A0 =A0VOIDmode. > =A0 =A0 =A0 =A0(mem_loc_descriptor) : If POINTERS_EXTEND= _UNSIGNED, > =A0 =A0 =A0 =A0don't give up if mode is Pmode and mem_mode is not VOIDmod= e. > =A0 =A0 =A0 =A0(mem_loc_descriptor) : If POINTERS_EXTEND_= UNSIGNED, > =A0 =A0 =A0 =A0use int_loc_descriptor if mode is Pmode and mem_mode is no= t VOIDmode. > Another problem. This patch http://gcc.gnu.org/ml/gcc-patches/2011-03/msg01730.html has @@ -14562,7 +15110,10 @@ loc_descriptor (rtx rtl, enum machine_mo up an entire register. For now, just assume that it is legitimate to make the Dwarf info refer to the whole register which contains the given subreg. */ - loc_result =3D loc_descriptor (SUBREG_REG (rtl), mode, initialized); + if (REG_P (SUBREG_REG (rtl)) && subreg_lowpart_p (rtl)) + loc_result =3D loc_descriptor (SUBREG_REG (rtl), mode, initialized); + else + goto do_default; break; case REG: It doesn't work with Pmode !=3D ptr_mode. I got Breakpoint 5, loc_descriptor (rtl=3D0x7ffff0acc900, mode=3DSImode, initialized=3DVAR_INIT_STATUS_INITIALIZED) at /export/gnu/import/git/gcc-x32/gcc/dwarf2out.c:15027 15027 if ((REG_P (SUBREG_REG (rtl)) (gdb) bt #0 loc_descriptor (rtl=3D0x7ffff0acc900, mode=3DSImode, initialized=3DVAR_INIT_STATUS_INITIALIZED) at /export/gnu/import/git/gcc-x32/gcc/dwarf2out.c:15027 #1 0x00000000006dae2a in loc_descriptor (rtl=3D0x7ffff0a6c660, mode=3DSImo= de, initialized=3DVAR_INIT_STATUS_INITIALIZED) at /export/gnu/import/git/gcc-x32/gcc/dwarf2out.c:15071 #2 0x00000000006dbc69 in dw_loc_list_1 (loc=3D0x7ffff0a87320, varloc=3D0x7ffff0a6c660, want_address=3D2, initialized=3DVAR_INIT_STATUS_INITIALIZED) at /export/gnu/import/git/gcc-x32/gcc/dwarf2out.c:15346 #3 0x00000000006dc5b2 in dw_loc_list (loc_list=3D0x7ffff0a6c800, decl=3D0x7ffff0a87320, want_address=3D2) at /export/gnu/import/git/gcc-x32/gcc/dwarf2out.c:15602 #4 0x00000000006dd920 in loc_list_from_tree (loc=3D0x7ffff0a87320, want_address=3D2) at /export/gnu/import/git/gcc-x32/gcc/dwarf2out.c:159= 90 #5 0x00000000006e3d81 in add_location_or_const_value_attribute ( die=3D0x7ffff0acd640, decl=3D0x7ffff0a87320, cache_p=3D0 '\000', attr=3DDW_AT_location) at /export/gnu/import/git/gcc-x32/gcc/dwarf2out.c:17500 #6 0x00000000006eae13 in gen_formal_parameter_die (node=3D0x7ffff0a87320, origin=3D0x7ffff0b71d48, emit_name_p=3D1 '\001', context_die=3D0x7ffff0= acd5a0) at /export/gnu/import/git/gcc-x32/gcc/dwarf2out.c:19244 #7 0x00000000006f6432 in gen_decl_die (decl=3D0x7ffff0a87320, origin=3D0x0, ---Type to continue, or q to quit---q contextQuit (gdb) call debug_rtx (rtl) (subreg:SI (symbol_ref:DI ("a") [flags 0x2] ) 0) (gdb) f 1 #1 0x00000000006dae2a in loc_descriptor (rtl=3D0x7ffff0a6c660, mode=3DSImo= de, initialized=3DVAR_INIT_STATUS_INITIALIZED) at /export/gnu/import/git/gcc-x32/gcc/dwarf2out.c:15071 15071 loc_result =3D loc_descriptor (loc, mode, initialized); (gdb) call debug_rtx (rtl) (var_location xxxxx (subreg:SI (symbol_ref:DI ("a") [flags 0x2] ) 0)) This patch restores the old behavior for Pmode. OK for trunk if there are no regressions? Thanks. --=20 H.J. 2011-05-11 H.J. Lu PR debug/48853 * dwarf2out.c (loc_descriptor) : If POINTERS_EXTEND_UNSIGNED is defined, don't give up if mode of SUBREG is Pmode. --0016e64bdb7a2bb57804a3051361 Content-Type: text/x-diff; charset=US-ASCII; name="gcc-pr48853-2.patch" Content-Disposition: attachment; filename="gcc-pr48853-2.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gnknu33y0 Content-length: 1188 MjAxMS0wNS0xMSAgSC5KLiBMdSAgPGhvbmdqaXUubHVAaW50ZWwuY29tPgoK CVBSIGRlYnVnLzQ4ODUzCgkqIGR3YXJmMm91dC5jIChsb2NfZGVzY3JpcHRv cikgPGNhc2UgU1VCUkVHPjogSWYKCVBPSU5URVJTX0VYVEVORF9VTlNJR05F RCBpcyBkZWZpbmVkLCBkb24ndCBnaXZlIHVwIGlmIG1vZGUgb2YKCVNVQlJF RyBpcyBQbW9kZS4KCmRpZmYgLS1naXQgYS9nY2MvZHdhcmYyb3V0LmMgYi9n Y2MvZHdhcmYyb3V0LmMKaW5kZXggYjg1YTU1ZS4uMDNkMTJkZSAxMDA2NDQK LS0tIGEvZ2NjL2R3YXJmMm91dC5jCisrKyBiL2djYy9kd2FyZjJvdXQuYwpA QCAtMTUwMjQsN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