public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Markus Metzger <markus.t.metzger@intel.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 5/8] testsuite, gdb.btrace: adjust expected output to pass with clang
Date: Thu,  4 Feb 2021 09:10:34 +0100	[thread overview]
Message-ID: <20210204081037.3712162-9-markus.t.metzger@intel.com> (raw)
In-Reply-To: <20210204081037.3712162-1-markus.t.metzger@intel.com>

Clang generates slightly different debug information.  Adjust the expected
output of gdb.btrace/function_call_history.exp to work with both gcc and
clang.

Also modify gdb.btrace/exception.cc to reliably trace into main and update
the corresponding patterns in gdb.btrace/exception.exp.

gdb/testsuite/ChangeLog:
2020-12-15  Markus Metzger  <markus.t.metzger@intel.com>

	* gdb.btrace/exception.cc (main): Update test source.
	* gdb.btrace/exception.exp: Update patterns.
	* gdb.btrace/function_call_history.exp: Likewise.
---
 gdb/testsuite/gdb.btrace/exception.cc         |  6 ++++-
 gdb/testsuite/gdb.btrace/exception.exp        | 26 ++++++++++++-------
 .../gdb.btrace/function_call_history.exp      | 20 +++++++-------
 3 files changed, 31 insertions(+), 21 deletions(-)

diff --git a/gdb/testsuite/gdb.btrace/exception.cc b/gdb/testsuite/gdb.btrace/exception.cc
index 6e4f872d8ff..0c660bb7051 100644
--- a/gdb/testsuite/gdb.btrace/exception.cc
+++ b/gdb/testsuite/gdb.btrace/exception.cc
@@ -50,7 +50,11 @@ test (void)
 int
 main (void)
 {
+  int ret;
+
   test ();
   test (); /* bp.1  */
-  return 0; /* bp.2  */
+
+  ret = 0;
+  return ret; /* bp.2  */
 }
diff --git a/gdb/testsuite/gdb.btrace/exception.exp b/gdb/testsuite/gdb.btrace/exception.exp
index 33cd0ea0bc9..7b840e41bfc 100755
--- a/gdb/testsuite/gdb.btrace/exception.exp
+++ b/gdb/testsuite/gdb.btrace/exception.exp
@@ -60,19 +60,25 @@ gdb_expect_list "flat" "\r\n$gdb_prompt $" [list \
     "3\tfoo\\(\\)" \
     "4\tbar\\(\\)" \
     "5\tbad\\(\\)\r" \
-  ] \
-  "" \
-  "\[0-9\]*\ttest\\(\\)"]
+  ] "" \
+  [multi_line \
+    "\[0-9\]*\ttest\\(\\)" \
+    "\[0-9\]*\tmain\\(\\)" \
+  ] "" \
+  ]
 
 # show the branch trace with calls indented
 send_gdb "record function-call-history /c 1\n"
 gdb_expect_list "indented" "\r\n$gdb_prompt $" [list \
   [multi_line \
     "1\tmain\\(\\)" \
-  "2\t  test\\(\\)" \
-  "3\t    foo\\(\\)" \
-  "4\t      bar\\(\\)" \
-  "5\t        bad\\(\\)\r" \
-  ] \
-  "" \
-  "\[0-9\]*\t  test\\(\\)"]
+    "2\t  test\\(\\)" \
+    "3\t    foo\\(\\)" \
+    "4\t      bar\\(\\)" \
+    "5\t        bad\\(\\)\r" \
+  ] "" \
+  [multi_line \
+    "\[0-9\]*\t  test\\(\\)" \
+    "\[0-9\]*\tmain\\(\\)" \
+  ] "" \
+  ]
diff --git a/gdb/testsuite/gdb.btrace/function_call_history.exp b/gdb/testsuite/gdb.btrace/function_call_history.exp
index 568f794db7e..f995016fafa 100644
--- a/gdb/testsuite/gdb.btrace/function_call_history.exp
+++ b/gdb/testsuite/gdb.btrace/function_call_history.exp
@@ -148,29 +148,29 @@ gdb_test_no_output "set filename-display basename"
 # moving forward again, but this time with file and line number, expected to see the first 15 entries
 gdb_test "record function-call-history /l +" [multi_line \
   "\[0-9\]*\tmain\tat $srcfile:40,41" \
-  "\[0-9\]*\tinc\tat $srcfile:22,24" \
+  "\[0-9\]*\tinc\tat $srcfile:22,2\[34\]" \
   "\[0-9\]*\tmain\tat $srcfile:40,41" \
-  "\[0-9\]*\tinc\tat $srcfile:22,24" \
+  "\[0-9\]*\tinc\tat $srcfile:22,2\[34\]" \
   "\[0-9\]*\tmain\tat $srcfile:40,41" \
-  "\[0-9\]*\tinc\tat $srcfile:22,24" \
+  "\[0-9\]*\tinc\tat $srcfile:22,2\[34\]" \
   "\[0-9\]*\tmain\tat $srcfile:40,41" \
-  "\[0-9\]*\tinc\tat $srcfile:22,24" \
+  "\[0-9\]*\tinc\tat $srcfile:22,2\[34\]" \
   "\[0-9\]*\tmain\tat $srcfile:40,41" \
-  "\[0-9\]*\tinc\tat $srcfile:22,24" \
+  "\[0-9\]*\tinc\tat $srcfile:22,2\[34\]" \
   "\[0-9\]*\tmain\tat $srcfile:40,41" \
-  "\[0-9\]*\tinc\tat $srcfile:22,24" \
+  "\[0-9\]*\tinc\tat $srcfile:22,2\[34\]" \
   "\[0-9\]*\tmain\tat $srcfile:40,41" \
-  "\[0-9\]*\tinc\tat $srcfile:22,24" \
+  "\[0-9\]*\tinc\tat $srcfile:22,2\[34\]" \
   "\[0-9\]*\tmain\tat $srcfile:40,41" \
   ] "forward /l - 1"
 
 # moving forward and expect to see the latest 6 entries
 gdb_test "record function-call-history /l +" [multi_line \
-  "\[0-9\]*\tinc\tat $srcfile:22,24" \
+  "\[0-9\]*\tinc\tat $srcfile:22,2\[34\]" \
   "\[0-9\]*\tmain\tat $srcfile:40,41" \
-  "\[0-9\]*\tinc\tat $srcfile:22,24" \
+  "\[0-9\]*\tinc\tat $srcfile:22,2\[34\]" \
   "\[0-9\]*\tmain\tat $srcfile:40,41" \
-  "\[0-9\]*\tinc\tat $srcfile:22,24" \
+  "\[0-9\]*\tinc\tat $srcfile:22,2\[34\]" \
   "\[0-9\]*\tmain\tat $srcfile:40,43" \
   ] "forward /l - 2"
 
