From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 7C6D13857C40 for ; Tue, 11 Jul 2023 11:23:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7C6D13857C40 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.org Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qJBST-0005BY-1I; Tue, 11 Jul 2023 07:23:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=HYMP+ekGzFDEB0nFHI4Wg1ofQ+u+iARz9HGG3NShUT0=; b=cZGNtNZ0nk5y 5mT+ld65MEN49EaMmG18wFK7uowSWJU6JvYaG/5CqqdQjPKIJ1vi2ho/JS02fCzUl+jAvujhReqB1 qOuAdsHE5JcRVcczd9tN2/VmjJgwZ/gJlPBD61xTps1QJQlBmHUbs6SiVd9/dhkRpWxeDJ9Nkm1TN oc7TPq5l9hDUyoXYcQETxGeDyv6PGFFJ22scfKrYrpOSqA4KaPenhdKc0J69suS+f6zmZpYdPuW2H AFGyDTwFz2dU9kG86xqFB53uXcUeITuVKgyTpFrGHkLdyw5G0wFuk36HXzD/lpChhILxx8KUA64rN i27O3rnzX6cj7CwxYRupcg==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qJBSC-0007Av-9E; Tue, 11 Jul 2023 07:23:03 -0400 Date: Tue, 11 Jul 2023 14:23:00 +0300 Message-Id: <835y6q8zfv.fsf@gnu.org> From: Eli Zaretskii To: Abdul Basit Ijaz Cc: gdb-patches@sourceware.org, JiniSusan.George@amd.com, tom@tromey.com In-Reply-To: <20230710225643.32280-5-abdul.b.ijaz@intel.com> (message from Abdul Basit Ijaz on Tue, 11 Jul 2023 00:56:43 +0200) Subject: Re: [PATCH v3 4/4] gdb: Skip trampoline frames in the stack for printing or finish command. References: <20230710225643.32280-1-abdul.b.ijaz@intel.com> <20230710225643.32280-5-abdul.b.ijaz@intel.com> X-Spam-Status: No, score=1.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_BARRACUDACENTRAL,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > From: Abdul Basit Ijaz > Cc: abdul.b.ijaz@intel.com, > JiniSusan.George@amd.com, > tom@tromey.com, > eliz@gnu.org > Date: Tue, 11 Jul 2023 00:56:43 +0200 > > Before the change, GDB prints the frames indicated by the compiler with DIE > "DW_AT_trampoline" in the backtrace and finish command, but for better user > experience, all such frames can be hidden from the user. So, after this > change, now such frames are not printed any more in the backtrace command > and also the 'finish' command skips the trampoline calls. > > So far, this DIE is added to DWARF only by the IFX compiler, so > gdb.fortran/mixed-lang-stack test used to fail for this compiler because of > these extra trampoline frames in the backtrace. After the commit, those > trampoline frames are filtered so test is updated accordingly to handle the > frame level of the filtered frames. > > Backtrace output in this test before the change: > > bt -frame-arguments all > ''' > ''' > (gdb) FAIL: gdb.fortran/mixed-lang-stack.exp: lang=auto: bt -frame-arguments all > > Now, after the change: > bt -frame-arguments all > ''' > ''' > (gdb) PASS: gdb.fortran/mixed-lang-stack.exp: lang=auto: bt -frame-arguments all > > Below is the example where IFX emits DW_at_trampoline for functions first > and second trampoline calls as following: > > F90 reproducer info: > function second (x, y) result(z) > integer, intent(in) :: x, y > integer :: z > z = x * y ! breakpt-backtrace > end function second > > function first (num1, num2) result(total) > integer, intent(in) :: num1, num2 > integer :: total > total = second (num1 + 4, num2 * 3) ! first-breakpt > total = total + 30 > end function first > > Related Dwarf: > > 0x0000013f: DW_TAG_subprogram > DW_AT_low_pc (0x0000000000404350) > DW_AT_high_pc (0x000000000040435f) > DW_AT_frame_base (DW_OP_reg6 RBP) > DW_AT_linkage_name ("second_.t74p.t75p") > DW_AT_name ("second_.t74p.t75p") > DW_AT_trampoline ("second_") > > 0x0000015a: DW_TAG_subprogram > DW_AT_low_pc (0x00000000004044a0) > DW_AT_high_pc (0x00000000004044af) > DW_AT_frame_base (DW_OP_reg6 RBP) > DW_AT_linkage_name ("first_.t104p.t105p") > DW_AT_name ("first_.t104p.t105p") > DW_AT_trampoline ("first_") > > Before this change at line with comment 'breakpt-backtrace': > (gdb) backtrace 3 > (gdb) finish > Run till exit from #0 second (x=20, y=9) at test.f90:4 > second_.t74p.t75p () at test.f90:10 > 10 total = second (num1 + 4, num2 * 3) ! first-breakpt > Value returned is $1 = 180 > > After the change: > (gdb) backtrace 3 > (gdb) finish > Run till exit from #0 second (x=20, y=9) at test.f90:4 > 0x0000000000404333 in first (num1=16, num2=3) at test.f90:10 > 10 total = second (num1 + 4, num2 * 3) ! first-breakpt > Value returned is $1 = 180 > > New test func-trampoline is also added to test this in both backtrace and > finish commands for Intel(R) Fortran Compiler. > > 2023-07-10 Abdul Basit Ijaz > --- > gdb/doc/gdb.texinfo | 35 ++++++---- > gdb/infcmd.c | 13 ++++ > gdb/infrun.c | 8 +-- > gdb/infrun.h | 6 ++ > gdb/stack.c | 8 +++ > gdb/symtab.c | 12 ++++ > gdb/symtab.h | 5 ++ > gdb/testsuite/gdb.fortran/func-trampoline.exp | 69 +++++++++++++++++++ > gdb/testsuite/gdb.fortran/func-trampoline.f90 | 39 +++++++++++ > .../gdb.fortran/mixed-lang-stack.exp | 10 ++- > 10 files changed, 186 insertions(+), 19 deletions(-) > create mode 100644 gdb/testsuite/gdb.fortran/func-trampoline.exp > create mode 100644 gdb/testsuite/gdb.fortran/func-trampoline.f90 OK for the documentation parts, thanks. Reviewed-By: Eli Zaretskii