summaryrefslogtreecommitdiffstats
path: root/buildrun.cxx
diff options
context:
space:
mode:
authorfche <fche>2005-07-05 20:38:37 +0000
committerfche <fche>2005-07-05 20:38:37 +0000
commitf4b2849102b2a195dd79bede8ec58f46fb99435e (patch)
treece9b211e38fc66caa1171584208595886067876a /buildrun.cxx
parent6deb8173c053febfbf336d1e962cb01d93a12404 (diff)
downloadsystemtap-steved-f4b2849102b2a195dd79bede8ec58f46fb99435e.tar.gz
systemtap-steved-f4b2849102b2a195dd79bede8ec58f46fb99435e.tar.xz
systemtap-steved-f4b2849102b2a195dd79bede8ec58f46fb99435e.zip
2005-07-05 Frank Ch. Eigler <fche@redhat.com>
* elaborate.h (systemtap_session): Add more command-line arguments. * staptree.h (verbose): Bad global, no donut. * elaborate.cxx: Temporarily disable verbose variable access. * main.cxx: Support more arguments, build/run passes. Revamp temporary file generation and partial-pass output generation. * tapsets.cxx, translate.cxx: Emit just enough extra punctuation and fluff to make generated probe pass -Werror. * buildrun.cxx, buildrun.h: New files for passes 4/5. Partial support for build pass, nothing on probe execution yet. * testsuite/transok/*.stp: Force just -p3, now that -p4/5 exist. * Makefile.am, Makefile.in: Corresponding changes.
Diffstat (limited to 'buildrun.cxx')
-rw-r--r--buildrun.cxx50
1 files changed, 50 insertions, 0 deletions
diff --git a/buildrun.cxx b/buildrun.cxx
new file mode 100644
index 00000000..af22f1c8
--- /dev/null
+++ b/buildrun.cxx
@@ -0,0 +1,50 @@
+// build/run probes
+// Copyright (C) 2005 Red Hat Inc.
+//
+// This file is part of systemtap, and is free software. You can
+// redistribute it and/or modify it under the terms of the GNU General
+// Public License (GPL); either version 2, or (at your option) any
+// later version.
+
+#include "config.h"
+#include "buildrun.h"
+
+#include <fstream>
+
+using namespace std;
+
+
+int
+compile_pass (systemtap_session& s)
+{
+ // fill in a quick Makefile
+ if (1)
+ {
+ // Assumes linux 2.6 kbuild
+ string makefile_nm = s.tmpdir + "/Makefile";
+ ofstream o (makefile_nm.c_str());
+ o << "CFLAGS += -Werror" << endl;
+ o << "CFLAGS += -I \"" << s.runtime_path << "\"" << endl;
+ o << "CFLAGS += -I \"" << s.runtime_path << "/relayfs\"" << endl;
+ o << "obj-m := " << s.module_name << ".o" << endl;
+ }
+
+ // run module make
+ string module_dir = string("/lib/modules/") + s.kernel_release + "/build";
+ string make_cmd = string("make")
+ + string (" -C \"") + module_dir + string("\"");
+ if (! s.verbose) make_cmd += " -s";
+ make_cmd += string(" M=\"") + s.tmpdir + string("\" modules");
+
+ if (s.verbose) cerr << "Running " << make_cmd << endl;
+ int rc = system (make_cmd.c_str());
+ if (s.verbose) cerr << "rc=" << rc << endl;
+ return rc;
+}
+
+
+int
+run_pass (systemtap_session& s)
+{
+ return 1;
+}