From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19833 invoked by alias); 21 Oct 2011 00:00:36 -0000 Received: (qmail 19817 invoked by uid 22791); 21 Oct 2011 00:00:35 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS 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; Fri, 21 Oct 2011 00:00:16 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9L00Ehc027360 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 20 Oct 2011 20:00:14 -0400 Received: from host1.jankratochvil.net (ovpn-116-16.ams2.redhat.com [10.36.116.16]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p9L00Co8004329 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 20 Oct 2011 20:00:14 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p9L00BHZ027262; Fri, 21 Oct 2011 02:00:11 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p9L00AfP027251; Fri, 21 Oct 2011 02:00:10 +0200 Date: Fri, 21 Oct 2011 00:34:00 -0000 From: Jan Kratochvil To: Ulrich Weigand Cc: gdb-patches@sourceware.org Subject: Re: entryval tail call frames $sp adjustment vs. gdbarches [Re: New ARI warning Thu Oct 13 01:55:36 UTC 2011] Message-ID: <20111021000010.GA28878@host1.jankratochvil.net> References: <20111013211526.GA5377@host1.jankratochvil.net> <201110191551.p9JFpjs3020322@d06av02.portsmouth.uk.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201110191551.p9JFpjs3020322@d06av02.portsmouth.uk.ibm.com> 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: 2011-10/txt/msg00583.txt.bz2 On Wed, 19 Oct 2011 17:51:45 +0200, Ulrich Weigand wrote: > It's just that some of those assumptions seem really unnecessary to me. > For example, the assumption that there is a fixed "PC" register: > > prev_gdbarch = frame_unwind_arch (this_frame); > pc_regnum = gdbarch_pc_regnum (prev_gdbarch); > if (pc_regnum == -1) > break; > > /* Simulate frame_unwind_pc without setting this_frame->prev_pc.p. */ > prev_pc = frame_unwind_register_unsigned (this_frame, pc_regnum); > > Why don't you just do something like: > > prev_gdbarch = frame_unwind_arch (this_frame); > > /* Simulate frame_unwind_pc without setting this_frame->prev_pc.p. */ > prev_pc = gdbarch_unwind_pc (prev_gdbarch, this_frame); I agree with this simplification, used it. > Yes, dwarf2_frame_cfa would be preferable here. Also I agree. Checked in both changes. No regressions on {x86_64,x86_64-m32,i686}-fedora16pre-linux-gnu. Thanks, Jan http://sourceware.org/ml/gdb-cvs/2011-10/msg00156.html --- src/gdb/ChangeLog 2011/10/20 23:12:59 1.13448 +++ src/gdb/ChangeLog 2011/10/20 23:57:23 1.13449 @@ -1,3 +1,12 @@ +2011-10-20 Jan Kratochvil + Ulrich Weigand + + * dwarf2-frame-tailcall.c: Include dwarf2-frame.h. + (dwarf2_tailcall_prev_register_first): Use dwarf2_frame_cfa. + (dwarf2_tailcall_sniffer_first): Remove variable pc_regnum. Replace + gdbarch_pc_regnum and frame_unwind_register_unsigned by + gdbarch_unwind_pc. + 2011-10-20 Cary Coutant * dwarf2read.c (dw2_get_file_names): Move adjustment for type --- src/gdb/dwarf2-frame-tailcall.c 2011/10/09 20:21:48 1.1 +++ src/gdb/dwarf2-frame-tailcall.c 2011/10/20 23:57:23 1.2 @@ -29,6 +29,7 @@ #include "gdbtypes.h" #include "regcache.h" #include "value.h" +#include "dwarf2-frame.h" /* Contains struct tailcall_cache indexed by next_bottom_frame. */ static htab_t cache_htab; @@ -280,7 +281,7 @@ if (next_levels == cache->chain_levels - 1) addr = cache->prev_sp; else - addr = get_frame_base (this_frame) - cache->entry_cfa_sp_offset; + addr = dwarf2_frame_cfa (this_frame) - cache->entry_cfa_sp_offset; } else return NULL; @@ -380,15 +381,12 @@ /* Catch any unwinding errors. */ TRY_CATCH (except, RETURN_MASK_ERROR) { - int pc_regnum, sp_regnum; + int sp_regnum; prev_gdbarch = frame_unwind_arch (this_frame); - pc_regnum = gdbarch_pc_regnum (prev_gdbarch); - if (pc_regnum == -1) - break; /* Simulate frame_unwind_pc without setting this_frame->prev_pc.p. */ - prev_pc = frame_unwind_register_unsigned (this_frame, pc_regnum); + prev_pc = gdbarch_unwind_pc (prev_gdbarch, this_frame); /* call_site_find_chain can throw an exception. */ chain = call_site_find_chain (prev_gdbarch, prev_pc, this_pc);