This commit is contained in:
Stan Cox 2011-06-23 14:31:43 -04:00
parent 54568463b4
commit 58ed3d891e
3 changed files with 259 additions and 4 deletions

178
swbz12899.patch Normal file
View File

@ -0,0 +1,178 @@
commit b571f9347c4a54facadb5e948e1430bd2b89158a
Author: Stan Cox <scox@redhat.com>
Date: Fri Jun 10 09:42:43 2011 -0400
Don't process the dtrace -o FILENAME.
dtrace.in (main): Use suffix for both -h and -G. Check gcc return code.
dtrace.exp: Massage results accordingly.
commit f6b267eb5f999ce380f1169ba4aa81945b8b8fd2
Author: Stan Cox <scox@redhat.com>
Date: Tue Jun 14 16:16:59 2011 -0400
Improve dtrace handling of CC environment variable.
* dtrace.in (main): Split CC to allow for application Makefile abuse.
commit 4c353c3a6d5a7b75c3e897f1605ae6a98b0b1951
Author: Stan Cox <scox@redhat.com>
Date: Tue Jun 14 17:36:23 2011 -0400
Split command line pieces with shlex
dtrace.in (main): Use shlex.split for CPP, CC, and CFLAGS
commit 12aad6f0ee85529fa29d6b0790f7afc6f075a808
Author: Stan Cox <scox@redhat.com>
Date: Wed Jun 15 15:52:38 2011 -0400
Do status setting and exit at the top level.
* dtrace.in (main): Use return instead of sys.exit; move sys.exit to top.
diff --git a/dtrace.in b/dtrace.in
index a64d110..c1ea1fe 100755
--- a/dtrace.in
+++ b/dtrace.in
@@ -17,6 +17,7 @@ import os
import posix
import string
import sys
+import shlex
from subprocess import call
from tempfile import mkstemp
@@ -179,7 +180,7 @@ def help ():
def main():
if (len(sys.argv) < 2):
usage()
- sys.exit(1)
+ return 1
i = 1
build_header = False
@@ -187,7 +188,7 @@ def main():
add_typedefs = False
keep_temps = False
use_cpp = False
- h_ext = '.h'
+ suffix = ""
filename = ""
s_filename = ""
includes = []
@@ -205,10 +206,12 @@ def main():
defines.append(sys.argv[i])
elif (sys.argv[i] == "-h"):
build_header = True
+ suffix = ".h"
elif (sys.argv[i].startswith("-I")):
includes.append(sys.argv[i])
elif (sys.argv[i] == "-G"):
build_source = True
+ suffix = ".o"
elif (sys.argv[i] == "-k"):
keep_temps = True
elif (sys.argv[i] == "--types"):
@@ -218,17 +221,16 @@ def main():
i += 1
if (build_header == False and build_source == False):
usage()
- sys.exit(1)
+ return 1
if (s_filename != "" and use_cpp):
(d,fn) = mkstemp(suffix=".d")
CPP = os.environ.get("CPP", "cpp")
- args = [CPP] + includes + defines + [s_filename, fn]
- retcode = call(args)
+ retcode = call(shlex.split(CPP) + includes + defines + [s_filename, fn])
if (retcode != 0):
print "\"cpp includes s_filename\" failed"
usage()
- sys.exit(1)
+ return 1
s_filename = fn
if (filename == ""):
if (s_filename != ""):
@@ -236,15 +238,12 @@ def main():
filename = os.path.basename(filename)
else:
usage()
- sys.exit(1)
+ return 1
else:
- if (build_header):
- h_ext = ""
- else:
- (filename,ext) = os.path.splitext(filename)
+ suffix = ""
if (build_header):
providers = _provider()
- providers.generate(s_filename, filename + h_ext, add_typedefs)
+ providers.generate(s_filename, filename + suffix, add_typedefs)
elif (build_source):
(basename,ext) = os.path.splitext(s_filename)
@@ -265,9 +264,13 @@ def main():
f.close()
CC = os.environ.get("CC", "gcc")
CFLAGS = "-g " + os.environ.get("CFLAGS", "")
- call([CC, "-fPIC"] + defines + includes + CFLAGS.split() +
- ["-I.", "-I@prefix@/include", "-c", fn, "-o",
- filename + ".o"], shell=False)
+ retcode = call(shlex.split(CC) + defines + includes + shlex.split(CFLAGS) +
+ ["-fPIC", "-I.", "-I@prefix@/include", "-c", fn, "-o",
+ filename + suffix], shell=False)
+ if (retcode != 0):
+ print "\"gcc " + fn + "\" failed"
+ usage()
+ return 1
if (not keep_temps):
os.remove(fn)
else:
@@ -277,6 +280,7 @@ def main():
os.remove(s_filename)
else:
print "cpp: " + s_filename
+ return 0
if __name__ == "__main__":
- main()
+ sys.exit(main())
diff --git a/testsuite/systemtap.base/dtrace.exp b/testsuite/systemtap.base/dtrace.exp
index b301793..cd97c79 100644
--- a/testsuite/systemtap.base/dtrace.exp
+++ b/testsuite/systemtap.base/dtrace.exp
@@ -60,12 +60,12 @@ exec rm -f XXX.o
verbose -log "$dtrace -G -s $dpath -o XXX"
catch {exec $dtrace -G -s $dpath -o XXX}
-if {[file exists XXX.o]} then {
+if {[file exists XXX]} then {
pass "dtrace -G -o XXX"
} else {
fail "dtrace -G -o XXX"
}
-exec rm -f XXX.o
+exec rm -f XXX
verbose -log "$dtrace -h -s $dpath -o XXX.h"
catch {exec $dtrace -h -s $dpath -o XXX.h}
@@ -96,12 +96,12 @@ exec rm -f /tmp/XXX.o
verbose -log "$dtrace -G -s $dpath -o /tmp/XXX"
catch {exec $dtrace -G -s $dpath -o /tmp/XXX}
-if {[file exists /tmp/XXX.o]} then {
- pass "dtrace -G -o /tmp/XXX.o"
+if {[file exists /tmp/XXX]} then {
+ pass "dtrace -G -o /tmp/XXX"
} else {
- fail "dtrace -G -o /tmp/XXX.o"
+ fail "dtrace -G -o /tmp/XXX"
}
-exec rm -f /tmp/XXX.o
+exec rm -f /tmp/XXX
verbose -log "$dtrace -h -s $dpath -o /tmp/XXX.h"
catch {exec $dtrace -h -s $dpath -o /tmp/XXX.h}

72
swbz12927.patch Normal file
View File

@ -0,0 +1,72 @@
commit 0bbb80098decc9c4c43a1800538007d86b600bba
Author: Josh Stone <jistone@redhat.com>
Date: Tue Jun 7 11:23:13 2011 -0700
stapconf: Conditionalize stacktrace_ops.warning{,_symbol}
Kernel commit 449a66f removed these fields.
* buildrun.cxx: Include the new test.
* runtime/autoconf-stacktrace_ops-warning.c: Check the warning field.
* runtime/stack.c: Conditionalize the warning initialization.
diff --git a/buildrun.cxx b/buildrun.cxx
index 0bebc35..79f8818 100644
--- a/buildrun.cxx
+++ b/buildrun.cxx
@@ -215,6 +215,8 @@ compile_pass (systemtap_session& s)
output_autoconf(s, o, "autoconf-ring_buffer-flags.c", "STAPCONF_RING_BUFFER_FLAGS", NULL);
output_autoconf(s, o, "autoconf-kallsyms-on-each-symbol.c", "STAPCONF_KALLSYMS_ON_EACH_SYMBOL", NULL);
output_autoconf(s, o, "autoconf-walk-stack.c", "STAPCONF_WALK_STACK", NULL);
+ output_autoconf(s, o, "autoconf-stacktrace_ops-warning.c",
+ "STAPCONF_STACKTRACE_OPS_WARNING", NULL);
output_autoconf(s, o, "autoconf-mm-context-vdso.c", "STAPCONF_MM_CONTEXT_VDSO", NULL);
output_autoconf(s, o, "autoconf-blk-types.c", "STAPCONF_BLK_TYPES", NULL);
output_autoconf(s, o, "autoconf-perf-structpid.c", "STAPCONF_PERF_STRUCTPID", NULL);
diff --git a/runtime/autoconf-stacktrace_ops-warning.c b/runtime/autoconf-stacktrace_ops-warning.c
new file mode 100644
index 0000000..9c00f05
--- /dev/null
+++ b/runtime/autoconf-stacktrace_ops-warning.c
@@ -0,0 +1,10 @@
+/* Some kernels have warning fields in stacktrace_ops. */
+#include <linux/sched.h>
+#include <asm/stacktrace.h>
+
+void foo (void)
+{
+ struct stacktrace_ops t;
+ t.warning = 0;
+ (void) t;
+}
diff --git a/runtime/stack.c b/runtime/stack.c
index 68a7e4f..b2d5d1d 100644
--- a/runtime/stack.c
+++ b/runtime/stack.c
@@ -73,6 +73,7 @@ struct print_stack_data
int level;
};
+#if defined(STAPCONF_STACKTRACE_OPS_WARNING)
static void print_stack_warning(void *data, char *msg)
{
}
@@ -81,6 +82,7 @@ static void
print_stack_warning_symbol(void *data, char *msg, unsigned long symbol)
{
}
+#endif
static int print_stack_stack(void *data, char *name)
{
@@ -95,8 +97,10 @@ static void print_stack_address(void *data, unsigned long addr, int reliable)
}
static const struct stacktrace_ops print_stack_ops = {
+#if defined(STAPCONF_STACKTRACE_OPS_WARNING)
.warning = print_stack_warning,
.warning_symbol = print_stack_warning_symbol,
+#endif
.stack = print_stack_stack,
.address = print_stack_address,
#if defined(STAPCONF_WALK_STACK)

View File

@ -16,7 +16,7 @@
Name: systemtap
Version: 1.5
Release: 4%{?dist}
Release: 5%{?dist}
# for version, see also configure.ac
Summary: Instrumentation System
Group: Development/System
@ -64,7 +64,8 @@ BuildRequires: m4
BuildRequires: elfutils-devel >= %{elfutils_version}
%endif
Patch2: rhbz711427.patch
Patch2: swbz12899.patch
Patch3: swbz12927.patch
%if %{with_docs}
BuildRequires: /usr/bin/latex /usr/bin/dvips /usr/bin/ps2pdf latex2html
@ -141,7 +142,6 @@ Summary: Static probe support tools
Group: Development/System
License: GPLv2+ and Public Domain
URL: http://sourceware.org/systemtap/
Requires: /usr/bin/python
%description sdt-devel
Support tools to allow applications to use static probes.
@ -187,6 +187,7 @@ cd ..
%endif
%patch2 -p1
%patch3 -p1
%build
@ -503,8 +504,12 @@ exit 0
%changelog
* Thu Jun 23 2011 Stan Cox <scox@redhat.com> - 1.5-5
- PR 12927
- Remove explicit 'Requires python' dependency
* Fri Jun 10 2011 Stan Cox <scox@redhat.com> - 1.5-4
- Split $CC
- PR 12899
* Fri Jun 10 2011 Stan Cox <scox@redhat.com> - 1.5-3
- Don't massage dtrace -o FILENAME arg