From 984e043d7999c866d20b7bc08eb1c1d641ca9266 Mon Sep 17 00:00:00 2001 From: Brian Sheedy Date: Thu, 16 Feb 2023 10:51:13 -0800 Subject: [PATCH] Print Crashpad annotation objects Updates minidump_dump to print out any Crashpad annotation objects that are in a minidump. If an annotation contains a string value, it will be printed out as such, otherwise it will be printed out as hex bytes. Bug: crashpad:329 Change-Id: Ieecd6381c623f9011b16357742f7145a118dbc3c Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4261631 Reviewed-by: Joshua Peraza --- src/processor/minidump.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/processor/minidump.cc b/src/processor/minidump.cc index 135770d5..2df932f4 100644 --- a/src/processor/minidump.cc +++ b/src/processor/minidump.cc @@ -5479,6 +5479,27 @@ void MinidumpCrashpadInfo::Print() { printf(" module_list[%d].simple_annotations[\"%s\"] = %s\n", module_index, annot.first.c_str(), annot.second.c_str()); } + const auto& crashpad_annots = + module_crashpad_info_annotation_objects_[module_index]; + for (const AnnotationObject& annot : crashpad_annots) { + std::string str_value; + if (annot.type == 1) { + // Value represents a C-style string. + for (const uint8_t& v : annot.value) { + str_value.append(1, static_cast(v)); + } + } else { + // Value represents something else. + char buffer[3]; + for (const uint8_t& v : annot.value) { + sprintf(buffer, "%X", v); + str_value.append(buffer); + } + } + printf( + " module_list[%d].crashpad_annotations[\"%s\"] (type = %u) = %s\n", + module_index, annot.name.c_str(), annot.type, str_value.c_str()); + } printf(" address_mask = %" PRIu64 "\n", crashpad_info_.address_mask); }