testsuite, gdb.btrace: adjust expected output to pass with clang
authorMarkus Metzger <markus.t.metzger@intel.com>
Tue, 15 Dec 2020 15:18:34 +0000 (16:18 +0100)
committerMarkus Metzger <markus.t.metzger@intel.com>
Wed, 3 Mar 2021 08:16:45 +0000 (09:16 +0100)
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
gdb/testsuite/gdb.btrace/exception.cc
gdb/testsuite/gdb.btrace/exception.exp
gdb/testsuite/gdb.btrace/function_call_history.exp

index 3712199c4b78922d5c989c9ddd3d4d0416e52988..1e79a145cc182da82063fc3b2405a853fcf40f20 100644 (file)
@@ -1,3 +1,9 @@
+2021-03-03  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.
+
 2021-03-03  Markus Metzger  <markus.t.metzger@intel.com>
 
        * gdb.btrace/unknown_functions.exp: Move -Wl,-x to ldflags.
index 6e4f872d8ff3eced7d9972ed765ccd01eab7196f..0c660bb705182b2356ba1cd74f742d19ce031906 100644 (file)
@@ -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  */
 }
index 33cd0ea0bc9d6b3ab1e76523aa4df249031a2be6..7b840e41bfc03bf6085315e8137c00bf0da71e53 100755 (executable)
@@ -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\\(\\)" \
+  ] "" \
+  ]
index 568f794db7ec8aaae81cf64914b8a71f52b31e96..f995016fafa73febb3e0aaca17a2ca117dd1f4b0 100644 (file)
@@ -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"