diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-03-01 11:55:13 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-03-01 13:31:47 -0800 |
commit | c46b9c0557eda229f1e73ebc54e079b321f997bd (patch) | |
tree | edbd3425b9ba8945f8b75a65ea396c7e69baa44e | |
parent | 0f23cac48fe4e5278e5b35f6a40e6f8a214d5e7c (diff) |
mention ASSERTIONS in abort() calls
-rw-r--r-- | src/postamble.js | 8 | ||||
-rw-r--r-- | tests/test_other.py | 2 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/postamble.js b/src/postamble.js index bb1e334c..603b330c 100644 --- a/src/postamble.js +++ b/src/postamble.js @@ -181,7 +181,13 @@ function abort(text) { ABORT = true; EXITSTATUS = 1; - throw 'abort() at ' + stackTrace(); +#if ASSERTIONS == 0 + var extra = '\nIf this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.'; +#else + var extra = ''; +#endif + + throw 'abort() at ' + stackTrace() + extra; } Module['abort'] = Module.abort = abort; diff --git a/tests/test_other.py b/tests/test_other.py index 678fa90d..18a64c85 100644 --- a/tests/test_other.py +++ b/tests/test_other.py @@ -555,7 +555,7 @@ f.close() 'Incompatible function pointer casts are very dangerous with ASM_JS=1, you should investigate and correct these']) # asm, so failure else: # fastcomp. all asm, so it can't just work with wrong sigs. but, ASSERTIONS=2 gives much better info to debug - test(['-O1'], 'abort') # no useful info + test(['-O1'], 'If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.') # no useful info, but does mention ASSERTIONS test(['-O1', '-s', 'ASSERTIONS=1'], '''Invalid function pointer called with signature 'v'. Perhaps this is an invalid value (e.g. caused by calling a virtual method on a NULL pointer)? Or calling a function with an incorrect type, which will fail? (it is worth building your source files with -Werror (warnings are errors), as warnings can indicate undefined behavior which can cause this) Build with ASSERTIONS=2 for more info. ''') # some useful text |