diff -uNr systemtap-0.8-old/translate.cxx systemtap-0.8-new/translate.cxx --- systemtap-0.8-old/translate.cxx 2008-11-13 21:29:23.000000000 +0100 +++ systemtap-0.8-new/translate.cxx 2009-01-26 17:18:05.000000000 +0100 @@ -28,6 +28,10 @@ #include } +#include +#include +#include + using namespace std; struct var; @@ -4645,12 +4649,39 @@ void emit_symbol_data (systemtap_session& s) { + /* string symfile = "stap-symbols.h"; s.op->newline() << "#include " << lex_cast_qstring (symfile); ofstream kallsyms_out ((s.tmpdir + "/" + symfile).c_str()); + */ + string kernel_image = string("/boot/vmlinux-")+s.kernel_release; + struct stat stat_kernel_image; + stat(kernel_image.c_str(), &stat_kernel_image); + + char last_modification[40]; + sprintf(last_modification, "%lld", (long long int) stat_kernel_image.st_mtime); + + string symfile = string("stap-symbols-") + s.kernel_release.c_str() + "-" + string(last_modification) + ".h"; + + string symbols_dir = s.data_path + "/symbols"; + + string symfile_path = symbols_dir + "/" + symfile; + + s.op->newline() << "#include " << lex_cast_qstring (symfile_path.c_str()); + + if(create_dir(symbols_dir.c_str()) == 0) { + struct stat stat_cached_sym; + + if(stat(symfile_path.c_str(), &stat_cached_sym) == 0) { + return; + } + } + + ofstream kallsyms_out (symfile_path.c_str()); + unwindsym_dump_context ctx = { s, kallsyms_out, 0, s.unwindsym_modules }; // XXX: copied from tapsets.cxx dwflpp::, sadly