Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(784)

Unified Diff: components/browser_watcher/dump_postmortem_minidump_main_win.cc

Issue 2657693002: Postmortem dumper: dump user data (Closed)
Patch Set: Fix format specifier Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/browser_watcher/dump_postmortem_minidump_main_win.cc
diff --git a/components/browser_watcher/dump_postmortem_minidump_main_win.cc b/components/browser_watcher/dump_postmortem_minidump_main_win.cc
index 246a06a56b0cef2d1f0293e2c9e8a555561fcf0b..07660115268c863d80368ae59c6242440612e0d3 100644
--- a/components/browser_watcher/dump_postmortem_minidump_main_win.cc
+++ b/components/browser_watcher/dump_postmortem_minidump_main_win.cc
@@ -39,6 +39,58 @@ void Indent(FILE* out, size_t indent_level) {
fprintf(out, " ");
}
+void PrintUserData(
+ FILE* out,
+ size_t indent_level,
+ const google::protobuf::Map<std::string, browser_watcher::TypedValue>&
+ user_data) {
+ DCHECK(out);
+ Indent(out, indent_level);
+ fprintf(out, "User data (%zu)\n", user_data.size());
+ for (const auto& kv : user_data) {
+ Indent(out, indent_level + 1);
+ fprintf(out, "%s : ", kv.first.c_str());
+ const browser_watcher::TypedValue& value = kv.second;
+ switch (kv.second.value_case()) {
+ case browser_watcher::TypedValue::kBytesValue: {
+ const std::string& bytes_value = value.bytes_value();
+ for (size_t i = 0; i < bytes_value.size(); ++i)
+ fprintf(out, "%02X", bytes_value.at(i));
bcwhite 2017/01/27 15:16:57 perhaps "%02X " (separate bytes with a space?)
manzagop (departed) 2017/01/27 19:16:42 Done.
+ fprintf(out, "\n");
+ break;
+ }
+ case browser_watcher::TypedValue::kBytesReference:
+ fprintf(out, "bytes reference (address: %llu, size: %lld)\n",
bcwhite 2017/01/27 15:16:57 Should size be "%llu" as well?
manzagop (departed) 2017/01/27 19:16:42 Hm. The size is stored and analyzed as unsigned, b
bcwhite 2017/01/27 20:03:24 The address could be a problem, given that a rando
manzagop (departed) 2017/01/27 20:15:42 I created https://crbug.com/686187
+ value.bytes_reference().address(),
+ value.bytes_reference().size());
+ break;
+ case browser_watcher::TypedValue::kStringValue:
+ fprintf(out, "%s\n", value.string_value().c_str());
bcwhite 2017/01/27 15:16:57 "\"%s\"\n" in case there are spaces at the head or
manzagop (departed) 2017/01/27 19:16:42 Done.
+ break;
+ case browser_watcher::TypedValue::kStringReference:
+ fprintf(out, "string reference (address: %llu, size: %lld)\n",
+ value.string_reference().address(),
+ value.string_reference().size());
+ break;
+ case browser_watcher::TypedValue::kCharValue:
+ fprintf(out, "%s\n", value.char_value().c_str());
bcwhite 2017/01/27 15:16:57 "'%s'\n"
manzagop (departed) 2017/01/27 19:16:42 Done.
+ break;
+ case browser_watcher::TypedValue::kBoolValue:
+ fprintf(out, "%d\n", value.bool_value());
bcwhite 2017/01/27 15:16:57 "%s", value.bool_value() ? "true" : "false"
manzagop (departed) 2017/01/27 19:16:42 Done.
+ break;
+ case browser_watcher::TypedValue::kSignedValue:
+ fprintf(out, "%lld\n", value.signed_value());
+ break;
+ case browser_watcher::TypedValue::kUnsignedValue:
+ fprintf(out, "%llu\n", value.unsigned_value());
+ break;
+ case browser_watcher::TypedValue::VALUE_NOT_SET:
+ fprintf(out, "<not set>\n");
+ break;
+ }
+ }
+}
+
void PrintActivity(FILE* out,
size_t indent_level,
const browser_watcher::Activity& activity) {
@@ -74,6 +126,8 @@ void PrintActivity(FILE* out,
fprintf(out, "process_id: %lld\n", activity.process_id());
break;
}
+
+ PrintUserData(out, indent_level + 1, activity.user_data());
}
void PrintProcessState(FILE* out,
@@ -90,6 +144,7 @@ void PrintProcessState(FILE* out,
// TODO(manzagop): flesh out as StabilityReport gets fleshed out.
void PrintReport(FILE* out, const browser_watcher::StabilityReport& report) {
+ PrintUserData(out, 0U, report.global_data());
for (int i = 0; i < report.process_states_size(); ++i) {
const browser_watcher::ProcessState process = report.process_states(i);
PrintProcessState(out, process);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698