-- 
2.26.2

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Gary Kershaw
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


  parent reply	other threads:[~2021-02-04  8:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-04  8:10 [PATCH 0/8] pass gdb.btrace " Markus Metzger
2021-02-04  8:10 ` [PATCH 1/2] gdb, btrace: fix hang when stepping over a breakpoint at the end of the trace Markus Metzger
2021-02-04  8:10 ` [PATCH 1/8] testsuite: extend nopie handling to add -fno-pie to compiler flags Markus Metzger
2021-03-02 16:00   ` Simon Marchi
2021-03-03  7:57     ` Metzger, Markus T
2021-02-04  8:10 ` [PATCH] testsuite: note on use_gdb_stub usage Markus Metzger
2021-02-26  7:48   ` Metzger, Markus T
2021-02-04  8:10 ` [PATCH 2/2] gdb, record: move no-history notification into normal_stop Markus Metzger
2021-02-04  8:10 ` [PATCH 2/8] testsuite, gdb.btrace: remove assembly-check in delta.exp Markus Metzger
2021-02-04  8:10 ` [PATCH 3/8] testsuite, gdb.btrace: pass rn-dl-bind.exp with clang Markus Metzger
2021-02-04  8:10 ` [PATCH 4/8] testsuite, gdb.btrace: move -Wl,-x to ldflags Markus Metzger
2021-02-04  8:10 ` Markus Metzger [this message]
2021-02-04  8:10 ` [PATCH 6/8] testsuite, gdb.btrace: remove implicit debug option in stepi.exp Markus Metzger
2021-02-04  8:10 ` [PATCH 7/8] testsuite, gdb.btrace: adjust expected source line in non-stop.exp Markus Metzger
2021-02-04  8:10 ` [PATCH 8/8] gdb, testsuite: enforce lazy binding for gdb.btrace/rn-dl-bind.exp Markus Metzger
2021-02-26  7:50 ` [PATCH 0/8] pass gdb.btrace with clang Metzger, Markus T

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210204081037.3712162-9-markus.t.metzger@intel.com \
    --to=markus.t.metzger@intel.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).