summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2009-04-21 12:12:43 -0700
committerJosh Stone <jistone@redhat.com>2009-04-21 12:34:43 -0700
commit3ae4cdf91d758136cbf71c814c725c643d251f41 (patch)
tree8112db0d2f18085841e2119c2081c2f3a65a41a0
parentd90053e72a515371936e10bf83ecb822aec91b17 (diff)
downloadsystemtap-steved-3ae4cdf91d758136cbf71c814c725c643d251f41.tar.gz
systemtap-steved-3ae4cdf91d758136cbf71c814c725c643d251f41.tar.xz
systemtap-steved-3ae4cdf91d758136cbf71c814c725c643d251f41.zip
NB @cast's relative header searching
-rw-r--r--buildrun.cxx14
1 files changed, 14 insertions, 0 deletions
diff --git a/buildrun.cxx b/buildrun.cxx
index 311937e2..6c51d0cd 100644
--- a/buildrun.cxx
+++ b/buildrun.cxx
@@ -466,7 +466,16 @@ make_typequery_kmod(systemtap_session& s, const string& header, string& name)
string makefile(dir + "/Makefile");
ofstream omf(makefile.c_str());
omf << "EXTRA_CFLAGS := -g -fno-eliminate-unused-debug-types" << endl;
+
+ // NB: We use -include instead of #include because that gives us more power.
+ // Using #include searches relative to the source's path, which in this case
+ // is /tmp/..., so that's not helpful. Using -include will search relative
+ // to the cwd, which will be the kernel build root. This means if you have a
+ // full kernel build tree, it's possible to get at types that aren't in the
+ // normal include path, e.g.:
+ // @cast(foo, "bsd_acct_struct", "kernel<kernel/acct.c>")->...
omf << "CFLAGS_" << basename << ".o := -include " << header << endl;
+
omf << "obj-m := " + basename + ".o" << endl;
omf.close();
@@ -493,6 +502,11 @@ make_typequery_umod(systemtap_session& s, const string& header, string& name)
name = s.tmpdir + "/typequery_umod_" + lex_cast<string>(++tick) + ".so";
// make the module
+ //
+ // NB: As with kmod, using -include makes relative paths more useful. The
+ // cwd in this case will be the cwd of stap itself though, which may be
+ // trickier to deal with. It might be better to "cd `dirname $script`"
+ // first...
string cmd = "gcc -shared -g -fno-eliminate-unused-debug-types -o "
+ name + " -xc /dev/null -include " + header;
if (s.verbose < 4)