From b593551607cc5b6ef512e787b0f881d99c4ac6c5 Mon Sep 17 00:00:00 2001 From: Dave Brolley Date: Mon, 25 Aug 2008 11:23:41 -0400 Subject: Robustness improvements for the stap client/server --- Makefile.am | 2 +- Makefile.in | 27 +++++++++------------- aclocal.m4 | 38 +++++++++++++----------------- doc/Makefile.in | 4 ++-- stap-client | 35 ++++++++++++++++++---------- stap-server | 51 ++++++++++++++++++++++------------------ stap-serverd | 64 +++++++++++++++++++++++++-------------------------- testsuite/Makefile.in | 8 ++++++- 8 files changed, 120 insertions(+), 109 deletions(-) diff --git a/Makefile.am b/Makefile.am index 05da9fad..9cbaf747 100644 --- a/Makefile.am +++ b/Makefile.am @@ -248,7 +248,7 @@ installcheck: echo "$(DESTDIR)$(bindir)/stap is not recent, run make install"; \ exit -1; \ fi; - $(MAKE) -C testsuite installcheck RUNTESTFLAGS="$(RUNTESTFLAGS)" EXTRA_SYSTEMTAP_PATH="$(EXTRA_SYSTEMTAP_PATH)" + $(MAKE) -C testsuite installcheck RUNTESTFLAGS="$(RUNTESTFLAGS)" rpm: systemtap.spec dist rpmbuild --define "_sourcedir $(PWD)/" -ba $(srcdir)/systemtap.spec diff --git a/Makefile.in b/Makefile.in index 9de49415..93d723a7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. +# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -1164,8 +1164,8 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS @@ -1190,8 +1190,8 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ @@ -1201,12 +1201,13 @@ ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ + here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique @@ -1279,10 +1280,6 @@ dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) -dist-lzma: distdir - tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma - $(am__remove_distdir) - dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) @@ -1310,8 +1307,6 @@ distcheck: dist GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.lzma*) \ - unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ @@ -1480,7 +1475,7 @@ uninstall-man: uninstall-man1 uninstall-man5 uninstall-man8 clean-binPROGRAMS clean-generic clean-local \ clean-noinstPROGRAMS clean-pkglibexecPROGRAMS ctags \ ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-hook \ - dist-lzma dist-shar dist-tarZ dist-zip distcheck distclean \ + dist-shar dist-tarZ dist-zip distcheck distclean \ distclean-compile distclean-generic distclean-hdr \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ @@ -1637,7 +1632,7 @@ installcheck: echo "$(DESTDIR)$(bindir)/stap is not recent, run make install"; \ exit -1; \ fi; - $(MAKE) -C testsuite installcheck RUNTESTFLAGS="$(RUNTESTFLAGS)" EXTRA_SYSTEMTAP_PATH="$(EXTRA_SYSTEMTAP_PATH)" + $(MAKE) -C testsuite installcheck RUNTESTFLAGS="$(RUNTESTFLAGS)" rpm: systemtap.spec dist rpmbuild --define "_sourcedir $(PWD)/" -ba $(srcdir)/systemtap.spec diff --git a/aclocal.m4 b/aclocal.m4 index 0e2027cd..9d70920d 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.10.1 -*- Autoconf -*- +# generated automatically by aclocal 1.10 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# 2005, 2006 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -11,15 +11,12 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -m4_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(AC_AUTOCONF_VERSION, [2.61],, -[m4_warning([this file was generated for autoconf 2.61. -You have another version of autoconf. It may work, but is not guaranteed to. -If you have problems, you may need to regenerate the build system entirely. -To do so, use the procedure documented by the package, typically `autoreconf'.])]) +m4_if(m4_PACKAGE_VERSION, [2.61],, +[m4_fatal([this file was generated for autoconf 2.61. +You have another version of autoconf. If you want to use that, +you should regenerate the build system entirely.], [63])]) -# Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -34,7 +31,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.10' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.10.1], [], +m4_if([$1], [1.10], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -50,10 +47,8 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.10.1])dnl -m4_ifndef([AC_AUTOCONF_VERSION], - [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)]) +[AM_AUTOMAKE_VERSION([1.10])dnl +_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- @@ -348,7 +343,7 @@ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue @@ -396,13 +391,13 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2008 Free Software Foundation, Inc. +# 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 13 +# serial 12 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. @@ -507,17 +502,16 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJC], # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. -_am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in - $_am_arg | $_am_arg:* ) + $1 | $1:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done -echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) +echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # @@ -878,7 +872,7 @@ AC_SUBST([INSTALL_STRIP_PROGRAM])]) # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- -# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) diff --git a/doc/Makefile.in b/doc/Makefile.in index e01c5ebf..6464afc3 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10.1 from Makefile.am. +# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. diff --git a/stap-client b/stap-client index 3fa397a7..f4ccb033 100755 --- a/stap-client +++ b/stap-client @@ -102,8 +102,10 @@ function parse_options { script_file=$first_token cmdline1="$cmdline2" cmdline2= - else + elif test "$first_char" != "'"; then cmdline2="$cmdline2 '$first_token'" + else + cmdline2="$cmdline2 $first_token" fi advance_p=$(($advance_p + 1)) break @@ -381,13 +383,15 @@ function package_request { # client -> "request:" # client -> $tar_client function send_request { - # Send the request file. We need to redirect to /dev/null - # in order to workaround a nc bug. It closes the connection - # early if stdin from the other side is not provided. - until nc $server $(($port + 1)) < $tar_client > /dev/null + # Send the request file. + for ((attempt=0; $attempt < 10; ++attempt)) do + if nc -w10 $server $(($port+1)) < $tar_client > /dev/null 2>&1; then + return; + fi sleep 1 done + fatal "ERROR: Unable to connect to server while sending request file" } # function: receive_response @@ -398,13 +402,15 @@ function receive_response { tar_server=`mktemp -t $tmpdir_prefix_client.server.tgz.XXXXXX` || \ fatal "ERROR: cannot create temporary file " $tar_server - # Retrieve the file. We need to redirect stdin from /dev/zero to work - # around a bug in nc. It closes the connection early is stdin is not - # provided. - until nc $server $(($port + 1)) < /dev/zero > $tar_server + # Retrieve the file. Wait for up to 5 minutes for a response. + for ((attempt=0; $attempt < 300; ++attempt)) do + if nc -d $server $(($port+1)) > $tar_server 2>/dev/null; then + return; + fi sleep 1 done + fatal "ERROR: Unable to connect to server while receiving response file" } # function: unpack_response @@ -516,8 +522,8 @@ function choose_server { fi done - if test num_servers = 0; then - fatal "ERROR: cannot find a server" + if test $num_servers = 0; then + fatal "ERROR: unable to find a server" fi fatal "ERROR: unable to connect to a server" @@ -527,10 +533,15 @@ function choose_server { # # Establish connection with the given server function connect_to_server { - until echo "request:" | nc $1 $2 > /dev/null + for ((attempt=0; $attempt < 10; ++attempt)) do + if echo "request:" | nc -w10 $1 $2 >/dev/null 2>&1; then + return 0 + fi sleep 1 done + + return 1 } # function: disconnect_from_server diff --git a/stap-server b/stap-server index b82bc695..67573de7 100755 --- a/stap-server +++ b/stap-server @@ -47,29 +47,26 @@ function initialization { # function: receive_request # # Receive a tar file representing the request from the client: -# The protocol is: -# client -> "request:" -# client -> $tar_client function receive_request { - # Request from the client is on stdin - read - line=$REPLY - - # Check to see that it is a client request - test "$line" = "request:" || \ - fatal "ERROR: client request, '$line' is incorrect" - # Create a place to receive the client's tar file tar_client=`mktemp -t $tmpdir_prefix_server.client.tgz.XXXXXX` || \ fatal "ERROR: cannot create temporary tar file " $tar_client - # Receive the file. We need to redirect stdin from /dev/zero to work - # around a bug in nc. It closes the connection early is stdin is not - # provided. - nc -l $port < /dev/zero > $tar_client & + # Receive the file. + nc -ld $port > $tar_client 2>/dev/null & + + # Wait for 10 seconds before timing out + for ((t=0; $t < 10; ++t)) + do + if jobs '%nc -l' >/dev/null 2>&1; then + sleep 1 + else + return + fi + done - # Wait for the transfer to complete. - wait '%nc' >/dev/null 2>&1 + # We have timed out. fatal will kill the job. + fatal "Timed out waiting for client request file" } # function: unpack_request @@ -386,11 +383,21 @@ function package_response { # # Wait for the client to take the response file. function send_response { - # Now send it. We need to redirect to /dev/null - # in order to workaround a nc bug. It closes the connection - # early if stdin from the other side is not provided. - nc -l $port < $tar_server > /dev/null & - wait '%nc' >/dev/null 2>&1 + # Now send it. + nc -l $port < $tar_server > /dev/null 2>&1 & + + # Wait for 10 seconds before timing out + for ((t=0; $t < 10; ++t)) + do + if jobs '%nc -l' >/dev/null 2>&1; then + sleep 1 + else + return + fi + done + + # We have timed out. fatal will kill the job. + fatal "Timed out waiting to send response file" } # function: fatal [ MESSAGE ] diff --git a/stap-serverd b/stap-serverd index 6970217d..45aacf63 100755 --- a/stap-serverd +++ b/stap-serverd @@ -22,11 +22,10 @@ trap 'terminate' SIGTERM SIGINT # function: initialization PORT function initialization { # Default settings. - tmpdir_prefix_serverd=stap.serverd avahi_type=_stap._tcp port=$1 test "X$port" = "X" && port=65000 - port2=$(($port + 1)) + export port2=$(($port + 1)) if netstat -atn | awk '{print $4}' | cut -f2 -d: | egrep -q "^($port|$port2)\$"; then # Whoops, the port is busy; try another one. initialization $((1024+($port + $RANDOM)%64000)) @@ -53,43 +52,41 @@ function advertise_presence { # # Listen for and handle requests to the server. function listen { - # Work in a temporary directory - tmpdir=`mktemp -dt $tmpdir_prefix_serverd.XXXXXX` || \ - fatal "ERROR: cannot create temporary directory " $tmpdir - cd $tmpdir - - # Create a fifo for communicating with the server - local fifo_name=$tmpdir_prefix_serverd.fifo - mknod $fifo_name p || \ - fatal "ERROR: cannot create temporary fifo " $tmpdir/$fifo_name - # Loop forever accepting requests - first=1 - set -o pipefail # We want the status of 'nc' not 'stap-server'. while true do - # Run this in the background and wait for it. This way any signals - # received (i.e. SIGTERM) will be processed. Make sure we don't - # advertise our presence until we're actually listening. for ((attempt=0; $attempt < 5; ++attempt)) do - nc -l $port < $fifo_name | stap-server $((port + 1)) > $fifo_name 2>&1 & - if test $first = 1; then - advertise_presence - first=0 - fi - wait '%nc' >/dev/null 2>&1 + nc -ld $port 2>/dev/null | process_request & + wait '%nc -l' rc=$? - if test $rc = 127 -o $rc = 0; then - break; # success + if test $rc = 0 -o $rc = 127; then + break; # port was read ok fi - sleep 1 done if test $attempt = 5; then fatal "ERROR: cannot listen on port $port. rc==$rc" fi done - set +o pipefail # restore +} + +# function: process_request +# +# Process an incoming request on stdin +function process_request { + read + case $REPLY in + request:) + stap-server $port2 >/dev/null 2>&1 & + wait '%stap-server' + rc=$? + test $rc = 127 && rc=0 + ;; + *) + rc=1 + esac + + exit $rc } # function: fatal [ MESSAGE ] @@ -112,13 +109,13 @@ function terminate { kill -s SIGTERM %avahi-publish-service 2> /dev/null wait '%avahi-publish-service' >/dev/null 2>&1 - # Kill any running 'nc -l' job. - kill -s SIGTERM "%nc -l" 2> /dev/null - wait "%nc - l" >/dev/null 2>&1 + # Kill any running 'stap-server' job. + kill -s SIGTERM "%stap-server" 2> /dev/null + wait "%stap-server" >/dev/null 2>&1 - # Clean up - cd `dirname $tmpdir` - rm -fr $tmpdir + # Kill any running 'nc -l' job. + kill -s SIGTERM "%?nc -l" 2> /dev/null + wait "%?nc - l" >/dev/null 2>&1 exit } @@ -127,4 +124,5 @@ function terminate { # Beginning of main line execution. #----------------------------------------------------------------------------- initialization "$@" +advertise_presence listen diff --git a/testsuite/Makefile.in b/testsuite/Makefile.in index 9c708bc9..f3b56f6f 100644 --- a/testsuite/Makefile.in +++ b/testsuite/Makefile.in @@ -140,7 +140,13 @@ EXTRA_DIST = execrc config lib systemtap \ parseok parseko semok semko transok transko buildok buildok \ systemtap.syscall systemtap.stress systemtap.string \ systemtap.pass1-4 systemtap.samples systemtap.printf \ - systemtap.maps systemtap.base + systemtap.maps systemtap.base \ + systemtap.examples/examples-index-gen.pl \ + systemtap.examples/systemtap.css \ + systemtap.examples/systemtapcorner.gif \ + systemtap.examples/systemtaplogo.png \ + systemtap.examples/html_footer.tmpl \ + systemtap.examples/html_header.tmpl # $(srcdir)/These values point the test suite to the install tree, and -- cgit From e396cf0c479e491ad6624f2c523f444a9f941f42 Mon Sep 17 00:00:00 2001 From: Dave Brolley Date: Mon, 25 Aug 2008 13:55:01 -0400 Subject: ChangeLog Entries --- ChangeLog | 22 ++++++++++++++++++++++ doc/ChangeLog | 2 +- testsuite/ChangeLog | 5 +++++ testsuite/systemtap.base/warnings.exp | 1 + 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ebbef729..3feb2f5c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2008-08-25 Dave Brolley + + * Makefile.am (installcheck): Remove $(EXTRA_SYSTEMTAP_PATH) from + invocation of $(MAKE). + * Makefile.in: Regenerated. + * aclocal.m4: Regenerated. + * stap-client (parse_options): Don't quote an argument if it is already + quoted. + (send_request): Timeout after 10 seconds. + (receive_response): Timeout after 5 minutes. + (choose_server): Add missing $ to variable reference. + (connect_to_server): Timeout after 10 seconds. + * stap-server (receive_request): Don't check for a "request:" + message. Timeout after 10 seconds. + (send_response): Timeout after 10 seconds. + * stap-serverd (initialization): Remove tmpdir_prefix_serverd and + port2. No need for a temp directory. + (listen): Fifo no longer necessary. Call nc and pipe the output to + process_request in the background. + (process_request): New function. + (fatal): Kill stap-server followed by nc. No tmpdir to remove. + 2008-08-24 Frank Ch. Eigler * tapsets.cxx (query_statement): Leave empty string for unknown file diff --git a/doc/ChangeLog b/doc/ChangeLog index 405dec3f..f83ac3d3 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,4 +1,4 @@ -2008-07-14 +2008-07-14 Dave Brolley * Makefile.in: Regenerated. diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index 27b0a0c1..434dbc3c 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-08-25 Dave Brolley + + * systemtap.base/warnings.exp: Allow 30 seconds for completion. + * Makefile.in: Regenerated. + 2008-08-22 Wenji Huang * buildok/process-all-probes.stp: Change system-wide probes to detailed ones to avoid including user space ones. diff --git a/testsuite/systemtap.base/warnings.exp b/testsuite/systemtap.base/warnings.exp index b56d7a98..a90860d9 100644 --- a/testsuite/systemtap.base/warnings.exp +++ b/testsuite/systemtap.base/warnings.exp @@ -3,6 +3,7 @@ set test "warnings" spawn stap -p4 $srcdir/$subdir/warnings.stp set ok 0 expect { + -timeout 30 -re {^WARNING:[^\r\n]*\r\n} { incr ok; exp_continue } -re {^[^\r\n]*.ko\r\n} { incr ok; exp_continue } timeout { fail "$test (timeout)" } -- cgit From 278def1009fff72da4e4ea3949e6b722cc541c07 Mon Sep 17 00:00:00 2001 From: David Smith Date: Mon, 25 Aug 2008 14:13:38 -0500 Subject: 2008-08-25 David Smith * tapsets.cxx (utrace_derived_probe_group::emit_module_init): Make sure we count the number of utrace probes correctly. (utrace_derived_probe_group::emit_module_exit): Ditto. --- ChangeLog | 6 ++++++ tapsets.cxx | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3feb2f5c..60bea84d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-08-25 David Smith + + * tapsets.cxx (utrace_derived_probe_group::emit_module_init): Make + sure we count the number of utrace probes correctly. + (utrace_derived_probe_group::emit_module_exit): Ditto. + 2008-08-25 Dave Brolley * Makefile.am (installcheck): Remove $(EXTRA_SYSTEMTAP_PATH) from diff --git a/tapsets.cxx b/tapsets.cxx index b924f1fc..289c5fac 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -6480,8 +6480,7 @@ utrace_derived_probe_group::emit_module_init (systemtap_session& s) s.op->newline(); s.op->newline() << "/* ---- utrace probes ---- */"; - - s.op->newline() << "for (i=0; i<" << num_probes << "; i++) {"; + s.op->newline() << "for (i=0; iindent(1); s.op->newline() << "struct stap_utrace_probe *p = &stap_utrace_probes[i];"; s.op->newline() << "rc = stap_register_task_finder_target(&p->tgt);"; @@ -6511,7 +6510,7 @@ utrace_derived_probe_group::emit_module_exit (systemtap_session& s) s.op->newline(); s.op->newline() << "/* ---- utrace probes ---- */"; - s.op->newline() << "for (i=0; i<" << num_probes << "; i++) {"; + s.op->newline() << "for (i=0; iindent(1); s.op->newline() << "struct stap_utrace_probe *p = &stap_utrace_probes[i];"; -- cgit From 677328047c60fbcdf0f755e72b165fe442098070 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 25 Aug 2008 22:41:07 +0200 Subject: Examples html files moved into subdir. --- testsuite/ChangeLog | 7 +++++++ testsuite/Makefile.am | 10 +++++----- testsuite/Makefile.in | 42 ++++++++++++++++++++++++------------------ testsuite/aclocal.m4 | 36 +++++++++++++++++++++--------------- 4 files changed, 57 insertions(+), 38 deletions(-) diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index 434dbc3c..4d0133aa 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2008-08-25 Mark Wielaard + + * Makefile.am (EXTRA_DIST): html_footer.tmpl, systemtapcorner.gif, + systemtaplogo.png, html_header.tmpl and systemtap.css moved to html + subdir. + * Makefile.in, aclocal.m4: Regenerated. + 2008-08-25 Dave Brolley * systemtap.base/warnings.exp: Allow 30 seconds for completion. diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am index b92286b0..3a47548c 100644 --- a/testsuite/Makefile.am +++ b/testsuite/Makefile.am @@ -34,11 +34,11 @@ EXTRA_DIST = execrc config lib systemtap \ systemtap.pass1-4 systemtap.samples systemtap.printf \ systemtap.maps systemtap.base \ systemtap.examples/examples-index-gen.pl \ - systemtap.examples/systemtap.css \ - systemtap.examples/systemtapcorner.gif \ - systemtap.examples/systemtaplogo.png \ - systemtap.examples/html_footer.tmpl \ - systemtap.examples/html_header.tmpl + systemtap.examples/html/systemtap.css \ + systemtap.examples/html/systemtapcorner.gif \ + systemtap.examples/html/systemtaplogo.png \ + systemtap.examples/html/html_footer.tmpl \ + systemtap.examples/html/html_header.tmpl # $(srcdir)/These values point the test suite to the install tree, and diff --git a/testsuite/Makefile.in b/testsuite/Makefile.in index f3b56f6f..a90a05cb 100644 --- a/testsuite/Makefile.in +++ b/testsuite/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.10 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -142,11 +142,11 @@ EXTRA_DIST = execrc config lib systemtap \ systemtap.pass1-4 systemtap.samples systemtap.printf \ systemtap.maps systemtap.base \ systemtap.examples/examples-index-gen.pl \ - systemtap.examples/systemtap.css \ - systemtap.examples/systemtapcorner.gif \ - systemtap.examples/systemtaplogo.png \ - systemtap.examples/html_footer.tmpl \ - systemtap.examples/html_header.tmpl + systemtap.examples/html/systemtap.css \ + systemtap.examples/html/systemtapcorner.gif \ + systemtap.examples/html/systemtaplogo.png \ + systemtap.examples/html/html_footer.tmpl \ + systemtap.examples/html/html_header.tmpl # $(srcdir)/These values point the test suite to the install tree, and @@ -275,6 +275,10 @@ dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) + dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) @@ -301,6 +305,8 @@ distcheck: dist GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lzma*) \ + unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ @@ -447,17 +453,17 @@ uninstall-am: .PHONY: all all-am all-local am--refresh check check-DEJAGNU check-am \ check-local clean clean-generic clean-local dist dist-all \ - dist-bzip2 dist-gzip dist-shar dist-tarZ dist-zip distcheck \ - distclean distclean-DEJAGNU distclean-generic distcleancheck \ - distdir distuninstallcheck dvi dvi-am html html-am info \ - info-am install install-am install-data install-data-am \ - install-dvi install-dvi-am install-exec install-exec-am \ - install-html install-html-am install-info install-info-am \ - install-man install-pdf install-pdf-am install-ps \ - install-ps-am install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ - uninstall-am + dist-bzip2 dist-gzip dist-lzma dist-shar dist-tarZ dist-zip \ + distcheck distclean distclean-DEJAGNU distclean-generic \ + distcleancheck distdir distuninstallcheck dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ + pdf-am ps ps-am uninstall uninstall-am all-local: diff --git a/testsuite/aclocal.m4 b/testsuite/aclocal.m4 index 5aee677e..c9daa488 100644 --- a/testsuite/aclocal.m4 +++ b/testsuite/aclocal.m4 @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.10 -*- Autoconf -*- +# generated automatically by aclocal 1.10.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006 Free Software Foundation, Inc. +# 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -11,12 +11,15 @@ # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. -m4_if(m4_PACKAGE_VERSION, [2.61],, -[m4_fatal([this file was generated for autoconf 2.61. -You have another version of autoconf. If you want to use that, -you should regenerate the build system entirely.], [63])]) +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(AC_AUTOCONF_VERSION, [2.61],, +[m4_warning([this file was generated for autoconf 2.61. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically `autoreconf'.])]) -# Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -31,7 +34,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.10' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.10], [], +m4_if([$1], [1.10.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -47,8 +50,10 @@ m4_define([_AM_AUTOCONF_VERSION], []) # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.10])dnl -_AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)]) +[AM_AUTOMAKE_VERSION([1.10.1])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- @@ -141,13 +146,13 @@ fi])]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006 Free Software Foundation, Inc. +# 2005, 2006, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 12 +# serial 13 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. @@ -252,16 +257,17 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJC], # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. +_am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in - $1 | $1:* ) + $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done -echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # @@ -510,7 +516,7 @@ AC_SUBST([INSTALL_STRIP_PROGRAM])]) # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- -# Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in. +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) -- cgit From 4040e9ea927a8ce508ff35096d0de74a274a2473 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Mon, 25 Aug 2008 22:48:44 -0400 Subject: remove support for "make dist" since git-archive does as well; "make rpm" remains for private testing --- ChangeLog | 8 ++ Makefile.am | 51 ++++------ Makefile.in | 258 ++++++++------------------------------------------ configure | 17 ++-- configure.ac | 2 +- doc/ChangeLog | 5 + doc/Makefile.am | 1 - doc/Makefile.in | 1 - systemtap.spec | 16 ++-- testsuite/ChangeLog | 6 ++ testsuite/Makefile.am | 19 +--- testsuite/Makefile.in | 193 +++---------------------------------- 12 files changed, 116 insertions(+), 461 deletions(-) diff --git a/ChangeLog b/ChangeLog index 60bea84d..469fada5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-08-25 Frank Ch. Eigler + + * Makefile.am (AUTOMAKE_OPTIONS): Add "no-dist". Remove all + "make dist"-oriented targets and macros. + (rpm): Rewrite. Allow parametrization with RPMBUILDFLAGS=. + * Makefile.in: Regenerated. + * systemtap.spec: Make configuration macros at top overridable. + 2008-08-25 David Smith * tapsets.cxx (utrace_derived_probe_group::emit_module_init): Make diff --git a/Makefile.am b/Makefile.am index 9cbaf747..eb4250b1 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ # Makefile.am --- automake input file for systemtap ## process this file with automake to produce Makefile.in -AUTOMAKE_OPTIONS = dist-bzip2 +AUTOMAKE_OPTIONS = no-dist pkglibexecdir = ${libexecdir}/${PACKAGE} @@ -10,7 +10,9 @@ AM_CPPFLAGS = -DBINDIR='"$(bindir)"' -DPKGDATADIR='"${pkgdatadir}"' -DPKGLIBDIR= AM_CFLAGS = -D_GNU_SOURCE -fexceptions -Wall -Werror -Wunused -Wformat=2 -W AM_CXXFLAGS = -Wall -Werror -dist_man_MANS = stap.1 stapprobes.5 stapfuncs.5 stapvars.5 stapex.5 staprun.8 man/stapprobes.iosched.5 man/stapprobes.netdev.5 man/stapprobes.nfs.5 man/stapprobes.nfsd.5 man/stapprobes.pagefault.5 man/stapprobes.process.5 man/stapprobes.rpc.5 man/stapprobes.scsi.5 man/stapprobes.signal.5 man/stapprobes.socket.5 man/stapprobes.tcp.5 man/stapprobes.udp.5 +man_MANS = stap.1 stapprobes.5 stapfuncs.5 stapvars.5 stapex.5 staprun.8 man/stapprobes.iosched.5 man/stapprobes.netdev.5 man/stapprobes.nfs.5 man/stapprobes.nfsd.5 man/stapprobes.pagefault.5 man/stapprobes.process.5 man/stapprobes.rpc.5 man/stapprobes.scsi.5 man/stapprobes.signal.5 man/stapprobes.socket.5 man/stapprobes.tcp.5 man/stapprobes.udp.5 +# see also configure.ac + bin_PROGRAMS = stap staprun bin_SCRIPTS = stap-client stap-server stap-serverd stap-find-servers stap-start-server stap-find-or-start-server stap-stop-server stap_SOURCES = main.cxx \ @@ -23,7 +25,7 @@ BUILT_SOURCES = CLEANFILES = # Arrange for git_version.h to be regenerated at every "make". -# Code fragment is based upon RadeonHD.am. +# Code fragment is based upon RadeonHD.am. # The stamp file which is never created ensures that git_version.h is updated # before every build. Having git_version.h in foo_SOURCES ensures a recompile @@ -50,13 +52,6 @@ git_version.stamp: fi; \ fi -dist-gitversion: git_version.stamp - if test -f "git_version.h"; then \ - sed -e 's|^#undef GIT_IS_DIST.*|#define GIT_IS_DIST 1|' \ - "git_version.h" > "$(distdir)/git_version.h"; \ - fi - - git_version.h: $(srcdir)/git_version.sh -k --srcdir $(srcdir) -o git_version.h @@ -74,9 +69,6 @@ stapio_CPPFLAGS = $(AM_CPPFLAGS) stapio_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@ if BUILD_ELFUTILS -# This tells automake's "make distcheck" what we need to compile. -DISTCHECK_CONFIGURE_FLAGS = --with-elfutils=$(elfutils_abs_srcdir) - stap_CPPFLAGS += -Iinclude-elfutils stap_LDFLAGS += -Llib-elfutils -Wl,-rpath-link,lib-elfutils \ -Wl,--enable-new-dtags,-rpath,$(pkglibdir) @@ -113,7 +105,7 @@ staprun_LDADD = @PROCFLAGS@ @cap_LIBS@ stapio_SOURCES = runtime/staprun/stapio.c \ runtime/staprun/mainloop.c runtime/staprun/common.c \ runtime/staprun/ctl.c \ - runtime/staprun/relay.c runtime/staprun/relay_old.c + runtime/staprun/relay.c runtime/staprun/relay_old.c stapio_CFLAGS = @PROCFLAGS@ $(AM_CFLAGS) stapio_LDADD = @PROCFLAGS@ -lpthread @@ -151,15 +143,6 @@ endif # Get extra libs as needed LDADD = -EXTRA_DIST = auto_free.h buildrun.h elaborate.h loc2c.h session.h \ - parse.h staptree.h tapsets.h translate.h \ - cache.h hash.h mdfour.h util.h staplog.c coveragedb.h \ - testsuite systemtap.spec runtime tapset \ - dwarf_wrappers.h \ - git_version.h git_version.sh \ - stap-client stap-server stap-serverd stap-find-servers stap-start-server stap-find-or-start-server stap-stop-server \ - systemtap.spec - EXAMPLE_SOURCE_DIR = $(srcdir)/testsuite/systemtap.examples EXAMPLE_META_FILES = $(EXAMPLE_SOURCE_DIR)/*/*.meta @@ -171,11 +154,6 @@ $(EXAMPLE_SOURCE_DIR)/index.html: $(EXAMPLE_META_FILES) $(EXAMPLE_INDEX_GEN) @echo " perl examples-index-gen.pl" @echo "to regenerate it." -dist-hook: dist-gitversion - find $(distdir) -name CVS -o -name '*~' -o -name '.#*' | xargs rm -rf - find $(distdir) -name '*.o' -o -name '*.ko' -o -name '*.cmd' -o -name '*.mod.c' -o -name '.??*' | xargs rm -rf - find $(distdir) -name 'stap' -o -name '*.log' -o -name '*.sum' -o -name 'site.exp' | xargs rm -rf - install-data-local: (cd $(srcdir)/runtime; for f in *.[ch]; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/$$f; done) (cd $(srcdir)/runtime/unwind; find . \( -name '*.[ch]' \) -print \ @@ -250,5 +228,18 @@ installcheck: fi; $(MAKE) -C testsuite installcheck RUNTESTFLAGS="$(RUNTESTFLAGS)" -rpm: systemtap.spec dist - rpmbuild --define "_sourcedir $(PWD)/" -ba $(srcdir)/systemtap.spec + +# Any extra flags, such as: +# --define "with_docs 0" +# --define "with_bundled_elfutils 1" --define "elfutils_version 0.135" +RPMBUILDFLAGS= + +rpm: + cd $(srcdir); git status | grep working.directory.clean || (echo "You should commit your changes before 'make rpm'.") + (cd $(srcdir); git archive --prefix=systemtap-$(VERSION)/ --format=tar HEAD) | gzip > systemtap-$(VERSION).tar.gz + mkdir -p `rpm --eval %_specdir` + mkdir -p `rpm --eval %_srcrpmdir` + mkdir -p `rpm --eval %_rpmdir` + mkdir -p `rpm --eval %_builddir` + mkdir -p `rpm --eval %_buildroot` + rpmbuild --define "_sourcedir $(PWD)/" -ta systemtap-$(VERSION).tar.gz $(RPMBUILDFLAGS) diff --git a/Makefile.in b/Makefile.in index 93d723a7..3d2a575a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -44,12 +44,13 @@ bin_PROGRAMS = stap$(EXEEXT) staprun$(EXEEXT) pkglibexec_PROGRAMS = stapio$(EXEEXT) noinst_PROGRAMS = loc2c-test$(EXEEXT) subdir = . -DIST_COMMON = README $(am__configure_deps) $(dist_man_MANS) \ - $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(srcdir)/config.in $(srcdir)/stap.1.in $(srcdir)/stapex.5.in \ - $(srcdir)/stapfuncs.5.in $(srcdir)/stapprobes.5.in \ - $(srcdir)/staprun.8.in $(srcdir)/stapvars.5.in \ - $(top_srcdir)/configure \ +DIST_COMMON = INSTALL NEWS README AUTHORS ChangeLog \ + $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/configure $(am__configure_deps) \ + $(srcdir)/config.in $(srcdir)/stap.1.in \ + $(srcdir)/stapprobes.5.in $(srcdir)/stapfuncs.5.in \ + $(srcdir)/stapvars.5.in $(srcdir)/stapex.5.in \ + $(srcdir)/staprun.8.in \ $(top_srcdir)/man/stapprobes.iosched.5.in \ $(top_srcdir)/man/stapprobes.netdev.5.in \ $(top_srcdir)/man/stapprobes.nfs.5.in \ @@ -61,9 +62,7 @@ DIST_COMMON = README $(am__configure_deps) $(dist_man_MANS) \ $(top_srcdir)/man/stapprobes.signal.5.in \ $(top_srcdir)/man/stapprobes.socket.5.in \ $(top_srcdir)/man/stapprobes.tcp.5.in \ - $(top_srcdir)/man/stapprobes.udp.5.in AUTHORS COPYING \ - ChangeLog INSTALL NEWS compile config.guess depcomp install-sh \ - missing + $(top_srcdir)/man/stapprobes.udp.5.in depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ @@ -133,8 +132,6 @@ CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ SOURCES = $(loc2c_test_SOURCES) $(stap_SOURCES) $(stapio_SOURCES) \ $(staprun_SOURCES) -DIST_SOURCES = $(loc2c_test_SOURCES) $(stap_SOURCES) $(stapio_SOURCES) \ - $(staprun_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ @@ -146,23 +143,12 @@ man1dir = $(mandir)/man1 man5dir = $(mandir)/man5 man8dir = $(mandir)/man8 NROFF = nroff -MANS = $(dist_man_MANS) +MANS = $(man_MANS) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) -am__remove_distdir = \ - { test ! -d $(distdir) \ - || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -fr $(distdir); }; } -DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 -GZIP_ENV = --best -distuninstallcheck_listfiles = find . -type f -print -distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ @@ -269,12 +255,12 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -AUTOMAKE_OPTIONS = dist-bzip2 +AUTOMAKE_OPTIONS = no-dist pkglibexecdir = ${libexecdir}/${PACKAGE} AM_CPPFLAGS = -DBINDIR='"$(bindir)"' -DPKGDATADIR='"${pkgdatadir}"' -DPKGLIBDIR='"$(pkglibexecdir)"' AM_CFLAGS = -D_GNU_SOURCE -fexceptions -Wall -Werror -Wunused -Wformat=2 -W AM_CXXFLAGS = -Wall -Werror -dist_man_MANS = stap.1 stapprobes.5 stapfuncs.5 stapvars.5 stapex.5 staprun.8 man/stapprobes.iosched.5 man/stapprobes.netdev.5 man/stapprobes.nfs.5 man/stapprobes.nfsd.5 man/stapprobes.pagefault.5 man/stapprobes.process.5 man/stapprobes.rpc.5 man/stapprobes.scsi.5 man/stapprobes.signal.5 man/stapprobes.socket.5 man/stapprobes.tcp.5 man/stapprobes.udp.5 +man_MANS = stap.1 stapprobes.5 stapfuncs.5 stapvars.5 stapex.5 staprun.8 man/stapprobes.iosched.5 man/stapprobes.netdev.5 man/stapprobes.nfs.5 man/stapprobes.nfsd.5 man/stapprobes.pagefault.5 man/stapprobes.process.5 man/stapprobes.rpc.5 man/stapprobes.scsi.5 man/stapprobes.signal.5 man/stapprobes.socket.5 man/stapprobes.tcp.5 man/stapprobes.udp.5 bin_SCRIPTS = stap-client stap-server stap-serverd stap-find-servers stap-start-server stap-find-or-start-server stap-stop-server stap_SOURCES = main.cxx \ parse.cxx staptree.cxx elaborate.cxx translate.cxx \ @@ -284,7 +270,7 @@ stap_SOURCES = main.cxx \ stap_LDADD = @stap_LIBS@ @sqlite3_LIBS@ # Arrange for git_version.h to be regenerated at every "make". -# Code fragment is based upon RadeonHD.am. +# Code fragment is based upon RadeonHD.am. # The stamp file which is never created ensures that git_version.h is updated # before every build. Having git_version.h in foo_SOURCES ensures a recompile @@ -300,9 +286,6 @@ stap_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@ $(am__append_2) staprun_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@ stapio_CPPFLAGS = $(AM_CPPFLAGS) stapio_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@ - -# This tells automake's "make distcheck" what we need to compile. -@BUILD_ELFUTILS_TRUE@DISTCHECK_CONFIGURE_FLAGS = --with-elfutils=$(elfutils_abs_srcdir) @BUILD_ELFUTILS_TRUE@stap_DEPENDENCIES = lib-elfutils/libdw.so staprun_SOURCES = runtime/staprun/staprun.c runtime/staprun/staprun_funcs.c\ runtime/staprun/ctl.c runtime/staprun/common.c \ @@ -314,7 +297,7 @@ staprun_LDADD = @PROCFLAGS@ @cap_LIBS@ stapio_SOURCES = runtime/staprun/stapio.c \ runtime/staprun/mainloop.c runtime/staprun/common.c \ runtime/staprun/ctl.c \ - runtime/staprun/relay.c runtime/staprun/relay_old.c + runtime/staprun/relay.c runtime/staprun/relay_old.c stapio_CFLAGS = @PROCFLAGS@ $(AM_CFLAGS) stapio_LDADD = @PROCFLAGS@ -lpthread @@ -328,20 +311,15 @@ loc2c_test_LDADD = $(stap_LDADD) # Get extra libs as needed LDADD = -EXTRA_DIST = auto_free.h buildrun.h elaborate.h loc2c.h session.h \ - parse.h staptree.h tapsets.h translate.h \ - cache.h hash.h mdfour.h util.h staplog.c coveragedb.h \ - testsuite systemtap.spec runtime tapset \ - dwarf_wrappers.h \ - git_version.h git_version.sh \ - stap-client stap-server stap-serverd stap-find-servers stap-start-server stap-find-or-start-server stap-stop-server \ - systemtap.spec - EXAMPLE_SOURCE_DIR = $(srcdir)/testsuite/systemtap.examples EXAMPLE_META_FILES = $(EXAMPLE_SOURCE_DIR)/*/*.meta TEST_COV_DIR = coverage # XXX: leaves behind man pages SUBDIRS = testsuite doc + +# Any extra flags such as +# --define "with_docs 0" +RPMBUILDFLAGS = all: $(BUILT_SOURCES) config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -1219,152 +1197,6 @@ GTAGS: distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - $(am__remove_distdir) - test -d $(distdir) || mkdir $(distdir) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - distdir=`$(am__cd) $(distdir) && pwd`; \ - top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ - (cd $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$top_distdir" \ - distdir="$$distdir/$$subdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - distdir) \ - || exit 1; \ - fi; \ - done - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$(top_distdir)" distdir="$(distdir)" \ - dist-hook - -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r $(distdir) -dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) -dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 - $(am__remove_distdir) - -dist-tarZ: distdir - tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__remove_distdir) - -dist-shar: distdir - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__remove_distdir) - -dist-zip: distdir - -rm -f $(distdir).zip - zip -rq $(distdir).zip $(distdir) - $(am__remove_distdir) - -dist dist-all: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 - $(am__remove_distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - case '$(DIST_ARCHIVES)' in \ - *.tar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ - *.tar.bz2*) \ - bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.Z*) \ - uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ - *.shar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ - *.zip*) \ - unzip $(distdir).zip ;;\ - esac - chmod -R a-w $(distdir); chmod a+w $(distdir) - mkdir $(distdir)/_build - mkdir $(distdir)/_inst - chmod a-w $(distdir) - dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ - && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ - && cd $(distdir)/_build \ - && ../configure --srcdir=.. --prefix="$$dc_install_base" \ - $(DISTCHECK_CONFIGURE_FLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ - distuninstallcheck \ - && chmod -R a-w "$$dc_install_base" \ - && ({ \ - (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ - distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ - } || { rm -rf "$$dc_destdir"; exit 1; }) \ - && rm -rf "$$dc_destdir" \ - && $(MAKE) $(AM_MAKEFLAGS) dist \ - && rm -rf $(DIST_ARCHIVES) \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck - $(am__remove_distdir) - @(echo "$(distdir) archives ready for distribution: "; \ - list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ - sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' -distuninstallcheck: - @cd $(distuninstallcheck_dir) \ - && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ - || { echo "ERROR: files left after uninstall:" ; \ - if test -n "$(DESTDIR)"; then \ - echo " (check DESTDIR support)"; \ - fi ; \ - $(distuninstallcheck_listfiles) ; \ - exit 1; } >&2 -distcleancheck: distclean - @if test '$(srcdir)' = . ; then \ - echo "ERROR: distcleancheck can only run from a VPATH build" ; \ - exit 1 ; \ - fi - @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left in build directory after distclean:" ; \ - $(distcleancheck_listfiles) ; \ - exit 1; } >&2 check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-recursive @@ -1474,24 +1306,22 @@ uninstall-man: uninstall-man1 uninstall-man5 uninstall-man8 all all-am all-local am--refresh check check-am clean \ clean-binPROGRAMS clean-generic clean-local \ clean-noinstPROGRAMS clean-pkglibexecPROGRAMS ctags \ - ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-hook \ - dist-shar dist-tarZ dist-zip distcheck distclean \ - distclean-compile distclean-generic distclean-hdr \ - distclean-tags distcleancheck distdir distuninstallcheck dvi \ - dvi-am html html-am info info-am install install-am \ - install-binPROGRAMS install-binSCRIPTS install-data \ - install-data-am install-data-local install-dvi install-dvi-am \ - install-exec install-exec-am install-exec-hook \ - install-exec-local install-html install-html-am install-info \ - install-info-am install-man install-man1 install-man5 \ - install-man8 install-pdf install-pdf-am \ - install-pkglibexecPROGRAMS install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - installdirs-am maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ - ps ps-am tags tags-recursive uninstall uninstall-am \ - uninstall-binPROGRAMS uninstall-binSCRIPTS uninstall-local \ - uninstall-man uninstall-man1 uninstall-man5 uninstall-man8 \ + ctags-recursive distclean distclean-compile distclean-generic \ + distclean-hdr distclean-tags dvi dvi-am html html-am info \ + info-am install install-am install-binPROGRAMS \ + install-binSCRIPTS install-data install-data-am \ + install-data-local install-dvi install-dvi-am install-exec \ + install-exec-am install-exec-hook install-exec-local \ + install-html install-html-am install-info install-info-am \ + install-man install-man1 install-man5 install-man8 install-pdf \ + install-pdf-am install-pkglibexecPROGRAMS install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-binSCRIPTS uninstall-local uninstall-man \ + uninstall-man1 uninstall-man5 uninstall-man8 \ uninstall-pkglibexecPROGRAMS git_version.stamp: @@ -1511,12 +1341,6 @@ git_version.stamp: fi; \ fi -dist-gitversion: git_version.stamp - if test -f "git_version.h"; then \ - sed -e 's|^#undef GIT_IS_DIST.*|#define GIT_IS_DIST 1|' \ - "git_version.h" > "$(distdir)/git_version.h"; \ - fi - git_version.h: $(srcdir)/git_version.sh -k --srcdir $(srcdir) -o git_version.h @@ -1560,11 +1384,6 @@ $(EXAMPLE_SOURCE_DIR)/index.html: $(EXAMPLE_META_FILES) $(EXAMPLE_INDEX_GEN) @echo " perl examples-index-gen.pl" @echo "to regenerate it." -dist-hook: dist-gitversion - find $(distdir) -name CVS -o -name '*~' -o -name '.#*' | xargs rm -rf - find $(distdir) -name '*.o' -o -name '*.ko' -o -name '*.cmd' -o -name '*.mod.c' -o -name '.??*' | xargs rm -rf - find $(distdir) -name 'stap' -o -name '*.log' -o -name '*.sum' -o -name 'site.exp' | xargs rm -rf - install-data-local: (cd $(srcdir)/runtime; for f in *.[ch]; do $(INSTALL_DATA) -D $$f $(DESTDIR)$(pkgdatadir)/runtime/$$f; done) (cd $(srcdir)/runtime/unwind; find . \( -name '*.[ch]' \) -print \ @@ -1634,8 +1453,15 @@ installcheck: fi; $(MAKE) -C testsuite installcheck RUNTESTFLAGS="$(RUNTESTFLAGS)" -rpm: systemtap.spec dist - rpmbuild --define "_sourcedir $(PWD)/" -ba $(srcdir)/systemtap.spec +rpm: + cd $(srcdir); git status | grep working.directory.clean || (echo "You should commit your changes before 'make rpm'.") + (cd $(srcdir); git archive --prefix=systemtap-$(VERSION)/ --format=tar HEAD) | gzip > systemtap-$(VERSION).tar.gz + mkdir -p `rpm --eval %_specdir` + mkdir -p `rpm --eval %_srcrpmdir` + mkdir -p `rpm --eval %_rpmdir` + mkdir -p `rpm --eval %_builddir` + mkdir -p `rpm --eval %_buildroot` + rpmbuild --define "_sourcedir $(PWD)/" -ta systemtap-$(VERSION).tar.gz $(RPMBUILDFLAGS) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/configure b/configure index ecf080bf..d1fe6a30 100755 --- a/configure +++ b/configure @@ -8455,22 +8455,21 @@ echo "$as_me: $ac_file is unchanged" >&6;} fi rm -f "$tmp/out12" # Compute $ac_file's index in $config_headers. -_am_arg=$ac_file _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in - $_am_arg | $_am_arg:* ) + $ac_file | $ac_file:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done -echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || -$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$_am_arg" : 'X\(//\)[^/]' \| \ - X"$_am_arg" : 'X\(//\)$' \| \ - X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || -echo X"$_am_arg" | +echo "timestamp for $ac_file" >`$as_dirname -- $ac_file || +$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X$ac_file : 'X\(//\)[^/]' \| \ + X$ac_file : 'X\(//\)$' \| \ + X$ac_file : 'X\(/\)' \| . 2>/dev/null || +echo X$ac_file | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -8507,7 +8506,7 @@ echo "$as_me: executing $ac_file commands" >&6;} # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ diff --git a/configure.ac b/configure.ac index 084e457c..4ad54f7c 100644 --- a/configure.ac +++ b/configure.ac @@ -161,7 +161,7 @@ if test "$enable_docs" == "yes"; then fi AM_CONDITIONAL([BUILD_DOCS], [test "x${have_latex}${have_dvips}${have_ps2pdf}${have_latex2html}" == "xyesyesyesyes" -a "$enable_docs" != "no"]) -AC_CHECK_HEADERS([sys/capability.h], , +AC_CHECK_HEADERS([sys/capability.h], , [AC_MSG_ERROR([cannot find required libcap header (libcap-devel may need to be installed)])]) dnl Handle elfutils. If '--with-elfutils=DIR' wasn't specified, used diff --git a/doc/ChangeLog b/doc/ChangeLog index f83ac3d3..a04c4cdc 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2008-08-25 Frank Ch. Eigler + + * Makefile.am: Removed dist-related targets and macros. + * Makefile.in: Regenerated. + 2008-07-14 Dave Brolley * Makefile.in: Regenerated. diff --git a/doc/Makefile.am b/doc/Makefile.am index e4bc3800..fb228897 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -38,4 +38,3 @@ SUFFIXES = ps pdf dvi ps tex latex -output-directory=$$pwd $<; \ latex -output-directory=$$pwd $< -EXTRA_DIST = tutorial.tex langref.tex tutorial nomencl.sty diff --git a/doc/Makefile.in b/doc/Makefile.in index 6464afc3..47b6d85b 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -152,7 +152,6 @@ top_srcdir = @top_srcdir@ PDF_FILES = tutorial.pdf langref.pdf DOC_INSTALL_DIR = $(DESTDIR)$(datadir)/doc/systemtap SUFFIXES = ps pdf dvi ps tex -EXTRA_DIST = tutorial.tex langref.tex tutorial nomencl.sty all: all-am .SUFFIXES: diff --git a/systemtap.spec b/systemtap.spec index da2a6fb2..4bbd9f37 100644 --- a/systemtap.spec +++ b/systemtap.spec @@ -1,9 +1,9 @@ -%define release 1 -%define with_sqlite 1 -%define with_docs 1 -%define with_crash 0 -%define with_bundled_elfutils 0 -%define elfutils_version 0.127 +%{!?release: %define release 1} +%{!?with_sqllite: %define with_sqlite 1} +%{!?with_docs: %define with_docs 1} +%{!?with_crash: %define with_crash 0} +%{!?with_bundled_elfutils: %define with_bundled_elfutils 0} +%{!?elfutils_version: %define elfutils_version 0.127} Name: systemtap # for version, see also configure.ac @@ -158,14 +158,14 @@ chmod 755 $RPM_BUILD_ROOT%{_bindir}/staprun # Copy over the testsuite cp -rp testsuite $RPM_BUILD_ROOT%{_datadir}/systemtap -#%if %{with_docs} +%if %{with_docs} # We want the manuals in the special doc dir, not the generic doc install dir. # We build it in place and then move it away so it doesn't get installed # twice. rpm can specify itself where the (versioned) docs go with the # %doc directive. mkdir docs.installed mv $RPM_BUILD_ROOT%{_datadir}/doc/systemtap/*.pdf docs.installed/ -#%endif +%endif %clean rm -rf ${RPM_BUILD_ROOT} diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index 4d0133aa..e6087f42 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2008-08-25 Frank Ch. Eigler + + * Makefile.am (AUTOMAKE_OPTIONS): Add no-dist. Remove dist-related + targets. + * Makefile.in: Regenerated. + 2008-08-25 Mark Wielaard * Makefile.am (EXTRA_DIST): html_footer.tmpl, systemtapcorner.gif, diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am index 3a47548c..9516fec4 100644 --- a/testsuite/Makefile.am +++ b/testsuite/Makefile.am @@ -1,7 +1,7 @@ # Makefile.am --- automake input file for systemtap testsuite ## process this file with automake to produce Makefile.in -AUTOMAKE_OPTIONS = dejagnu +AUTOMAKE_OPTIONS = dejagnu no-dist all-local: @echo Run \"make check\" or \"make installcheck\". @@ -26,22 +26,7 @@ installcheck: site.exp -$(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU RUNTESTFLAGS="$(RUNTESTFLAGS) --tool_opts \'install $(TOOL_OPTS)\'" if test -n "$(DEJAZILLA)"; then mail $(DEJAZILLA) < systemtap.sum; fi -SRCDIR = $(shell cd $(srcdir); pwd) - -EXTRA_DIST = execrc config lib systemtap \ - parseok parseko semok semko transok transko buildok buildok \ - systemtap.syscall systemtap.stress systemtap.string \ - systemtap.pass1-4 systemtap.samples systemtap.printf \ - systemtap.maps systemtap.base \ - systemtap.examples/examples-index-gen.pl \ - systemtap.examples/html/systemtap.css \ - systemtap.examples/html/systemtapcorner.gif \ - systemtap.examples/html/systemtaplogo.png \ - systemtap.examples/html/html_footer.tmpl \ - systemtap.examples/html/html_header.tmpl - - -# $(srcdir)/These values point the test suite to the install tree, and +# $(srcdir)/These values point the test suite to the install tree, and # are overridden by "make check" from full source/build tree SYSTEMTAP_RUNTIME=$(DESTDIR)$(pkgdatadir)/runtime SYSTEMTAP_TAPSET=$(DESTDIR)$(pkgdatadir)/tapset diff --git a/testsuite/Makefile.in b/testsuite/Makefile.in index a90a05cb..4e9f9374 100644 --- a/testsuite/Makefile.in +++ b/testsuite/Makefile.in @@ -32,12 +32,8 @@ NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = . -DIST_COMMON = $(am__configure_deps) $(srcdir)/../install-sh \ - $(srcdir)/../missing $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in $(top_srcdir)/configure ../AUTHORS \ - ../COPYING ../ChangeLog ../INSTALL ../NEWS ../README \ - ../compile ../config.guess ../depcomp ../install-sh ../missing \ - ChangeLog +DIST_COMMON = ChangeLog $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/configure $(am__configure_deps) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ @@ -47,19 +43,7 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = SOURCES = -DIST_SOURCES = DEJATOOL = $(PACKAGE) -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -distdir = $(PACKAGE)-$(VERSION) -top_distdir = $(distdir) -am__remove_distdir = \ - { test ! -d $(distdir) \ - || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ - && rm -fr $(distdir); }; } -DIST_ARCHIVES = $(distdir).tar.gz -GZIP_ENV = --best -distuninstallcheck_listfiles = find . -type f -print -distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ @@ -132,24 +116,11 @@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -AUTOMAKE_OPTIONS = dejagnu +AUTOMAKE_OPTIONS = dejagnu no-dist DEJAZILLA = @dejazilla@ TOOL_OPTS = -SRCDIR = $(shell cd $(srcdir); pwd) -EXTRA_DIST = execrc config lib systemtap \ - parseok parseko semok semko transok transko buildok buildok \ - systemtap.syscall systemtap.stress systemtap.string \ - systemtap.pass1-4 systemtap.samples systemtap.printf \ - systemtap.maps systemtap.base \ - systemtap.examples/examples-index-gen.pl \ - systemtap.examples/html/systemtap.css \ - systemtap.examples/html/systemtapcorner.gif \ - systemtap.examples/html/systemtaplogo.png \ - systemtap.examples/html/html_footer.tmpl \ - systemtap.examples/html/html_header.tmpl - - -# $(srcdir)/These values point the test suite to the install tree, and + +# $(srcdir)/These values point the test suite to the install tree, and # are overridden by "make check" from full source/build tree SYSTEMTAP_RUNTIME = $(DESTDIR)$(pkgdatadir)/runtime SYSTEMTAP_TAPSET = $(DESTDIR)$(pkgdatadir)/tapset @@ -233,138 +204,6 @@ distclean-DEJAGNU: -l='$(DEJATOOL)'; for tool in $$l; do \ rm -f $$tool.sum $$tool.log; \ done - -distdir: $(DISTFILES) - $(am__remove_distdir) - test -d $(distdir) || mkdir $(distdir) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ - fi; \ - cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ - else \ - test -f $(distdir)/$$file \ - || cp -p $$d/$$file $(distdir)/$$file \ - || exit 1; \ - fi; \ - done - -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ - ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ - ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ - || chmod -R a+r $(distdir) -dist-gzip: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) - -dist-bzip2: distdir - tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 - $(am__remove_distdir) - -dist-lzma: distdir - tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma - $(am__remove_distdir) - -dist-tarZ: distdir - tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z - $(am__remove_distdir) - -dist-shar: distdir - shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz - $(am__remove_distdir) - -dist-zip: distdir - -rm -f $(distdir).zip - zip -rq $(distdir).zip $(distdir) - $(am__remove_distdir) - -dist dist-all: distdir - tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz - $(am__remove_distdir) - -# This target untars the dist file and tries a VPATH configuration. Then -# it guarantees that the distribution is self-contained by making another -# tarfile. -distcheck: dist - case '$(DIST_ARCHIVES)' in \ - *.tar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ - *.tar.bz2*) \ - bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ - *.tar.lzma*) \ - unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ - *.tar.Z*) \ - uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ - *.shar.gz*) \ - GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ - *.zip*) \ - unzip $(distdir).zip ;;\ - esac - chmod -R a-w $(distdir); chmod a+w $(distdir) - mkdir $(distdir)/_build - mkdir $(distdir)/_inst - chmod a-w $(distdir) - dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ - && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ - && cd $(distdir)/_build \ - && ../configure --srcdir=.. --prefix="$$dc_install_base" \ - $(DISTCHECK_CONFIGURE_FLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) \ - && $(MAKE) $(AM_MAKEFLAGS) dvi \ - && $(MAKE) $(AM_MAKEFLAGS) check \ - && $(MAKE) $(AM_MAKEFLAGS) install \ - && $(MAKE) $(AM_MAKEFLAGS) installcheck \ - && $(MAKE) $(AM_MAKEFLAGS) uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ - distuninstallcheck \ - && chmod -R a-w "$$dc_install_base" \ - && ({ \ - (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ - && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ - distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ - } || { rm -rf "$$dc_destdir"; exit 1; }) \ - && rm -rf "$$dc_destdir" \ - && $(MAKE) $(AM_MAKEFLAGS) dist \ - && rm -rf $(DIST_ARCHIVES) \ - && $(MAKE) $(AM_MAKEFLAGS) distcleancheck - $(am__remove_distdir) - @(echo "$(distdir) archives ready for distribution: "; \ - list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ - sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' -distuninstallcheck: - @cd $(distuninstallcheck_dir) \ - && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ - || { echo "ERROR: files left after uninstall:" ; \ - if test -n "$(DESTDIR)"; then \ - echo " (check DESTDIR support)"; \ - fi ; \ - $(distuninstallcheck_listfiles) ; \ - exit 1; } >&2 -distcleancheck: distclean - @if test '$(srcdir)' = . ; then \ - echo "ERROR: distcleancheck can only run from a VPATH build" ; \ - exit 1 ; \ - fi - @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ - || { echo "ERROR: files left in build directory after distclean:" ; \ - $(distcleancheck_listfiles) ; \ - exit 1; } >&2 check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU check-local check: check-am @@ -452,18 +291,16 @@ uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am all-local am--refresh check check-DEJAGNU check-am \ - check-local clean clean-generic clean-local dist dist-all \ - dist-bzip2 dist-gzip dist-lzma dist-shar dist-tarZ dist-zip \ - distcheck distclean distclean-DEJAGNU distclean-generic \ - distcleancheck distdir distuninstallcheck dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ - pdf-am ps ps-am uninstall uninstall-am + check-local clean clean-generic clean-local distclean \ + distclean-DEJAGNU distclean-generic dvi dvi-am html html-am \ + info info-am install install-am install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ + uninstall-am all-local: -- cgit From 813ed4cbfddd5ebeb034490e517595d549b837a3 Mon Sep 17 00:00:00 2001 From: David Smith Date: Tue, 26 Aug 2008 09:49:58 -0500 Subject: Moved tar archive creation step from "rpm" target to "dist-gzip" target. 2008-08-26 David Smith * Makefile.am: Moved tar archive creation step from "rpm" target into "dist-gzip" target. * Makefile.in: Regenerated. --- ChangeLog | 6 ++++++ Makefile.am | 5 ++++- Makefile.in | 8 ++++++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 469fada5..11b9346a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-08-26 David Smith + + * Makefile.am: Moved tar archive creation step from "rpm" target + into "dist-gzip" target. + * Makefile.in: Regenerated. + 2008-08-25 Frank Ch. Eigler * Makefile.am (AUTOMAKE_OPTIONS): Add "no-dist". Remove all diff --git a/Makefile.am b/Makefile.am index eb4250b1..d0fac084 100644 --- a/Makefile.am +++ b/Makefile.am @@ -234,9 +234,12 @@ installcheck: # --define "with_bundled_elfutils 1" --define "elfutils_version 0.135" RPMBUILDFLAGS= -rpm: +dist-gzip: cd $(srcdir); git status | grep working.directory.clean || (echo "You should commit your changes before 'make rpm'.") (cd $(srcdir); git archive --prefix=systemtap-$(VERSION)/ --format=tar HEAD) | gzip > systemtap-$(VERSION).tar.gz + +rpm: + $(MAKE) $(AM_MAKEFLAGS) dist-gzip mkdir -p `rpm --eval %_specdir` mkdir -p `rpm --eval %_srcrpmdir` mkdir -p `rpm --eval %_rpmdir` diff --git a/Makefile.in b/Makefile.in index 3d2a575a..5005acdc 100644 --- a/Makefile.in +++ b/Makefile.in @@ -317,8 +317,9 @@ TEST_COV_DIR = coverage # XXX: leaves behind man pages SUBDIRS = testsuite doc -# Any extra flags such as +# Any extra flags, such as: # --define "with_docs 0" +# --define "with_bundled_elfutils 1" --define "elfutils_version 0.135" RPMBUILDFLAGS = all: $(BUILT_SOURCES) config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive @@ -1453,9 +1454,12 @@ installcheck: fi; $(MAKE) -C testsuite installcheck RUNTESTFLAGS="$(RUNTESTFLAGS)" -rpm: +dist-gzip: cd $(srcdir); git status | grep working.directory.clean || (echo "You should commit your changes before 'make rpm'.") (cd $(srcdir); git archive --prefix=systemtap-$(VERSION)/ --format=tar HEAD) | gzip > systemtap-$(VERSION).tar.gz + +rpm: + $(MAKE) $(AM_MAKEFLAGS) dist-gzip mkdir -p `rpm --eval %_specdir` mkdir -p `rpm --eval %_srcrpmdir` mkdir -p `rpm --eval %_rpmdir` -- cgit From 9b2e2b5856ee6986340f2b4cf4a43c4654b07a6a Mon Sep 17 00:00:00 2001 From: David Smith Date: Tue, 26 Aug 2008 10:40:47 -0500 Subject: Simplified "rpm" target a bit. 2008-08-26 David Smith * Makefile.am: Simplified "rpm" target a bit. * Makefile.in: Regenerated. --- ChangeLog | 3 +++ Makefile.am | 4 ++-- Makefile.in | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 11b9346a..fec31229 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2008-08-26 David Smith + * Makefile.am: Simplified "rpm" target a bit. + * Makefile.in: Regenerated. + * Makefile.am: Moved tar archive creation step from "rpm" target into "dist-gzip" target. * Makefile.in: Regenerated. diff --git a/Makefile.am b/Makefile.am index d0fac084..867066bb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -234,12 +234,12 @@ installcheck: # --define "with_bundled_elfutils 1" --define "elfutils_version 0.135" RPMBUILDFLAGS= +.PHONY: dist-gzip dist-gzip: cd $(srcdir); git status | grep working.directory.clean || (echo "You should commit your changes before 'make rpm'.") (cd $(srcdir); git archive --prefix=systemtap-$(VERSION)/ --format=tar HEAD) | gzip > systemtap-$(VERSION).tar.gz -rpm: - $(MAKE) $(AM_MAKEFLAGS) dist-gzip +rpm: dist-gzip mkdir -p `rpm --eval %_specdir` mkdir -p `rpm --eval %_srcrpmdir` mkdir -p `rpm --eval %_rpmdir` diff --git a/Makefile.in b/Makefile.in index 5005acdc..1d3225b8 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1454,12 +1454,12 @@ installcheck: fi; $(MAKE) -C testsuite installcheck RUNTESTFLAGS="$(RUNTESTFLAGS)" +.PHONY: dist-gzip dist-gzip: cd $(srcdir); git status | grep working.directory.clean || (echo "You should commit your changes before 'make rpm'.") (cd $(srcdir); git archive --prefix=systemtap-$(VERSION)/ --format=tar HEAD) | gzip > systemtap-$(VERSION).tar.gz -rpm: - $(MAKE) $(AM_MAKEFLAGS) dist-gzip +rpm: dist-gzip mkdir -p `rpm --eval %_specdir` mkdir -p `rpm --eval %_srcrpmdir` mkdir -p `rpm --eval %_rpmdir` -- cgit From 36ba5475952aa7ee1388ce9d94695550c2258c86 Mon Sep 17 00:00:00 2001 From: David Smith Date: Tue, 26 Aug 2008 12:48:40 -0500 Subject: Uses STAPCONF_DPATH_PATH instead of a kernel version check. 2008-08-26 David Smith * buildrun.cxx (compile_pass): Added autoconf-dpath-path.c. 2008-08-26 David Smith * autoconf-d_path-path.c: New file. * task_finder.c (__stp_get_mm_path): Uses STAPCONF_DPATH_PATH instead of a kernel version check to determine how to call d_path(). (__stp_utrace_task_finder_target_quiesce): Ditto. (__stp_target_call_vm_callback): Ditto. --- ChangeLog | 2 ++ buildrun.cxx | 1 + runtime/ChangeLog | 10 ++++++++++ runtime/autoconf-dpath-path.c | 7 +++++++ runtime/task_finder.c | 20 ++++++++++---------- 5 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 runtime/autoconf-dpath-path.c diff --git a/ChangeLog b/ChangeLog index fec31229..7e1931de 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2008-08-26 David Smith + * buildrun.cxx (compile_pass): Added autoconf-dpath-path.c. + * Makefile.am: Simplified "rpm" target a bit. * Makefile.in: Regenerated. diff --git a/buildrun.cxx b/buildrun.cxx index a265e4db..6b2b779d 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -110,6 +110,7 @@ compile_pass (systemtap_session& s) o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-real-parent.c, -DSTAPCONF_REAL_PARENT,)" << endl; o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-uaccess.c, -DSTAPCONF_LINUX_UACCESS_H,)" << endl; o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-oneachcpu-retry.c, -DSTAPCONF_ONEACHCPU_RETRY,)" << endl; + o << module_cflags << " += $(call stap_check_build, $(SYSTEMTAP_RUNTIME)/autoconf-dpath-path.c, -DSTAPCONF_DPATH_PATH,)" << endl; #if 0 /* NB: For now, the performance hit of probe_kernel_read/write (vs. our * homegrown safe-access functions) is deemed undesireable, so we'll skip diff --git a/runtime/ChangeLog b/runtime/ChangeLog index 3e1e400a..926e05d9 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,3 +1,13 @@ +2008-08-26 David Smith + + * autoconf-d_path-path.c: New file. + + * task_finder.c (__stp_get_mm_path): Uses STAPCONF_DPATH_PATH + instead of a kernel version check to determine how to call + d_path(). + (__stp_utrace_task_finder_target_quiesce): Ditto. + (__stp_target_call_vm_callback): Ditto. + 2008-08-21 David Smith * task_finder.c (__stp_tf_vm_cb): Added task finder target diff --git a/runtime/autoconf-dpath-path.c b/runtime/autoconf-dpath-path.c new file mode 100644 index 00000000..c3654604 --- /dev/null +++ b/runtime/autoconf-dpath-path.c @@ -0,0 +1,7 @@ +#include +#include + +void ____autoconf_func(struct path *p) +{ + (void)d_path(p, NULL, 0); +} diff --git a/runtime/task_finder.c b/runtime/task_finder.c index d81ad115..af2345be 100644 --- a/runtime/task_finder.c +++ b/runtime/task_finder.c @@ -326,11 +326,11 @@ __stp_get_mm_path(struct mm_struct *mm, char *buf, int buflen) vma = vma->vm_next; } if (vma) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) +#ifdef STAPCONF_DPATH_PATH + rc = d_path(&(vma->vm_file->f_path), buf, buflen); +#else rc = d_path(vma->vm_file->f_dentry, vma->vm_file->f_vfsmnt, buf, buflen); -#else - rc = d_path(&(vma->vm_file->f_path), buf, buflen); #endif } else { @@ -721,12 +721,12 @@ __stp_utrace_task_finder_target_quiesce(enum utrace_resume_action action, vma = mm->mmap; while (vma) { if (vma->vm_file) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) - mmpath = d_path(vma->vm_file->f_dentry, - vma->vm_file->f_vfsmnt, +#ifdef STAPCONF_DPATH_PATH + mmpath = d_path(&(vma->vm_file->f_path), mmpath_buf, PATH_MAX); #else - mmpath = d_path(&(vma->vm_file->f_path), + mmpath = d_path(vma->vm_file->f_dentry, + vma->vm_file->f_vfsmnt, mmpath_buf, PATH_MAX); #endif if (mmpath) { @@ -855,11 +855,11 @@ __stp_target_call_vm_callback(struct stap_task_finder_target *tgt, } // Grab the path associated with this vma. -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25) +#ifdef STAPCONF_DPATH_PATH + mmpath = d_path(&(vma->vm_file->f_path), mmpath_buf, PATH_MAX); +#else mmpath = d_path(vma->vm_file->f_dentry, vma->vm_file->f_vfsmnt, mmpath_buf, PATH_MAX); -#else - mmpath = d_path(&(vma->vm_file->f_path), mmpath_buf, PATH_MAX); #endif if (mmpath == NULL || IS_ERR(mmpath)) { rc = -PTR_ERR(mmpath); -- cgit From 695ae5272479f77d261eea37a9ee4bef55c4ab12 Mon Sep 17 00:00:00 2001 From: Wenji Huang Date: Wed, 27 Aug 2008 01:07:26 -0400 Subject: Make nodwf test passed when CONFIG_QUOTACTL unset --- testsuite/ChangeLog | 5 +++++ testsuite/semok/nodwf02.stp | 2 +- testsuite/semok/nodwf05.stp | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index e6087f42..597c2665 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-08-27 Wenji Huang + + * semok/nodwf02.stp: Make syscall.q* optional. + * semok/nodwf05.stp: Ditto. + 2008-08-25 Frank Ch. Eigler * Makefile.am (AUTOMAKE_OPTIONS): Add no-dist. Remove dist-related diff --git a/testsuite/semok/nodwf02.stp b/testsuite/semok/nodwf02.stp index 545f6154..b6df44e5 100755 --- a/testsuite/semok/nodwf02.stp +++ b/testsuite/semok/nodwf02.stp @@ -28,7 +28,7 @@ probe syscall.n*, /* skip o */ syscall.p*, - syscall.q*, + syscall.q* ?, syscall.r*, /* skip s */ syscall.t*, diff --git a/testsuite/semok/nodwf05.stp b/testsuite/semok/nodwf05.stp index d0043eab..8c9dda2c 100755 --- a/testsuite/semok/nodwf05.stp +++ b/testsuite/semok/nodwf05.stp @@ -30,7 +30,7 @@ probe syscall.n*, /* skip o */ syscall.p*, - syscall.q*, + syscall.q* ?, syscall.r*, /* skip s */ syscall.t*, -- cgit From 0a102c820c4ee8da300b4a834ef0f15fa13016d3 Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Wed, 27 Aug 2008 17:56:28 -0400 Subject: Automatically print written but unread globals --- ChangeLog | 7 ++ elaborate.cxx | 202 ++++++++++++++++++++++++++++-- testsuite/ChangeLog | 8 ++ testsuite/systemtap.base/bench.exp | 2 +- testsuite/systemtap.base/global_end.exp | 23 ++++ testsuite/systemtap.base/global_end.stp | 30 +++++ testsuite/systemtap.base/optim_arridx.exp | 40 ++++-- testsuite/systemtap.base/optim_arridx.stp | 6 +- 8 files changed, 298 insertions(+), 20 deletions(-) create mode 100644 testsuite/systemtap.base/global_end.exp create mode 100644 testsuite/systemtap.base/global_end.stp diff --git a/ChangeLog b/ChangeLog index 7e1931de..43fe2f59 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-08-27 Stan Cox + + * elaborate.cxx (add_global_var_display): New. + (semantic_pass): Call it. + (dead_assignment_remover::visit_assignment): Don't remove written + but unread global variables. + 2008-08-26 David Smith * buildrun.cxx (compile_pass): Added autoconf-dpath-path.c. diff --git a/elaborate.cxx b/elaborate.cxx index 0950b086..4fe228ab 100644 --- a/elaborate.cxx +++ b/elaborate.cxx @@ -1144,6 +1144,180 @@ semantic_pass_symbols (systemtap_session& s) } +// Keep unread global variables for probe end value display. +void add_global_var_display (systemtap_session& s) +{ + varuse_collecting_visitor vut; + for (unsigned i=0; ibody->visit (& vut); + + if (s.probes[i]->sole_location()->condition) + s.probes[i]->sole_location()->condition->visit (& vut); + } + + for (unsigned g=0; g < s.globals.size(); g++) + { + vardecl* l = s.globals[g]; + if (vut.read.find (l) != vut.read.end() + || vut.written.find (l) == vut.written.end() + || l->type == pe_stats) + continue; + + print_format* pf = new print_format; + probe* p = new probe; + probe_point* pl = new probe_point; + probe_point::component* c = new probe_point::component("end"); + token* print_tok = new token; + vector dps; + + pl->components.push_back (c); + token* p_tok = new token; + p_tok->type = tok_identifier; + p_tok->content = "probe"; + p->tok = p_tok; + p->locations.push_back (pl); + print_tok->type = tok_identifier; + print_tok->content = "printf"; + + // Create a symbol + symbol* g_sym = new symbol; + g_sym->name = l->name; + g_sym->tok = l->tok; + g_sym->type = l->type; + g_sym->referent = l; + + pf->print_to_stream = true; + pf->print_with_format = true; + pf->print_with_delim = false; + pf->print_with_newline = false; + pf->print_char = false; + pf->raw_components += l->name; + pf->tok = print_tok; + + if (l->index_types.size() == 0) // Scalar + { + if (l->type == pe_string) + pf->raw_components += "=\"%#s\"\\n"; + else + pf->raw_components += "=%#x\\n"; + pf->args.push_back(g_sym); + pf->components = print_format::string_to_components(pf->raw_components); + expr_statement* feb = new expr_statement; + feb->value = pf; + feb->tok = print_tok; + block *b = new block; + b->statements.push_back(feb); + p->body = b; + + derive_probes (s, p, dps); + + // Repopulate the type info. Should semantic_pass_types do this? + ((class symbol*) + ((class print_format*) + ((class expr_statement*) + ((class block*)dps[0]->body)->statements[0])->value)->args[0])->type = g_sym->type; + } + else // Array + { + int idx_count = l->index_types.size(); + token* idx_tok[idx_count]; + symbol* idx_sym[idx_count]; + vardecl* idx_v[idx_count]; + // Create a foreach loop + token* fe_tok = new token; + fe_tok->type = tok_identifier; + fe_tok->content = "foreach"; + foreach_loop* fe = new foreach_loop; + fe->sort_direction = 0; + fe->limit = NULL; + + // Create indices for the foreach loop + for (int i=0; i < idx_count; i++) + { + idx_tok[i] = new token; + idx_tok[i]->type = tok_identifier; + char *idx_name; + if (asprintf (&idx_name, "idx%d", i) < 0) + return; + idx_tok[i]->content = idx_name; + idx_sym[i] = new symbol; + idx_sym[i]->tok = idx_tok[i]; + idx_sym[i]->name = idx_name; + idx_v[i] = new vardecl; + idx_v[i]->name = idx_name; + idx_v[i]->tok = idx_tok[i]; + idx_v[i]->type = l->index_types[i]; + idx_sym[i]->referent = idx_v[i]; + fe->indexes.push_back (idx_sym[i]); + } + + // Create a printf for the foreach loop + for (int i=0; i < idx_count; i++) + if (l->index_types[i] == pe_string) + pf->raw_components += "[\"%#s\"]"; + else + pf->raw_components += "[%#d]"; + if (l->type == pe_string) + pf->raw_components += "=\"%#s\"\\n"; + else + pf->raw_components += "=%#x\\n"; + + // Create an index for the array + struct arrayindex* ai = new arrayindex; + ai->tok = l->tok; + ai->base = g_sym; + for (int i=0; i < idx_count; i++) + { + ai->indexes.push_back (idx_sym[i]); + pf->args.push_back(idx_sym[i]); + } + pf->args.push_back(ai); + + pf->components = print_format::string_to_components(pf->raw_components); + expr_statement* feb = new expr_statement; + feb->value = pf; + block *b = new block; + fe->base = g_sym; + fe->block = (statement*)feb; + b->statements.push_back(fe); + p->body = b; + + derive_probes (s, p, dps); + + // Repopulate the type info. Should semantic_pass_types do this? + print_format* dpf = ((print_format*) + ((expr_statement*) + ((foreach_loop*) + ((block*)dps[0]->body)->statements[0])->block)->value); + for (int i=0; i < idx_count; i++) + { + // printf argument types + dpf->args[i]->type = l->index_types[i]; + // arrayindex indices types + ((struct arrayindex*)dpf->args[idx_count])->indexes[i]->type = l->index_types[i]; + dps[0]->locals.push_back(idx_v[i]); + } + // arrayindex type + dpf->args[idx_count]->type = l->type; + } + + symresolution_info sym (s); + sym.current_function = 0; + sym.current_probe = dps[0]; + dps[0]->body->visit (& sym); + + // Add created probe + for (unsigned i = 0; i < dps.size(); i++) + { + derived_probe* dp = dps[i]; + s.probes.push_back (dp); + dp->join_group (s); + } + + vut.read.insert (l); + } +} int semantic_pass (systemtap_session& s) @@ -1159,6 +1333,7 @@ semantic_pass (systemtap_session& s) if (rc == 0) rc = semantic_pass_conditions (s); if (rc == 0 && ! s.unoptimized) rc = semantic_pass_optimize1 (s); if (rc == 0) rc = semantic_pass_types (s); + if (rc == 0) add_global_var_display (s); if (rc == 0 && ! s.unoptimized) rc = semantic_pass_optimize2 (s); if (rc == 0) rc = semantic_pass_vars (s); if (rc == 0) rc = semantic_pass_stats (s); @@ -1745,16 +1920,16 @@ void semantic_pass_opt2 (systemtap_session& s, bool& relaxed_p, unsigned iterati { if (l->tok->location.file == s.user_file->name && // !tapset ! s.suppress_warnings) - s.print_warning ("eliding unused variable '" + l->name + "'", l->tok); + s.print_warning ("eliding unused variable '" + l->name + "'", l->tok); else if (s.verbose>2) clog << "Eliding unused global variable " << l->name << endl; if (s.tapset_compile_coverage) { - s.unused_globals.push_back(s.globals[i]); + s.unused_globals.push_back(s.globals[i]); } - s.globals.erase(s.globals.begin() + i); - relaxed_p = false; - // don't increment i + s.globals.erase(s.globals.begin() + i); + relaxed_p = false; + // don't increment i } else { @@ -1831,6 +2006,7 @@ dead_assignment_remover::visit_assignment (assignment* e) current_expr = &e->right; e->right->visit (this); current_expr = last_expr; + if (vut.read.find(leftvar) == vut.read.end()) // var never read? { // NB: Not so fast! The left side could be an array whose @@ -1838,10 +2014,21 @@ dead_assignment_remover::visit_assignment (assignment* e) // OK if we could replace the array assignment with a // statement-expression containing all the index expressions // and the rvalue... but we can't. + // Another possibility is that we have an unread global variable + // which are kept for probe end value display. + + bool is_global = false; + vector::iterator it; + for (it = session.globals.begin(); it != session.globals.end(); it++) + if (leftvar->name == (*it)->name) + { + is_global = true; + break; + } varuse_collecting_visitor vut; e->left->visit (& vut); - if (vut.side_effect_free ()) // XXX: use _wrt() once we track focal_vars + if (vut.side_effect_free () && !is_global) // XXX: use _wrt() once we track focal_vars { /* PR 1119: NB: This is not necessary here. A write-only variable will also be elided soon at the next _opt2 iteration. @@ -2156,7 +2343,8 @@ dead_stmtexpr_remover::visit_expr_statement (expr_statement *s) varuse_collecting_visitor vut; s->value->visit (& vut); - if (vut.side_effect_free_wrt (focal_vars) && + + if (vut.side_effect_free_wrt (focal_vars) && *current_stmt == s) // we're not nested any deeper than expected { /* PR 1119: NB: this message is not a good idea here. It can diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog index 597c2665..e6649a36 100644 --- a/testsuite/ChangeLog +++ b/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2008-08-27 Stan Cox + + * systemtap.base/global_end.exp: New. + * systemtap.base/global_end.stp: New. + * systemtap.base/bench.exp: Bump up ok. + * systemtap.base/optim_arridx.exp: Consider unread globals. + * systemtap.base/optim_arridx.stp: Fix typos. + 2008-08-27 Wenji Huang * semok/nodwf02.stp: Make syscall.q* optional. diff --git a/testsuite/systemtap.base/bench.exp b/testsuite/systemtap.base/bench.exp index 4863a00c..72864292 100644 --- a/testsuite/systemtap.base/bench.exp +++ b/testsuite/systemtap.base/bench.exp @@ -11,4 +11,4 @@ expect { eof { } } wait -if {$ok == 15} { pass "$test ($ok)" } { fail "$test ($ok)" } +if {$ok == 18} { pass "$test ($ok)" } { fail "$test ($ok)" } diff --git a/testsuite/systemtap.base/global_end.exp b/testsuite/systemtap.base/global_end.exp new file mode 100644 index 00000000..b1931a90 --- /dev/null +++ b/testsuite/systemtap.base/global_end.exp @@ -0,0 +1,23 @@ +# test end probe creation and display of written and unread global variables + +set test "global_end" + +if {![installtest_p]} {untested $test; return} + +spawn stap $srcdir/$subdir/global_end.stp +set ok 0 +expect { + -timeout 180 + -re {one,0x1.*one,0x2.*two,0x1.*two,0x2} { incr ok; exp_continue } + -re {alpha."one"..1.=0x1} { incr ok; exp_continue } + -re {alpha."one"..2.=0x2} { incr ok; exp_continue } + -re {alpha."two"..1.=0x3} { incr ok; exp_continue } + -re {alpha."two"..2.=0x4} { incr ok; exp_continue } + -re {gamma="abcdefghijklmnopqrstuvwxyz"} { incr ok; exp_continue } + -re {iota."one".="eleven"} { incr ok; exp_continue } + -re {iota."two".="twelve"} { incr ok; exp_continue } + timeout { fail "$test (timeout)" } + eof { } +} +wait +if {$ok == 8} { pass "$test ($ok)" } { fail "$test ($ok)" } diff --git a/testsuite/systemtap.base/global_end.stp b/testsuite/systemtap.base/global_end.stp new file mode 100644 index 00000000..e9a1eb8f --- /dev/null +++ b/testsuite/systemtap.base/global_end.stp @@ -0,0 +1,30 @@ +global alpha, beta, gamma, iota + +probe begin { + gamma = "abcdefghijklmnopqrstuvwxyz" + + iota["one"] = "eleven" + iota["two"] = "twelve" + + alpha["one",1] = 1 + alpha["one",2] = 2 + alpha["two",1] = 3 + alpha["two",2] = 4 + + beta["one",1] = 1 + beta["one",2] = 2 + beta["two",1] = 3 + beta["two",2] = 4 +} + +probe timer.ms(2000) { + exit () +} + +probe end { +foreach ([i,j] in beta) + printf("[%#s,%#x]=%#x ", i, j, beta[i,j]) +print("\n") +exit() +} + diff --git a/testsuite/systemtap.base/optim_arridx.exp b/testsuite/systemtap.base/optim_arridx.exp index f4308db5..89282d1b 100644 --- a/testsuite/systemtap.base/optim_arridx.exp +++ b/testsuite/systemtap.base/optim_arridx.exp @@ -5,11 +5,14 @@ set ::result_string {# globals arr1:long [long, long] arr2:long [long] arr3:long [long] +elide_idx1:long +elide_global_a:long +elide_global_b:long # functions fna:long (a:long) return a fnb:long (a:long, b:long) -return ((a) + (b)) + (printf("")) +return (a) + (b) exit:unknown () %{ atomic_set (&session_state, STAP_SESSION_STOPPING); @@ -23,33 +26,52 @@ begin /* <- begin */ k:long b:long m:long - arr1:long [long] - arr2:long [long, long] aa:long bb:long cc:long dd:long ee:long { +(arr2[(elide_idx1) = (1)]) = (10) (arr2[(idx2) = (2)]) = (20) +(arr2[3]) = (30) (arr2[(j) = (4)]) = (40) (arr1[fna((k) = (0)), k]) = (1) (arr1[(b) = (1), b]) = (2) -fnb((arr3[0]) = (4), arr3[0]) +(arr1[2, 2]) = (3) +(arr3[0]) = (4) (m) = (1) -for (2; (m) <= (10); (m)++) ; -printf("%d %d %d %d\\n", arr1[0], arr2[0, 0], idx2, j) +for (2; (m) <= (10); (m)++) (arr2[m]) = ((m) * (10)) +printf("%d %d %d %d\\n", arr1[0, 0], arr2[0], idx2, j) (aa) = (fna(1)) -(bb) = (fnb((cc) = (1), 2)) +(bb) = (fnb((cc) = (1), (elide_global_a) = (2))) for (1; (bb) < (10); (bb)++) (cc) += (bb) for ((dd) = (1); (dd) < (10); 1) (dd) += (1) -if (1) (ee) = (1) +if ((elide_global_b) = (1)) (ee) = (1) (cc) = ((dd) = (5)) (cc) = ((4) + ((cc) = (1))) -printf("%d %d %d %d %d", aa, bb, cc, dd, ee) +printf("%d %d %d %d %d\\n", aa, bb, cc, dd, ee) exit() } +end /* <- end */ + # locals + idx0:long +{ +foreach ([idx0] in arr3) printf("arr3[%#d]=%#x\\n", idx0, arr3[idx0]) +} +end /* <- end */ +{ +printf("elide_idx1=%#x\\n", elide_idx1) +} +end /* <- end */ +{ +printf("elide_global_a=%#x\\n", elide_global_a) +} +end /* <- end */ +{ +printf("elide_global_b=%#x\\n", elide_global_b) +} } proc optim_arridx_run { TEST_NAME args } { diff --git a/testsuite/systemtap.base/optim_arridx.stp b/testsuite/systemtap.base/optim_arridx.stp index 3e4f8fd2..5c9c1051 100644 --- a/testsuite/systemtap.base/optim_arridx.stp +++ b/testsuite/systemtap.base/optim_arridx.stp @@ -1,7 +1,7 @@ global arr1, arr2, arr3, elide_idx1, elide_global_a, elide_global_b function fna(a:long) {return a} -function fnb(a:long, b:long) {return a+b+printf("")} +function fnb(a:long, b:long) {return a+b} probe begin { // array indices @@ -16,7 +16,7 @@ probe begin { m = 1 for (elide_n=2; m <= 10; m++) arr2[m] = m * 10 - printf ("%d %d %d %d\n", arr1[0], arr2[0,0], idx2, j) + printf ("%d %d %d %d\n", arr1[0,0], arr2[0], idx2, j) // function args aa = fna(elide_aa = 1) @@ -40,6 +40,6 @@ probe begin { // binary expression cc = ((elide_hh = 4) + (cc = 1)) - printf("%d %d %d %d %d", aa, bb, cc, dd, ee) + printf("%d %d %d %d %d\n", aa, bb, cc, dd, ee) exit () } -- cgit From 8aae0f0da19a11bd8f3f699ac98460e62de3388e Mon Sep 17 00:00:00 2001 From: Zhaolei Date: Thu, 28 Aug 2008 16:49:08 +0800 Subject: Make _get_sock_addr return correct address in kernel before 2.6.16. --- tapset/ChangeLog | 3 +++ tapset/socket.stp | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tapset/ChangeLog b/tapset/ChangeLog index b2592e1e..9e418e99 100644 --- a/tapset/ChangeLog +++ b/tapset/ChangeLog @@ -1,3 +1,6 @@ +2008-08-28 Zhaolei + * socket.stp: Make _get_sock_addr return correct address in kernel + before 2.6.16. 2008-08-04 Wenji Huang diff --git a/tapset/socket.stp b/tapset/socket.stp index 54a7c71f..3197a0e2 100644 --- a/tapset/socket.stp +++ b/tapset/socket.stp @@ -910,7 +910,14 @@ function _success_check(ret:long) function _get_sock_addr:long (file:long) %{ /* pure */ struct file *filep = (struct file *)(long)(THIS->file); - struct socket *sockp = filep? kread(&(filep->private_data)) : NULL; + struct socket *sockp; + if (filep) { + struct dentry *dentry = kread(&(filep->f_dentry)); + struct inode *inode = kread(&(dentry->d_inode)); + sockp = &container_of(inode, struct socket_alloc, vfs_inode)->socket; + } else { + sockp = NULL; + } if (sockp == NULL) THIS->__retvalue = -1; else -- cgit From 64fb79c01679d037f1ca2b86fb1f916395ead00d Mon Sep 17 00:00:00 2001 From: Don Domingo Date: Thu, 28 Aug 2008 23:23:58 +1000 Subject: initial --- doc/BeginnersGuide/Makefile | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 doc/BeginnersGuide/Makefile diff --git a/doc/BeginnersGuide/Makefile b/doc/BeginnersGuide/Makefile new file mode 100644 index 00000000..cf9d6bc3 --- /dev/null +++ b/doc/BeginnersGuide/Makefile @@ -0,0 +1,13 @@ +#Makefile for SystemTap_Beginners_Guide + +XML_LANG = en-US +DOCNAME = SystemTap_Beginners_Guide +PRODUCT = Red_Hat_Enterprise_Linux +BRAND = RedHat + +#OTHER_LANGS = as-IN bn-IN de-DE es-ES fr-FR gu-IN hi-IN it-IT ja-JP kn-IN ko-KR ml-IN mr-IN or-IN pa-IN pt-BR ru-RU si-LK ta-IN te-IN zh-CN zh-TW +TRANSLATIONS = $(XML_LANG) $(OTHER_LANGS) + +COMMON_CONFIG = /usr/share/publican +include $(COMMON_CONFIG)/make/Makefile.common + -- cgit From 0565b404408de934e41a4343259068d27deb3ecb Mon Sep 17 00:00:00 2001 From: Don Domingo Date: Thu, 28 Aug 2008 23:34:18 +1000 Subject: 2nd try --- doc/test | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/test diff --git a/doc/test b/doc/test new file mode 100644 index 00000000..eefc69f7 --- /dev/null +++ b/doc/test @@ -0,0 +1 @@ +Thu Aug 28 23:10:00 EST 2008 -- cgit From cd221ed4afd8d5e0f24f3f9d6ed4216f3181b1ca Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Thu, 28 Aug 2008 11:05:32 -0400 Subject: Document written but unread global variable automatic display. --- ChangeLog | 1 + NEWS | 7 +++++++ doc/ChangeLog | 4 ++++ doc/langref.tex | 4 +++- stap.1.in | 4 +++- 5 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 43fe2f59..23425b71 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ (semantic_pass): Call it. (dead_assignment_remover::visit_assignment): Don't remove written but unread global variables. + * NEWS, stap.1.in: Document 2008-08-26 David Smith diff --git a/NEWS b/NEWS index ce3954cf..969f736f 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,12 @@ * What's new +- Global variables which are written to but never read are now + automatically displayed when the session does a shutdown. For example: + global running_tasks + probe timer.profile {tc=task_current(); + running_tasks[task_pid(tc),task_tid(tc)] = execname()} + probe timer.ms(8000) {exit()} + - A formatted string representation of the variables, parameters, or local variables at a probe point is now supported via the special $$vars, $$parms, and $$locals context variables, which expand to a string diff --git a/doc/ChangeLog b/doc/ChangeLog index a04c4cdc..d28b588d 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2008-08-28 Stan Cox + + * langref.tex: Document written but unread global variable display. + 2008-08-25 Frank Ch. Eigler * Makefile.am: Removed dist-related targets and macros. diff --git a/doc/langref.tex b/doc/langref.tex index 413ece4d..5db82550 100644 --- a/doc/langref.tex +++ b/doc/langref.tex @@ -495,7 +495,9 @@ found. Because of possible concurrency limits, such as multiple probe handlers, each global variable used by a probe is automatically read- or write-locked while the handler is running. A global declaration may be written at the outermost level anywhere in a script file, not just within a block of code. -The following declaration marks \texttt{var1} and \texttt{var2} as global. +Global variables which are written but never read will be displayed +automatically at session shutdown. The following declaration marks +\texttt{var1} and \texttt{var2} as global. The translator will infer a value type for each, and if the variable is used as an array, its key types. diff --git a/stap.1.in b/stap.1.in index 466c021b..d787a015 100644 --- a/stap.1.in +++ b/stap.1.in @@ -351,7 +351,9 @@ Variables may be declared global, so that they are shared amongst all probes and live as long as the entire systemtap session. There is one namespace for all global variables, regardless of which script file they are found within. A global declaration may be written at the -outermost level anywhere, not within a block of code. The following +outermost level anywhere, not within a block of code. Global +variables which are written but never read will be displayed +automatically at session shutdown. The following declaration marks a few variables as global. The translator will infer for each its value type, and if it is used as an array, its key types. Optionally, scalar globals may be initialized with a string -- cgit From 5d9541658a8598f9430a7285ea04cafdb849e7d7 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Thu, 28 Aug 2008 11:59:26 -0400 Subject: fix NEWS to refer to simpler context.stp tapset functions in auto-printing blurb --- NEWS | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 969f736f..398964d9 100644 --- a/NEWS +++ b/NEWS @@ -2,10 +2,10 @@ - Global variables which are written to but never read are now automatically displayed when the session does a shutdown. For example: - global running_tasks - probe timer.profile {tc=task_current(); - running_tasks[task_pid(tc),task_tid(tc)] = execname()} - probe timer.ms(8000) {exit()} + + global running_tasks + probe timer.profile {running_tasks[pid(),tid()] = execname()} + probe timer.ms(8000) {exit()} - A formatted string representation of the variables, parameters, or local variables at a probe point is now supported via the special $$vars, -- cgit From 57148ee74505bdc3f33746563a998a9832924a41 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Thu, 28 Aug 2008 12:10:21 -0400 Subject: fix global-var array index rendering (plus emacs' automagic whitespace fixes) --- ChangeLog | 5 + elaborate.cxx | 302 ++++++++++++++++---------------- testsuite/systemtap.base/global_end.exp | 8 +- 3 files changed, 163 insertions(+), 152 deletions(-) diff --git a/ChangeLog b/ChangeLog index 23425b71..77484a8d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-08-28 Frank Ch. Eigler + + * elaborate.cxx (add_global_var_display): Render array indexes + in [key,key,key] vs. [key][key][key] form. + 2008-08-27 Stan Cox * elaborate.cxx (add_global_var_display): New. diff --git a/elaborate.cxx b/elaborate.cxx index 4fe228ab..88133c31 100644 --- a/elaborate.cxx +++ b/elaborate.cxx @@ -127,7 +127,7 @@ derived_probe::sole_location () const throw semantic_error ("derived_probe with no locations", this->tok); else if (locations.size() > 1) throw semantic_error ("derived_probe with too many locations", this->tok); - else + else return locations[0]; } @@ -183,9 +183,9 @@ derived_probe_builder::has_null_param (std::map const & p // ------------------------------------------------------------------------ // Members of match_key. -match_key::match_key(string const & n) - : name(n), - have_parameter(false), +match_key::match_key(string const & n) + : name(n), + have_parameter(false), parameter_type(pe_unknown) { } @@ -198,7 +198,7 @@ match_key::match_key(probe_point::component const & c) } match_key & -match_key::with_number() +match_key::with_number() { have_parameter = true; parameter_type = pe_long; @@ -206,14 +206,14 @@ match_key::with_number() } match_key & -match_key::with_string() +match_key::with_string() { have_parameter = true; parameter_type = pe_string; return *this; } -string +string match_key::str() const { if (have_parameter) @@ -226,16 +226,16 @@ match_key::str() const return name; } -bool +bool match_key::operator<(match_key const & other) const { return ((name < other.name) - - || (name == other.name + + || (name == other.name && have_parameter < other.have_parameter) - - || (name == other.name - && have_parameter == other.have_parameter + + || (name == other.name + && have_parameter == other.have_parameter && parameter_type < other.parameter_type)); } @@ -252,7 +252,7 @@ match_key::globmatch(match_key const & other) const const char *name_str = name.c_str(); return ((fnmatch(name_str, other_str, FNM_NOESCAPE) == 0) - && have_parameter == other.have_parameter + && have_parameter == other.have_parameter && parameter_type == other.parameter_type); } @@ -265,7 +265,7 @@ match_node::match_node() {} match_node * -match_node::bind(match_key const & k) +match_node::bind(match_key const & k) { if (k.name == "*") throw semantic_error("invalid use of wildcard probe point component"); @@ -278,7 +278,7 @@ match_node::bind(match_key const & k) return n; } -void +void match_node::bind(derived_probe_builder * e) { if (end) @@ -286,7 +286,7 @@ match_node::bind(derived_probe_builder * e) end = e; } -match_node * +match_node * match_node::bind(string const & k) { return bind(match_key(k)); @@ -298,7 +298,7 @@ match_node::bind_str(string const & k) return bind(match_key(k).with_string()); } -match_node * +match_node * match_node::bind_num(string const & k) { return bind(match_key(k).with_number()); @@ -311,7 +311,7 @@ match_node::find_and_build (systemtap_session& s, vector& results) { assert (pos <= loc->components.size()); - if (pos == loc->components.size()) // matched all probe point components so far + if (pos == loc->components.size()) // matched all probe point components so far { derived_probe_builder *b = end; // may be 0 if only nested names are bound @@ -321,7 +321,7 @@ match_node::find_and_build (systemtap_session& s, for (sub_map_iterator_t i = sub.begin(); i != sub.end(); i++) alternatives += string(" ") + i->first.str(); - throw semantic_error (string("probe point truncated at position ") + + throw semantic_error (string("probe point truncated at position ") + lex_cast (pos) + " (follow:" + alternatives + ")", loc->tok); } @@ -392,14 +392,14 @@ match_node::find_and_build (systemtap_session& s, string alternatives; for (sub_map_iterator_t i = sub.begin(); i != sub.end(); i++) alternatives += string(" ") + i->first.str(); - + throw semantic_error(string("probe point mismatch at position ") + lex_cast (pos) + " (alternatives:" + alternatives + ")", loc->tok); } } - else + else { match_key match (* loc->components[pos]); sub_map_iterator_t i = sub.find (match); @@ -408,8 +408,8 @@ match_node::find_and_build (systemtap_session& s, string alternatives; for (sub_map_iterator_t i = sub.begin(); i != sub.end(); i++) alternatives += string(" ") + i->first.str(); - - throw semantic_error (string("probe point mismatch at position ") + + + throw semantic_error (string("probe point mismatch at position ") + lex_cast (pos) + " (alternatives:" + alternatives + ")", loc->tok); @@ -456,17 +456,17 @@ private: struct -alias_expansion_builder +alias_expansion_builder : public derived_probe_builder { probe_alias * alias; - alias_expansion_builder(probe_alias * a) + alias_expansion_builder(probe_alias * a) : alias(a) {} virtual void build(systemtap_session & sess, - probe * use, + probe * use, probe_point * location, std::map const &, vector & finished_results) @@ -483,7 +483,7 @@ alias_expansion_builder // We're going to build a new probe and wrap it up in an // alias_expansion_probe so that the expansion loop recognizes it as // such and re-expands its expansion. - + alias_derived_probe * n = new alias_derived_probe (use, location /* soon overwritten */, this->alias); n->body = new block(); @@ -497,7 +497,7 @@ alias_expansion_builder n->tok = location->tok; // and statements representing the concatenation of the alias' - // body with the use's. + // body with the use's. // // NB: locals are *not* copied forward, from either alias or // use. The expansion should have its locals re-inferred since @@ -508,7 +508,7 @@ alias_expansion_builder n->body = new block (use->body, alias->body); else n->body = new block (alias->body, use->body); - + derive_probes (sess, n, finished_results, location->optional); } @@ -554,7 +554,7 @@ systemtap_session::register_library_aliases() for (unsigned a = 0; a < file->aliases.size(); ++a) { probe_alias * alias = file->aliases[a]; - try + try { for (unsigned n = 0; n < alias->alias_names.size(); ++n) { @@ -565,8 +565,8 @@ systemtap_session::register_library_aliases() probe_point::component * comp = name->components[c]; // XXX: alias parameters if (comp->arg) - throw semantic_error("alias component " - + comp->functor + throw semantic_error("alias component " + + comp->functor + " contains illegal parameter"); n = n->bind(comp->functor); } @@ -591,7 +591,7 @@ systemtap_session::register_library_aliases() static unsigned max_recursion = 100; -struct +struct recursion_guard { unsigned & i; @@ -601,7 +601,7 @@ recursion_guard throw semantic_error("recursion limit reached"); ++i; } - ~recursion_guard() + ~recursion_guard() { --i; } @@ -682,7 +682,7 @@ struct symbol_fetcher { symbol *&sym; - symbol_fetcher (symbol *&sym): sym(sym) + symbol_fetcher (symbol *&sym): sym(sym) {} void visit_symbol (symbol* e) @@ -732,7 +732,7 @@ struct mutated_var_collector { set * mutated_vars; - mutated_var_collector (set * mm) + mutated_var_collector (set * mm) : mutated_vars (mm) {} @@ -768,8 +768,8 @@ struct no_var_mutation_during_iteration_check systemtap_session & session; map *> & function_mutates_vars; vector vars_being_iterated; - - no_var_mutation_during_iteration_check + + no_var_mutation_during_iteration_check (systemtap_session & sess, map *> & fmv) : session(sess), function_mutates_vars (fmv) @@ -799,7 +799,7 @@ struct no_var_mutation_during_iteration_check void visit_functioncall (functioncall* e) { - map *>::const_iterator i + map *>::const_iterator i = function_mutates_vars.find (e->referent); if (i != function_mutates_vars.end()) @@ -825,7 +825,7 @@ struct no_var_mutation_during_iteration_check if (vd) vars_being_iterated.push_back (vd); - + traversing_visitor::visit_foreach_loop (s); if (vd) @@ -840,7 +840,7 @@ struct stat_decl_collector : public traversing_visitor { systemtap_session & session; - + stat_decl_collector(systemtap_session & sess) : session(sess) {} @@ -897,12 +897,12 @@ struct stat_decl_collector else { // FIXME: Support multiple co-declared histogram types - semantic_error se("multiple histogram types declared on '" + sym->name + "'", + semantic_error se("multiple histogram types declared on '" + sym->name + "'", e->tok); session.print_error (se); } } - } + } } }; @@ -912,10 +912,10 @@ semantic_pass_stats (systemtap_session & sess) { stat_decl_collector sdc(sess); - for (unsigned i = 0; i < sess.functions.size(); ++i) + for (unsigned i = 0; i < sess.functions.size(); ++i) sess.functions[i]->body->visit (&sdc); - for (unsigned i = 0; i < sess.probes.size(); ++i) + for (unsigned i = 0; i < sess.probes.size(); ++i) sess.probes[i]->body->visit (&sdc); for (unsigned i = 0; i < sess.globals.size(); ++i) @@ -923,7 +923,7 @@ semantic_pass_stats (systemtap_session & sess) vardecl *v = sess.globals[i]; if (v->type == pe_stats) { - + if (sess.stat_decls.find(v->name) == sess.stat_decls.end()) { semantic_error se("unable to infer statistic parameters for global '" + v->name + "'"); @@ -931,7 +931,7 @@ semantic_pass_stats (systemtap_session & sess) } } } - + return sess.num_errors(); } @@ -942,10 +942,10 @@ semantic_pass_stats (systemtap_session & sess) static int semantic_pass_vars (systemtap_session & sess) { - + map *> fmv; no_var_mutation_during_iteration_check chk(sess, fmv); - + for (unsigned i = 0; i < sess.functions.size(); ++i) { functiondecl * fn = sess.functions[i]; @@ -968,7 +968,7 @@ semantic_pass_vars (systemtap_session & sess) { if (sess.probes[i]->body) sess.probes[i]->body->visit (&chk); - } + } return sess.num_errors(); } @@ -986,7 +986,7 @@ semantic_pass_vars (systemtap_session & sess) // // probe begin(MAX) { if (! (g1 || g2)) %{ disable_probe_foo %} } // probe foo { if (! (g1 || g2)) next; ... } -// probe bar { ... g1 ++ ...; +// probe bar { ... g1 ++ ...; // if (g1 || g2) %{ enable_probe_foo %} else %{ disable_probe_foo %} // } // @@ -1029,7 +1029,7 @@ semantic_pass_conditions (systemtap_session & sess) ifs->condition = notex; p->body = new block (ifs, p->body); } - } + } return sess.num_errors(); } @@ -1084,7 +1084,7 @@ semantic_pass_symbols (systemtap_session& s) if (pending_interrupts) break; functiondecl* fd = dome->functions[i]; - try + try { sym.current_function = fd; sym.current_probe = 0; @@ -1097,7 +1097,7 @@ semantic_pass_symbols (systemtap_session& s) } // Pass 3: derive probes and resolve any further symbols in the - // derived results. + // derived results. for (unsigned i=0; iprobes.size(); i++) { @@ -1116,7 +1116,7 @@ semantic_pass_symbols (systemtap_session& s) s.probes.push_back (dp); dp->join_group (s); - try + try { sym.current_function = 0; sym.current_probe = dp; @@ -1139,7 +1139,7 @@ semantic_pass_symbols (systemtap_session& s) // Inform all derived_probe builders that we're done with // all resolution, so it's time to release caches. s.pattern_root->build_no_more (s); - + return s.num_errors(); // all those print_error calls } @@ -1185,7 +1185,7 @@ void add_global_var_display (systemtap_session& s) g_sym->name = l->name; g_sym->tok = l->tok; g_sym->type = l->type; - g_sym->referent = l; + g_sym->referent = l; pf->print_to_stream = true; pf->print_with_format = true; @@ -1253,11 +1253,17 @@ void add_global_var_display (systemtap_session& s) } // Create a printf for the foreach loop + pf->raw_components += "["; for (int i=0; i < idx_count; i++) - if (l->index_types[i] == pe_string) - pf->raw_components += "[\"%#s\"]"; - else - pf->raw_components += "[%#d]"; + { + if (i > 0) + pf->raw_components += ","; + if (l->index_types[i] == pe_string) + pf->raw_components += "\"%#s\""; + else + pf->raw_components += "%#d"; + } + pf->raw_components += "]"; if (l->type == pe_string) pf->raw_components += "=\"%#s\"\\n"; else @@ -1273,7 +1279,7 @@ void add_global_var_display (systemtap_session& s) pf->args.push_back(idx_sym[i]); } pf->args.push_back(ai); - + pf->components = print_format::string_to_components(pf->raw_components); expr_statement* feb = new expr_statement; feb->value = pf; @@ -1324,11 +1330,11 @@ semantic_pass (systemtap_session& s) { int rc = 0; - try + try { s.register_library_aliases(); register_standard_tapsets(s); - + if (rc == 0) rc = semantic_pass_symbols (s); if (rc == 0) rc = semantic_pass_conditions (s); if (rc == 0 && ! s.unoptimized) rc = semantic_pass_optimize1 (s); @@ -1337,7 +1343,7 @@ semantic_pass (systemtap_session& s) if (rc == 0 && ! s.unoptimized) rc = semantic_pass_optimize2 (s); if (rc == 0) rc = semantic_pass_vars (s); if (rc == 0) rc = semantic_pass_stats (s); - + if (s.probes.size() == 0 && !s.listing_mode) throw semantic_error ("no probes found"); } @@ -1346,7 +1352,7 @@ semantic_pass (systemtap_session& s) s.print_error (e); rc ++; } - + return rc; } @@ -1358,18 +1364,18 @@ systemtap_session::systemtap_session (): // NB: pointer members must be manually initialized! pattern_root(new match_node), user_file (0), - be_derived_probes(0), - dwarf_derived_probes(0), - uprobe_derived_probes(0), - utrace_derived_probes(0), - itrace_derived_probes(0), - task_finder_derived_probes(0), - timer_derived_probes(0), - profile_derived_probes(0), - mark_derived_probes(0), - hrtimer_derived_probes(0), - perfmon_derived_probes(0), - procfs_derived_probes(0), + be_derived_probes(0), + dwarf_derived_probes(0), + uprobe_derived_probes(0), + utrace_derived_probes(0), + itrace_derived_probes(0), + task_finder_derived_probes(0), + timer_derived_probes(0), + profile_derived_probes(0), + mark_derived_probes(0), + hrtimer_derived_probes(0), + perfmon_derived_probes(0), + procfs_derived_probes(0), op (0), up (0), sym_kprobes_text_start (0), sym_kprobes_text_end (0), @@ -1396,7 +1402,7 @@ systemtap_session::print_token (ostream& o, const token* tok) size_t idx = ts.find (tok->location.file); if (idx != string::npos) ts.replace (idx, tok->location.file.size(), ""); - + o << ts; } else @@ -1465,7 +1471,7 @@ symresolution_info::visit_block (block* e) { for (unsigned i=0; istatements.size(); i++) { - try + try { e->statements[i]->visit (this); } @@ -1483,14 +1489,14 @@ symresolution_info::visit_foreach_loop (foreach_loop* e) for (unsigned i=0; iindexes.size(); i++) e->indexes[i]->visit (this); - symbol *array = NULL; + symbol *array = NULL; hist_op *hist = NULL; classify_indexable (e->base, array, hist); if (array) { if (!array->referent) - { + { vardecl* d = find_var (array->name, e->indexes.size ()); if (d) array->referent = d; @@ -1503,7 +1509,7 @@ symresolution_info::visit_foreach_loop (foreach_loop* e) } } } - else + else { assert (hist); hist->visit (this); @@ -1516,7 +1522,7 @@ symresolution_info::visit_foreach_loop (foreach_loop* e) } -struct +struct delete_statement_symresolution_info: public traversing_visitor { @@ -1539,7 +1545,7 @@ delete_statement_symresolution_info: { if (e->referent) return; - + vardecl* d = parent->find_var (e->name, -1); if (d) e->referent = d; @@ -1548,7 +1554,7 @@ delete_statement_symresolution_info: } }; -void +void symresolution_info::visit_delete_statement (delete_statement* s) { delete_statement_symresolution_info di (this); @@ -1589,7 +1595,7 @@ symresolution_info::visit_arrayindex (arrayindex* e) for (unsigned i=0; iindexes.size(); i++) e->indexes[i]->visit (this); - symbol *array = NULL; + symbol *array = NULL; hist_op *hist = NULL; classify_indexable(e->base, array, hist); @@ -1616,7 +1622,7 @@ symresolution_info::visit_arrayindex (arrayindex* e) // must not happen throw semantic_error ("no current probe/function", e->tok); array->referent = v; - } + } } else { @@ -1656,19 +1662,19 @@ symresolution_info::visit_functioncall (functioncall* e) } -vardecl* +vardecl* symresolution_info::find_var (const string& name, int arity) { if (current_function || current_probe) { // search locals - vector& locals = (current_function ? + vector& locals = (current_function ? current_function->locals : current_probe->locals); - - + + for (unsigned i=0; iname == name + if (locals[i]->name == name && locals[i]->compatible_arity(arity)) { locals[i]->set_arity (arity); @@ -1689,12 +1695,12 @@ symresolution_info::find_var (const string& name, int arity) // search processed globals for (unsigned i=0; iname == name - && session.globals[i]->compatible_arity(arity)) + && session.globals[i]->compatible_arity(arity)) { session.globals[i]->set_arity (arity); return session.globals[i]; } - + // search library globals for (unsigned i=0; iname == name && g->compatible_arity (arity)) { g->set_arity (arity); - - // put library into the queue if not already there - if (find (session.files.begin(), session.files.end(), f) + + // put library into the queue if not already there + if (find (session.files.begin(), session.files.end(), f) == session.files.end()) session.files.push_back (f); - + return g; } } @@ -1720,7 +1726,7 @@ symresolution_info::find_var (const string& name, int arity) } -functiondecl* +functiondecl* symresolution_info::find_function (const string& name, unsigned arity) { for (unsigned j = 0; j < session.functions.size(); j++) @@ -1744,7 +1750,7 @@ symresolution_info::find_function (const string& name, unsigned arity) cerr << " function " << name << " " << "is defined from " << f->name << endl; - if (find (session.files.begin(), session.files.end(), f) + if (find (session.files.begin(), session.files.end(), f) == session.files.end()) session.files.push_back (f); // else .. print different message? @@ -1819,10 +1825,10 @@ void semantic_pass_opt2 (systemtap_session& s, bool& relaxed_p, unsigned iterati // // for (unsigned i=0; ibody->visit (& vut); - + // Now in vut.read/written, we have a mixture of all locals, globals - - for (unsigned i=0; ilocals.size(); /* see below */) { vardecl* l = s.probes[i]->locals[j]; @@ -1864,7 +1870,7 @@ void semantic_pass_opt2 (systemtap_session& s, bool& relaxed_p, unsigned iterati j++; } } - + for (unsigned i=0; ilocals.size(); /* see below */) { @@ -1941,7 +1947,7 @@ void semantic_pass_opt2 (systemtap_session& s, bool& relaxed_p, unsigned iterati for (it = s.globals.begin(); it != s.globals.end(); it++) if (l->name != (*it)->name) o << " " << (*it)->name; - + s.print_warning ("read-only global variable '" + l->name + "' " + (o.str() == "" ? "" : ("(alternatives:" + o.str() + ")")), l->tok); } @@ -1962,7 +1968,7 @@ struct dead_assignment_remover: public traversing_visitor expression** current_expr; dead_assignment_remover(systemtap_session& s, bool& r, - const varuse_collecting_visitor& v): + const varuse_collecting_visitor& v): session(s), relaxed_p(r), vut(v), current_expr(0) {} void visit_expr_statement (expr_statement* s); @@ -1998,7 +2004,7 @@ dead_assignment_remover::visit_assignment (assignment* e) vardecl* leftvar = left->referent; // NB: may be 0 for unresolved $target if (current_expr && // see XXX above: this case represents a missed // optimization opportunity - *current_expr == e && // we're not nested any deeper than expected + *current_expr == e && // we're not nested any deeper than expected leftvar) // not unresolved $target; intended sideeffect cannot be elided { expression** last_expr = current_expr; @@ -2011,7 +2017,7 @@ dead_assignment_remover::visit_assignment (assignment* e) { // NB: Not so fast! The left side could be an array whose // index expressions may have side-effects. This would be - // OK if we could replace the array assignment with a + // OK if we could replace the array assignment with a // statement-expression containing all the index expressions // and the rvalue... but we can't. // Another possibility is that we have an unread global variable @@ -2038,9 +2044,9 @@ dead_assignment_remover::visit_assignment (assignment* e) else */ if (session.verbose>2) - clog << "Eliding assignment to " << leftvar->name + clog << "Eliding assignment to " << leftvar->name << " at " << *e->tok << endl; - + *current_expr = e->right; // goodbye assignment* relaxed_p = false; } @@ -2149,7 +2155,7 @@ struct dead_stmtexpr_remover: public traversing_visitor statement** current_stmt; // pointer to current stmt* being iterated set focal_vars; // vars considered subject to side-effects - dead_stmtexpr_remover(systemtap_session& s, bool& r): + dead_stmtexpr_remover(systemtap_session& s, bool& r): session(s), relaxed_p(r), current_stmt(0) {} void visit_block (block *s); @@ -2182,7 +2188,7 @@ dead_stmtexpr_remover::visit_block (block *s) statement** last_stmt = current_stmt; current_stmt = & s->statements[i]; s->statements[i]->visit (this); - if (*current_stmt != 0) + if (*current_stmt != 0) { // flatten nested blocks into this one block *b = dynamic_cast(*current_stmt); @@ -2343,16 +2349,16 @@ dead_stmtexpr_remover::visit_expr_statement (expr_statement *s) varuse_collecting_visitor vut; s->value->visit (& vut); - + if (vut.side_effect_free_wrt (focal_vars) && - *current_stmt == s) // we're not nested any deeper than expected + *current_stmt == s) // we're not nested any deeper than expected { /* PR 1119: NB: this message is not a good idea here. It can name some arbitrary RHS expression of an assignment. if (s->value->tok->location.file == session.user_file->name && // not tapset ! session.suppress_warnings) clog << "WARNING: eliding read-only " << *s->value->tok << endl; - else + else */ if (session.verbose>2) clog << "Eliding side-effect-free expression " @@ -2372,7 +2378,7 @@ void semantic_pass_opt4 (systemtap_session& s, bool& relaxed_p) // Finally, let's remove some statement-expressions that have no // side-effect. These should be exactly those whose private varuse // visitors come back with an empty "written" and "embedded" lists. - + dead_stmtexpr_remover duv (s, relaxed_p); // This instance may be reused for multiple probe/function body trims. @@ -2948,7 +2954,7 @@ semantic_pass_types (systemtap_session& s) // next pass: type inference unsigned iterations = 0; typeresolution_info ti (s); - + ti.assert_resolvability = false; // XXX: maybe convert to exception-based error signalling while (1) @@ -2974,7 +2980,7 @@ semantic_pass_types (systemtap_session& s) // // if (fn->type == pe_unknown) // ti.unresolved (fn->tok); - } + } for (unsigned j=0; jtype == pe_unknown) ti.unresolved (gd->tok); } - + if (ti.num_newly_resolved == 0) // converged { if (ti.num_still_unresolved == 0) @@ -3016,7 +3022,7 @@ semantic_pass_types (systemtap_session& s) } } } - + return rc + s.num_errors(); } @@ -3075,12 +3081,12 @@ typeresolution_info::visit_comparison (comparison *e) e->left->visit (this); t = (e->left->type != pe_unknown) ? e->left->type : pe_unknown; e->right->visit (this); - + if (e->left->type != pe_unknown && e->right->type != pe_unknown && e->left->type != e->right->type) mismatch (e->tok, e->left->type, e->right->type); - + if (e->type == pe_unknown) { e->type = pe_long; @@ -3184,7 +3190,7 @@ typeresolution_info::visit_assignment (assignment *e) (e->left->type != pe_unknown) ? e->left->type : pe_unknown; e->right->visit (this); - + if ((sub_type != pe_unknown) && (e->type == pe_unknown)) { e->type = sub_type; @@ -3222,7 +3228,7 @@ typeresolution_info::visit_binary_expression (binary_expression* e) e->right->type != pe_unknown && e->left->type != e->right->type) mismatch (e->tok, e->left->type, e->right->type); - + if (e->type == pe_unknown) { e->type = pe_long; @@ -3378,7 +3384,7 @@ typeresolution_info::visit_target_symbol (target_symbol* e) current_probe->body->print (clog); clog << endl; } - else + else clog << "other" << endl; } @@ -3396,7 +3402,7 @@ typeresolution_info::visit_arrayindex (arrayindex* e) symbol *array = NULL; hist_op *hist = NULL; classify_indexable(e->base, array, hist); - + // Every hist_op has type [int]:int, that is to say, every hist_op // is a pseudo-one-dimensional integer array type indexed by // integers (bucket numbers). @@ -3464,7 +3470,7 @@ typeresolution_info::visit_functioncall (functioncall* e) { assert (e->referent != 0); - resolve_2types (e, e->referent, this, t, true); // accept unknown type + resolve_2types (e, e->referent, this, t, true); // accept unknown type if (e->type == pe_stats) invalid (e->tok, e->type); @@ -3480,7 +3486,7 @@ typeresolution_info::visit_functioncall (functioncall* e) t = ft; ee->visit (this); exp_type at = ee->type; - + if (((at == pe_string) || (at == pe_long)) && ft == pe_unknown) { // propagate to formal arg @@ -3504,7 +3510,7 @@ typeresolution_info::visit_block (block* e) { for (unsigned i=0; istatements.size(); i++) { - try + try { t = pe_unknown; e->statements[i]->visit (this); @@ -3548,9 +3554,9 @@ typeresolution_info::visit_for_loop (for_loop* e) t = pe_long; e->cond->visit (this); t = pe_unknown; - if (e->incr) e->incr->visit (this); + if (e->incr) e->incr->visit (this); t = pe_unknown; - e->block->visit (this); + e->block->visit (this); } @@ -3570,7 +3576,7 @@ typeresolution_info::visit_foreach_loop (foreach_loop* e) classify_indexable(e->base, array, hist); if (hist) - { + { if (e->indexes.size() != 1) unresolved (e->tok); t = pe_long; @@ -3581,7 +3587,7 @@ typeresolution_info::visit_foreach_loop (foreach_loop* e) } else { - assert (array); + assert (array); if (e->indexes.size() != array->referent->index_types.size()) unresolved (e->tok); // symbol resolution should prevent this else for (unsigned i=0; iindexes.size(); i++) @@ -3591,7 +3597,7 @@ typeresolution_info::visit_foreach_loop (foreach_loop* e) t = ft; ee->visit (this); exp_type at = ee->type; - + if ((at == pe_string || at == pe_long) && ft == pe_unknown) { // propagate to formal type @@ -3617,7 +3623,7 @@ typeresolution_info::visit_foreach_loop (foreach_loop* e) } t = pe_unknown; - e->block->visit (this); + e->block->visit (this); } @@ -3635,7 +3641,7 @@ typeresolution_info::visit_expr_statement (expr_statement* e) } -struct delete_statement_typeresolution_info: +struct delete_statement_typeresolution_info: public throwing_visitor { typeresolution_info *parent; @@ -3648,11 +3654,11 @@ struct delete_statement_typeresolution_info: { parent->visit_arrayindex (e); } - + void visit_symbol (symbol* e) { exp_type ignored = pe_unknown; - assert (e->referent != 0); + assert (e->referent != 0); resolve_2types (e, e->referent, parent, ignored); } }; @@ -3711,7 +3717,7 @@ typeresolution_info::visit_return_statement (return_statement* e) // This is like symbol, where the referent is // the return value of the function. - // translation pass will print error + // translation pass will print error if (current_function == 0) return; @@ -3722,7 +3728,7 @@ typeresolution_info::visit_return_statement (return_statement* e) if (e_type != pe_unknown && e->value->type != pe_unknown && e_type != e->value->type) mismatch (current_function->tok, e_type, e->value->type); - if (e_type == pe_unknown && + if (e_type == pe_unknown && (e->value->type == pe_long || e->value->type == pe_string)) { // propagate non-statistics from value @@ -3733,7 +3739,7 @@ typeresolution_info::visit_return_statement (return_statement* e) invalid (e->value->tok, e->value->type); } -void +void typeresolution_info::visit_print_format (print_format* e) { size_t unresolved_args = 0; @@ -3758,7 +3764,7 @@ typeresolution_info::visit_print_format (print_format* e) if (e->components[i].type == print_format::conv_unspecified) throw semantic_error ("Unspecified conversion in print operator format string", e->tok); - else if (e->components[i].type == print_format::conv_literal + else if (e->components[i].type == print_format::conv_literal || e->components[i].type == print_format::conv_size) continue; components.push_back(e->components[i]); @@ -3841,7 +3847,7 @@ typeresolution_info::visit_print_format (print_format* e) } } } - + if (unresolved_args == 0) { if (e->type == pe_unknown) @@ -3849,7 +3855,7 @@ typeresolution_info::visit_print_format (print_format* e) if (e->print_to_stream) e->type = pe_long; else - e->type = pe_string; + e->type = pe_string; resolved (e->tok, e->type); } } @@ -3861,7 +3867,7 @@ typeresolution_info::visit_print_format (print_format* e) } -void +void typeresolution_info::visit_stat_op (stat_op* e) { t = pe_stats; @@ -3875,7 +3881,7 @@ typeresolution_info::visit_stat_op (stat_op* e) mismatch (e->tok, e->type, pe_long); } -void +void typeresolution_info::visit_hist_op (hist_op* e) { t = pe_stats; diff --git a/testsuite/systemtap.base/global_end.exp b/testsuite/systemtap.base/global_end.exp index b1931a90..08cf0dea 100644 --- a/testsuite/systemtap.base/global_end.exp +++ b/testsuite/systemtap.base/global_end.exp @@ -9,10 +9,10 @@ set ok 0 expect { -timeout 180 -re {one,0x1.*one,0x2.*two,0x1.*two,0x2} { incr ok; exp_continue } - -re {alpha."one"..1.=0x1} { incr ok; exp_continue } - -re {alpha."one"..2.=0x2} { incr ok; exp_continue } - -re {alpha."two"..1.=0x3} { incr ok; exp_continue } - -re {alpha."two"..2.=0x4} { incr ok; exp_continue } + -re {alpha."one".1.=0x1} { incr ok; exp_continue } + -re {alpha."one".2.=0x2} { incr ok; exp_continue } + -re {alpha."two".1.=0x3} { incr ok; exp_continue } + -re {alpha."two".2.=0x4} { incr ok; exp_continue } -re {gamma="abcdefghijklmnopqrstuvwxyz"} { incr ok; exp_continue } -re {iota."one".="eleven"} { incr ok; exp_continue } -re {iota."two".="twelve"} { incr ok; exp_continue } -- cgit From dff50e09fea194433e15aa6137c835cedcf94a58 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Thu, 28 Aug 2008 12:14:49 -0400 Subject: trailing whitespace removal, as approved by emacs (add-hook 'before-save-hook 'delete-trailing-whitespace) --- buildrun.cxx | 22 +-- coveragedb.cxx | 4 +- coveragedb.h | 4 +- dwarf_wrappers.h | 2 +- elaborate.h | 4 +- hash.cxx | 6 +- main.cxx | 16 +- mdfour.c | 46 ++--- mdfour.h | 10 +- parse.cxx | 162 +++++++++--------- parse.h | 10 +- session.h | 6 +- staptree.cxx | 136 +++++++-------- staptree.h | 2 +- translate.cxx | 506 +++++++++++++++++++++++++++---------------------------- util.cxx | 6 +- util.h | 8 +- 17 files changed, 475 insertions(+), 475 deletions(-) diff --git a/buildrun.cxx b/buildrun.cxx index 6b2b779d..ada00027 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -53,10 +53,10 @@ run_make_cmd(systemtap_session& s, string& make_cmd) make_cmd += " >/dev/null"; else make_cmd += " -s >/dev/null 2>&1"; - + if (s.verbose > 1) clog << "Running " << make_cmd << endl; rc = system (make_cmd.c_str()); - + return rc; } @@ -133,7 +133,7 @@ compile_pass (systemtap_session& s) o << "EXTRA_CFLAGS += -freorder-blocks" << endl; // improve on -Os // o << "CFLAGS += -fno-unit-at-a-time" << endl; - + // Assumes linux 2.6 kbuild o << "EXTRA_CFLAGS += -Wno-unused -Werror" << endl; o << "EXTRA_CFLAGS += -I\"" << s.runtime_path << "\"" << endl; @@ -154,7 +154,7 @@ compile_pass (systemtap_session& s) << strerror(errno) << endl << "Make sure kernel devel is installed." << endl; return rc; - } + } // Run make string make_cmd = string("make") @@ -162,7 +162,7 @@ compile_pass (systemtap_session& s) make_cmd += string(" M=\"") + s.tmpdir + string("\" modules"); rc = run_make_cmd(s, make_cmd); - + return rc; } @@ -274,23 +274,23 @@ run_pass (systemtap_session& s) + (s.verbose>1 ? "-v " : "") + (s.verbose>2 ? "-v " : "") + (s.output_file.empty() ? "" : "-o " + s.output_file + " "); - + if (s.cmd != "") staprun_cmd += "-c " + cmdstr_quoted(s.cmd) + " "; - + if (s.target_pid) staprun_cmd += "-t " + stringify(s.target_pid) + " "; - + if (s.buffer_size) staprun_cmd += "-b " + stringify(s.buffer_size) + " "; - + if (s.need_uprobes) staprun_cmd += "-u "; staprun_cmd += s.tmpdir + "/" + s.module_name + ".ko"; - + if (s.verbose>1) clog << "Running " << staprun_cmd << endl; - + rc = system (staprun_cmd.c_str ()); return rc; } diff --git a/coveragedb.cxx b/coveragedb.cxx index 8258b359..63cc4c0f 100644 --- a/coveragedb.cxx +++ b/coveragedb.cxx @@ -35,7 +35,7 @@ void print_coverage_info(systemtap_session &s) clog << "probe: " << used_probe_list[j]->locations[k]->tok->location << endl; } - + clog << "----" << endl; // for each probe print used and unused variables for (unsigned j=0; jlocals.size(); ++j) { @@ -210,7 +210,7 @@ sql_update_used_probes(sqlite3 *db, systemtap_session &s) increment_element(db, x); } } - + // for each probe update used and unused variables for (unsigned j=0; jlocals.size(); ++j) { struct source_loc place = s.probes[i]->locals[j]->tok->location; diff --git a/coveragedb.h b/coveragedb.h index ccf1911d..df5782ca 100644 --- a/coveragedb.h +++ b/coveragedb.h @@ -62,11 +62,11 @@ public: int compiled; int executed; - coverage_element() { line = 0; col = 0; + coverage_element() { line = 0; col = 0; compiled = 0; executed = 0; } coverage_element(source_loc &place) { - file = place.file; line = place.line; col = place.column; + file = place.file; line = place.line; col = place.column; compiled = 0; executed = 0; } }; diff --git a/dwarf_wrappers.h b/dwarf_wrappers.h index c498de05..abf2c1e5 100644 --- a/dwarf_wrappers.h +++ b/dwarf_wrappers.h @@ -63,7 +63,7 @@ public: { return line != 0; } - + int lineno() const { int lineval; diff --git a/elaborate.h b/elaborate.h index afc0c569..df888360 100644 --- a/elaborate.h +++ b/elaborate.h @@ -23,7 +23,7 @@ struct derived_probe; struct match_node; -struct symresolution_info: public traversing_visitor +struct symresolution_info: public traversing_visitor { protected: systemtap_session& session; @@ -185,7 +185,7 @@ typedef std::map literal_map_t; struct derived_probe_builder { virtual void build(systemtap_session & sess, - probe* base, + probe* base, probe_point* location, literal_map_t const & parameters, std::vector & finished_results) = 0; diff --git a/hash.cxx b/hash.cxx index 2c1bfb25..ef02c8f1 100644 --- a/hash.cxx +++ b/hash.cxx @@ -1,16 +1,16 @@ // Copyright (C) Andrew Tridgell 2002 (original file) // Copyright (C) 2006-2008 Red Hat Inc. (systemtap changes) -// +// // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. -// +// // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. diff --git a/main.cxx b/main.cxx index 8c99cf7e..27926447 100644 --- a/main.cxx +++ b/main.cxx @@ -79,7 +79,7 @@ usage (systemtap_session& s, int exitcode) << " -u unoptimized translation" << (s.unoptimized ? " [set]" : "") << endl << " -w suppress warnings" << (s.suppress_warnings ? " [set]" : "") << endl << " -g guru mode" << (s.guru_mode ? " [set]" : "") << endl - << " -P prologue-searching for function probes" + << " -P prologue-searching for function probes" << (s.prologue_searching ? " [set]" : "") << endl << " -b bulk (percpu file) mode" << (s.bulk_mode ? " [set]" : "") << endl << " -s NUM buffer size in megabytes, instead of " @@ -165,7 +165,7 @@ printscript(systemtap_session& s, ostream& o) { assert (a->alias_names.size() >= 1); a->alias_names[0]->print(tmps); // XXX: [0] is arbitrary; perhaps print all - } + } else { assert (second->locations.size() >= 1); @@ -193,7 +193,7 @@ printscript(systemtap_session& s, ostream& o) ec->print (o); o << endl; } - + if (s.globals.size() > 0) o << "# globals" << endl; for (unsigned i=0; i 0) o << "# functions" << endl; for (unsigned i=0; i 0) o << "# probes" << endl; for (unsigned i=0; i #include "mdfour.h" -/* NOTE: This code makes no attempt to be fast! +/* NOTE: This code makes no attempt to be fast! It assumes that a int is at least 32 bits long */ @@ -46,41 +46,41 @@ mdfour64(uint32_t *M) uint32_t AA, BB, CC, DD; uint32_t A,B,C,D; - A = m->A; B = m->B; C = m->C; D = m->D; + A = m->A; B = m->B; C = m->C; D = m->D; AA = A; BB = B; CC = C; DD = D; - ROUND1(A,B,C,D, 0, 3); ROUND1(D,A,B,C, 1, 7); + ROUND1(A,B,C,D, 0, 3); ROUND1(D,A,B,C, 1, 7); ROUND1(C,D,A,B, 2, 11); ROUND1(B,C,D,A, 3, 19); - ROUND1(A,B,C,D, 4, 3); ROUND1(D,A,B,C, 5, 7); + ROUND1(A,B,C,D, 4, 3); ROUND1(D,A,B,C, 5, 7); ROUND1(C,D,A,B, 6, 11); ROUND1(B,C,D,A, 7, 19); - ROUND1(A,B,C,D, 8, 3); ROUND1(D,A,B,C, 9, 7); + ROUND1(A,B,C,D, 8, 3); ROUND1(D,A,B,C, 9, 7); ROUND1(C,D,A,B, 10, 11); ROUND1(B,C,D,A, 11, 19); - ROUND1(A,B,C,D, 12, 3); ROUND1(D,A,B,C, 13, 7); - ROUND1(C,D,A,B, 14, 11); ROUND1(B,C,D,A, 15, 19); + ROUND1(A,B,C,D, 12, 3); ROUND1(D,A,B,C, 13, 7); + ROUND1(C,D,A,B, 14, 11); ROUND1(B,C,D,A, 15, 19); - ROUND2(A,B,C,D, 0, 3); ROUND2(D,A,B,C, 4, 5); + ROUND2(A,B,C,D, 0, 3); ROUND2(D,A,B,C, 4, 5); ROUND2(C,D,A,B, 8, 9); ROUND2(B,C,D,A, 12, 13); - ROUND2(A,B,C,D, 1, 3); ROUND2(D,A,B,C, 5, 5); + ROUND2(A,B,C,D, 1, 3); ROUND2(D,A,B,C, 5, 5); ROUND2(C,D,A,B, 9, 9); ROUND2(B,C,D,A, 13, 13); - ROUND2(A,B,C,D, 2, 3); ROUND2(D,A,B,C, 6, 5); + ROUND2(A,B,C,D, 2, 3); ROUND2(D,A,B,C, 6, 5); ROUND2(C,D,A,B, 10, 9); ROUND2(B,C,D,A, 14, 13); - ROUND2(A,B,C,D, 3, 3); ROUND2(D,A,B,C, 7, 5); + ROUND2(A,B,C,D, 3, 3); ROUND2(D,A,B,C, 7, 5); ROUND2(C,D,A,B, 11, 9); ROUND2(B,C,D,A, 15, 13); - ROUND3(A,B,C,D, 0, 3); ROUND3(D,A,B,C, 8, 9); + ROUND3(A,B,C,D, 0, 3); ROUND3(D,A,B,C, 8, 9); ROUND3(C,D,A,B, 4, 11); ROUND3(B,C,D,A, 12, 15); - ROUND3(A,B,C,D, 2, 3); ROUND3(D,A,B,C, 10, 9); + ROUND3(A,B,C,D, 2, 3); ROUND3(D,A,B,C, 10, 9); ROUND3(C,D,A,B, 6, 11); ROUND3(B,C,D,A, 14, 15); - ROUND3(A,B,C,D, 1, 3); ROUND3(D,A,B,C, 9, 9); + ROUND3(A,B,C,D, 1, 3); ROUND3(D,A,B,C, 9, 9); ROUND3(C,D,A,B, 5, 11); ROUND3(B,C,D,A, 13, 15); - ROUND3(A,B,C,D, 3, 3); ROUND3(D,A,B,C, 11, 9); + ROUND3(A,B,C,D, 3, 3); ROUND3(D,A,B,C, 11, 9); ROUND3(C,D,A,B, 7, 11); ROUND3(B,C,D,A, 15, 15); - A += AA; B += BB; + A += AA; B += BB; C += CC; D += DD; - - A &= MASK32; B &= MASK32; + + A &= MASK32; B &= MASK32; C &= MASK32; D &= MASK32; m->A = A; m->B = B; m->C = C; m->D = D; @@ -140,7 +140,7 @@ mdfour_tail(const unsigned char *in, int n) } else { - copy4(buf+120, b); + copy4(buf+120, b); copy64(M, buf); mdfour64(M); copy64(M, buf+64); diff --git a/mdfour.h b/mdfour.h index 223302ad..5ed9df30 100644 --- a/mdfour.h +++ b/mdfour.h @@ -1,19 +1,19 @@ -/* +/* Unix SMB/Netbios implementation. Version 1.9. a implementation of MD4 designed for use in the SMB authentication protocol Copyright (C) Andrew Tridgell 1997-1998. - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. @@ -26,7 +26,7 @@ struct mdfour uint32_t A, B, C, D; uint32_t totalN; unsigned char tail[64]; - unsigned tail_len; + unsigned tail_len; }; void mdfour_begin(struct mdfour *md); diff --git a/parse.cxx b/parse.cxx index 59f3cb8a..00991022 100644 --- a/parse.cxx +++ b/parse.cxx @@ -88,7 +88,7 @@ tt2str(token_type tt) ostream& operator << (ostream& o, const source_loc& loc) { - o << loc.file << ":" + o << loc.file << ":" << loc.line << ":" << loc.column; @@ -111,14 +111,14 @@ operator << (ostream& o, const token& t) o << "'"; } - o << " at " + o << " at " << t.location; return o; } -void +void parser::print_error (const parse_error &pe) { cerr << "parse error: " << pe.what () << endl; @@ -143,7 +143,7 @@ parser::print_error (const parse_error &pe) } -const token* +const token* parser::last () { return last_t; @@ -194,11 +194,11 @@ bool eval_pp_conditional (systemtap_session& s, { string target_kernel_vr = s.kernel_release; string target_kernel_v = s.kernel_base_release; - + if (! (r->type == tok_string)) throw parse_error ("expected string literal", r); - string target = (l->content == "kernel_vr" ? + string target = (l->content == "kernel_vr" ? target_kernel_vr.c_str() : target_kernel_v.c_str()); string query = r->content; @@ -247,7 +247,7 @@ bool eval_pp_conditional (systemtap_session& s, if (! (r->type == tok_string)) throw parse_error ("expected string literal", r); string query_architecture = r->content; - + int nomatch = fnmatch (query_architecture.c_str(), target_architecture.c_str(), FNM_NOESCAPE); // still spooky @@ -259,9 +259,9 @@ bool eval_pp_conditional (systemtap_session& s, result = nomatch; else throw parse_error ("expected '==' or '!='", op); - + return result; - } + } else if (l->type == tok_string && r->type == tok_string) { string lhs = l->content; @@ -307,7 +307,7 @@ parser::scan_pp (bool wildcard) const token* t = input.scan (wildcard); // NB: not recursive! if (t == 0) // EOF return t; - + if (! (t->type == tok_operator && t->content == "%(")) // ordinary token return t; @@ -349,7 +349,7 @@ parser::scan_pp (bool wildcard) } catch (const parse_error &e) { - if (result) throw e; // propagate errors if THEN branch taken + if (result) throw e; // propagate errors if THEN branch taken continue; } @@ -370,7 +370,7 @@ parser::scan_pp (bool wildcard) continue; } - + if (m && m->type == tok_operator && m->content == "%:") // ELSE { delete m; // "%:" @@ -380,10 +380,10 @@ parser::scan_pp (bool wildcard) try { m = result ? input.scan (wildcard) : scan_pp (wildcard); - } + } catch (const parse_error& e) { - if (!result) throw e; // propagate errors if ELSE branch taken + if (!result) throw e; // propagate errors if ELSE branch taken continue; } @@ -397,7 +397,7 @@ parser::scan_pp (bool wildcard) if (!m) throw parse_error ("incomplete conditional - missing %)", t); if (!result) - my_enqueued_pp.push_back (m); + my_enqueued_pp.push_back (m); if (result) delete m; // do nothing, just dispose of unkept ELSE token @@ -466,7 +466,7 @@ tok_is(token const * t, token_type tt, string const & expected) } -const token* +const token* parser::expect_known (token_type tt, string const & expected) { const token *t = next(); @@ -476,7 +476,7 @@ parser::expect_known (token_type tt, string const & expected) } -const token* +const token* parser::expect_unknown (token_type tt, string & target) { const token *t = next(); @@ -487,7 +487,7 @@ parser::expect_unknown (token_type tt, string & target) } -const token* +const token* parser::expect_unknown2 (token_type tt1, token_type tt2, string & target) { const token *t = next(); @@ -498,20 +498,20 @@ parser::expect_unknown2 (token_type tt1, token_type tt2, string & target) } -const token* +const token* parser::expect_op (std::string const & expected) { return expect_known (tok_operator, expected); } -const token* +const token* parser::expect_kw (std::string const & expected) { return expect_known (tok_identifier, expected); } -const token* +const token* parser::expect_number (int64_t & value) { bool neg = false; @@ -537,8 +537,8 @@ parser::expect_number (int64_t & value) || (neg && (unsigned long long) value > 9223372036854775808ULL) || (unsigned long long) value > 18446744073709551615ULL || value < -9223372036854775807LL-1) - throw parse_error ("number invalid or out of range"); - + throw parse_error ("number invalid or out of range"); + if (neg) value = -value; @@ -546,28 +546,28 @@ parser::expect_number (int64_t & value) } -const token* +const token* parser::expect_ident (std::string & target) { return expect_unknown (tok_identifier, target); } -const token* +const token* parser::expect_ident_or_keyword (std::string & target) { return expect_unknown2 (tok_identifier, tok_keyword, target); } -bool +bool parser::peek_op (std::string const & op) { return tok_is (peek(), tok_operator, op); } -bool +bool parser::peek_kw (std::string const & kw) { return tok_is (peek(), tok_identifier, kw); @@ -576,7 +576,7 @@ parser::peek_kw (std::string const & kw) lexer::lexer (istream& i, const string& in, systemtap_session& s): - input (i), input_name (in), cursor_suspend_count(0), + input (i), input_name (in), cursor_suspend_count(0), cursor_line (1), cursor_column (1), session(s) { } @@ -593,7 +593,7 @@ lexer::input_peek (unsigned n) } -int +int lexer::input_get () { int c = input_peek (0); @@ -691,7 +691,7 @@ lexer::scan (bool wildcard) idx = (idx * 10) + (c2 - '0'); c2 = input_peek (); } while (c2 > 0 && - isdigit (c2) && + isdigit (c2) && idx <= session.args.size()); // prevent overflow if (idx == 0 || idx-1 >= session.args.size()) @@ -736,7 +736,7 @@ lexer::scan (bool wildcard) || n->content == "string" || n->content == "long") n->type = tok_keyword; - + return n; } @@ -781,7 +781,7 @@ lexer::scan (bool wildcard) if (c == '\"') // closing double-quotes break; else if (c == '\\') // see also input_put - { + { c = input_get (); switch (c) { @@ -795,7 +795,7 @@ lexer::scan (bool wildcard) case '0' ... '7': // NB: need only match the first digit case '\\': // Pass these escapes through to the string value - // being parsed; it will be emitted into a C literal. + // being parsed; it will be emitted into a C literal. n->content.push_back('\\'); @@ -918,7 +918,7 @@ lexer::scan (bool wildcard) { n->content = s2; input_get (); // swallow other character - } + } else { n->content = s1; @@ -985,7 +985,7 @@ parser::parse () { print_error (pe); if (pe.skip_some) // for recovery - try + try { // Quietly swallow all tokens until the next '}'. while (1) @@ -1018,7 +1018,7 @@ parser::parse () delete f; return 0; } - + return f; } @@ -1041,16 +1041,16 @@ parser::parse_probe (std::vector & probe_ret, while (1) { probe_point * pp = parse_probe_point (); - + const token* t = peek (); - if (equals_ok && t + if (equals_ok && t && t->type == tok_operator && t->content == "=") { aliases.push_back(pp); next (); continue; } - else if (equals_ok && t + else if (equals_ok && t && t->type == tok_operator && t->content == "+=") { aliases.push_back(pp); @@ -1172,7 +1172,7 @@ parser::parse_statement () n->tok = next (); return n; } - else if (t && t->type == tok_operator && t->content == "{") + else if (t && t->type == tok_operator && t->content == "{") return parse_stmt_block (); else if (t && t->type == tok_keyword && t->content == "if") return parse_if_statement (); @@ -1220,7 +1220,7 @@ parser::parse_global (vector & globals, vector&) for (unsigned i=0; iname == t->content) throw parse_error ("duplicate global name"); - + vardecl* d = new vardecl; d->name = t->content; d->tok = t; @@ -1326,7 +1326,7 @@ parser::parse_functiondecl (std::vector& functions) else if (t->type == tok_keyword && t->content == "long") vd->type = pe_long; else throw parse_error ("expected 'string' or 'long'"); - + t = next (); } if (t->type == tok_operator && t->content == ")") @@ -1420,11 +1420,11 @@ parser::parse_probe_point () // fall through } - if (t && t->type == tok_operator + if (t && t->type == tok_operator && (t->content == "{" || t->content == "," || t->content == "=" || t->content == "+=" )) break; - + throw parse_error ("expected one of '. , ( ? ! { = +='"); } @@ -1463,7 +1463,7 @@ parser::parse_literal () || (neg && (unsigned long long) value > 9223372036854775808ULL) || (unsigned long long) value > 18446744073709551615ULL || value < -9223372036854775807LL-1) - throw parse_error ("number invalid or out of range"); + throw parse_error ("number invalid or out of range"); if (neg) value = -value; @@ -1633,7 +1633,7 @@ parser::parse_for_loop () if (! (t->type == tok_operator && t->content == ";")) throw parse_error ("expected ';'"); } - + // increment + ")" t = peek (); if (t && t->type == tok_operator && t->content == ")") @@ -1679,7 +1679,7 @@ parser::parse_while_loop () t = next (); if (! (t->type == tok_operator && t->content == ")")) throw parse_error ("expected ')'"); - + // block s->block = parse_statement (); @@ -1746,7 +1746,7 @@ parser::parse_foreach_loop () next (); break; } - else + else throw parse_error ("expected ',' or ']'"); } else @@ -1756,7 +1756,7 @@ parser::parse_foreach_loop () t = next (); if (! (t->type == tok_keyword && t->content == "in")) throw parse_error ("expected 'in'"); - + s->base = parse_indexable(); t = peek (); @@ -1800,7 +1800,7 @@ parser::parse_assignment () const token* t = peek (); // right-associative operators - if (t && t->type == tok_operator + if (t && t->type == tok_operator && (t->content == "=" || t->content == "<<<" || t->content == "+=" || @@ -1814,7 +1814,7 @@ parser::parse_assignment () t->content == "^=" || t->content == "|=" || t->content == ".=" || - false)) + false)) { // NB: lvalueness is checked during elaboration / translation assignment* e = new assignment; @@ -1860,7 +1860,7 @@ expression* parser::parse_logical_or () { expression* op1 = parse_logical_and (); - + const token* t = peek (); while (t && t->type == tok_operator && t->content == "||") { @@ -1999,7 +1999,7 @@ parser::parse_array_in () next (); break; } - else + else throw parse_error ("expected ',' or ']'"); } else @@ -2033,7 +2033,7 @@ parser::parse_comparison () expression* op1 = parse_shift (); const token* t = peek (); - while (t && t->type == tok_operator + while (t && t->type == tok_operator && (t->content == ">" || t->content == "<" || t->content == "==" || @@ -2061,7 +2061,7 @@ parser::parse_shift () expression* op1 = parse_concatenation (); const token* t = peek (); - while (t && t->type == tok_operator && + while (t && t->type == tok_operator && (t->content == "<<" || t->content == ">>")) { binary_expression* e = new binary_expression; @@ -2108,7 +2108,7 @@ parser::parse_additive () expression* op1 = parse_multiplicative (); const token* t = peek (); - while (t && t->type == tok_operator + while (t && t->type == tok_operator && (t->content == "+" || t->content == "-")) { binary_expression* e = new binary_expression; @@ -2131,7 +2131,7 @@ parser::parse_multiplicative () expression* op1 = parse_unary (); const token* t = peek (); - while (t && t->type == tok_operator + while (t && t->type == tok_operator && (t->content == "*" || t->content == "/" || t->content == "%")) { binary_expression* e = new binary_expression; @@ -2152,9 +2152,9 @@ expression* parser::parse_unary () { const token* t = peek (); - if (t && t->type == tok_operator - && (t->content == "+" || - t->content == "-" || + if (t && t->type == tok_operator + && (t->content == "+" || + t->content == "-" || t->content == "!" || t->content == "~" || false)) @@ -2181,7 +2181,7 @@ parser::parse_crement () // as in "increment" / "decrement" // cases like "4++". const token* t = peek (); - if (t && t->type == tok_operator + if (t && t->type == tok_operator && (t->content == "++" || t->content == "--")) { pre_crement* e = new pre_crement; @@ -2194,9 +2194,9 @@ parser::parse_crement () // as in "increment" / "decrement" // post-crement or non-crement expression *op1 = parse_value (); - + t = peek (); - if (t && t->type == tok_operator + if (t && t->type == tok_operator && (t->content == "++" || t->content == "--")) { post_crement* e = new post_crement; @@ -2285,7 +2285,7 @@ parser::parse_indexable () // var, indexable[index], func(parms), printf("...", ...), $var, $var->member, @stat_op(stat) expression* -parser::parse_symbol () +parser::parse_symbol () { hist_op *hop = NULL; symbol *sym = NULL; @@ -2294,7 +2294,7 @@ parser::parse_symbol () if (!hop) { - // If we didn't get a hist_op, then we did get an identifier. We can + // If we didn't get a hist_op, then we did get an identifier. We can // now scrutinize this identifier for the various magic forms of identifier // (printf, @stat_op, and $var...) @@ -2321,7 +2321,7 @@ parser::parse_symbol () expect_op(")"); return sop; } - + else if (print_format::parse_print(name, pf_stream, pf_format, pf_delim, pf_newline, pf_char)) { @@ -2342,16 +2342,16 @@ parser::parse_symbol () // construct. This is sort of gross but it avoids // promoting histogram references to typeful // expressions. - + hop = NULL; t = parse_hist_op_or_bare_name(hop, name); assert(hop); - + // It is, sadly, possible that even while parsing a // hist_op, we *mis-guessed* and the user wishes to // print(@hist_op(foo)[bucket]), a scalar. In that case // we must parse the arrayindex and print an expression. - + if (!peek_op ("[")) fmt->hist = hop; else @@ -2410,7 +2410,7 @@ parser::parse_symbol () expect_op(")"); return fmt; } - + else if (name.size() > 0 && name[0] == '$') { // target_symbol time @@ -2421,20 +2421,20 @@ parser::parse_symbol () { string c; if (peek_op ("->")) - { - next(); + { + next(); expect_ident_or_keyword (c); tsym->components.push_back (make_pair (target_symbol::comp_struct_member, c)); } else if (peek_op ("[")) - { + { next(); expect_unknown (tok_number, c); expect_op ("]"); tsym->components.push_back (make_pair (target_symbol::comp_literal_array_index, c)); - } + } else break; } @@ -2479,8 +2479,8 @@ parser::parse_symbol () sym->tok = t; } } - - // By now, either we had a hist_op in the first place, or else + + // By now, either we had a hist_op in the first place, or else // we had a plain word and it was converted to a symbol. assert (!hop != !sym); // logical XOR @@ -2502,9 +2502,9 @@ parser::parse_symbol () { ai->indexes.push_back (parse_expression ()); if (peek_op ("]")) - { - next(); - break; + { + next(); + break; } else if (peek_op (",")) { @@ -2523,7 +2523,7 @@ parser::parse_symbol () if (hop) throw parse_error("base histogram operator where expression expected", t); - - return sym; + + return sym; } diff --git a/parse.h b/parse.h index ae1ac67f..25c42931 100644 --- a/parse.h +++ b/parse.h @@ -33,7 +33,7 @@ enum parse_context }; -enum token_type +enum token_type { tok_junk, tok_identifier, tok_operator, tok_string, tok_number, tok_embedded, tok_keyword @@ -55,11 +55,11 @@ struct parse_error: public std::runtime_error { const token* tok; bool skip_some; - parse_error (const std::string& msg): + parse_error (const std::string& msg): runtime_error (msg), tok (0), skip_some (true) {} - parse_error (const std::string& msg, const token* t): + parse_error (const std::string& msg, const token* t): runtime_error (msg), tok (t), skip_some (true) {} - parse_error (const std::string& msg, bool skip): + parse_error (const std::string& msg, bool skip): runtime_error (msg), tok (0), skip_some (skip) {} }; @@ -141,7 +141,7 @@ private: const token* last_t; // the last value returned by peek() or next() const token* next_t; // lookahead token - + // expectations const token* expect_known (token_type tt, std::string const & expected); const token* expect_unknown (token_type tt, std::string & target); diff --git a/session.h b/session.h index 9f38372f..e8100cf5 100644 --- a/session.h +++ b/session.h @@ -52,16 +52,16 @@ struct module_cache; struct statistic_decl { statistic_decl() - : type(none), + : type(none), linear_low(0), linear_high(0), linear_step(0) - {} + {} enum { none, linear, logarithmic } type; int64_t linear_low; int64_t linear_high; int64_t linear_step; bool operator==(statistic_decl const & other) { - return type == other.type + return type == other.type && linear_low == other.linear_low && linear_high == other.linear_high && linear_step == other.linear_step; diff --git a/staptree.cxx b/staptree.cxx index 347d799f..73d6fe93 100644 --- a/staptree.cxx +++ b/staptree.cxx @@ -27,7 +27,7 @@ using namespace std; expression::expression (): type (pe_unknown), tok (0) { -} +} expression::~expression () @@ -38,7 +38,7 @@ expression::~expression () statement::statement (): tok (0) { -} +} statement::~statement () @@ -68,7 +68,7 @@ symboldecl::symboldecl (): tok (0), type (pe_unknown) { -} +} symboldecl::~symboldecl () @@ -110,8 +110,8 @@ probe_point::component::component (): } -probe_point::component::component (std::string const & f, literal * a): - functor(f), arg(a) +probe_point::component::component (std::string const & f, literal * a): + functor(f), arg(a) { } @@ -140,7 +140,7 @@ vardecl::set_arity (int a) } } -bool +bool vardecl::compatible_arity (int a) { if (a == 0 && maxsize > 0) @@ -216,15 +216,15 @@ void literal_number::print (ostream& o) const void binary_expression::print (ostream& o) const { - o << "(" << *left << ") " - << op + o << "(" << *left << ") " + << op << " (" << *right << ")"; } void unary_expression::print (ostream& o) const { - o << op << '(' << *operand << ")"; + o << op << '(' << *operand << ")"; } void array_in::print (ostream& o) const @@ -241,7 +241,7 @@ void array_in::print (ostream& o) const void post_crement::print (ostream& o) const { - o << '(' << *operand << ")" << op; + o << '(' << *operand << ")" << op; } @@ -249,7 +249,7 @@ void ternary_expression::print (ostream& o) const { o << "(" << *cond << ")?(" << *truevalue << "):(" - << *falsevalue << ")"; + << *falsevalue << ")"; } @@ -346,7 +346,7 @@ void functioncall::print (ostream& o) const for (unsigned i=0; i0 ? ", " : "") << *args[i]; o << ")"; -} +} bool @@ -398,7 +398,7 @@ print_format::parse_print(const std::string &name, } -string +string print_format::components_to_string(vector const & components) { ostringstream oss; @@ -452,7 +452,7 @@ print_format::components_to_string(vector const & components) else if (i->prectype != prec_unspecified && i->precision > 0) oss << '.' << i->precision; - switch (i->type) + switch (i->type) { case conv_binary: oss << "b"; @@ -485,11 +485,11 @@ print_format::components_to_string(vector const & components) case conv_string: oss << 's'; break; - + case conv_memory: oss << 'm'; break; - + case conv_size: oss << 'n'; break; @@ -501,8 +501,8 @@ print_format::components_to_string(vector const & components) } return oss.str (); } - -vector + +vector print_format::string_to_components(string const & str) { format_component curr; @@ -511,7 +511,7 @@ print_format::string_to_components(string const & str) curr.clear(); string::const_iterator i = str.begin(); - + while (i != str.end()) { if (*i != '%') @@ -532,7 +532,7 @@ print_format::string_to_components(string const & str) i += 2; continue; } - else + else { assert(*i == '%'); if (curr.type != conv_unspecified) @@ -544,11 +544,11 @@ print_format::string_to_components(string const & str) } } ++i; - + if (i == str.end()) break; - // Now we are definitely parsing a conversion. + // Now we are definitely parsing a conversion. // Begin by parsing flags (which are optional). switch (*i) @@ -557,22 +557,22 @@ print_format::string_to_components(string const & str) curr.flags |= static_cast(fmt_flag_zeropad); ++i; break; - + case '+': curr.flags |= static_cast(fmt_flag_plus); ++i; break; - + case '-': curr.flags |= static_cast(fmt_flag_left); ++i; break; - + case ' ': curr.flags |= static_cast(fmt_flag_space); ++i; break; - + case '#': curr.flags |= static_cast(fmt_flag_special); ++i; @@ -642,28 +642,28 @@ print_format::string_to_components(string const & str) case 'b': curr.type = conv_binary; break; - + case 's': curr.type = conv_string; break; - + case 'm': curr.type = conv_memory; break; - + case 'd': case 'i': curr.type = conv_signed_decimal; break; - + case 'o': curr.type = conv_unsigned_octal; break; - + case 'u': curr.type = conv_unsigned_decimal; break; - + case 'p': curr.type = conv_unsigned_ptr; break; @@ -671,7 +671,7 @@ print_format::string_to_components(string const & str) case 'X': curr.type = conv_unsigned_uppercase_hex; break; - + case 'x': curr.type = conv_unsigned_lowercase_hex; break; @@ -679,24 +679,24 @@ print_format::string_to_components(string const & str) case 'n': curr.type = conv_size; break; - + default: break; } - + if (curr.type == conv_unspecified) throw parse_error("invalid or missing conversion specifier"); - + ++i; res.push_back(curr); - curr.clear(); + curr.clear(); } // If there's a remaining partly-composed conversion, fail. if (!curr.is_empty()) { if (curr.type == conv_literal) - res.push_back(curr); + res.push_back(curr); else throw parse_error("trailing incomplete print format conversion"); } @@ -744,7 +744,7 @@ void stat_op::print (ostream& o) const case sc_min: o << "min("; break; - + case sc_max: o << "max("; break; @@ -753,7 +753,7 @@ void stat_op::print (ostream& o) const o << ")"; } -void +void hist_op::print (ostream& o) const { o << '@'; @@ -849,7 +849,7 @@ void foreach_loop::print (ostream& o) const void null_statement::print (ostream& o) const { - o << ";"; + o << ";"; } @@ -944,7 +944,7 @@ void probe::printsig (ostream& o) const alias->printsig (o); return; } - + for (unsigned i=0; i 0) o << ","; @@ -1205,7 +1205,7 @@ symbol::visit (visitor* u) u->visit_symbol (this); } -void +void target_symbol::visit (visitor* u) { u->visit_target_symbol(this); @@ -1241,7 +1241,7 @@ hist_op::visit (visitor *u) u->visit_hist_op (this); } -void +void indexable::print_indexable (std::ostream& o) const { const symbol *sym; @@ -1253,10 +1253,10 @@ indexable::print_indexable (std::ostream& o) const { assert (hist); hist->print (o); - } + } } -void +void indexable::visit_indexable (visitor* u) { symbol *sym; @@ -1272,42 +1272,42 @@ indexable::visit_indexable (visitor* u) } -bool +bool indexable::is_symbol(symbol *& sym_out) { sym_out = NULL; return false; } -bool +bool indexable::is_hist_op(hist_op *& hist_out) { hist_out = NULL; return false; } -bool +bool indexable::is_const_symbol(const symbol *& sym_out) const { sym_out = NULL; return false; } -bool +bool indexable::is_const_hist_op(const hist_op *& hist_out) const { hist_out = NULL; return false; } -bool +bool symbol::is_symbol(symbol *& sym_out) { sym_out = this; return true; } -bool +bool symbol::is_const_symbol(const symbol *& sym_out) const { sym_out = this; @@ -1320,14 +1320,14 @@ symbol::get_tok() const return tok; } -bool +bool hist_op::is_hist_op(hist_op *& hist_out) { hist_out = this; return true; } -bool +bool hist_op::is_const_hist_op(const hist_op *& hist_out) const { hist_out = this; @@ -1343,7 +1343,7 @@ hist_op::get_tok() const void classify_indexable(indexable* ix, symbol *& array_out, - hist_op *& hist_out) + hist_op *& hist_out) { array_out = NULL; hist_out = NULL; @@ -1356,7 +1356,7 @@ classify_indexable(indexable* ix, void classify_const_indexable(const indexable* ix, const symbol *& array_out, - const hist_op *& hist_out) + const hist_op *& hist_out) { array_out = NULL; hist_out = NULL; @@ -1366,7 +1366,7 @@ classify_const_indexable(const indexable* ix, // ------------------------------------------------------------------------ -bool +bool visitor::is_active_lvalue(expression *e) { for (unsigned i = 0; i < active_lvalues.size(); ++i) @@ -1377,13 +1377,13 @@ visitor::is_active_lvalue(expression *e) return false; } -void +void visitor::push_active_lvalue(expression *e) { active_lvalues.push_back(e); } -void +void visitor::pop_active_lvalue() { assert(!active_lvalues.empty()); @@ -1438,7 +1438,7 @@ traversing_visitor::visit_for_loop (for_loop* s) void traversing_visitor::visit_foreach_loop (foreach_loop* s) { - symbol *array = NULL; + symbol *array = NULL; hist_op *hist = NULL; classify_indexable (s->base, array, hist); if (array) @@ -1622,7 +1622,7 @@ traversing_visitor::visit_hist_op (hist_op* e) void -functioncall_traversing_visitor::visit_functioncall (functioncall* e) +functioncall_traversing_visitor::visit_functioncall (functioncall* e) { traversing_visitor::visit_functioncall (e); @@ -1651,7 +1651,7 @@ varuse_collecting_visitor::visit_embeddedcode (embeddedcode *s) // Kludge(tm): we look for a magic string within the function body. // $target variables as rvalues will have this; lvalues won't. // Also, explicit side-effect-free tapset functions will have this. - + assert (current_function); // only they get embedded code if (s->code.find ("/* pure */") != string::npos) return; @@ -1677,7 +1677,7 @@ varuse_collecting_visitor::visit_print_format (print_format* e) // NB: Instead of being top-level statements, "print" and "printf" // are implemented as statement-expressions containing a // print_format. They have side-effects, but not via the - // embedded-code detection method above. + // embedded-code detection method above. // // But sprint and sprintf don't have side-effects. @@ -1801,7 +1801,7 @@ varuse_collecting_visitor::visit_foreach_loop (foreach_loop* s) // NB: we duplicate so don't bother call // functioncall_traversing_visitor::visit_foreach_loop (s); - symbol *array = NULL; + symbol *array = NULL; hist_op *hist = NULL; classify_indexable (s->base, array, hist); if (array) @@ -1813,7 +1813,7 @@ varuse_collecting_visitor::visit_foreach_loop (foreach_loop* s) // array in addition to the "read" one already noted above. if (s->sort_direction) { - symbol *array = NULL; + symbol *array = NULL; hist_op *hist = NULL; classify_indexable (s->base, array, hist); if (array) this->written.insert (array->referent); @@ -2148,7 +2148,7 @@ deep_copy_visitor::visit_for_loop (for_loop* s) require (this, &(n->init), s->init); require (this, &(n->cond), s->cond); require (this, &(n->incr), s->incr); - require (this, &(n->block), s->block); + require (this, &(n->block), s->block); provide (this, n); } @@ -2447,7 +2447,7 @@ deep_copy_visitor::visit_hist_op (hist_op* e) provide (this, n); } -block* +block* deep_copy_visitor::deep_copy (block* b) { block* n; @@ -2456,7 +2456,7 @@ deep_copy_visitor::deep_copy (block* b) return n; } -statement* +statement* deep_copy_visitor::deep_copy (statement* s) { statement* n; diff --git a/staptree.h b/staptree.h index 9adbc822..770a731e 100644 --- a/staptree.h +++ b/staptree.h @@ -346,7 +346,7 @@ struct print_format: public expression static std::string components_to_string(std::vector const & components); static std::vector string_to_components(std::string const & str); - static bool parse_print(const std::string &name, bool &stream, + static bool parse_print(const std::string &name, bool &stream, bool &format, bool &delim, bool &newline, bool &_char); void print (std::ostream& o) const; diff --git a/translate.cxx b/translate.cxx index c4370cc8..57dfe4c3 100644 --- a/translate.cxx +++ b/translate.cxx @@ -153,12 +153,12 @@ struct c_unparser: public unparser, public visitor // for function or probe bodies. Member functions should exactly match // the corresponding c_unparser logic and traversal sequence, // to ensure interlocking naming and declaration of temp variables. -struct c_tmpcounter: +struct c_tmpcounter: public traversing_visitor { c_unparser* parent; - c_tmpcounter (c_unparser* p): - parent (p) + c_tmpcounter (c_unparser* p): + parent (p) { parent->tmpvar_counter = 0; } @@ -187,7 +187,7 @@ struct c_tmpcounter: void visit_stat_op (stat_op* e); }; -struct c_unparser_assignment: +struct c_unparser_assignment: public throwing_visitor { c_unparser* parent; @@ -201,12 +201,12 @@ struct c_unparser_assignment: throwing_visitor ("invalid lvalue type"), parent (p), op (o), rvalue (0), post (pp) {} - void prepare_rvalue (string const & op, + void prepare_rvalue (string const & op, tmpvar & rval, token const* tok); - void c_assignop(tmpvar & res, - var const & lvar, + void c_assignop(tmpvar & res, + var const & lvar, tmpvar const & tmp, token const* tok); @@ -216,7 +216,7 @@ struct c_unparser_assignment: }; -struct c_tmpcounter_assignment: +struct c_tmpcounter_assignment: public traversing_visitor // leave throwing for illegal lvalues to the c_unparser_assignment instance { @@ -242,13 +242,13 @@ ostream & operator<<(ostream & o, var const & v); /* Some clarification on the runtime structures involved in statistics: - + The basic type for collecting statistics in the runtime is struct stat_data. This contains the count, min, max, sum, and possibly histogram fields. - + There are two places struct stat_data shows up. - + 1. If you declare a statistic variable of any sort, you want to make a struct _Stat. A struct _Stat* is also called a Stat. Struct _Stat contains a per-CPU array of struct stat_data values, as well as a @@ -269,7 +269,7 @@ ostream & operator<<(ostream & o, var const & v); Because, at the moment, the runtime does not support the concept of a statistic which collects multiple histogram types, we may need to instantiate one pmap or struct _Stat for each histogram variation - the user wants to track. + the user wants to track. */ class var @@ -369,36 +369,36 @@ public: case pe_stats: { // See also mapvar::init(). - + string prefix = value() + " = _stp_stat_init ("; // Check for errors during allocation. string suffix = "if (" + value () + " == NULL) rc = -ENOMEM;"; - + switch (sd.type) { case statistic_decl::none: prefix += "HIST_NONE"; break; - + case statistic_decl::linear: prefix += string("HIST_LINEAR") - + ", " + stringify(sd.linear_low) - + ", " + stringify(sd.linear_high) + + ", " + stringify(sd.linear_low) + + ", " + stringify(sd.linear_high) + ", " + stringify(sd.linear_step); break; - + case statistic_decl::logarithmic: prefix += string("HIST_LOG"); break; - + default: throw semantic_error("unsupported stats type for " + value()); } - + prefix = prefix + "); "; return string (prefix + suffix); } - + default: throw semantic_error("unsupported initializer for " + value()); } @@ -432,7 +432,7 @@ ostream & operator<<(ostream & o, var const & v) struct stmt_expr { c_unparser & c; - stmt_expr(c_unparser & c) : c(c) + stmt_expr(c_unparser & c) : c(c) { c.o->newline() << "({"; c.o->indent(1); @@ -452,8 +452,8 @@ protected: string override_value; public: - tmpvar(exp_type ty, - unsigned & counter) + tmpvar(exp_type ty, + unsigned & counter) : var(true, ty, ("__tmp" + stringify(counter++))), overridden(false) {} @@ -473,7 +473,7 @@ public: return override_value; else return var::value(); - } + } }; ostream & operator<<(ostream & o, tmpvar const & v) @@ -484,7 +484,7 @@ ostream & operator<<(ostream & o, tmpvar const & v) struct aggvar : public var { - aggvar(unsigned & counter) + aggvar(unsigned & counter) : var(true, pe_stats, ("__tmp" + stringify(counter++))) {} @@ -506,16 +506,16 @@ struct mapvar { vector index_types; int maxsize; - mapvar (bool local, exp_type ty, + mapvar (bool local, exp_type ty, statistic_decl const & sd, - string const & name, + string const & name, vector const & index_types, int maxsize) : var (local, ty, sd, name), index_types (index_types), maxsize (maxsize) {} - + static string shortname(exp_type e); static string key_typename(exp_type e); static string value_typename(exp_type e); @@ -571,7 +571,7 @@ struct mapvar { if (!is_parallel()) throw semantic_error("aggregating non-parallel map type"); - + return "_stp_pmap_agg (" + value() + ")"; } @@ -579,7 +579,7 @@ struct mapvar { if (!is_parallel()) throw semantic_error("fetching aggregate of non-parallel map type"); - + return "_stp_pmap_get_agg(" + value() + ")"; } @@ -636,7 +636,7 @@ struct mapvar // impedance matching: empty strings -> NULL if (type() == pe_string) - res += (call_prefix("set", indices) + res += (call_prefix("set", indices) + ", (" + val.value() + "[0] ? " + val.value() + " : NULL))"); else if (type() == pe_long) res += (call_prefix("set", indices) + ", " + val.value() + ")"); @@ -664,11 +664,11 @@ struct mapvar assert (sd.type != statistic_decl::none); return "(" + fetch_existing_aggregate() + "->hist.buckets)"; } - + string init () const { string mtype = is_parallel() ? "pmap" : "map"; - string prefix = value() + " = _stp_" + mtype + "_new_" + keysym() + " (" + + string prefix = value() + " = _stp_" + mtype + "_new_" + keysym() + " (" + (maxsize > 0 ? stringify(maxsize) : "MAXMAPENTRIES") ; // See also var::init(). @@ -686,9 +686,9 @@ struct mapvar case statistic_decl::linear: // FIXME: check for "reasonable" values in linear stats - prefix = prefix + ", HIST_LINEAR" - + ", " + stringify(sdecl().linear_low) - + ", " + stringify(sdecl().linear_high) + prefix = prefix + ", HIST_LINEAR" + + ", " + stringify(sdecl().linear_low) + + ", " + stringify(sdecl().linear_high) + ", " + stringify(sdecl().linear_step); break; @@ -725,25 +725,25 @@ class itervar public: itervar (symbol* e, unsigned & counter) - : referent_ty(e->referent->type), + : referent_ty(e->referent->type), name("__tmp" + stringify(counter++)) { if (referent_ty == pe_unknown) throw semantic_error("iterating over unknown reference type", e->tok); } - + string declare () const { return "struct map_node *" + name + ";"; } - + string start (mapvar const & mv) const { string res; if (mv.type() != referent_ty) throw semantic_error("inconsistent iterator type in itervar::start()"); - + if (mv.is_parallel()) return "_stp_map_start (" + mv.fetch_existing_aggregate() + ")"; else @@ -765,7 +765,7 @@ public: { return "l->" + name; } - + string get_key (exp_type ty, unsigned i) const { // bug translator/1175: runtime uses base index 1 for the first dimension @@ -802,8 +802,8 @@ translator_output::translator_output (ostream& f): translator_output::translator_output (const string& filename, size_t bufsize): buf (new char[bufsize]), - o2 (new ofstream (filename.c_str ())), - o (*o2), + o2 (new ofstream (filename.c_str ())), + o (*o2), tablevel (0) { o2->rdbuf()->pubsetbuf(buf, bufsize); @@ -919,15 +919,15 @@ c_unparser::emit_common_header () tmp_probe_contents[oss.str()] = dp->name; // save it // XXX: probe locals need not be recursion-nested, only function locals - + o->newline() << "struct " << dp->name << "_locals {"; o->indent(1); for (unsigned j=0; jlocals.size(); j++) { vardecl* v = dp->locals[j]; - try + try { - o->newline() << c_typename (v->type) << " " + o->newline() << c_typename (v->type) << " " << c_varname (v->name) << ";"; } catch (const semantic_error& e) { semantic_error e2 (e); @@ -937,7 +937,7 @@ c_unparser::emit_common_header () } // NB: This part is finicky. The logic here must - // match up with + // match up with c_tmpcounter ct (this); dp->emit_probe_context_vars (o); dp->body->visit (& ct); @@ -955,9 +955,9 @@ c_unparser::emit_common_header () for (unsigned j=0; jlocals.size(); j++) { vardecl* v = fd->locals[j]; - try + try { - o->newline() << c_typename (v->type) << " " + o->newline() << c_typename (v->type) << " " << c_varname (v->name) << ";"; } catch (const semantic_error& e) { semantic_error e2 (e); @@ -968,9 +968,9 @@ c_unparser::emit_common_header () for (unsigned j=0; jformal_args.size(); j++) { vardecl* v = fd->formal_args[j]; - try + try { - o->newline() << c_typename (v->type) << " " + o->newline() << c_typename (v->type) << " " << c_varname (v->name) << ";"; } catch (const semantic_error& e) { semantic_error e2 (e); @@ -1077,7 +1077,7 @@ c_unparser::emit_module_init () vector g = all_session_groups (*session); for (unsigned i=0; iemit_module_decls (*session); - + o->newline(); o->newline() << "int systemtap_module_init (void) {"; o->newline(1) << "int rc = 0;"; @@ -1091,7 +1091,7 @@ c_unparser::emit_module_init () o->newline() << "{"; o->newline(1) << "const char* release = UTS_RELEASE;"; - // NB: This UTS_RELEASE compile-time macro directly checks only that + // NB: This UTS_RELEASE compile-time macro directly checks only that // the compile-time kbuild tree matches the compile-time debuginfo/etc. // It does not check the run time kernel value. However, this is // probably OK since the kbuild modversions system aims to prevent @@ -1131,10 +1131,10 @@ c_unparser::emit_module_init () o->newline() << "rc = -ENOMEM;"; o->newline() << "goto out;"; o->newline(-1) << "}"; - + for (unsigned i=0; iglobals.size(); i++) { - vardecl* v = session->globals[i]; + vardecl* v = session->globals[i]; if (v->index_types.size() > 0) o->newline() << getmap (v).init(); else @@ -1150,7 +1150,7 @@ c_unparser::emit_module_init () o->newline() << "rwlock_init (& global.s_" << c_varname (v->name) << "_lock);"; } - // initialize each Stat used for timing information + // initialize each Stat used for timing information o->newline() << "#ifdef STP_TIMING"; set basest_names; for (unsigned i=0; iprobes.size(); i++) @@ -1170,7 +1170,7 @@ c_unparser::emit_module_init () // intended to help debug problems with systemtap modules. o->newline() << "_stp_print_kernel_info(" - << "\"" << VERSION + << "\"" << VERSION << "/" << dwfl_version (NULL) << "\"" << ", (num_online_cpus() * sizeof(struct context))" << ", " << session->probes.size() @@ -1197,7 +1197,7 @@ c_unparser::emit_module_init () // All registrations were successful. Consider the system started. o->newline() << "if (atomic_read (&session_state) == STAP_SESSION_STARTING)"; - // NB: only other valid state value is ERROR, in which case we don't + // NB: only other valid state value is ERROR, in which case we don't o->newline(1) << "atomic_set (&session_state, STAP_SESSION_RUNNING);"; o->newline(-1) << "return 0;"; @@ -1210,7 +1210,7 @@ c_unparser::emit_module_init () // as this is our only chance. for (unsigned i=0; iglobals.size(); i++) { - vardecl* v = session->globals[i]; + vardecl* v = session->globals[i]; if (v->index_types.size() > 0) o->newline() << getmap (v).fini(); else @@ -1238,9 +1238,9 @@ c_unparser::emit_module_exit () o->newline() << "if (atomic_read (&session_state) == STAP_SESSION_STARTING)"; o->newline(1) << "return;"; o->indent(-1); - + o->newline() << "if (atomic_read (&session_state) == STAP_SESSION_RUNNING)"; - // NB: only other valid state value is ERROR, in which case we don't + // NB: only other valid state value is ERROR, in which case we don't o->newline(1) << "atomic_set (&session_state, STAP_SESSION_STOPPING);"; o->indent(-1); // This signals any other probes that may be invoked in the next little @@ -1254,7 +1254,7 @@ c_unparser::emit_module_exit () o->newline(1) << "int i;"; o->newline() << "holdon = 0;"; o->newline() << "for (i=0; i < NR_CPUS; i++)"; - o->newline(1) << "if (cpu_possible (i) && " + o->newline(1) << "if (cpu_possible (i) && " << "atomic_read (& ((struct context *)per_cpu_ptr(contexts, i))->busy)) " << "holdon = 1;"; o->newline () << "schedule ();"; @@ -1273,7 +1273,7 @@ c_unparser::emit_module_exit () for (unsigned i=0; iglobals.size(); i++) { - vardecl* v = session->globals[i]; + vardecl* v = session->globals[i]; if (v->index_types.size() > 0) o->newline() << getmap (v).fini(); else @@ -1297,7 +1297,7 @@ c_unparser::emit_module_exit () basest_names.insert (nm); // NB: check for null stat object o->newline() << "if (likely (time_" << p->name << ")) {"; - o->newline(1) << "const char *probe_point = " + o->newline(1) << "const char *probe_point = " << lex_cast_qstring (* p->locations[0]) << (p->locations.size() > 1 ? "\"+\"" : "") << (p->locations.size() > 1 ? lex_cast_qstring(p->locations.size()-1) : "") @@ -1357,7 +1357,7 @@ c_unparser::emit_function (functiondecl* v) o->newline() << "#define THIS l"; o->newline() << "if (0) goto out;"; // make sure out: is marked used - // set this, in case embedded-c code sets last_error but doesn't otherwise identify itself + // set this, in case embedded-c code sets last_error but doesn't otherwise identify itself o->newline() << "c->last_stmt = " << lex_cast_qstring(*v->tok) << ";"; // check/increment nesting level @@ -1373,7 +1373,7 @@ c_unparser::emit_function (functiondecl* v) for (unsigned i=0; ilocals.size(); i++) { if (v->locals[i]->index_types.size() > 0) // array? - throw semantic_error ("array locals not supported, missing global declaration?", + throw semantic_error ("array locals not supported, missing global declaration?", v->locals[i]->tok); o->newline() << getvar (v->locals[i]).init(); @@ -1448,7 +1448,7 @@ c_unparser::emit_probe (derived_probe* v) // NB: This code *could* be enclosed in an "if (session->timing)". That would // recognize more duplicate probe handlers, but then the generated code could // be very different with or without -t. - oss << "c->statp = & time_" << v->basest()->name << ";" << endl; + oss << "c->statp = & time_" << v->basest()->name << ";" << endl; v->body->print(oss); @@ -1510,7 +1510,7 @@ c_unparser::emit_probe (derived_probe* v) o->newline() << "struct " << v->name << "_locals * __restrict__ l ="; o->newline(1) << "& c->locals[0]." << v->name << ";"; o->newline(-1) << "(void) l;"; // make sure "l" is marked used - + o->newline() << "#ifdef STP_TIMING"; o->newline() << "c->statp = & time_" << v->basest()->name << ";"; o->newline() << "#endif"; @@ -1530,7 +1530,7 @@ c_unparser::emit_probe (derived_probe* v) for (unsigned j=0; jlocals.size(); j++) { if (v->locals[j]->index_types.size() > 0) // array? - throw semantic_error ("array locals not supported, missing global declaration?", + throw semantic_error ("array locals not supported, missing global declaration?", v->locals[j]->tok); else if (v->locals[j]->type == pe_long) o->newline() << "l->" << c_varname (v->locals[j]->name) @@ -1557,7 +1557,7 @@ c_unparser::emit_probe (derived_probe* v) o->newline(-1) << "out:"; // NB: no need to uninitialize locals, except if arrays/stats can - // someday be local + // someday be local // XXX: do this flush only if the body included a // print/printf/etc. routine! @@ -1569,12 +1569,12 @@ c_unparser::emit_probe (derived_probe* v) o->newline(-1) << "}\n"; } - + this->current_probe = 0; } -void +void c_unparser::emit_locks(const varuse_collecting_visitor& vut) { o->newline() << "{"; @@ -1613,7 +1613,7 @@ c_unparser::emit_locks(const varuse_collecting_visitor& vut) continue; } - string lockcall = + string lockcall = string (write_p ? "write" : "read") + "_trylock (& global.s_" + v->name + "_lock)"; @@ -1637,7 +1637,7 @@ c_unparser::emit_locks(const varuse_collecting_visitor& vut) } -void +void c_unparser::emit_unlocks(const varuse_collecting_visitor& vut) { unsigned numvars = 0; @@ -1682,7 +1682,7 @@ c_unparser::emit_unlocks(const varuse_collecting_visitor& vut) // fall through to next variable; thus the reverse ordering } - + // emit plain "unlock" label, used if the very first lock failed. o->newline(-1) << "unlock_: ;"; o->indent(1); @@ -1704,7 +1704,7 @@ c_unparser::emit_unlocks(const varuse_collecting_visitor& vut) } -void +void c_unparser::collect_map_index_types(vector const & vars, set< pair, exp_type> > & types) { @@ -1746,7 +1746,7 @@ mapvar::key_typename(exp_type e) return "STRING"; default: throw semantic_error("array key is neither string nor long"); - } + } return ""; } @@ -1761,7 +1761,7 @@ mapvar::shortname(exp_type e) return "s"; default: throw semantic_error("array type is neither string nor long"); - } + } return ""; } @@ -1770,7 +1770,7 @@ void c_unparser::emit_map_type_instantiations () { set< pair, exp_type> > types; - + collect_map_index_types(session->globals, types); for (unsigned i = 0; i < session->probes.size(); ++i) @@ -1799,7 +1799,7 @@ c_unparser::emit_map_type_instantiations () for (unsigned j = 0; j < i->first.size(); ++j) { o->newline() << "#undef KEY" << (j+1) << "_TYPE"; - } + } /* FIXME * For pmaps, we also need to include map-gen.c, because we might be accessing @@ -1819,7 +1819,7 @@ c_unparser::emit_map_type_instantiations () for (unsigned j = 0; j < i->first.size(); ++j) { o->newline() << "#undef KEY" << (j+1) << "_TYPE"; - } + } } } @@ -1835,9 +1835,9 @@ c_unparser::c_typename (exp_type e) switch (e) { case pe_long: return string("int64_t"); - case pe_string: return string("string_t"); + case pe_string: return string("string_t"); case pe_stats: return string("Stat"); - case pe_unknown: + case pe_unknown: default: throw semantic_error ("cannot expand unknown type"); } @@ -1892,9 +1892,9 @@ c_unparser::c_expression (expression *e) } -void +void c_unparser::c_assign (var& lvalue, const string& rvalue, const token *tok) -{ +{ switch (lvalue.type()) { case pe_string: @@ -1950,9 +1950,9 @@ c_unparser::c_assign (const string& lvalue, const string& rvalue, } -void -c_unparser_assignment::c_assignop(tmpvar & res, - var const & lval, +void +c_unparser_assignment::c_assignop(tmpvar & res, + var const & lval, tmpvar const & rval, token const * tok) { @@ -1965,7 +1965,7 @@ c_unparser_assignment::c_assignop(tmpvar & res, // lval: the lvalue of the expression, which may be damaged // rval: the rvalue of the expression, which is a temporary or constant - // we'd like to work with a local tmpvar so we can overwrite it in + // we'd like to work with a local tmpvar so we can overwrite it in // some optimized cases translator_output* o = parent->o; @@ -1973,7 +1973,7 @@ c_unparser_assignment::c_assignop(tmpvar & res, if (res.type() == pe_string) { if (post) - throw semantic_error ("post assignment on strings not supported", + throw semantic_error ("post assignment on strings not supported", tok); if (op == "=") { @@ -2064,31 +2064,31 @@ c_unparser_assignment::c_assignop(tmpvar & res, } -void -c_unparser::c_declare(exp_type ty, const string &name) +void +c_unparser::c_declare(exp_type ty, const string &name) { o->newline() << c_typename (ty) << " " << c_varname (name) << ";"; } -void -c_unparser::c_declare_static(exp_type ty, const string &name) +void +c_unparser::c_declare_static(exp_type ty, const string &name) { o->newline() << "static " << c_typename (ty) << " " << c_varname (name) << ";"; } -void -c_unparser::c_strcpy (const string& lvalue, const string& rvalue) +void +c_unparser::c_strcpy (const string& lvalue, const string& rvalue) { - o->newline() << "strlcpy (" - << lvalue << ", " + o->newline() << "strlcpy (" + << lvalue << ", " << rvalue << ", MAXSTRINGLEN);"; } -void -c_unparser::c_strcpy (const string& lvalue, expression* rvalue) +void +c_unparser::c_strcpy (const string& lvalue, expression* rvalue) { o->newline() << "strlcpy (" << lvalue << ", "; rvalue->visit (this); @@ -2096,17 +2096,17 @@ c_unparser::c_strcpy (const string& lvalue, expression* rvalue) } -void -c_unparser::c_strcat (const string& lvalue, const string& rvalue) +void +c_unparser::c_strcat (const string& lvalue, const string& rvalue) { - o->newline() << "strlcat (" - << lvalue << ", " + o->newline() << "strlcat (" + << lvalue << ", " << rvalue << ", MAXSTRINGLEN);"; } -void -c_unparser::c_strcat (const string& lvalue, expression* rvalue) +void +c_unparser::c_strcat (const string& lvalue, expression* rvalue) { o->newline() << "strlcat (" << lvalue << ", "; rvalue->visit (this); @@ -2116,7 +2116,7 @@ c_unparser::c_strcat (const string& lvalue, expression* rvalue) bool c_unparser::is_local(vardecl const *r, token const *tok) -{ +{ if (current_probe) { for (unsigned i=0; ilocals.size(); i++) @@ -2145,7 +2145,7 @@ c_unparser::is_local(vardecl const *r, token const *tok) if (session->globals[i] == r) return false; } - + if (tok) throw semantic_error ("unresolved symbol", tok); else @@ -2153,24 +2153,24 @@ c_unparser::is_local(vardecl const *r, token const *tok) } -tmpvar -c_unparser::gensym(exp_type ty) -{ - return tmpvar (ty, tmpvar_counter); +tmpvar +c_unparser::gensym(exp_type ty) +{ + return tmpvar (ty, tmpvar_counter); } -aggvar -c_unparser::gensym_aggregate() -{ - return aggvar (tmpvar_counter); +aggvar +c_unparser::gensym_aggregate() +{ + return aggvar (tmpvar_counter); } -var -c_unparser::getvar(vardecl *v, token const *tok) -{ +var +c_unparser::getvar(vardecl *v, token const *tok) +{ bool loc = is_local (v, tok); - if (loc) + if (loc) return var (loc, v->type, v->name); else { @@ -2184,9 +2184,9 @@ c_unparser::getvar(vardecl *v, token const *tok) } -mapvar -c_unparser::getmap(vardecl *v, token const *tok) -{ +mapvar +c_unparser::getmap(vardecl *v, token const *tok) +{ if (v->arity < 1) throw semantic_error("attempt to use scalar where map expected", tok); statistic_decl sd; @@ -2199,9 +2199,9 @@ c_unparser::getmap(vardecl *v, token const *tok) } -itervar +itervar c_unparser::getiter(symbol *s) -{ +{ return itervar (s, tmpvar_counter); } @@ -2392,9 +2392,9 @@ struct arrayindex_downcaster : public traversing_visitor { arrayindex *& arr; - + arrayindex_downcaster (arrayindex *& arr) - : arr(arr) + : arr(arr) {} void visit_arrayindex (arrayindex* e) @@ -2405,7 +2405,7 @@ struct arrayindex_downcaster static bool -expression_is_arrayindex (expression *e, +expression_is_arrayindex (expression *e, arrayindex *& hist) { arrayindex *h = NULL; @@ -2423,7 +2423,7 @@ expression_is_arrayindex (expression *e, void c_tmpcounter::visit_foreach_loop (foreach_loop *s) { - symbol *array; + symbol *array; hist_op *hist; classify_indexable (s->base, array, hist); @@ -2433,17 +2433,17 @@ c_tmpcounter::visit_foreach_loop (foreach_loop *s) parent->o->newline() << iv.declare(); } else - { + { // See commentary in c_tmpcounter::visit_arrayindex for // discussion of tmpvars required to look into @hist_op(...) // expressions. // First make sure we have exactly one pe_long variable to use as // our bucket index. - + if (s->indexes.size() != 1 || s->indexes[0]->referent->type != pe_long) throw semantic_error("Invalid indexing of histogram", s->tok); - + // Then declare what we need to form the aggregate we're // iterating over, and all the tmpvars needed by our call to // load_aggregate(). @@ -2460,7 +2460,7 @@ c_tmpcounter::visit_foreach_loop (foreach_loop *s) throw semantic_error("expected arrayindex expression in iterated hist_op", s->tok); for (unsigned i=0; ireferent->index_types.size(); i++) - { + { tmpvar ix = parent->gensym (sym->referent->index_types[i]); ix.declare (*parent); arr->indexes[i]->visit(this); @@ -2487,7 +2487,7 @@ c_tmpcounter::visit_foreach_loop (foreach_loop *s) void c_unparser::visit_foreach_loop (foreach_loop *s) { - symbol *array; + symbol *array; hist_op *hist; classify_indexable (s->base, array, hist); @@ -2496,14 +2496,14 @@ c_unparser::visit_foreach_loop (foreach_loop *s) mapvar mv = getmap (array->referent, s->tok); itervar iv = getiter (array); vector keys; - + string ctr = stringify (label_counter++); string toplabel = "top_" + ctr; string contlabel = "continue_" + ctr; string breaklabel = "break_" + ctr; - + // NB: structure parallels for_loop - + // initialization tmpvar *res_limit = NULL; @@ -2513,7 +2513,7 @@ c_unparser::visit_foreach_loop (foreach_loop *s) res_limit = new tmpvar(gensym(pe_long)); c_assign (res_limit->value(), s->limit, "foreach limit"); } - + // aggregate array if required if (mv.is_parallel()) { @@ -2554,7 +2554,7 @@ c_unparser::visit_foreach_loop (foreach_loop *s) } } else - { + { // sort array if desired if (s->sort_direction) { @@ -2574,11 +2574,11 @@ c_unparser::visit_foreach_loop (foreach_loop *s) } // NB: sort direction sense is opposite in runtime, thus the negation - + if (mv.is_parallel()) aggregations_active.insert(mv.value()); o->newline() << iv << " = " << iv.start (mv) << ";"; - + tmpvar *limitv = NULL; if (s->limit) { @@ -2599,7 +2599,7 @@ c_unparser::visit_foreach_loop (foreach_loop *s) record_actions(1); o->newline() << "if (! (" << iv << ")) goto " << breaklabel << ";"; - + // body loop_break_labels.push_back (breaklabel); loop_continue_labels.push_back (contlabel); @@ -2628,12 +2628,12 @@ c_unparser::visit_foreach_loop (foreach_loop *s) o->newline(-1) << "}"; loop_break_labels.pop_back (); loop_continue_labels.pop_back (); - + // iteration o->newline(-1) << contlabel << ":"; o->newline(1) << iv << " = " << iv.next (mv) << ";"; o->newline() << "goto " << toplabel << ";"; - + // exit o->newline(-1) << breaklabel << ":"; o->newline(1) << "; /* dummy statement */"; @@ -2667,10 +2667,10 @@ c_unparser::visit_foreach_loop (foreach_loop *s) limitv = new tmpvar(gensym (pe_long)); o->newline() << *limitv << " = 0LL;"; } - + // XXX: break / continue don't work here yet record_actions(1, true); - o->newline() << "for (" << bucketvar << " = 0; " + o->newline() << "for (" << bucketvar << " = 0; " << bucketvar << " < " << v.buckets() << "; " << bucketvar << "++) { "; o->newline(1); @@ -2744,17 +2744,17 @@ struct delete_statement_operand_visitor: void visit_arrayindex (arrayindex* e); }; -void +void delete_statement_operand_visitor::visit_symbol (symbol* e) { assert (e->referent != 0); if (e->referent->arity > 0) { - mapvar mvar = parent->getmap(e->referent, e->tok); + mapvar mvar = parent->getmap(e->referent, e->tok); /* NB: Memory deallocation/allocation operations are not generally safe. parent->o->newline() << mvar.fini (); - parent->o->newline() << mvar.init (); + parent->o->newline() << mvar.init (); */ if (mvar.is_parallel()) parent->o->newline() << "_stp_pmap_clear (" << mvar.value() << ");"; @@ -2763,7 +2763,7 @@ delete_statement_operand_visitor::visit_symbol (symbol* e) } else { - var v = parent->getvar(e->referent, e->tok); + var v = parent->getvar(e->referent, e->tok); switch (e->type) { case pe_stats: @@ -2782,10 +2782,10 @@ delete_statement_operand_visitor::visit_symbol (symbol* e) } } -void +void delete_statement_operand_tmp_visitor::visit_arrayindex (arrayindex* e) { - symbol *array; + symbol *array; hist_op *hist; classify_indexable (e->base, array, hist); @@ -2808,10 +2808,10 @@ delete_statement_operand_tmp_visitor::visit_arrayindex (arrayindex* e) } } -void +void delete_statement_operand_visitor::visit_arrayindex (arrayindex* e) { - symbol *array; + symbol *array; hist_op *hist; classify_indexable (e->base, array, hist); @@ -2819,7 +2819,7 @@ delete_statement_operand_visitor::visit_arrayindex (arrayindex* e) { vector idx; parent->load_map_indices (e, idx); - + { mapvar mvar = parent->getmap (array->referent, e->tok); parent->o->newline() << mvar.del (idx) << ";"; @@ -2932,7 +2932,7 @@ c_unparser::visit_binary_expression (binary_expression* e) e->left->type != pe_long || e->right->type != pe_long) throw semantic_error ("expected numeric types", e->tok); - + if (e->op == "+" || e->op == "-" || e->op == "*" || @@ -2995,7 +2995,7 @@ c_unparser::visit_binary_expression (binary_expression* e) o->newline(-1) << "})"; } else - throw semantic_error ("operator not yet implemented", e->tok); + throw semantic_error ("operator not yet implemented", e->tok); } @@ -3059,13 +3059,13 @@ c_unparser::visit_logical_and_expr (logical_and_expr* e) } -void +void c_tmpcounter::visit_array_in (array_in* e) { - symbol *array; + symbol *array; hist_op *hist; classify_indexable (e->operand->base, array, hist); - + if (array) { assert (array->referent != 0); @@ -3078,7 +3078,7 @@ c_tmpcounter::visit_array_in (array_in* e) ix.declare (*parent); e->operand->indexes[i]->visit(this); } - + // A boolean result. tmpvar res = parent->gensym (e->type); res.declare (*parent); @@ -3100,18 +3100,18 @@ c_tmpcounter::visit_array_in (array_in* e) void c_unparser::visit_array_in (array_in* e) { - symbol *array; + symbol *array; hist_op *hist; classify_indexable (e->operand->base, array, hist); - + if (array) { - stmt_expr block(*this); - + stmt_expr block(*this); + vector idx; load_map_indices (e->operand, idx); // o->newline() << "c->last_stmt = " << lex_cast_qstring(*e->tok) << ";"; - + tmpvar res = gensym (pe_long); mapvar mvar = getmap (array->referent, e->tok); c_assign (res, mvar.exists(idx), e->tok); @@ -3189,7 +3189,7 @@ c_unparser::visit_concatenation (concatenation* e) throw semantic_error ("expected string types", e->tok); tmpvar t = gensym (e->type); - + o->line() << "({ "; o->indent(1); // o->newline() << "c->last_stmt = " << lex_cast_qstring(*e->tok) << ";"; @@ -3242,7 +3242,7 @@ c_unparser::visit_assignment (assignment* e) if (e->right->type != pe_long) throw semantic_error ("non-number right operand to <<< expression", e->right->tok); - + } else { @@ -3326,7 +3326,7 @@ c_tmpcounter_assignment::prepare_rvalue (tmpvar & rval) } } -void +void c_tmpcounter_assignment::c_assignop(tmpvar & res) { if (res.type() == pe_string) @@ -3380,7 +3380,7 @@ c_tmpcounter_assignment::visit_symbol (symbol *e) void -c_unparser_assignment::prepare_rvalue (string const & op, +c_unparser_assignment::prepare_rvalue (string const & op, tmpvar & rval, token const * tok) { @@ -3422,13 +3422,13 @@ c_unparser_assignment::visit_symbol (symbol *e) prepare_rvalue (op, rval, e->tok); var lvar = parent->getvar (e->referent, e->tok); - c_assignop (res, lvar, rval, e->tok); + c_assignop (res, lvar, rval, e->tok); parent->o->newline() << res << ";"; } -void +void c_unparser::visit_target_symbol (target_symbol* e) { throw semantic_error("cannot translate general target-symbol expression", e->tok); @@ -3438,7 +3438,7 @@ c_unparser::visit_target_symbol (target_symbol* e) void c_tmpcounter::load_map_indices(arrayindex *e) { - symbol *array; + symbol *array; hist_op *hist; classify_indexable (e->base, array, hist); @@ -3446,7 +3446,7 @@ c_tmpcounter::load_map_indices(arrayindex *e) { assert (array->referent != 0); vardecl* r = array->referent; - + // One temporary per index dimension, except in the case of // number or string constants. for (unsigned i=0; iindex_types.size(); i++) @@ -3469,26 +3469,26 @@ void c_unparser::load_map_indices(arrayindex *e, vector & idx) { - symbol *array; + symbol *array; hist_op *hist; classify_indexable (e->base, array, hist); if (array) { idx.clear(); - + assert (array->referent != 0); vardecl* r = array->referent; - + if (r->index_types.size() == 0 || r->index_types.size() != e->indexes.size()) throw semantic_error ("invalid array reference", e->tok); - + for (unsigned i=0; iindex_types.size(); i++) { if (r->index_types[i] != e->indexes[i]->type) throw semantic_error ("array index type mismatch", e->indexes[i]->tok); - + tmpvar ix = gensym (r->index_types[i]); if (e->indexes[i]->tok->type == tok_number || e->indexes[i]->tok->type == tok_string) @@ -3514,31 +3514,31 @@ c_unparser::load_map_indices(arrayindex *e, // << lex_cast_qstring(*e->indexes[0]->tok) << ";"; c_assign (ix.value(), e->indexes[0], "array index copy"); idx.push_back(ix); - } + } } -void +void c_unparser::load_aggregate (expression *e, aggvar & agg, bool pre_agg) { symbol *sym = get_symbol_within_expression (e); - + if (sym->referent->type != pe_stats) throw semantic_error ("unexpected aggregate of non-statistic", sym->tok); - + var v = getvar(sym->referent, e->tok); if (sym->referent->arity == 0) { // o->newline() << "c->last_stmt = " << lex_cast_qstring(*sym->tok) << ";"; - o->newline() << agg << " = _stp_stat_get (" << v << ", 0);"; + o->newline() << agg << " = _stp_stat_get (" << v << ", 0);"; } else { arrayindex *arr = NULL; if (!expression_is_arrayindex (e, arr)) throw semantic_error("unexpected aggregate of non-arrayindex", e->tok); - + vector idx; load_map_indices (arr, idx); mapvar mvar = getmap (sym->referent, sym->tok); @@ -3548,25 +3548,25 @@ c_unparser::load_aggregate (expression *e, aggvar & agg, bool pre_agg) } -string +string c_unparser::histogram_index_check(var & base, tmpvar & idx) const { return "((" + idx.value() + " >= 0)" - + " && (" + idx.value() + " < " + base.buckets() + "))"; + + " && (" + idx.value() + " < " + base.buckets() + "))"; } void c_tmpcounter::visit_arrayindex (arrayindex *e) { - symbol *array; + symbol *array; hist_op *hist; classify_indexable (e->base, array, hist); if (array) { load_map_indices(e); - + // The index-expression result. tmpvar res = parent->gensym (e->type); res.declare (*parent); @@ -3580,18 +3580,18 @@ c_tmpcounter::visit_arrayindex (arrayindex *e) // temporaries. The reason is that we're in the branch handling // histogram-indexing, and the histogram might be build over an // indexable entity itself. For example if we have: - // + // // global foo // ... // foo[getpid(), geteuid()] <<< 1 // ... // print @log_hist(foo[pid, euid])[bucket] - // + // // We are looking at the @log_hist(...)[bucket] expression, so // allocating one tmpvar for calculating bucket (the "index" of // this arrayindex expression), and one tmpvar for storing the // result in, just as normal. - // + // // But we are *also* going to call load_aggregate on foo, which // will itself require tmpvars for each of its indices. Since // this is not handled by delving into the subexpression (it @@ -3601,17 +3601,17 @@ c_tmpcounter::visit_arrayindex (arrayindex *e) // (bucket) tmpvar, then all the index tmpvars of our // pe_stat-valued subexpression, then our result. - + // First all the stuff related to indexing into the histogram if (e->indexes.size() != 1) throw semantic_error("Invalid indexing of histogram", e->tok); tmpvar ix = parent->gensym (pe_long); - ix.declare (*parent); + ix.declare (*parent); e->indexes[0]->visit(this); tmpvar res = parent->gensym (pe_long); res.declare (*parent); - + // Then the aggregate, and all the tmpvars needed by our call to // load_aggregate(). @@ -3627,7 +3627,7 @@ c_tmpcounter::visit_arrayindex (arrayindex *e) throw semantic_error("expected arrayindex expression in indexed hist_op", e->tok); for (unsigned i=0; ireferent->index_types.size(); i++) - { + { tmpvar ix = parent->gensym (sym->referent->index_types[i]); ix.declare (*parent); arr->indexes[i]->visit(this); @@ -3639,8 +3639,8 @@ c_tmpcounter::visit_arrayindex (arrayindex *e) void c_unparser::visit_arrayindex (arrayindex* e) -{ - symbol *array; +{ + symbol *array; hist_op *hist; classify_indexable (e->base, array, hist); @@ -3650,16 +3650,16 @@ c_unparser::visit_arrayindex (arrayindex* e) if (array->referent->type == pe_stats) throw semantic_error ("statistic-valued array in rvalue context", e->tok); - stmt_expr block(*this); + stmt_expr block(*this); // NB: Do not adjust the order of the next few lines; the tmpvar // allocation order must remain the same between // c_unparser::visit_arrayindex and c_tmpcounter::visit_arrayindex - + vector idx; load_map_indices (e, idx); tmpvar res = gensym (e->type); - + mapvar mvar = getmap (array->referent, e->tok); // o->newline() << "c->last_stmt = " << lex_cast_qstring(*e->tok) << ";"; c_assign (res, mvar.get(idx), e->tok); @@ -3671,21 +3671,21 @@ c_unparser::visit_arrayindex (arrayindex* e) // See commentary in c_tmpcounter::visit_arrayindex assert(hist); - stmt_expr block(*this); + stmt_expr block(*this); // NB: Do not adjust the order of the next few lines; the tmpvar // allocation order must remain the same between // c_unparser::visit_arrayindex and c_tmpcounter::visit_arrayindex - + vector idx; load_map_indices (e, idx); tmpvar res = gensym (e->type); - + aggvar agg = gensym_aggregate (); // These should have faulted during elaboration if not true. assert(idx.size() == 1); - assert(idx[0].type() == pe_long); + assert(idx[0].type() == pe_long); symbol *sym = get_symbol_within_expression (hist->stat); @@ -3699,7 +3699,7 @@ c_unparser::visit_arrayindex (arrayindex* e) if (aggregations_active.count(v->value())) load_aggregate(hist->stat, agg, true); - else + else load_aggregate(hist->stat, agg, false); o->newline() << "c->last_stmt = " << lex_cast_qstring(*e->tok) << ";"; @@ -3719,7 +3719,7 @@ c_unparser::visit_arrayindex (arrayindex* e) o->newline(-1) << "}"; o->newline() << res << ";"; - + delete v; } } @@ -3728,14 +3728,14 @@ c_unparser::visit_arrayindex (arrayindex* e) void c_tmpcounter_assignment::visit_arrayindex (arrayindex *e) { - symbol *array; + symbol *array; hist_op *hist; classify_indexable (e->base, array, hist); if (array) { parent->load_map_indices(e); - + // The expression rval, lval, and result. exp_type ty = rvalue ? rvalue->type : e->type; tmpvar rval = parent->parent->gensym (ty); @@ -3760,14 +3760,14 @@ c_tmpcounter_assignment::visit_arrayindex (arrayindex *e) void c_unparser_assignment::visit_arrayindex (arrayindex *e) { - symbol *array; + symbol *array; hist_op *hist; classify_indexable (e->base, array, hist); if (array) { - stmt_expr block(*parent); + stmt_expr block(*parent); translator_output *o = parent->o; @@ -3778,14 +3778,14 @@ c_unparser_assignment::visit_arrayindex (arrayindex *e) // allocation order must remain the same between // c_unparser_assignment::visit_arrayindex and // c_tmpcounter_assignment::visit_arrayindex - + vector idx; parent->load_map_indices (e, idx); exp_type ty = rvalue ? rvalue->type : e->type; tmpvar rvar = parent->gensym (ty); tmpvar lvar = parent->gensym (ty); tmpvar res = parent->gensym (ty); - + // NB: because these expressions are nestable, emit this construct // thusly: // ({ tmp0=(idx0); ... tmpN=(idxN); rvar=(rhs); lvar; res; @@ -3801,7 +3801,7 @@ c_unparser_assignment::visit_arrayindex (arrayindex *e) // e.g. ++a[a[c]=5] could deadlock // // - // There is an exception to the above form: if we're doign a <<< assigment to + // There is an exception to the above form: if we're doign a <<< assigment to // a statistic-valued map, there's a special form we follow: // // ({ tmp0=(idx0); ... tmpN=(idxN); rvar=(rhs); @@ -3835,12 +3835,12 @@ c_unparser_assignment::visit_arrayindex (arrayindex *e) // o->newline() << "c->last_stmt = " << lex_cast_qstring(*e->tok) << ";"; if (op != "=") // don't bother fetch slot if we will just overwrite it parent->c_assign (lvar, mvar.get(idx), e->tok); - c_assignop (res, lvar, rvar, e->tok); + c_assignop (res, lvar, rvar, e->tok); o->newline() << mvar.set (idx, lvar) << ";"; } o->newline() << res << ";"; - } + } else { throw semantic_error("cannot assign to histogram buckets", e->tok); @@ -3874,7 +3874,7 @@ c_unparser::visit_functioncall (functioncall* e) if (r->formal_args.size() != e->args.size()) throw semantic_error ("invalid length argument list", e->tok); - stmt_expr block(*this); + stmt_expr block(*this); // NB: we store all actual arguments in temporary variables, // to avoid colliding sharing of context variables with @@ -3953,7 +3953,7 @@ c_tmpcounter::visit_print_format (print_format* e) arrayindex *arr = NULL; if (!expression_is_arrayindex (e->hist->stat, arr)) throw semantic_error("expected arrayindex expression in printed hist_op", e->tok); - + tmpvar ix = parent->gensym (sym->referent->index_types[i]); ix.declare (*parent); arr->indexes[i]->visit(this); @@ -3968,7 +3968,7 @@ c_tmpcounter::visit_print_format (print_format* e) tmpvar t = parent->gensym (e->args[i]->type); if (e->args[i]->type == pe_unknown) { - throw semantic_error("unknown type of arg to print operator", + throw semantic_error("unknown type of arg to print operator", e->args[i]->tok); } @@ -3980,14 +3980,14 @@ c_tmpcounter::visit_print_format (print_format* e) // And the result exp_type ty = e->print_to_stream ? pe_long : pe_string; - tmpvar res = parent->gensym (ty); + tmpvar res = parent->gensym (ty); if (ty == pe_string) res.declare (*parent); } } -void +void c_unparser::visit_print_format (print_format* e) { // Print formats can contain a general argument list *or* a special @@ -3996,7 +3996,7 @@ c_unparser::visit_print_format (print_format* e) if (e->hist) { - stmt_expr block(*this); + stmt_expr block(*this); symbol *sym = get_symbol_within_expression (e->hist->stat); aggvar agg = gensym_aggregate (); @@ -4011,7 +4011,7 @@ c_unparser::visit_print_format (print_format* e) { if (aggregations_active.count(v->value())) load_aggregate(e->hist->stat, agg, true); - else + else load_aggregate(e->hist->stat, agg, false); // PR 2142+2610: empty aggregates @@ -4029,11 +4029,11 @@ c_unparser::visit_print_format (print_format* e) } else { - stmt_expr block(*this); + stmt_expr block(*this); // Compute actual arguments vector tmp; - + for (unsigned i=0; iargs.size(); i++) { tmpvar t = gensym(e->args[i]->type); @@ -4051,11 +4051,11 @@ c_unparser::visit_print_format (print_format* e) tmp[i].override(c_expression(e->args[i])); else c_assign (t.value(), e->args[i], - "print format actual argument evaluation"); + "print format actual argument evaluation"); } std::vector components; - + if (e->print_with_format) { components = e->components; @@ -4099,13 +4099,13 @@ c_unparser::visit_print_format (print_format* e) // Allocate the result exp_type ty = e->print_to_stream ? pe_long : pe_string; - tmpvar res = gensym (ty); + tmpvar res = gensym (ty); int use_print = 0; string format_string = print_format::components_to_string(components); if (tmp.size() == 0 || (tmp.size() == 1 && format_string == "%s")) use_print = 1; - else if (tmp.size() == 1 + else if (tmp.size() == 1 && e->args[0]->tok->type == tok_string && format_string == "%s\\n") { @@ -4155,7 +4155,7 @@ c_unparser::visit_print_format (print_format* e) o->line() << tmp[0].value() << ");"; else o->line() << '"' << format_string << "\");"; - return; + return; } if (use_print) { @@ -4176,7 +4176,7 @@ c_unparser::visit_print_format (print_format* e) o->newline() << "_stp_snprintf (" << res.value() << ", MAXSTRINGLEN, "; o->line() << '"' << format_string << '"'; - + /* Generate the actual arguments. Make sure that they match the expected type of the format specifier. */ arg_ix = 0; @@ -4203,7 +4203,7 @@ c_unparser::visit_print_format (print_format* e) } -void +void c_tmpcounter::visit_stat_op (stat_op* e) { symbol *sym = get_symbol_within_expression (e->stat); @@ -4232,14 +4232,14 @@ c_tmpcounter::visit_stat_op (stat_op* e) } } -void +void c_unparser::visit_stat_op (stat_op* e) { // Stat ops can be *applied* to two types of expression: // - // 1. An arrayindex expression on a pe_stats-valued array. + // 1. An arrayindex expression on a pe_stats-valued array. // - // 2. A symbol of type pe_stats. + // 2. A symbol of type pe_stats. // FIXME: classify the expression the stat_op is being applied to, // call appropriate stp_get_stat() / stp_pmap_get_stat() helper, @@ -4248,12 +4248,12 @@ c_unparser::visit_stat_op (stat_op* e) // FIXME: also note that summarizing anything is expensive, and we // really ought to pass a timeout handler into the summary routine, // check its response, possibly exit if it ran out of cycles. - + { stmt_expr block(*this); symbol *sym = get_symbol_within_expression (e->stat); aggvar agg = gensym_aggregate (); - tmpvar res = gensym (pe_long); + tmpvar res = gensym (pe_long); var v = getvar(sym->referent, e->tok); { if (aggregations_active.count(v.value())) @@ -4301,13 +4301,13 @@ c_unparser::visit_stat_op (stat_op* e) break; } o->indent(-1); - } + } o->newline() << res << ";"; } } -void +void c_unparser::visit_hist_op (hist_op*) { // Hist ops can only occur in a limited set of circumstances: @@ -4387,13 +4387,13 @@ dump_unwindsyms (Dwfl_Module *m, map addrmap; // per-relocation-base sorted addrmap Dwarf_Addr extra_offset = 0; - + for (int i = 1 /* XXX: why not 0? */ ; i < syments; ++i) { GElf_Sym sym; const char *name = dwfl_module_getsym(m, i, &sym, NULL); if (name) - { + { // NB: Yey, we found the kernel's _stext value. // Sess.sym_stext may be unset (0) at this point, since // there may have been no kernel probes set. We could @@ -4431,11 +4431,11 @@ dump_unwindsyms (Dwfl_Module *m, assert (secname != NULL); // secname adequately set } - else + else { assert (n == 0); // sym_addr is absolute, as it must be since there are no relocation bases - secname = ".absolute"; // sentinel + secname = ".absolute"; // sentinel } // Compute our section number @@ -4443,7 +4443,7 @@ dump_unwindsyms (Dwfl_Module *m, for (secidx=0; secidxfirst < extra_offset) continue; // skip symbols that occur before our chosen base address - + c->output << " { 0x" << hex << it->first-extra_offset << dec << ", " << lex_cast_qstring (it->second) << " }," << endl; } @@ -4481,10 +4481,10 @@ dump_unwindsyms (Dwfl_Module *m, c->output << "struct _stp_module _stp_module_" << stpmod_idx << " = {" << endl; c->output << ".name = " << lex_cast_qstring (modname) << ", " << endl; - c->output << ".sections = _stp_module_" << stpmod_idx << "_sections" << ", " << endl; + c->output << ".sections = _stp_module_" << stpmod_idx << "_sections" << ", " << endl; c->output << ".num_sections = sizeof(_stp_module_" << stpmod_idx << "_sections)/" - << "sizeof(struct _stp_section), " << endl; - + << "sizeof(struct _stp_section), " << endl; + c->output << "};" << endl << endl; c->undone_unwindsym_modules.erase (modname); @@ -4510,7 +4510,7 @@ emit_symbol_data (systemtap_session& s) // XXX: copied from tapsets.cxx, sadly static char debuginfo_path_arr[] = "-:.debug:/usr/lib/debug:build"; static char *debuginfo_env_arr = getenv("SYSTEMTAP_DEBUGINFO_PATH"); - + static char *debuginfo_path = (debuginfo_env_arr ? debuginfo_env_arr : debuginfo_path_arr); static const char *debug_path = (debuginfo_env_arr ? @@ -4524,7 +4524,7 @@ emit_symbol_data (systemtap_session& s) dwfl_offline_section_address, & debuginfo_path }; - + Dwfl *dwfl = dwfl_begin (&kernel_callbacks); if (!dwfl) throw semantic_error ("cannot open dwfl"); @@ -4615,7 +4615,7 @@ translate_pass (systemtap_session& s) try { // This is at the very top of the file. - + s.op->newline() << "#ifndef MAXNESTING"; s.op->newline() << "#define MAXNESTING 10"; s.op->newline() << "#endif"; @@ -4663,7 +4663,7 @@ translate_pass (systemtap_session& s) if (s.bulk_mode) s.op->newline() << "#define STP_BULKMODE"; - + if (s.timing) s.op->newline() << "#define STP_TIMING"; diff --git a/util.cxx b/util.cxx index 97425d76..d57ef88c 100644 --- a/util.cxx +++ b/util.cxx @@ -173,7 +173,7 @@ find_executable(const char *name, string& retpath) if (!p) return false; path = p; - + // Split PATH up. tokenize(path, dirs, string(":")); @@ -215,8 +215,8 @@ const string cmdstr_quoted(const string& cmd) string::size_type pos = 0; quoted_cmd += quote; - for (string::size_type quote_pos = cmd.find(quote, pos); - quote_pos != string::npos; + for (string::size_type quote_pos = cmd.find(quote, pos); + quote_pos != string::npos; quote_pos = cmd.find(quote, pos)) { quoted_cmd += cmd.substr(pos, quote_pos - pos); quoted_cmd += replace; diff --git a/util.h b/util.h index 97fa7062..735652eb 100644 --- a/util.h +++ b/util.h @@ -27,7 +27,7 @@ stringify(T t) } -template +template inline OUT lex_cast(IN const & in) { std::stringstream ss; @@ -39,7 +39,7 @@ inline OUT lex_cast(IN const & in) } -template +template inline OUT lex_cast_hex(IN const & in) { @@ -54,7 +54,7 @@ lex_cast_hex(IN const & in) // Return as quoted string, so that when compiled as a C literal, it // would print to the user out nicely. -template +template inline std::string lex_cast_qstring(IN const & in) { @@ -74,7 +74,7 @@ lex_cast_qstring(IN const & in) out2 += "01234567" [(c >> 6) & 0x07]; out2 += "01234567" [(c >> 3) & 0x07]; out2 += "01234567" [(c >> 0) & 0x07]; - } + } else if (c == '"' || c == '\\') { out2 += '\\'; -- cgit From 84f00e279d98edba986225386c7183db3c5968b0 Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Thu, 28 Aug 2008 12:47:49 -0400 Subject: PR5686: correct regression in semok/optimize.stp --- testsuite/semok/optimize.stp | 1 - 1 file changed, 1 deletion(-) diff --git a/testsuite/semok/optimize.stp b/testsuite/semok/optimize.stp index a728bd66..621bd1ca 100755 --- a/testsuite/semok/optimize.stp +++ b/testsuite/semok/optimize.stp @@ -10,7 +10,6 @@ function zoo (x) { } probe begin { - b <<< "hello" a = b + 2 zoo (zoo (5)) b = "goodbye" -- cgit