public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Change gdb.base/skip-solib.exp deal with lack of epilogue information
@ 2022-09-22  9:04 Bruno Larsen
  0 siblings, 0 replies; only message in thread
From: Bruno Larsen @ 2022-09-22  9:04 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d5bcff0343ae1a4a8be76fd8646b22f20f9ed94a

commit d5bcff0343ae1a4a8be76fd8646b22f20f9ed94a
Author: Bruno Larsen <blarsen@redhat.com>
Date:   Tue Sep 13 18:47:05 2022 +0200

    Change gdb.base/skip-solib.exp deal with lack of epilogue information
    
    When running gdb.base/skip-solib.exp, the backtrace tests could fail with
    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
    
    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.so.6
     #1  0x00007ffff7cef60c in __libc_start_main_impl () from /lib64/libc.so.6
     #2  0x0000000000401065 in _start ()
    (gdb) FAIL: gdb.base/skip-solib.exp: ignoring solib file: bt
    
    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.base/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)
 
 int square(int num)
 {
-  return multiply(num, num);
+  int res = multiply(num, num);
+  return res;
 }
diff --git a/gdb/testsuite/gdb.base/skip-solib-main.c b/gdb/testsuite/gdb.base/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);
 
 int main()
 {
-  return square(0);
+  int s = square(0);
+  return s;
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-09-22  9:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-22  9:04 [binutils-gdb] Change gdb.base/skip-solib.exp deal with lack of epilogue information Bruno Larsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).