[binutils-gdb] gdb/testsuite/gdb.base/stap-probe: Minor clean-up

Simon Marchi simark@sourceware.org
Fri Jan 10 19:59:00 GMT 2020


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

commit 47e9d49d2d795224f4b3f04c89c268627b850be4
Author: George Barrett <bob@bob131.so>
Date:   Sat Jan 11 06:30:01 2020 +1100

    gdb/testsuite/gdb.base/stap-probe: Minor clean-up
    
    This patch resolves a couple of issues with the test case for SystemTap
    user-space probe points:
      1. The preprocessor macro guarding the semaphore variables in the C
         file is (rather confusingly) named USE_PROBES. This has been
         renamed to USE_SEMAPHORES, to better reflect its function.
      2. The test procedures in the expect file improperly pass the flag
         defining USE_PROBES to prepare_for_testing; as such, the test
         binary that's supposed to have probes with semaphores is the same
         as the one without. This has also been fixed.
      3. No test is performed to check that `info probes' returns
         information about probe semaphores. Such a test is included in this
         patch.
    
    gdb/testsuite/ChangeLog
    2020-01-10  George Barrett  <bob@bob131.so>
    
    	* gdb.base/stap-probe.c: Rename USE_PROBES to USE_SEMAPHORES.
    	* gdb.base/stap-probe.exp: Likewise.
    	(stap_test): Pass argument as an additional flag.
    	(stap_test_no_debuginfo): Likewise.
    	(stap_test): Check `info probes stap' output for semaphore
    	addresses if the test binary is supposed to have them.

Diff:
---
 gdb/testsuite/ChangeLog               |  9 +++++++++
 gdb/testsuite/gdb.base/stap-probe.c   |  2 +-
 gdb/testsuite/gdb.base/stap-probe.exp | 19 ++++++++++++-------
 3 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 536a964..84fa9ae 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2020-01-10  George Barrett  <bob@bob131.so>
+
+	* gdb.base/stap-probe.c: Rename USE_PROBES to USE_SEMAPHORES.
+	* gdb.base/stap-probe.exp: Likewise.
+	(stap_test): Pass argument as an additional flag.
+	(stap_test_no_debuginfo): Likewise.
+	(stap_test): Check `info probes stap' output for semaphore
+	addresses if the test binary is supposed to have them.
+
 2020-01-09  Andrew Burgess  <andrew.burgess@embecosm.com>
 
 	* gdb.tui/basic.exp: Add more scrolling tests.
diff --git a/gdb/testsuite/gdb.base/stap-probe.c b/gdb/testsuite/gdb.base/stap-probe.c
index f79e9e1..3d742d1 100644
--- a/gdb/testsuite/gdb.base/stap-probe.c
+++ b/gdb/testsuite/gdb.base/stap-probe.c
@@ -15,7 +15,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#if USE_PROBES
+#if USE_SEMAPHORES
 
 #define _SDT_HAS_SEMAPHORES
 __extension__ unsigned short test_user_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes")));
diff --git a/gdb/testsuite/gdb.base/stap-probe.exp b/gdb/testsuite/gdb.base/stap-probe.exp
index b35f350..fce5286 100644
--- a/gdb/testsuite/gdb.base/stap-probe.exp
+++ b/gdb/testsuite/gdb.base/stap-probe.exp
@@ -22,7 +22,7 @@ proc stap_test {exec_name {arg ""}} {
     global testfile hex srcfile
 
     if {[prepare_for_testing "failed to prepare" ${exec_name} $srcfile \
-	   [concat $arg debug]]} {
+	   [concat additional_flags=$arg debug]]} {
 	return -1
     }
 
@@ -33,9 +33,14 @@ proc stap_test {exec_name {arg ""}} {
     gdb_test "print \$_probe_argc" "No probe at PC $hex" \
 	"check argument not at probe point"
 
-    gdb_test "info probes stap" \
-	"test *user *$hex .*"
-    
+    if {[string first "-DUSE_SEMAPHORES" $arg] != -1} {
+	gdb_test "info probes stap" \
+	    "test *user *$hex *$hex .*"
+    } else {
+	gdb_test "info probes stap" \
+	    "test *user *$hex .*"
+    }
+
     if {[runto "-pstap test:user"]} {
 	pass "run to -pstap test:user"
     } else {
@@ -96,7 +101,7 @@ proc stap_test_no_debuginfo {exec_name {arg ""}} {
     global testfile hex
 
     if {[prepare_for_testing "failed to prepare" ${exec_name} ${testfile}.c \
-	   {$arg nodebug optimize=-O2}]} {
+	   [concat additional_flags=$arg nodebug optimize=-O2]]} {
 	return -1
     }
 
@@ -166,7 +171,7 @@ with_test_prefix "without semaphore, not optimized" {
 }
 
 with_test_prefix "with semaphore, not optimized" {
-    stap_test "stap-probe-sem-noopt" "-DUSE_PROBES"
+    stap_test "stap-probe-sem-noopt" "-DUSE_SEMAPHORES"
 }
 
 with_test_prefix "without semaphore, optimized" {
@@ -174,5 +179,5 @@ with_test_prefix "without semaphore, optimized" {
 }
 
 with_test_prefix "with semaphore, optimized" {
-    stap_test_no_debuginfo "stap-probe-sem-opt" "-DUSE_PROBES"
+    stap_test_no_debuginfo "stap-probe-sem-opt" "-DUSE_SEMAPHORES"
 }



More information about the Gdb-cvs mailing list