From f4b2849102b2a195dd79bede8ec58f46fb99435e Mon Sep 17 00:00:00 2001 From: fche Date: Tue, 5 Jul 2005 20:38:37 +0000 Subject: 2005-07-05 Frank Ch. Eigler * 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. --- buildrun.cxx | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 buildrun.cxx (limited to 'buildrun.cxx') 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 + +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; +} -- cgit