From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 718253857029 for ; Tue, 25 Oct 2022 14:37:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 718253857029 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [10.0.0.85] (modemcable162.249-56-74.mc.videotron.ca [74.56.249.162]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 1E7091E0D3; Tue, 25 Oct 2022 10:37:14 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1666708634; bh=jlohuWj2lYERnTA+/V2R6rFsMz/Hn9xIj8LDsAySzw8=; h=Date:Subject:To:References:From:In-Reply-To:From; b=tU0t74NxJNSF//8p3241qxX2xYtXKZEiFJDzwRH1okpyq2Eje5YCOloqVMW++9Iyp 8I+Ah2Y0bJMOtBUAVbrVQHHFHliazQM2tfvuhCFyOEPjXygfHM7yd28D0qJeO1KwbB gbDOCQH+YdV5odS2aLDqLFO+Guc6z9Z6fJtEE6KU= Message-ID: Date: Tue, 25 Oct 2022 10:37:13 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.2 Subject: Re: [PATCH v4 1/2] Change calculation of frame_id by amd64 epilogue unwinder Content-Language: fr To: Bruno Larsen , gdb-patches@sourceware.org References: <20221005103832.3163424-1-blarsen@redhat.com> <20221005103832.3163424-2-blarsen@redhat.com> <6975b747-e4fd-ca3c-1b89-d65b51d44d1f@simark.ca> From: Simon Marchi In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 10/25/22 10:13, Bruno Larsen via Gdb-patches wrote: > On 25/10/2022 15:59, Simon Marchi wrote: >> On 10/25/22 09:44, Simon Marchi wrote: >>> On 10/5/22 06:38, Bruno Larsen via Gdb-patches wrote: >>>> 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. >>>> >>>> It also adds a test to confirm that the frame_id will be the same, >>>> regardless of using the epilogue unwinder or not, thanks to Andrew >>>> Burgess. >>>> >>>> Co-Authored-By: Andrew Burgess >>>> --- >>>>   gdb/amd64-tdep.c                              |  10 +- >>>>   .../gdb.base/unwind-on-each-insn-foo.c        |  22 +++ >>>>   gdb/testsuite/gdb.base/unwind-on-each-insn.c  |  25 +++ >>>>   .../gdb.base/unwind-on-each-insn.exp          | 154 ++++++++++++++++++/usr/lib/x86_64-linux-gnu/libasan.so.6 >>>>   4 files changed, 206 insertions(+), 5 deletions(-) >>>>   create mode 100644 gdb/testsuite/gdb.base/unwind-on-each-insn-foo.c >>>>   create mode 100644 gdb/testsuite/gdb.base/unwind-on-each-insn.c >>>>   create mode 100644 gdb/testsuite/gdb.base/unwind-on-each-insn.exp >>> Hi Bruno, >>> >>> On Ubuntu 22.04, I can get this new test to fail quite reliably with: >>> >>>      $ taskset -c 1 make check TESTS="gdb.base/unwind-on-each-insn.exp" RUNTESTFLAGS="--target_board=native-gdbserver" >>> >>> Can you give it a try? >>> >>> Simon >> Actually, I took the time to look into it, it turns out the problem is >> simple.  Here's a patch below. > Ah great! I didn't even have time to finish making an Ubuntu VM lol. I just noticed one typo: 99% of the time, when needing to test on a specific version of a specific distro, it is sufficient to use Docker (or whatever) containers. It's much, much faster than installing a VM from scratch. >>  From 7090bf701b2f1cca89985ea1b45b0a2e3859e19e Mon Sep 17 00:00:00 2001 >> From: Simon Marchi >> Date: Tue, 25 Oct 2022 09:50:56 -0400 >> Subject: [PATCH] gdb/testsuite: make sure to consume the prompt in >>   gdb.base/unwind-on-each-insn.exp >> >> This test fails quite reliably for me when ran as: >> >>      $ taskset -c 1 make check TESTS="gdb.base/unwind-on-each-insn.exp" RUNTESTFLAGS="--target_board=native-gdbserver" >> >> or more simply: >> >>      $ make check-read1 TESTS="gdb.base/unwind-on-each-insn.exp" >> >> The problem is that the that grabs the frame id from "maint print > > Missing word here. "The problem is that the __proc__" ? I think I meant "the gdb_test_multiple", thanks for pointing it out. > With this fixed, LGTM. > > Reviewed-By: Bruno Larsen Thanks, will push. Simon