|
1 | 1 | #include "node_report.h"
|
2 |
| -#include "node_version.h" |
3 | 2 | #include "v8.h"
|
4 | 3 | #include "time.h"
|
5 |
| -#include "zlib.h" |
6 |
| -#include "ares.h" |
7 | 4 |
|
8 | 5 | #include <fcntl.h>
|
9 | 6 | #include <string.h>
|
@@ -52,7 +49,7 @@ using v8::String;
|
52 | 49 | using v8::V8;
|
53 | 50 |
|
54 | 51 | // Internal/static function declarations
|
55 |
| -static void PrintVersionInformation(FILE* fp); |
| 52 | +static void PrintVersionInformation(FILE* fp, Isolate* isolate); |
56 | 53 | static void PrintJavaScriptStack(FILE* fp, Isolate* isolate, DumpEvent event, const char* location);
|
57 | 54 | static void PrintStackFromStackTrace(FILE* fp, Isolate* isolate, DumpEvent event);
|
58 | 55 | static void PrintStackFrame(FILE* fp, Isolate* isolate, Local<StackFrame> frame, int index, void* pc);
|
@@ -317,7 +314,7 @@ void TriggerNodeReport(Isolate* isolate, DumpEvent event, const char* message, c
|
317 | 314 | fflush(fp);
|
318 | 315 |
|
319 | 316 | // Print Node.js and OS version information
|
320 |
| - PrintVersionInformation(fp); |
| 317 | + PrintVersionInformation(fp, isolate); |
321 | 318 | fflush(fp);
|
322 | 319 |
|
323 | 320 | // Print summary JavaScript stack backtrace
|
@@ -369,12 +366,28 @@ void TriggerNodeReport(Isolate* isolate, DumpEvent event, const char* message, c
|
369 | 366 | * Function to print Node.js version, OS version and machine information
|
370 | 367 | *
|
371 | 368 | ******************************************************************************/
|
372 |
| -static void PrintVersionInformation(FILE* fp) { |
| 369 | +static void PrintVersionInformation(FILE* fp, Isolate* isolate) { |
373 | 370 |
|
374 | 371 | // Print Node.js and deps component versions
|
375 |
| - fprintf(fp, "\nNode.js version: %s\n", NODE_VERSION); |
376 |
| - fprintf(fp, "(v8: %s, libuv: %s, zlib: %s, ares: %s)\n", |
377 |
| - V8::GetVersion(), uv_version_string(), ZLIB_VERSION, ARES_VERSION_STR); |
| 372 | + fprintf(fp, "\nprocess.versions = {\n"); |
| 373 | + { |
| 374 | + Nan::MaybeLocal<Value> process = Nan::Get( |
| 375 | + isolate->GetCurrentContext()->Global(), |
| 376 | + Nan::New<String>("process").ToLocalChecked()); |
| 377 | + Local<Value> versions = Nan::Get(process.ToLocalChecked().As<Object>(), |
| 378 | + Nan::New<String>("versions").ToLocalChecked()).ToLocalChecked(); |
| 379 | + Local<Object> versionsObj = versions.As<Object>(); |
| 380 | + Local<v8::Array> keys = Nan::GetOwnPropertyNames(versionsObj) |
| 381 | + .ToLocalChecked(); |
| 382 | + for (uint32_t i = 0, nKeys = (*keys)->Length(); i < nKeys; i++) { |
| 383 | + Local<Value> keyVal = Nan::Get(keys.As<Object>(), i).ToLocalChecked(); |
| 384 | + Local<Value> valVal = Nan::Get(versionsObj, keyVal).ToLocalChecked(); |
| 385 | + Nan::Utf8String name(keyVal); |
| 386 | + Nan::Utf8String version(valVal); |
| 387 | + fprintf(fp, " %s: %s\n", *name, *version); |
| 388 | + } |
| 389 | + } |
| 390 | + fprintf(fp, "}\n"); |
378 | 391 |
|
379 | 392 | // Print operating system and machine information (Windows)
|
380 | 393 | #ifdef _WIN32
|
|
0 commit comments