From 0562c0e77429fd6798f8a1d46ef597527e7a392f Mon Sep 17 00:00:00 2001 From: David Smith Date: Wed, 11 Jun 2008 11:16:07 -0500 Subject: [PATCH] utrace thread.begin and thread.end probe test fixes. 2008-06-11 David Smith * systemtap.base/utrace_p5.exp: Made changes to work when not configured in the src directory. * systemtap.base/utrace_p5_multi.c: Made changes to work on x86_64 systems. --- testsuite/ChangeLog | 5 +++++ testsuite/systemtap.base/utrace_p5.exp | 2 +- testsuite/systemtap.base/utrace_p5_multi.c | 14 ++++++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index bf2f7ccae..1fd4c0e6a 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2008-06-11 David Smith + * systemtap.base/utrace_p5.exp: Made changes to work when not + configured in the src directory. + * systemtap.base/utrace_p5_multi.c: Made changes to work on x86_64 + systems. + * systemtap.base/utrace_p5.exp: Added 'process().thread.begin' and 'process().thread.end' tests. * systemtap.base/utrace_p5_multi.c: Added multi-threaded test diff --git a/testsuite/systemtap.base/utrace_p5.exp b/testsuite/systemtap.base/utrace_p5.exp index 1185f0150..fcd617fe4 100644 --- a/testsuite/systemtap.base/utrace_p5.exp +++ b/testsuite/systemtap.base/utrace_p5.exp @@ -3,7 +3,7 @@ # Initialize variables set utrace_support_found 0 set exepath "[pwd]/cat_[pid]" -set multi_srcpath "systemtap.base/utrace_p5_multi.c" +set multi_srcpath "$srcdir/systemtap.base/utrace_p5_multi.c" set multi_exepath "[pwd]/utrace_p5_multi_[pid]" set multi_flags "libs=-lpthread" diff --git a/testsuite/systemtap.base/utrace_p5_multi.c b/testsuite/systemtap.base/utrace_p5_multi.c index 03c6eea04..153243d0e 100644 --- a/testsuite/systemtap.base/utrace_p5_multi.c +++ b/testsuite/systemtap.base/utrace_p5_multi.c @@ -7,6 +7,10 @@ void *thread_function( void *ptr ); +struct thread_data { + int tnum; +}; + int main() { @@ -14,8 +18,10 @@ main() int iret1, iret2; /* Create independent threads each of which will execute function */ - iret1 = pthread_create(&thread1, NULL, thread_function, (void*) 1); - iret2 = pthread_create(&thread2, NULL, thread_function, (void*) 2); + struct thread_data t1 = { 1 }; + struct thread_data t2 = { 2 }; + iret1 = pthread_create(&thread1, NULL, thread_function, (void*) &t1); + iret2 = pthread_create(&thread2, NULL, thread_function, (void*) &t2); /* Wait till threads are complete before main continues. Unless we * wait we run the risk of executing an exit which will terminate @@ -31,8 +37,8 @@ main() void *thread_function(void *ptr) { - int tnum = (int)ptr; - if (tnum == 1) { + struct thread_data *td = ptr; + if (td->tnum == 1) { int fd = open("/dev/null", O_RDONLY); close(fd); } -- 2.43.5