summaryrefslogtreecommitdiffstats
path: root/cache.cxx
diff options
context:
space:
mode:
authordsmith <dsmith>2006-11-08 19:10:21 +0000
committerdsmith <dsmith>2006-11-08 19:10:21 +0000
commitd1b3549da1b8013bd791b27f02cee2293505b075 (patch)
treede4fbbd6f5844c55b27c8d03e0a7cb7fa59196b9 /cache.cxx
parentc4bb5be2defde1d2f99ede96b6de48684f8934e6 (diff)
downloadsystemtap-steved-d1b3549da1b8013bd791b27f02cee2293505b075.tar.gz
systemtap-steved-d1b3549da1b8013bd791b27f02cee2293505b075.tar.xz
systemtap-steved-d1b3549da1b8013bd791b27f02cee2293505b075.zip
2006-11-08 David Smith <dsmith@redhat.com>
* cache.cxx (get_from_cache): To preserve semantics with non-cached use, if the last pass is 3, display the cached C source.
Diffstat (limited to 'cache.cxx')
-rw-r--r--cache.cxx15
1 files changed, 13 insertions, 2 deletions
diff --git a/cache.cxx b/cache.cxx
index 0bbc8416..247bb96b 100644
--- a/cache.cxx
+++ b/cache.cxx
@@ -3,6 +3,7 @@
#include "util.h"
#include <cerrno>
#include <string>
+#include <fstream>
extern "C" {
#include <sys/types.h>
@@ -96,6 +97,18 @@ get_from_cache(systemtap_session& s)
}
}
+ // We're done with these file handles.
+ close(fd_module);
+ close(fd_c);
+
+ // To preserve semantics (since this will happen if we're not
+ // caching), display the C source if the last pass is 3.
+ if (s.last_pass == 3)
+ {
+ ifstream i (s.translated_source.c_str());
+ cout << i.rdbuf();
+ }
+
// If everything worked, tell the user. We need to do this here,
// since if copying the cached C file works, but copying the cached
// module fails, we remove the cached C file and let the C file get
@@ -107,7 +120,5 @@ get_from_cache(systemtap_session& s)
clog << "Pass 4: using cached " << s.hash_path << endl;
}
- close(fd_module);
- close(fd_c);
return true;
}