public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM]  archer-sergiodj-stap: Implementing the support for testing probes with semaphores.
@ 2011-03-24  5:07 sergiodj
  0 siblings, 0 replies; only message in thread
From: sergiodj @ 2011-03-24  5:07 UTC (permalink / raw)
  To: archer-commits

The branch, archer-sergiodj-stap has been updated
       via  fa28225366469dc39cabf960a49e795ae9a1c793 (commit)
      from  8531c9a99512b24369506b9dd2748e8f692e3839 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit fa28225366469dc39cabf960a49e795ae9a1c793
Author: Sergio Durigan Junior <sergiodj@redhat.com>
Date:   Thu Mar 24 02:06:52 2011 -0300

    Implementing the support for testing probes with semaphores.
    
    This commit basically implements the support for semaphores on the
    current testcase for probes and tracepoints.  Everything is working on
    my machine.

-----------------------------------------------------------------------

Summary of changes:
 gdb/testsuite/gdb.trace/stap-trace.c   |   43 ++++++++++++++++++++--------
 gdb/testsuite/gdb.trace/stap-trace.exp |   48 ++++++++++++++++++++------------
 2 files changed, 61 insertions(+), 30 deletions(-)

First 500 lines of diff:
diff --git a/gdb/testsuite/gdb.trace/stap-trace.c b/gdb/testsuite/gdb.trace/stap-trace.c
index 55cb645..27f317e 100644
--- a/gdb/testsuite/gdb.trace/stap-trace.c
+++ b/gdb/testsuite/gdb.trace/stap-trace.c
@@ -15,6 +15,22 @@
    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
+
+#define _SDT_HAS_SEMAPHORES
+__extension__ unsigned short teste_user_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes")));
+#define TEST teste_user_semaphore
+
+__extension__ unsigned short teste_two_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes")));
+#define TEST2 teste_two_semaphore
+
+#else
+
+#define TEST 1
+#define TEST2 1
+
+#endif /* USE_PROBES */
+
 #include <sys/sdt.h>
 
 /* We only support SystemTap and only the v3 form.  */
@@ -23,30 +39,33 @@
 #endif
 
 void
-m1 (void)
-{
-  STAP_PROBE (teste, two);
-}
-
-void
-m2 (void)
+m1 (int x)
 {
-  STAP_PROBE (teste, two);
+  if (TEST2)
+    STAP_PROBE1 (teste, two, x);
 }
 
 int
 f (int x)
 {
-  STAP_PROBE1(teste, user, x);
+  if (TEST)
+    STAP_PROBE1(teste, user, x);
   return x+5;
 }
 
+void
+nothing (void)
+{
+  int a = 1 + 1;
+  return;
+}
+
 int
 main()
 {
-  f(f(23)); /* begin-here */
-  m1();
-  m2(); /* end-here */
+  f (f (23));
+  m1 (46);
+  nothing (); /* end-here */
 
   return 0;
 }
diff --git a/gdb/testsuite/gdb.trace/stap-trace.exp b/gdb/testsuite/gdb.trace/stap-trace.exp
index 1025687..189355f 100644
--- a/gdb/testsuite/gdb.trace/stap-trace.exp
+++ b/gdb/testsuite/gdb.trace/stap-trace.exp
@@ -28,17 +28,28 @@ set binfile $objdir/$subdir/$executable
 set ws "\[\r\n\t \]+"
 set cr "\[\r\n\]+"
 
-if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
-	executable {debug nowarnings}] != "" } {
-    untested "Could not compile ${srcfile}"
-    return -1
+# Only x86 and x86_64 targets are supported for now.
+
+if { ![istarget "x86_64-*"] && ![istarget "i?86-*"] } {
+    continue
 }
 
-# Only x86 and x86_64 targets are supported for now.
+proc compile_stap_bin {{ arg "" }} {
+    global srcfile
+    global binfile
+    global srcdir
+    global subdir
 
-#if { ![istarget "x86_64-*"] && ![istarget "i?86-*"] } {
-#    continue
-#}
+    if { $arg != "" } {
+	set arg "additional_flags=$arg"
+    }
+
+    if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
+	    executable [concat $arg debug nowarnings]] != "" } {
+	untested "Could not compile ${srcfile}"
+	return -1
+    }
+}
 
 proc prepare_for_trace_test {} {
     global executable
@@ -50,17 +61,12 @@ proc prepare_for_trace_test {} {
 	continue
     }
 
-#    gdb_breakpoint [gdb_get_line_number "begin-here"]
     gdb_breakpoint [gdb_get_line_number "end-here"]
 }
 
 proc run_trace_experiment { test_probe msg } {
     global gdb_prompt
 
-#    gdb_test "continue" \
-#	".*Breakpoint \[0-9\]+.*" \
-#	"collect $msg: advance to begin-here"
-
     set test "collect $msg: start trace experiment"
     gdb_test_multiple "tstart" "$test" {
 	-re "^tstart\r\n$gdb_prompt $" {
@@ -79,13 +85,13 @@ proc run_trace_experiment { test_probe msg } {
 	    "collect $msg: tfind test frame"
 }
 
-proc gdb_collect_probe_arg { msg } {
+proc gdb_collect_probe_arg { msg probe val_arg0 } {
     global gdb_prompt
     global cr
 
     prepare_for_trace_test
 
-    gdb_test "trace probe:user" \
+    gdb_test "trace $probe" \
 	    "Tracepoint \[0-9\]+ at .*" \
 	    "collect $msg: set tracepoint"
     gdb_trace_setactions "collect $msg: define actions" \
@@ -93,13 +99,15 @@ proc gdb_collect_probe_arg { msg } {
 	    "collect \$_probe_arg0" "^$"
 
     # Begin the test.
-    run_trace_experiment $msg "probe:user"
+    run_trace_experiment $msg $probe
 
     gdb_test "print \$_probe_arg0" \
-	    "\\$\[0-9\]+ = 23$cr" \
+	    "\\$\[0-9\]+ = $val_arg0$cr" \
 	    "collect $msg: collected probe arg0"
 }
 
+compile_stap_bin ""
+
 clean_restart $executable
 if { ![runto_main] } {
     perror "Could not run to `main'."
@@ -111,7 +119,11 @@ if { ![gdb_target_supports_trace] } {
     return 1;
 }
 
-gdb_collect_probe_arg "probe args"
+gdb_collect_probe_arg "probe args without semaphore" "probe:user" "23"
+gdb_exit
+
+compile_stap_bin "-DUSE_PROBES"
+gdb_collect_probe_arg "probe args with semaphore" "probe:two" "46"
 
 # Finished!
 gdb_test "tfind none" ".*" ""


hooks/post-receive
--
Repository for Project Archer.


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

only message in thread, other threads:[~2011-03-24  5:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-24  5:07 [SCM] archer-sergiodj-stap: Implementing the support for testing probes with semaphores sergiodj

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).