aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-09-02 16:57:05 -0700
committerAlon Zakai <alonzakai@gmail.com>2011-09-02 16:57:05 -0700
commitfa9e495e4dcd5c433c74175974d7d0962aa10df6 (patch)
tree58a4697fe736ddde206dea96392cb9a3360d4bc8
parentcb596dcd841e22143ae8fdb66c1356a7553b93f8 (diff)
LIBRARY_DEBUG option
-rw-r--r--src/jsifier.js3
-rw-r--r--src/settings.js1
2 files changed, 4 insertions, 0 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 1c512581..f20bd680 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -314,6 +314,9 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) {
snippet = snippet.toString();
// name the function; overwrite if it's already named
snippet = snippet.replace(/function(?:\s+([^(]+))?\s*\(/, 'function _' + ident + '(');
+ if (LIBRARY_DEBUG) {
+ snippet = snippet.replace('{', '{ print("[library call:' + ident + ']"); ');
+ }
}
var postsetId = ident + '__postset';
diff --git a/src/settings.js b/src/settings.js
index 88887794..1d67e5b4 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -69,6 +69,7 @@ SAFE_HEAP_LOG = 0; // Log out all SAFE_HEAP operations
LABEL_DEBUG = 0; // Print out labels and functions as we enter them
EXCEPTION_DEBUG = 1; // Print out exceptions in emscriptened code
+LIBRARY_DEBUG = 0; // Print out when we enter a library call (library*.js)
DISABLE_EXCEPTIONS = 0; // Disables generating code to actually catch exceptions. If the code you
// are compiling does not actually rely on catching exceptions (but the
// compiler generates code for it, maybe because of stdlibc++ stuff),