From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7862) id 82CAB385800E; Thu, 22 Sep 2022 09:04:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 82CAB385800E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1663837499; bh=NFcCAOqx38zTMx112AQ3ihKHFGQUOTjUdDUq6yVp1cc=; h=From:To:Subject:Date:From; b=tWjzQn1Y8NFRin/Grarv4HHLX0rNR/KmkjrIo6OAY5fKqNtwSSScxpMQ0VxFzB8kV uwTT8NJxYdz0QVlbukgTJVCoK68nQ37O/RE/PR+4mp1IYHCz8pxmKxr8L+YCN4wHkk abXO1R4VrwHfdlC44Etqfj+yqwGd/yitTk/xuC3w= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Bruno Larsen To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Change gdb.base/skip-solib.exp deal with lack of epilogue information X-Act-Checkin: binutils-gdb X-Git-Author: Bruno Larsen X-Git-Refname: refs/heads/master X-Git-Oldrev: 07bb02de7232c7d0974007296540d9887532b952 X-Git-Newrev: d5bcff0343ae1a4a8be76fd8646b22f20f9ed94a Message-Id: <20220922090459.82CAB385800E@sourceware.org> Date: Thu, 22 Sep 2022 09:04:59 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Dd5bcff0343ae= 1a4a8be76fd8646b22f20f9ed94a commit d5bcff0343ae1a4a8be76fd8646b22f20f9ed94a Author: Bruno Larsen Date: Tue Sep 13 18:47:05 2022 +0200 Change gdb.base/skip-solib.exp deal with lack of epilogue information =20 When running gdb.base/skip-solib.exp, the backtrace tests could fail wi= th compilers that associated epilogue instructions with the last statement line of the function, instead of associating it with the closing brace, despite the feature being fully functional. As an example, when testing skipping the function square, the testsuite would show =20 Breakpoint 1, main () at (...)/binutils-gdb/gdb/testsuite/gdb.base/skip= -solib-main.c:5 5 return square(0); (gdb) step 0x00007ffff7cef560 in __libc_start_call_main () from /lib64/libc.so.6 (gdb) PASS: gdb.base/skip-solib.exp: ignoring solib file: step bt #0 0x00007ffff7cef560 in __libc_start_call_main () from /lib64/libc.s= o.6 #1 0x00007ffff7cef60c in __libc_start_main_impl () from /lib64/libc.s= o.6 #2 0x0000000000401065 in _start () (gdb) FAIL: gdb.base/skip-solib.exp: ignoring solib file: bt =20 Which means that the feature is working, the testsuite is just mis-identifying it. To avoid this problem, the skipped function calls have been sent to a line before `return`, so epilogues won't factor in. Diff: --- gdb/testsuite/gdb.base/skip-solib-lib.c | 3 ++- gdb/testsuite/gdb.base/skip-solib-main.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.base/skip-solib-lib.c b/gdb/testsuite/gdb.ba= se/skip-solib-lib.c index b2c4d86d703..341f1440a3b 100644 --- a/gdb/testsuite/gdb.base/skip-solib-lib.c +++ b/gdb/testsuite/gdb.base/skip-solib-lib.c @@ -7,5 +7,6 @@ int multiply(int a, int b) =20 int square(int num) { - return multiply(num, num); + int res =3D multiply(num, num); + return res; } diff --git a/gdb/testsuite/gdb.base/skip-solib-main.c b/gdb/testsuite/gdb.b= ase/skip-solib-main.c index 746bb5f36bb..a3b6d417935 100644 --- a/gdb/testsuite/gdb.base/skip-solib-main.c +++ b/gdb/testsuite/gdb.base/skip-solib-main.c @@ -2,5 +2,6 @@ int square(int num); =20 int main() { - return square(0); + int s =3D square(0); + return s; }