diff options
author | Josh Stone <jistone@redhat.com> | 2009-04-21 12:08:42 -0700 |
---|---|---|
committer | Josh Stone <jistone@redhat.com> | 2009-04-21 12:34:43 -0700 |
commit | d90053e72a515371936e10bf83ecb822aec91b17 (patch) | |
tree | 4589b3f1e0cb79b47d7d02c0eb49ac97079713fc /buildrun.cxx | |
parent | 31a0ad65c838d0530b321c75c5b328828daa71ac (diff) | |
download | systemtap-steved-d90053e72a515371936e10bf83ecb822aec91b17.tar.gz systemtap-steved-d90053e72a515371936e10bf83ecb822aec91b17.tar.xz systemtap-steved-d90053e72a515371936e10bf83ecb822aec91b17.zip |
Refine the @cast-with-header syntax
The special syntax to generate a module for type information is now:
- "kernel<path/to/header.h>" to use the kernel's build environment
- "<path/to/header.h>" to use no special build environment, and so use
gcc's default parameters only (for user mode).
Diffstat (limited to 'buildrun.cxx')
-rw-r--r-- | buildrun.cxx | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/buildrun.cxx b/buildrun.cxx index 71753e9f..311937e2 100644 --- a/buildrun.cxx +++ b/buildrun.cxx @@ -445,7 +445,7 @@ make_tracequery(systemtap_session& s, string& name, const vector<string>& extra_ // Build a tiny kernel module to query type information -int +static int make_typequery_kmod(systemtap_session& s, const string& header, string& name) { static unsigned tick = 0; @@ -485,7 +485,7 @@ make_typequery_kmod(systemtap_session& s, const string& header, string& name) // Build a tiny user module to query type information -int +static int make_typequery_umod(systemtap_session& s, const string& header, string& name) { static unsigned tick = 0; @@ -500,4 +500,33 @@ make_typequery_umod(systemtap_session& s, const string& header, string& name) return stap_system (cmd.c_str()); } + +int +make_typequery(systemtap_session& s, string& module) +{ + int rc; + string new_module; + + if (module[module.size() - 1] != '>') + return -1; + + if (module[0] == '<') + { + string header = module.substr(1, module.size() - 2); + rc = make_typequery_umod(s, header, new_module); + } + else if (module.compare(0, 7, "kernel<") == 0) + { + string header = module.substr(7, module.size() - 8); + rc = make_typequery_kmod(s, header, new_module); + } + else + return -1; + + if (!rc) + module = new_module; + + return rc; +} + /* vim: set sw=2 ts=8 cino=>4,n-2,{2,^-2,t0,(0,u0,w1,M1 : */ |