From 2e526dabcf4b15fb102e295b282df3af54d5c9d3 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Mon, 19 Oct 2009 11:33:24 -0400 Subject: PR10799: warn on possibly uintended local-vs-global namespace collision * elaborate.cxx (find_var): Take extra token parameter. Look for cross-file global variable resolution, signal a warning. * testsuite/systemtap.examples/io/traceio2.stp: Fix it. * testsuite/systemtap.syscall/sys.stp: Fix it. * NEWS: Document it. --- testsuite/systemtap.syscall/sys.stp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'testsuite/systemtap.syscall') diff --git a/testsuite/systemtap.syscall/sys.stp b/testsuite/systemtap.syscall/sys.stp index e3564a15..79c7ff57 100755 --- a/testsuite/systemtap.syscall/sys.stp +++ b/testsuite/systemtap.syscall/sys.stp @@ -1,4 +1,4 @@ -global indent, indent_str, entry +global indent, indent_str, entry_p probe begin { indent = 0 @@ -13,22 +13,22 @@ probe begin { probe syscall.* ? { if (pid() == target()) { - if (entry) printf("\n") + if (entry_p) printf("\n") printf("%s%s: %s (%s) = ", indent_str[indent], execname(), name, argstr) # printf("%s%s: %s (%s) = ", indent_str[indent], execname(), probefunc(), argstr) indent++ - entry = 1 + entry_p = 1 } } probe syscall.*.return ? { if (pid() == target()) { if (indent) indent-- - if (entry) + if (entry_p) printf("%s\n", retstr) else printf("%s%s\n", indent_str[indent],retstr) - entry = 0 + entry_p = 0 } } -- cgit From 49e20063710b1d5dbb4efeb53d751b684835413c Mon Sep 17 00:00:00 2001 From: David Smith Date: Thu, 29 Oct 2009 16:12:18 -0500 Subject: Fix syscall testsuite bugs. * testsuite/systemtap.syscall/test.tcl: Substitute '[[[[' and ']]]]' for '(' and ')'. This allows us to get unquoted parens. * testsuite/systemtap.syscall/test-debug.tcl: Matches substitute logic of test.tcl. * testsuite/systemtap.syscall/README: Document '[[[[' and ']]]]'. * testsuite/systemtap.syscall/chmod.c: Handle optional O_LARGEFILE flag in open calls. * testsuite/systemtap.syscall/dir.c: Ditto. * testsuite/systemtap.syscall/mmap.c: Ditto. * testsuite/systemtap.syscall/openclose.c: Ditto. * testsuite/systemtap.syscall/readwrite.c: Ditto. * testsuite/systemtap.syscall/stat.c: Ditto. --- testsuite/systemtap.syscall/README | 3 +++ testsuite/systemtap.syscall/chmod.c | 2 +- testsuite/systemtap.syscall/dir.c | 4 ++-- testsuite/systemtap.syscall/mmap.c | 4 ++-- testsuite/systemtap.syscall/openclose.c | 18 +++++++++--------- testsuite/systemtap.syscall/readwrite.c | 4 ++-- testsuite/systemtap.syscall/stat.c | 2 +- testsuite/systemtap.syscall/test-debug.tcl | 11 +++++++++++ testsuite/systemtap.syscall/test.tcl | 6 ++++++ 9 files changed, 37 insertions(+), 17 deletions(-) (limited to 'testsuite/systemtap.syscall') diff --git a/testsuite/systemtap.syscall/README b/testsuite/systemtap.syscall/README index 480bd8cd..836ac747 100644 --- a/testsuite/systemtap.syscall/README +++ b/testsuite/systemtap.syscall/README @@ -18,6 +18,9 @@ is expected, put "NNNN" (for decimal) or "XXXX" (for hex). Or you can just write regular expressions. The "NNNN" and "XXXX" are just shorthand to aid readability and are converted to regular expressions in test.tcl. +Normally opening and closing parentheses ('(' and ')') get quoted. If +you want unquoted parentheses, use '[[[[' (for '(') or ']]]]' (for ')'). + 3. Somewhere is your test program puts a comment line like this: /* COVERAGE: syscall1 syscall2 ... */ where you list the systemcalls that are tested. Then you can run diff --git a/testsuite/systemtap.syscall/chmod.c b/testsuite/systemtap.syscall/chmod.c index 724b86c4..ce18b3d0 100644 --- a/testsuite/systemtap.syscall/chmod.c +++ b/testsuite/systemtap.syscall/chmod.c @@ -11,7 +11,7 @@ int main() int fd; fd = open("foobar",O_WRONLY|O_CREAT, 0666); - //staptest// open ("foobar", O_WRONLY|O_CREAT, 0666) = NNNN + //staptest// open ("foobar", O_WRONLY|O_CREAT[[[[.O_LARGEFILE]]]]?, 0666) = NNNN chmod("foobar", 0644); //staptest// chmod ("foobar", 0644) diff --git a/testsuite/systemtap.syscall/dir.c b/testsuite/systemtap.syscall/dir.c index 3eda8175..f5b9f320 100644 --- a/testsuite/systemtap.syscall/dir.c +++ b/testsuite/systemtap.syscall/dir.c @@ -20,7 +20,7 @@ int main() //staptest// chdir ("..") = 0 fd = open("foobar", O_RDONLY); - //staptest// open ("foobar", O_RDONLY) = NNNN + //staptest// open ("foobar", O_RDONLY[[[[.O_LARGEFILE]]]]?) = NNNN fchdir(fd); //staptest// fchdir (NNNN) = 0 @@ -35,7 +35,7 @@ int main() //staptest// rmdir ("foobar") = 0 fd = open(".", O_RDONLY); - //staptest// open (".", O_RDONLY) = NNNN + //staptest// open (".", O_RDONLY[[[[.O_LARGEFILE]]]]?) = NNNN #ifdef SYS_mkdirat mkdirat(fd, "xyzzy", 0765); diff --git a/testsuite/systemtap.syscall/mmap.c b/testsuite/systemtap.syscall/mmap.c index 13145fb2..a09888b4 100644 --- a/testsuite/systemtap.syscall/mmap.c +++ b/testsuite/systemtap.syscall/mmap.c @@ -13,14 +13,14 @@ int main() /* create a file with something in it */ fd = open("foobar",O_WRONLY|O_CREAT|O_TRUNC, 0600); - //staptest// open ("foobar", O_WRONLY|O_CREAT|O_TRUNC, 0600) = NNNN + //staptest// open ("foobar", O_WRONLY|O_CREAT[[[[.O_LARGEFILE]]]]?|O_TRUNC, 0600) = NNNN lseek(fd, 1024, SEEK_SET); write(fd, "abcdef", 6); close(fd); //staptest// close (NNNN) = 0 fd = open("foobar", O_RDONLY); - //staptest// open ("foobar", O_RDONLY) = NNNN + //staptest// open ("foobar", O_RDONLY[[[[.O_LARGEFILE]]]]?) = NNNN /* stat for file size */ ret = fstat(fd, &fs); diff --git a/testsuite/systemtap.syscall/openclose.c b/testsuite/systemtap.syscall/openclose.c index cb003a9e..aeabbe19 100644 --- a/testsuite/systemtap.syscall/openclose.c +++ b/testsuite/systemtap.syscall/openclose.c @@ -13,46 +13,46 @@ int main() int fd1, fd2; fd2 = creat("foobar1",S_IREAD|S_IWRITE); - //staptest// open ("foobar1", O_WRONLY|O_CREAT|O_TRUNC, 0600) = NNNN + //staptest// open ("foobar1", O_WRONLY|O_CREAT[[[[.O_LARGEFILE]]]]?|O_TRUNC, 0600) = NNNN fd1 = open("foobar2",O_WRONLY|O_CREAT, S_IRWXU); - //staptest// open ("foobar2", O_WRONLY|O_CREAT, 0700) = NNNN + //staptest// open ("foobar2", O_WRONLY|O_CREAT[[[[.O_LARGEFILE]]]]?, 0700) = NNNN close(fd1); //staptest// close (NNNN) = 0 fd1 = open("foobar2",O_RDONLY); - //staptest// open ("foobar2", O_RDONLY) = NNNN + //staptest// open ("foobar2", O_RDONLY[[[[.O_LARGEFILE]]]]?) = NNNN close(fd1); //staptest// close (NNNN) = 0 fd1 = open("foobar2",O_RDWR); - //staptest// open ("foobar2", O_RDWR) = NNNN + //staptest// open ("foobar2", O_RDWR[[[[.O_LARGEFILE]]]]?) = NNNN close(fd1); //staptest// close (NNNN) = 0 fd1 = open("foobar2",O_APPEND|O_WRONLY); - //staptest// open ("foobar2", O_WRONLY|O_APPEND) = NNNN + //staptest// open ("foobar2", O_WRONLY|O_APPEND[[[[.O_LARGEFILE]]]]?) = NNNN close(fd1); //staptest// close (NNNN) = 0 fd1 = open("foobar2",O_DIRECT|O_RDWR); - //staptest// open ("foobar2", O_RDWR|O_DIRECT) = NNNN + //staptest// open ("foobar2", O_RDWR|O_DIRECT[[[[.O_LARGEFILE]]]]?) = NNNN close(fd1); //staptest// close (NNNN) = 0 fd1 = open("foobar2",O_NOATIME|O_SYNC|O_RDWR); - //staptest// open ("foobar2", O_RDWR|O_NOATIME|O_SYNC) = NNNN + //staptest// open ("foobar2", O_RDWR[[[[.O_LARGEFILE]]]]?|O_NOATIME|O_SYNC) = NNNN close(fd1); //staptest// close (NNNN) = 0 /* Now test some bad opens */ fd1 = open("/",O_WRONLY); - //staptest// open ("/", O_WRONLY) = -NNNN (EISDIR) + //staptest// open ("/", O_WRONLY[[[[.O_LARGEFILE]]]]?) = -NNNN (EISDIR) close (fd1); //staptest// close (NNNN) = -NNNN (EBADF) fd1 = open("foobar2",O_WRONLY|O_CREAT|O_EXCL, S_IRWXU); - //staptest// open ("foobar2", O_WRONLY|O_CREAT|O_EXCL, 0700) = -NNNN (EEXIST) + //staptest// open ("foobar2", O_WRONLY|O_CREAT|O_EXCL[[[[.O_LARGEFILE]]]]?, 0700) = -NNNN (EEXIST) return 0; } diff --git a/testsuite/systemtap.syscall/readwrite.c b/testsuite/systemtap.syscall/readwrite.c index bd0914cc..d966c0a8 100644 --- a/testsuite/systemtap.syscall/readwrite.c +++ b/testsuite/systemtap.syscall/readwrite.c @@ -26,7 +26,7 @@ int main() v[2].iov_len = sizeof(STRING3); fd = open("foobar1",O_WRONLY|O_CREAT, 0666); - //staptest// open ("foobar1", O_WRONLY|O_CREAT, 0666) = NNNN + //staptest// open ("foobar1", O_WRONLY|O_CREAT[[[[.O_LARGEFILE]]]]?, 0666) = NNNN write(fd,"Hello world", 11); //staptest// write (NNNN, "Hello world", 11) = 11 @@ -66,7 +66,7 @@ int main() close (fd); fd = open("foobar1",O_RDONLY); - //staptest// open ("foobar1", O_RDONLY) = NNNN + //staptest// open ("foobar1", O_RDONLY[[[[.O_LARGEFILE]]]]?) = NNNN read(fd, buf, 11); //staptest// read (NNNN, XXXX, 11) = 11 diff --git a/testsuite/systemtap.syscall/stat.c b/testsuite/systemtap.syscall/stat.c index d47c1440..20a66b09 100644 --- a/testsuite/systemtap.syscall/stat.c +++ b/testsuite/systemtap.syscall/stat.c @@ -20,7 +20,7 @@ int main() //staptest// getcwd (XXXX, 128) = NNNN fd = creat("foobar",S_IREAD|S_IWRITE); - //staptest// open ("foobar", O_WRONLY|O_CREAT|O_TRUNC, 0600) = NNNN + //staptest// open ("foobar", O_WRONLY|O_CREAT[[[[.O_LARGEFILE]]]]?|O_TRUNC, 0600) = NNNN fstat(fd, &sbuf); //staptest// fstat (NNNN, XXXX) = 0 diff --git a/testsuite/systemtap.syscall/test-debug.tcl b/testsuite/systemtap.syscall/test-debug.tcl index eb730459..3eb6bbf0 100755 --- a/testsuite/systemtap.syscall/test-debug.tcl +++ b/testsuite/systemtap.syscall/test-debug.tcl @@ -50,9 +50,20 @@ foreach line [split $output "\n"] { if {[regsub {//} $line {} line]} { set line "$testname: [string trimleft $line]" + # We need to quote all these metacharacters regsub -all {\(} $line {\\(} line regsub -all {\)} $line {\\)} line regsub -all {\|} $line {\|} line + # + and * are metacharacters, but should always be used + # as metacharacters in the expressions, don't escape them. + #regsub -all {\+} $line {\\+} line + #regsub -all {\*} $line {\\*} line + + # Turn '[[[[' and ']]]]' into '(' and ')' respectively. + # Because normally parens get quoted, this allows us to + # have non-quoted parens. + regsub -all {\[\[\[\[} $line {(} line + regsub -all {\]\]\]\]} $line {)} line regsub -all NNNN $line {[\-0-9]+} line regsub -all XXXX $line {[x0-9a-fA-F]+} line diff --git a/testsuite/systemtap.syscall/test.tcl b/testsuite/systemtap.syscall/test.tcl index b9d3c0d9..e640db66 100755 --- a/testsuite/systemtap.syscall/test.tcl +++ b/testsuite/systemtap.syscall/test.tcl @@ -67,6 +67,12 @@ proc run_one_test {filename flags bits} { #regsub -all {\+} $line {\\+} line #regsub -all {\*} $line {\\*} line + # Turn '[[[[' and ']]]]' into '(' and ')' respectively. + # Because normally parens get quoted, this allows us to + # have non-quoted parens. + regsub -all {\[\[\[\[} $line {(} line + regsub -all {\]\]\]\]} $line {)} line + regsub -all NNNN $line {[\-0-9]+} line regsub -all XXXX $line {[x0-9a-fA-F]+} line -- cgit From 9f61c5d4c3487aa8225d5271c798f5ebaafc398a Mon Sep 17 00:00:00 2001 From: David Smith Date: Mon, 2 Nov 2009 12:51:12 -0600 Subject: PR 6691 fixed by adding support for sys_accept4. * tapset/aux_syscalls.stp(_sock_type_str): Rewrote in embedded-C and added socket flags support. (_sock_flags_str): New function. * tapset/syscalls.stp: syscall.accept prefers to use sys_accept4 when it exists. Added support for sys_accept4's 'flag' parameter. * testsuite/systemtap.syscall/net1.c (main): Updated regular expression to handle the new 'flags' argument. --- testsuite/systemtap.syscall/net1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'testsuite/systemtap.syscall') diff --git a/testsuite/systemtap.syscall/net1.c b/testsuite/systemtap.syscall/net1.c index f8079ffd..b7f1d6cb 100644 --- a/testsuite/systemtap.syscall/net1.c +++ b/testsuite/systemtap.syscall/net1.c @@ -32,7 +32,7 @@ int main() //staptest// listen (NNNN, 7) = 0 cfd = accept(listenfd, (struct sockaddr *)NULL, NULL); - //staptest// accept (NNNN, 0x[0]+, 0x[0]+) = -NNNN (EAGAIN) + //staptest// accept (NNNN, 0x[0]+, 0x[0]+, 0) = -NNNN (EAGAIN) close(cfd); close(listenfd); -- cgit