diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-02-10 02:06:03 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2019-02-12 02:55:46 +0300 |
commit | 2c84f6e75cc513fe6e958f0489d104ee883db232 (patch) | |
tree | a7e70744a9d17cec3433cdd040366d26e0575bbc /src/node_report.cc | |
parent | 6edf88284b2ef522d2f073e66fa32e9cbe6fafd2 (diff) |
report: make more items programmatically accessible
Prefer structured output over stringified information
for libuv handles and the native stack trace.
PR-URL: https://github.com/nodejs/node/pull/26019
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_report.cc')
-rw-r--r-- | src/node_report.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/node_report.cc b/src/node_report.cc index 7477a2fd240..1a459a2d1c9 100644 --- a/src/node_report.cc +++ b/src/node_report.cc @@ -216,9 +216,8 @@ void GetNodeReport(Isolate* isolate, // Obtain the current time and the pid (platform dependent) TIME_TYPE tm_struct; LocalTime(&tm_struct); - std::string str = "NA"; WriteNodeReport( - isolate, env, message, location, str, out, stackstr, &tm_struct); + isolate, env, message, location, "", out, stackstr, &tm_struct); } // Internal function to coordinate and write the various @@ -249,7 +248,7 @@ static void WriteNodeReport(Isolate* isolate, if (!filename.empty()) writer.json_keyvalue("filename", filename); else - writer.json_keyvalue("filename", "''"); + writer.json_keyvalue("filename", JSONWriter::Null{}); // Report dump event and module load date/time stamps char timebuf[64]; @@ -431,13 +430,13 @@ static void PrintNativeStack(JSONWriter* writer) { const int size = sym_ctx->GetStackTrace(frames, arraysize(frames)); writer->json_arraystart("nativeStack"); int i; - std::ostringstream buf; for (i = 1; i < size; i++) { void* frame = frames[i]; - buf.str(""); - buf << " [pc=" << frame << "] "; - buf << sym_ctx->LookupSymbol(frame).Display().c_str(); - writer->json_element(buf.str()); + writer->json_start(); + writer->json_keyvalue("pc", + ValueToHexString(reinterpret_cast<uintptr_t>(frame))); + writer->json_keyvalue("symbol", sym_ctx->LookupSymbol(frame).Display()); + writer->json_end(); } writer->json_arrayend(); } |