src,worker: display remaining handles if `uv_loop_close` fails
This is refactoring our native stack trace code, and adding support for a better error message when a uv_loop_close()
for a worker fails because there are still active handles.
Example output in that case (taken from test failures on the current canary
branch while looking into https://github.com/nodejs/node-v8/issues/66):
uv loop at [0x5623f5b32950] has active handles
[0x5623f5b13360] async
Close callback: (nil)
Data: 0x5623f5b343e0
(First field): 0x5623f4dbf000 vtable for node::PerIsolatePlatformData [out/Release/node]
out/Release/node[28598]: ../src/debug_utils.cc:217:void node::CheckedUvLoopClose(uv_loop_t*): Assertion `0 && "uv_loop_close() while having open handles"' failed.
1: node::Abort() [out/Release/node]
[ ... stack trace ... ]
As opposed to the previous error message:
out/Release/node[31550]: ../src/node_worker.cc:307:virtual node::worker::Worker::~Worker(): Assertion `(uv_loop_close(&loop_)) == (0)' failed.
1: node::Abort() [out/Release/node]
[ ... stack trace ... ]
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines