diff options
author | Jukka Jylänki <jujjyl@gmail.com> | 2014-05-16 12:38:55 +0300 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2014-05-23 02:20:06 +0300 |
commit | a08e845a8cef8492ac56211d5bc00596ca021192 (patch) | |
tree | 64c0fb0a69b5f471a43bd531cfab35ea0c974cb5 /src | |
parent | 4800e3b7f8d0c8402bfb2d0fbd5a1780acce772a (diff) |
Improve error messages from SAFE_HEAP_ACCESS function.
Diffstat (limited to 'src')
-rw-r--r-- | src/preamble.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/preamble.js b/src/preamble.js index e0ed8786..c4db3d1e 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -41,13 +41,13 @@ var ACCEPTABLE_SAFE_HEAP_ERRORS = 0; function SAFE_HEAP_ACCESS(dest, type, store, ignore, storeValue) { //if (dest === A_NUMBER) Module.print ([dest, type, store, ignore, storeValue] + ' ' + stackTrace()); // Something like this may be useful, in debugging - assert(dest > 0, 'segmentation fault'); + if (dest <= 0) abort('segmentation fault ' + (store ? ('storing value ' + storeValue) : 'loading') + ' type ' + type + ' at address ' + dest); #if USE_TYPED_ARRAYS // When using typed arrays, reads over the top of TOTAL_MEMORY will fail silently, so we must // correct that by growing TOTAL_MEMORY as needed. Without typed arrays, memory is a normal // JS array so it will work (potentially slowly, depending on the engine). - assert(ignore || dest < Math.max(DYNAMICTOP, STATICTOP)); + if (!ignore && dest >= Math.max(DYNAMICTOP, STATICTOP)) abort('segmentation fault ' + (store ? ('storing value ' + storeValue) : 'loading') + ' type ' + type + ' at address ' + dest + '. Heap ends at address ' + Math.max(DYNAMICTOP, STATICTOP)); assert(ignore || DYNAMICTOP <= TOTAL_MEMORY); #endif |