Skip to content

Instantly share code, notes, and snippets.

@laverdet
Created April 26, 2016 00:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laverdet/3feac4d902b224d31c1576fab3c56c10 to your computer and use it in GitHub Desktop.
Save laverdet/3feac4d902b224d31c1576fab3c56c10 to your computer and use it in GitHub Desktop.
node or v8 bug?
marcel@marcel-2 ~ $ node -v
v5.10.1
marcel@marcel-2 ~ $ cat a.js
"use strict";
switch (1) {
case 2:
let foo;
}
foo.bar;
marcel@marcel-2 ~ $ node a.js
Stacktrace (bbbbbbbb-bbbbbbbb) 0x1be2a7a041e9 0x0:
==== JS stack trace =========================================
Security context: 0x1be2a7ad81b1 <JS Object>
1: /* anonymous */ [/Users/marcel/a.js:6] [pc=0x3080ab45095e] (this=0x372e780a8341 <an Object with map 0x1f501d308301>,exports=0x372e780a8341 <an Object with map 0x1f501d308301>,require=0x372e780aaba1 <JS Function require (SharedFunctionInfo 0x1e72da1420a9)>,module=0x372e780a8249 <a Module with map 0x20abb24179d1>,__filename=0x372e780a5f59 <String[18]: /Users/marcel/a.js>,__dirname=0x372e780aaa81 <String[13]: /Users/marcel>)
3: _compile [module.js:413] [pc=0x3080ab4502bc] (this=0x372e780a8249 <a Module with map 0x20abb24179d1>,content=0x372e780aa689 <String[58]\: "use strict";\nswitch (1) {\n\x09case 2:\n\x09\x09let foo;\n}\nfoo.bar;\n>,filename=0x372e780a5f59 <String[18]: /Users/marcel/a.js>)
4: .js [module.js:422] [pc=0x3080ab448f6b] (this=0x372e780a3241 <an Object with map 0x20abb2416d71>,module=0x372e780a8249 <a Module with map 0x20abb24179d1>,filename=0x372e780a5f59 <String[18]: /Users/marcel/a.js>)
5: load [module.js:357] [pc=0x3080ab44669b] (this=0x372e780a8249 <a Module with map 0x20abb24179d1>,filename=0x372e780a5f59 <String[18]: /Users/marcel/a.js>)
6: _load [module.js:314] [pc=0x3080ab43beee] (this=0x372e78060651 <JS Function Module (SharedFunctionInfo 0x1e72da116a09)>,request=0x372e7805bf19 <String[18]: /Users/marcel/a.js>,parent=0x1be2a7a04101 <null>,isMain=0x1be2a7a04231 <true>)
7: runMain [module.js:447] [pc=0x3080ab43b906] (this=0x372e78060651 <JS Function Module (SharedFunctionInfo 0x1e72da116a09)>)
8: startup(aka startup) [node.js:146] [pc=0x3080ab337af2] (this=0x1be2a7a04189 <undefined>)
9: /* anonymous */ [node.js:404] [pc=0x3080ab335943] (this=0x1be2a7af2261 <JS Global Object>,process=0x1be2a7af2399 <a process with map 0x1f501d3117d9>)
==== Details ================================================
[1]: /* anonymous */ [/Users/marcel/a.js:6] [pc=0x3080ab45095e] (this=0x372e780a8341 <an Object with map 0x1f501d308301>,exports=0x372e780a8341 <an Object with map 0x1f501d308301>,require=0x372e780aaba1 <JS Function require (SharedFunctionInfo 0x1e72da1420a9)>,module=0x372e780a8249 <a Module with map 0x20abb24179d1>,__filename=0x372e780a5f59 <String[18]: /Users/marcel/a.js>,__dirname=0x372e780aaa81 <String[13]: /Users/marcel>) {
// stack-allocated locals
var foo = 0x1be2a7a041e9 <the hole>
// expression stack (top to bottom)
[04] : 0x1e72da141c89 <FixedArray[6]>
[03] : 4
[02] : 0x1e72da141c59 <String[3]: bar>
[01] : 0x1be2a7a041e9 <the hole>
--------- s o u r c e c o d e ---------
function (exports, require, module, __filename, __dirname) { "use strict";\x0aswitch (1) {\x0a\x09case 2:\x0a\x09\x09let foo;\x0a}\x0afoo.bar;\x0a\x0a}
-----------------------------------------
}
[3]: _compile [module.js:413] [pc=0x3080ab4502bc] (this=0x372e780a8249 <a Module with map 0x20abb24179d1>,content=0x372e780aa689 <String[58]\: "use strict";\nswitch (1) {\n\x09case 2:\n\x09\x09let foo;\n}\nfoo.bar;\n>,filename=0x372e780a5f59 <String[18]: /Users/marcel/a.js>) {
// stack-allocated locals
var wrapper = 0x372e780aa771 <String[124]\: (function (exports, require, module, __filename, __dirname) { "use strict";\nswitch (1) {\n\x09case 2:\n\x09\x09let foo;\n}\nfoo.bar;\n\n});>
var compiledWrapper = 0x372e780aaa39 <JS Function (SharedFunctionInfo 0x1e72da141da1)>
var dirname = 0x372e780aaa81 <String[13]: /Users/marcel>
var require = 0x372e780aaba1 <JS Function require (SharedFunctionInfo 0x1e72da1420a9)>
var args = 0x372e780aafd9 <JS Array[5]>
var depth = 0
var result = 0x1be2a7a041e9 <the hole>
// expression stack (top to bottom)
[10] : 0x372e780aafd9 <JS Array[5]>
[09] : 0x372e780a8341 <an Object with map 0x1f501d308301>
[08] : 0x372e780aaa39 <JS Function (SharedFunctionInfo 0x1e72da141da1)>
[07] : 0x1be2a7ac8899 <JS Function apply (SharedFunctionInfo 0x1be2a7a7c279)>
--------- s o u r c e c o d e ---------
function (content, filename) {\x0a // remove shebang\x0a content = content.replace(shebangRe, '');\x0a\x0a // create wrapper function\x0a var wrapper = Module.wrap(content);\x0a\x0a var compiledWrapper = runInThisContext(wrapper,\x0a { filename: filename, lineOffset: 0 });\x0a if (global.v8de...
-----------------------------------------
}
[4]: .js [module.js:422] [pc=0x3080ab448f6b] (this=0x372e780a3241 <an Object with map 0x20abb2416d71>,module=0x372e780a8249 <a Module with map 0x20abb24179d1>,filename=0x372e780a5f59 <String[18]: /Users/marcel/a.js>) {
// stack-allocated locals
var content = 0x372e780aa689 <String[58]\: "use strict";\nswitch (1) {\n\x09case 2:\n\x09\x09let foo;\n}\nfoo.bar;\n>
// expression stack (top to bottom)
[04] : 0x372e780a5f59 <String[18]: /Users/marcel/a.js>
[03] : 0x372e780aa689 <String[58]\: "use strict";\nswitch (1) {\n\x09case 2:\n\x09\x09let foo;\n}\nfoo.bar;\n>
[02] : 0x372e780a8249 <a Module with map 0x20abb24179d1>
[01] : 0x1e72da135e89 <JS Function Module._compile (SharedFunctionInfo 0x1e72da1172d1)>
--------- s o u r c e c o d e ---------
function (module, filename) {\x0a var content = fs.readFileSync(filename, 'utf8');\x0a module._compile(internalModule.stripBOM(content), filename);\x0a}
-----------------------------------------
}
[5]: load [module.js:357] [pc=0x3080ab44669b] (this=0x372e780a8249 <a Module with map 0x20abb24179d1>,filename=0x372e780a5f59 <String[18]: /Users/marcel/a.js>) {
// stack-allocated locals
var extension = 0x372e780a9849 <String[3]: .js>
// expression stack (top to bottom)
[04] : 0x372e780a5f59 <String[18]: /Users/marcel/a.js>
[03] : 0x372e780a8249 <a Module with map 0x20abb24179d1>
[02] : 0x372e780a3241 <an Object with map 0x20abb2416d71>
[01] : 0x1e72da135ef1 <JS Function Module._extensions..js (SharedFunctionInfo 0x1e72da117379)>
--------- s o u r c e c o d e ---------
function (filename) {\x0a debug('load %j for module %j', filename, this.id);\x0a\x0a assert(!this.loaded);\x0a this.filename = filename;\x0a this.paths = Module._nodeModulePaths(path.dirname(filename));\x0a\x0a var extension = path.extname(filename) || '.js';\x0a if (!Module._extensions[extension]) extension = '.js';\x0a Module...
-----------------------------------------
}
[6]: _load [module.js:314] [pc=0x3080ab43beee] (this=0x372e78060651 <JS Function Module (SharedFunctionInfo 0x1e72da116a09)>,request=0x372e7805bf19 <String[18]: /Users/marcel/a.js>,parent=0x1be2a7a04101 <null>,isMain=0x1be2a7a04231 <true>) {
// stack-allocated locals
var filename = 0x372e780a5f59 <String[18]: /Users/marcel/a.js>
var cachedModule = 0x1be2a7a04189 <undefined>
var module = 0x372e780a8249 <a Module with map 0x20abb24179d1>
var hadException = 0x1be2a7a04231 <true>
// expression stack (top to bottom)
[07] : 0x372e780a5f59 <String[18]: /Users/marcel/a.js>
[06] : 0x372e780a8249 <a Module with map 0x20abb24179d1>
[05] : 0x1e72da135df9 <JS Function Module.load (SharedFunctionInfo 0x1e72da117181)>
[04] : 0x372e780604c9 <FixedArray[29]>
--------- s o u r c e c o d e ---------
function (request, parent, isMain) {\x0a if (parent) {\x0a debug('Module._load REQUEST %s parent: %s', request, parent.id);\x0a }\x0a\x0a var filename = Module._resolveFilename(request, parent);\x0a\x0a var cachedModule = Module._cache[filename];\x0a if (cachedModule) {\x0a return cachedModule.exports;\x0a }\x0a\x0a if (NativeModu...
-----------------------------------------
}
[7]: runMain [module.js:447] [pc=0x3080ab43b906] (this=0x372e78060651 <JS Function Module (SharedFunctionInfo 0x1e72da116a09)>) {
// expression stack (top to bottom)
[04] : 0x1be2a7a04231 <true>
[03] : 0x1be2a7a04101 <null>
[02] : 0x372e7805bf19 <String[18]: /Users/marcel/a.js>
[01] : 0x372e78060651 <JS Function Module (SharedFunctionInfo 0x1e72da116a09)>
[00] : 0x1e72da135d11 <JS Function Module._load (SharedFunctionInfo 0x1e72da117031)>
--------- s o u r c e c o d e ---------
function () {\x0a // Load the main module--the command line argument.\x0a Module._load(process.argv[1], null, true);\x0a // Handle any nextTicks added in the first tick of the program\x0a process._tickCallback();\x0a}
-----------------------------------------
}
[8]: startup(aka startup) [node.js:146] [pc=0x3080ab337af2] (this=0x1be2a7a04189 <undefined>) {
// stack-allocated locals
var EventEmitter = 0x372e780041e9 <JS Function EventEmitter (SharedFunctionInfo 0x1be2a7aea671)>
var _process = 0x372e7803f7b1 <an Object with map 0x20abb240a929>
var cluster = 0x1be2a7a04189 <undefined>
var path = 0x372e7805b8c9 <an Object with map 0x20abb240c089>
var Module = 0x372e78060651 <JS Function Module (SharedFunctionInfo 0x1e72da116a09)>
var vm = 0x1be2a7a04189 <undefined>
var fs = 0x1be2a7a04189 <undefined>
var internalModule = 0x1be2a7a04189 <undefined>
var filename = 0x1be2a7a04189 <undefined>
var source = 0x1be2a7a04189 <undefined>
var debugTimeout = 0x1be2a7a04189 <undefined>
var cliRepl = 0x1be2a7a04189 <undefined>
// heap-allocated locals
var code = 0x1be2a7a04189 <undefined>
// expression stack (top to bottom)
[13] : 0x372e78060651 <JS Function Module (SharedFunctionInfo 0x1e72da116a09)>
[12] : 0x1e72da135ff9 <JS Function Module.runMain (SharedFunctionInfo 0x1e72da117571)>
--------- s o u r c e c o d e ---------
function startup() {\x0a var EventEmitter = NativeModule.require('events');\x0a process._eventsCount = 0;\x0a\x0a Object.setPrototypeOf(process, Object.create(EventEmitter.prototype, {\x0a constructor: {\x0a value: process.constructor\x0a }\x0a }));\x0a\x0a EventEmitter.call(process);\x0a\x0a process.EventEmitter = ...
-----------------------------------------
}
[9]: /* anonymous */ [node.js:404] [pc=0x3080ab335943] (this=0x1be2a7af2261 <JS Global Object>,process=0x1be2a7af2399 <a process with map 0x1f501d3117d9>) {
// stack-allocated locals
var startup = 0x1be2a7af22d1 <JS Function startup (SharedFunctionInfo 0x1be2a7ae2c61)>
var EXPOSE_INTERNALS = 0x1be2a7a04299 <false>
// heap-allocated locals
var process = 0x1be2a7af2399 <a process with map 0x1f501d3117d9>
var setupProcessObject = 0x1be2a7afa9d1 <JS Function setupProcessObject (SharedFunctionInfo 0x1be2a7ae2d09)>
var setupGlobalVariables = 0x1be2a7af2289 <JS Function setupGlobalVariables (SharedFunctionInfo 0x1be2a7ae2db1)>
var setupGlobalTimeouts = 0x11ae50a0b629 <JS Function setupGlobalTimeouts (SharedFunctionInfo 0x1be2a7ae2e59)>
var setupGlobalConsole = 0x11ae50a0b671 <JS Function setupGlobalConsole (SharedFunctionInfo 0x1be2a7ae2f01)>
var setupProcessFatal = 0x1be2a7afaa19 <JS Function setupProcessFatal (SharedFunctionInfo 0x1be2a7ae2fa9)>
var evalScript = 0x11ae50a0b6b9 <JS Function evalScript (SharedFunctionInfo 0x1be2a7ae3051)>
var preloadModules = 0x11ae50a0b701 <JS Function preloadModules (SharedFunctionInfo 0x1be2a7ae30f9)>
var ContextifyScript = 0x1be2a7ae5ac9 <JS Function ContextifyScript (SharedFunctionInfo 0x1be2a7ae5a39)>
var runInThisContext = 0x1be2a7af21d1 <JS Function runInThisContext (SharedFunctionInfo 0x1be2a7ae31a1)>
var NativeModule = 0x1be2a7af2219 <JS Function NativeModule (SharedFunctionInfo 0x1be2a7ae3249)>
// expression stack (top to bottom)
[03] : 0x1be2a7a04189 <undefined>
[02] : 0x1be2a7af22d1 <JS Function startup (SharedFunctionInfo 0x1be2a7ae2c61)>
--------- s o u r c e c o d e ---------
function (process) {\x0a this.global = this;\x0a\x0a function startup() {\x0a var EventEmitter = NativeModule.require('events');\x0a process._eventsCount = 0;\x0a\x0a Object.setPrototypeOf(process, Object.create(EventEmitter.prototype, {\x0a constructor: {\x0a value: process.constructor\x0a }\x0a }));\x0a\x0a Eve...
-----------------------------------------
}
=====================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment