From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id tzD6MgRGBmO6nywAWB0awg (envelope-from ) for ; Wed, 24 Aug 2022 11:38:44 -0400 Received: by simark.ca (Postfix, from userid 112) id C44D01E4A7; Wed, 24 Aug 2022 11:38:44 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=x6nF2IWR; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 711771E21F for ; Wed, 24 Aug 2022 11:38:44 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 92FDC3854148 for ; Wed, 24 Aug 2022 15:38:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 92FDC3854148 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1661355523; bh=XagDEaeZyQVprBhdUilqH/Iv5l4hnF29Eec+kZsZjgg=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=x6nF2IWRuNPjQP+EGhLI0/MBrwg8sSZYK1fPxR6/NMDPkqBuNtWBulHQvk6jxx0bB yMrOmkOCtp0UAJpP02Zs3gkNcaTmPaU8gJw8VJgDyVZpkPq2uc0rqsltKCTR4Qaa83 D0YsxZi1Xo+PkyWFFE9fTtoouQscWAa7AebMtfK8= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 57A0E385380D for ; Wed, 24 Aug 2022 15:38:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 57A0E385380D Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-182-Wu2covoWNCyxHDmndKZGJQ-1; Wed, 24 Aug 2022 11:38:21 -0400 X-MC-Unique: Wu2covoWNCyxHDmndKZGJQ-1 Received: by mail-wm1-f69.google.com with SMTP id h133-20020a1c218b000000b003a5fa79008bso974545wmh.5 for ; Wed, 24 Aug 2022 08:38:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc; bh=XagDEaeZyQVprBhdUilqH/Iv5l4hnF29Eec+kZsZjgg=; b=xx3rkOdG5nLi9iJ0a8iw5/FePXX3HrOMIiMTGkAqhIyzyXrgWSsUfp7EE6TpKix4lT A6imCoAItrQyxq+nr3nRx1Ifdi4+9A07FIhuCFxLm1k37H3KyWfImNtuILUT4CPyyHiC wrRdpZgA69Q0GBgvpWQTA2Sd7xjLgYThy7AKRotU/Co7K2MPgrMZNY/XMnyshk+YM6Gm XGzt3RmX9tv1VjzuwKHGiSdDDDmMJsJFmgfFz4qvE7FK6ArtE/FHY9EEKVzBN/0h3i1v FoBIav21+dQMF4vXfGsBFXtplhTeKBNpaBwuVrnVSZkyHpG9mkgcJ3QsXor3UhlhlcxY 2rHg== X-Gm-Message-State: ACgBeo2bPciSf+AnOU/eTa7wKk2KgiSpIPZllYAy+f5bjKxq3iqhOkVh jjJMKo+zJLl7zWr6Oj7QuRNQDZQHqQ3BbwJxA3mgy7L+LnATGAx0lQR07fjMeeK4E19UU5ZBxIP 4S36FyU/XNmUHAI7AgVcLGA== X-Received: by 2002:a05:600c:430c:b0:3a6:26e:88e8 with SMTP id p12-20020a05600c430c00b003a6026e88e8mr5608402wme.48.1661355499637; Wed, 24 Aug 2022 08:38:19 -0700 (PDT) X-Google-Smtp-Source: AA6agR7qlB+yvWNuM5y3dI62pMay1QIZOxHK2a8vpcqb/VdlJ8+/9/zH36bfx6H8C4jRUNaRJwQXPw== X-Received: by 2002:a05:600c:430c:b0:3a6:26e:88e8 with SMTP id p12-20020a05600c430c00b003a6026e88e8mr5608393wme.48.1661355499431; Wed, 24 Aug 2022 08:38:19 -0700 (PDT) Received: from localhost ([31.111.84.229]) by smtp.gmail.com with ESMTPSA id m9-20020adfe0c9000000b00225206dd595sm17005176wri.86.2022.08.24.08.38.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Aug 2022 08:38:19 -0700 (PDT) To: Bruno Larsen , gdb-patches@sourceware.org Subject: Re: [PATCH v2 1/2] Change calculation of frame_id by amd64 epilogue unwinder In-Reply-To: <20220823142204.31659-2-blarsen@redhat.com> References: <20220823142204.31659-1-blarsen@redhat.com> <20220823142204.31659-2-blarsen@redhat.com> Date: Wed, 24 Aug 2022 16:38:17 +0100 Message-ID: <878rndejo6.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Andrew Burgess via Gdb-patches Reply-To: Andrew Burgess Cc: pedro@palves.net Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Bruno Larsen via Gdb-patches writes: > When GDB is stopped at a ret instruction and no debug information is > available for unwinding, GDB defaults to the amd64 epilogue unwinder, to > be able to generate a decent backtrace. However, when calculating the > frame id, the epilogue unwinder generates information as if the return > instruction was the whole frame. > > This was an issue especially when attempting to reverse debug, as GDB > would place a step_resume_breakpoint from the epilogue of a function if > we were to attempt to skip that function, and this breakpoint should > ideally have the current function's frame_id to avoid other problems > such as PR record/16678. > > This commit changes the frame_id calculation for the amd64 epilogue, > so that it is always the same as the dwarf2 unwinder's frame_id. > --- > gdb/amd64-tdep.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c > index d89e06d27cb..17c82ac919c 100644 > --- a/gdb/amd64-tdep.c > +++ b/gdb/amd64-tdep.c > @@ -2943,7 +2943,7 @@ amd64_epilogue_frame_cache (struct frame_info *this_frame, void **this_cache) > byte_order) + cache->sp_offset; > > /* Cache pc will be the frame func. */ > - cache->pc = get_frame_pc (this_frame); > + cache->pc = get_frame_func (this_frame); > Not for fixing in this patch, but I notice that amd64_sigtramp_frame_this_id also uses get_frame_pc, and as a consequence, has a non-stable frame-id. It doesn't cause many problems because the sigtramp frame is pretty small, and I guess folk don't usually debug in that frame. But maybe worth fixing at some point... Thanks, Andrew > /* The saved %esp will be at cache->base plus 16. */ > cache->saved_sp = cache->base + 16; > @@ -2986,7 +2986,7 @@ amd64_epilogue_frame_this_id (struct frame_info *this_frame, > if (!cache->base_p) > (*this_id) = frame_id_build_unavailable_stack (cache->pc); > else > - (*this_id) = frame_id_build (cache->base + 8, cache->pc); > + (*this_id) = frame_id_build (cache->saved_sp, cache->pc); > } > > static const struct frame_unwind amd64_epilogue_frame_unwind = > -- > 2.37.2