Ref: this comment by @mscdex: https://github.com/nodejs/node/issues/6121#issuecomment-207679785
I've been attempting to get a coredump with node --abort-on-uncaught-exception test.js on Windows. The test fails as expected, but I'm not sure whether the core has been generated and where to find it.
I've checked %localappdata%\Microsoft\Windows\WER.
I checked the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting and there wasn't a LocalDumps key. I've manually added one following these instructions and then rebooted. However I haven't found anything in C:\Gib.
I assume this is a setup problem, but can anyone confirm that it is actually possible to get a core dump from Windows.
cc. @orangemocha

C:\gib\code\node_test>node --abort-on-uncaught-exception t.js
Uncaught Input String Too Big
FROM
main (C:\gib\code\node_test\t.js:9:7)
Object.<anonymous> (C:\gib\code\node_test\t.js:14:1)
Module._compile (module.js:541:32)
Object.Module._extensions..js (module.js:550:10)
Module.load (module.js:458:32)
tryModuleLoad (module.js:417:12)
Function.Module._load (module.js:409:3)
Module.runMain (module.js:575:10)
run (bootstrap_node.js:352:7)
startup (bootstrap_node.js:144:9)
bootstrap_node.js:467:3
function main() {
var inputObject = {
input: ["one", "two", "three", "fifteen", "one hundred"],
counter:0,
};
for(; inputObject.counter< inputObject.input.length; inputObject.counter++) {
if (inputObject.input[inputObject.counter].length > 8) {
throw "Input String Too Big";
}
}
}
main();
@gibfahn I don't know if WER can be used to generate a dump (that MSDN page says so, but I had the same luck as you). You can accomplish this by using Visual Studio: Open the node.sln solution, then in the Solution Explorer right-click the node project and Set as StartUp Project. Right-click again and select Properties, then under Debugging you can set the Command Arguments to --abort-on-uncaught-exception C:\gib\code\node_test\t.js. (That setting changes with the active configuration, so make sure it matches what you have enabled: Debug or Release.)
Start the debugger and it will stop on the v8 abort. From the Debug menu you can save a dump file if you want.
Thanks @joaocgreis, that sounds like the easiest graphical way.
I've been trying to script the coredumps though, so I've been looking for a command line utility. It looks like the easiest way is with procdump. I've managed to get a dump file (extension .dmp) with the following command:
procdump -e -ma -x C:\put\dump\here C:\path\to\node.exe --abort-on-uncaught-exception C:\path\to\throw_exception.js
-e = dump on error
-ma = full dump
-x = execute program with arguments
Doesn't look like v8 supports core dumps on Windows natively, so I guess there's no easier method than downloading procdump (which is at least a 600kb Microsoft Sysinternals standalone .exe).
Looks like this commit in V8 may add coredumps for windows. not sure whether it would work with node --abort-on-uncaught-exception though, or when it will get into node.
Discussion: https://groups.google.com/forum/#!topic/v8-dev/-WQike4xUp8
Commit: https://github.com/v8/v8/commit/49c14f63ef1ea94b8d7b5a9dfe939b2dbc02e42e (original https://chromium.googlesource.com/v8/v8/+/49c14f63ef1ea94b8d7b5a9dfe939b2dbc02e42e)
@ofrobots I know it's a long shot, but do you know if it is now possible to get core dumps in Windows in node with --abort-on-uncaught-exception? I'm pretty sure that the above commit is now in Node master (with v8 5.4), but I'm still not getting dumps anywhere. Is it possible that Node needs to do something to enable them (or maybe I misunderstood the above discussion and we still can't get dumps through v8 in windows)?
It's only been a year https://github.com/nodejs/node/pull/13947#issuecomment-312231068
Most helpful comment
@gibfahn I don't know if WER can be used to generate a dump (that MSDN page says so, but I had the same luck as you). You can accomplish this by using Visual Studio: Open the
node.slnsolution, then in the Solution Explorer right-click thenodeproject andSet as StartUp Project. Right-click again and selectProperties, then underDebuggingyou can set theCommand Argumentsto--abort-on-uncaught-exception C:\gib\code\node_test\t.js. (That setting changes with the active configuration, so make sure it matches what you have enabled: Debug or Release.)Start the debugger and it will stop on the v8 abort. From the
Debugmenu you can save a dump file if you want.