From 1f15e4e3e43e73d2df7af897347b1ea29e7ddca1 Mon Sep 17 00:00:00 2001 From: Joshua Peraza Date: Thu, 16 Apr 2020 11:12:55 -0700 Subject: [PATCH] Use portable format macros Bug: 1071277 Change-Id: Ic65704a20c55fea83b5633650ee2c769ac227a56 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/2153333 Reviewed-by: Mike Frysinger --- src/common/dwarf/dwarf2reader.cc | 45 ++++++++++++++++---------------- src/common/dwarf_cu_to_module.cc | 27 ++++++++++--------- 2 files changed, 37 insertions(+), 35 deletions(-) diff --git a/src/common/dwarf/dwarf2reader.cc b/src/common/dwarf/dwarf2reader.cc index e615fc4b..6b9ce2b4 100644 --- a/src/common/dwarf/dwarf2reader.cc +++ b/src/common/dwarf/dwarf2reader.cc @@ -50,6 +50,7 @@ #include "common/dwarf/bytereader.h" #include "common/dwarf/line_state_machine.h" #include "common/using_std_string.h" +#include "google_breakpad/common/breakpad_types.h" namespace dwarf2reader { @@ -2686,14 +2687,14 @@ bool CallFrameInfo::ReportIncomplete(Entry *entry) { void CallFrameInfo::Reporter::Incomplete(uint64_t offset, CallFrameInfo::EntryKind kind) { fprintf(stderr, - "%s: CFI %s at offset 0x%llx in '%s': entry ends early\n", + "%s: CFI %s at offset 0x%" PRIx64 " in '%s': entry ends early\n", filename_.c_str(), CallFrameInfo::KindName(kind), offset, section_.c_str()); } void CallFrameInfo::Reporter::EarlyEHTerminator(uint64_t offset) { fprintf(stderr, - "%s: CFI at offset 0x%llx in '%s': saw end-of-data marker" + "%s: CFI at offset 0x%" PRIx64 " in '%s': saw end-of-data marker" " before end of section contents\n", filename_.c_str(), offset, section_.c_str()); } @@ -2701,22 +2702,22 @@ void CallFrameInfo::Reporter::EarlyEHTerminator(uint64_t offset) { void CallFrameInfo::Reporter::CIEPointerOutOfRange(uint64_t offset, uint64_t cie_offset) { fprintf(stderr, - "%s: CFI frame description entry at offset 0x%llx in '%s':" - " CIE pointer is out of range: 0x%llx\n", + "%s: CFI frame description entry at offset 0x%" PRIx64 " in '%s':" + " CIE pointer is out of range: 0x%" PRIx64 "\n", filename_.c_str(), offset, section_.c_str(), cie_offset); } void CallFrameInfo::Reporter::BadCIEId(uint64_t offset, uint64_t cie_offset) { fprintf(stderr, - "%s: CFI frame description entry at offset 0x%llx in '%s':" - " CIE pointer does not point to a CIE: 0x%llx\n", + "%s: CFI frame description entry at offset 0x%" PRIx64 " in '%s':" + " CIE pointer does not point to a CIE: 0x%" PRIx64 "\n", filename_.c_str(), offset, section_.c_str(), cie_offset); } void CallFrameInfo::Reporter::UnexpectedAddressSize(uint64_t offset, uint8_t address_size) { fprintf(stderr, - "%s: CFI frame description entry at offset 0x%llx in '%s':" + "%s: CFI frame description entry at offset 0x%" PRIx64 " in '%s':" " CIE specifies unexpected address size: %d\n", filename_.c_str(), offset, section_.c_str(), address_size); } @@ -2724,14 +2725,14 @@ void CallFrameInfo::Reporter::UnexpectedAddressSize(uint64_t offset, void CallFrameInfo::Reporter::UnexpectedSegmentSize(uint64_t offset, uint8_t segment_size) { fprintf(stderr, - "%s: CFI frame description entry at offset 0x%llx in '%s':" + "%s: CFI frame description entry at offset 0x%" PRIx64 " in '%s':" " CIE specifies unexpected segment size: %d\n", filename_.c_str(), offset, section_.c_str(), segment_size); } void CallFrameInfo::Reporter::UnrecognizedVersion(uint64_t offset, int version) { fprintf(stderr, - "%s: CFI frame description entry at offset 0x%llx in '%s':" + "%s: CFI frame description entry at offset 0x%" PRIx64 " in '%s':" " CIE specifies unrecognized version: %d\n", filename_.c_str(), offset, section_.c_str(), version); } @@ -2739,7 +2740,7 @@ void CallFrameInfo::Reporter::UnrecognizedVersion(uint64_t offset, int version) void CallFrameInfo::Reporter::UnrecognizedAugmentation(uint64_t offset, const string &aug) { fprintf(stderr, - "%s: CFI frame description entry at offset 0x%llx in '%s':" + "%s: CFI frame description entry at offset 0x%" PRIx64 " in '%s':" " CIE specifies unrecognized augmentation: '%s'\n", filename_.c_str(), offset, section_.c_str(), aug.c_str()); } @@ -2747,7 +2748,7 @@ void CallFrameInfo::Reporter::UnrecognizedAugmentation(uint64_t offset, void CallFrameInfo::Reporter::InvalidPointerEncoding(uint64_t offset, uint8_t encoding) { fprintf(stderr, - "%s: CFI common information entry at offset 0x%llx in '%s':" + "%s: CFI common information entry at offset 0x%" PRIx64 " in '%s':" " 'z' augmentation specifies invalid pointer encoding: 0x%02x\n", filename_.c_str(), offset, section_.c_str(), encoding); } @@ -2755,7 +2756,7 @@ void CallFrameInfo::Reporter::InvalidPointerEncoding(uint64_t offset, void CallFrameInfo::Reporter::UnusablePointerEncoding(uint64_t offset, uint8_t encoding) { fprintf(stderr, - "%s: CFI common information entry at offset 0x%llx in '%s':" + "%s: CFI common information entry at offset 0x%" PRIx64 " in '%s':" " 'z' augmentation specifies a pointer encoding for which" " we have no base address: 0x%02x\n", filename_.c_str(), offset, section_.c_str(), encoding); @@ -2763,8 +2764,8 @@ void CallFrameInfo::Reporter::UnusablePointerEncoding(uint64_t offset, void CallFrameInfo::Reporter::RestoreInCIE(uint64_t offset, uint64_t insn_offset) { fprintf(stderr, - "%s: CFI common information entry at offset 0x%llx in '%s':" - " the DW_CFA_restore instruction at offset 0x%llx" + "%s: CFI common information entry at offset 0x%" PRIx64 " in '%s':" + " the DW_CFA_restore instruction at offset 0x%" PRIx64 " cannot be used in a common information entry\n", filename_.c_str(), offset, section_.c_str(), insn_offset); } @@ -2773,8 +2774,8 @@ void CallFrameInfo::Reporter::BadInstruction(uint64_t offset, CallFrameInfo::EntryKind kind, uint64_t insn_offset) { fprintf(stderr, - "%s: CFI %s at offset 0x%llx in section '%s':" - " the instruction at offset 0x%llx is unrecognized\n", + "%s: CFI %s at offset 0x%" PRIx64 " in section '%s':" + " the instruction at offset 0x%" PRIx64 " is unrecognized\n", filename_.c_str(), CallFrameInfo::KindName(kind), offset, section_.c_str(), insn_offset); } @@ -2783,8 +2784,8 @@ void CallFrameInfo::Reporter::NoCFARule(uint64_t offset, CallFrameInfo::EntryKind kind, uint64_t insn_offset) { fprintf(stderr, - "%s: CFI %s at offset 0x%llx in section '%s':" - " the instruction at offset 0x%llx assumes that a CFA rule has" + "%s: CFI %s at offset 0x%" PRIx64 " in section '%s':" + " the instruction at offset 0x%" PRIx64 " assumes that a CFA rule has" " been set, but none has been set\n", filename_.c_str(), CallFrameInfo::KindName(kind), offset, section_.c_str(), insn_offset); @@ -2794,8 +2795,8 @@ void CallFrameInfo::Reporter::EmptyStateStack(uint64_t offset, CallFrameInfo::EntryKind kind, uint64_t insn_offset) { fprintf(stderr, - "%s: CFI %s at offset 0x%llx in section '%s':" - " the DW_CFA_restore_state instruction at offset 0x%llx" + "%s: CFI %s at offset 0x%" PRIx64 " in section '%s':" + " the DW_CFA_restore_state instruction at offset 0x%" PRIx64 " should pop a saved state from the stack, but the stack is empty\n", filename_.c_str(), CallFrameInfo::KindName(kind), offset, section_.c_str(), insn_offset); @@ -2805,8 +2806,8 @@ void CallFrameInfo::Reporter::ClearingCFARule(uint64_t offset, CallFrameInfo::EntryKind kind, uint64_t insn_offset) { fprintf(stderr, - "%s: CFI %s at offset 0x%llx in section '%s':" - " the DW_CFA_restore_state instruction at offset 0x%llx" + "%s: CFI %s at offset 0x%" PRIx64 " in section '%s':" + " the DW_CFA_restore_state instruction at offset 0x%" PRIx64 " would clear the CFA rule in effect\n", filename_.c_str(), CallFrameInfo::KindName(kind), offset, section_.c_str(), insn_offset); diff --git a/src/common/dwarf_cu_to_module.cc b/src/common/dwarf_cu_to_module.cc index 161b9e10..d6e79769 100644 --- a/src/common/dwarf_cu_to_module.cc +++ b/src/common/dwarf_cu_to_module.cc @@ -49,6 +49,7 @@ #include "common/dwarf_line_to_module.h" #include "common/unordered.h" +#include "google_breakpad/common/breakpad_types.h" namespace google_breakpad { @@ -696,7 +697,7 @@ dwarf2reader::DIEHandler *DwarfCUToModule::NamedScopeHandler::FindChildHandler( void DwarfCUToModule::WarningReporter::CUHeading() { if (printed_cu_header_) return; - fprintf(stderr, "%s: in compilation unit '%s' (offset 0x%llx):\n", + fprintf(stderr, "%s: in compilation unit '%s' (offset 0x%" PRIx64 "):\n", filename_.c_str(), cu_name_.c_str(), cu_offset_); printed_cu_header_ = true; } @@ -704,18 +705,18 @@ void DwarfCUToModule::WarningReporter::CUHeading() { void DwarfCUToModule::WarningReporter::UnknownSpecification(uint64_t offset, uint64_t target) { CUHeading(); - fprintf(stderr, "%s: the DIE at offset 0x%llx has a DW_AT_specification" - " attribute referring to the DIE at offset 0x%llx, which was not" - " marked as a declaration\n", + fprintf(stderr, "%s: the DIE at offset 0x%" PRIx64 " has a " + "DW_AT_specification attribute referring to the DIE at offset 0x%" + PRIx64 ", which was not marked as a declaration\n", filename_.c_str(), offset, target); } void DwarfCUToModule::WarningReporter::UnknownAbstractOrigin(uint64_t offset, uint64_t target) { CUHeading(); - fprintf(stderr, "%s: the DIE at offset 0x%llx has a DW_AT_abstract_origin" - " attribute referring to the DIE at offset 0x%llx, which was not" - " marked as an inline\n", + fprintf(stderr, "%s: the DIE at offset 0x%" PRIx64 " has a " + "DW_AT_abstract_origin attribute referring to the DIE at offset 0x%" + PRIx64 ", which was not marked as an inline\n", filename_.c_str(), offset, target); } @@ -762,7 +763,7 @@ void DwarfCUToModule::WarningReporter::UncoveredLine(const Module::Line &line) { void DwarfCUToModule::WarningReporter::UnnamedFunction(uint64_t offset) { CUHeading(); - fprintf(stderr, "%s: warning: function at offset 0x%llx has no name\n", + fprintf(stderr, "%s: warning: function at offset 0x%" PRIx64 " has no name\n", filename_.c_str(), offset); } @@ -775,16 +776,16 @@ void DwarfCUToModule::WarningReporter::DemangleError(const string &input) { void DwarfCUToModule::WarningReporter::UnhandledInterCUReference( uint64_t offset, uint64_t target) { CUHeading(); - fprintf(stderr, "%s: warning: the DIE at offset 0x%llx has a " + fprintf(stderr, "%s: warning: the DIE at offset 0x%" PRIx64 " has a " "DW_FORM_ref_addr attribute with an inter-CU reference to " - "0x%llx, but inter-CU reference handling is turned off.\n", - filename_.c_str(), offset, target); + "0x%" PRIx64 ", but inter-CU reference handling is turned " + " off.\n", filename_.c_str(), offset, target); } void DwarfCUToModule::WarningReporter::MalformedRangeList(uint64_t offset) { CUHeading(); - fprintf(stderr, "%s: warning: the range list at offset 0x%llx falls out of " - "the .debug_ranges section.\n", + fprintf(stderr, "%s: warning: the range list at offset 0x%" PRIx64 " falls " + " out of the .debug_ranges section.\n", filename_.c_str(), offset); }