summaryrefslogtreecommitdiffstats
path: root/libunwind/src/DwarfParser.hpp
diff options
context:
space:
mode:
authorwhitequark <whitequark@whitequark.org>2017-12-25 13:27:56 +0000
committerwhitequark <whitequark@whitequark.org>2017-12-25 13:27:56 +0000
commitfa83ee25234589316253a5070823e153a9724347 (patch)
tree09c4ea7f318e69059111d534ee3701304211a83e /libunwind/src/DwarfParser.hpp
parent91e49066e3067bcc585c434490ba73aef1c3988e (diff)
downloadbcm5719-llvm-fa83ee25234589316253a5070823e153a9724347.tar.gz
bcm5719-llvm-fa83ee25234589316253a5070823e153a9724347.zip
[libunwind] convert error logs to _LIBUNWIND_LOG/_LIBUNWIND_LOG0.
Use the `_LIBUNWIND_LOG` and `_LIBUNWIND_LOG0` macros instead of the explicit `fprintf` call. This was previously done in r292721 as a cleanup and then reverted in r293257 because the implementation in r292721 relied on a GNU extension. This implementation avoids the use of an extension by using a second macro instead, and allows to avoid the dependency on fprintf if _LIBUNWIND_BARE_METAL is defined. llvm-svn: 321441
Diffstat (limited to 'libunwind/src/DwarfParser.hpp')
-rw-r--r--libunwind/src/DwarfParser.hpp67
1 files changed, 32 insertions, 35 deletions
diff --git a/libunwind/src/DwarfParser.hpp b/libunwind/src/DwarfParser.hpp
index 330daddfb4f..47f79577920 100644
--- a/libunwind/src/DwarfParser.hpp
+++ b/libunwind/src/DwarfParser.hpp
@@ -416,8 +416,8 @@ bool CFI_Parser<A>::parseInstructions(A &addressSpace, pint_t instructions,
offset = (int64_t)addressSpace.getULEB128(p, instructionsEnd)
* cieInfo.dataAlignFactor;
if (reg > kMaxRegisterNumber) {
- fprintf(stderr,
- "malformed DW_CFA_offset_extended DWARF unwind, reg too big\n");
+ _LIBUNWIND_LOG0(
+ "malformed DW_CFA_offset_extended DWARF unwind, reg too big");
return false;
}
results->savedRegisters[reg].location = kRegisterInCFA;
@@ -429,9 +429,8 @@ bool CFI_Parser<A>::parseInstructions(A &addressSpace, pint_t instructions,
case DW_CFA_restore_extended:
reg = addressSpace.getULEB128(p, instructionsEnd);
if (reg > kMaxRegisterNumber) {
- fprintf(
- stderr,
- "malformed DW_CFA_restore_extended DWARF unwind, reg too big\n");
+ _LIBUNWIND_LOG0(
+ "malformed DW_CFA_restore_extended DWARF unwind, reg too big");
return false;
}
results->savedRegisters[reg] = initialState.savedRegisters[reg];
@@ -440,8 +439,8 @@ bool CFI_Parser<A>::parseInstructions(A &addressSpace, pint_t instructions,
case DW_CFA_undefined:
reg = addressSpace.getULEB128(p, instructionsEnd);
if (reg > kMaxRegisterNumber) {
- fprintf(stderr,
- "malformed DW_CFA_undefined DWARF unwind, reg too big\n");
+ _LIBUNWIND_LOG0(
+ "malformed DW_CFA_undefined DWARF unwind, reg too big");
return false;
}
results->savedRegisters[reg].location = kRegisterUnused;
@@ -450,8 +449,8 @@ bool CFI_Parser<A>::parseInstructions(A &addressSpace, pint_t instructions,
case DW_CFA_same_value:
reg = addressSpace.getULEB128(p, instructionsEnd);
if (reg > kMaxRegisterNumber) {
- fprintf(stderr,
- "malformed DW_CFA_same_value DWARF unwind, reg too big\n");
+ _LIBUNWIND_LOG0(
+ "malformed DW_CFA_same_value DWARF unwind, reg too big");
return false;
}
// <rdar://problem/8456377> DW_CFA_same_value unsupported
@@ -467,13 +466,13 @@ bool CFI_Parser<A>::parseInstructions(A &addressSpace, pint_t instructions,
reg = addressSpace.getULEB128(p, instructionsEnd);
reg2 = addressSpace.getULEB128(p, instructionsEnd);
if (reg > kMaxRegisterNumber) {
- fprintf(stderr,
- "malformed DW_CFA_register DWARF unwind, reg too big\n");
+ _LIBUNWIND_LOG0(
+ "malformed DW_CFA_register DWARF unwind, reg too big");
return false;
}
if (reg2 > kMaxRegisterNumber) {
- fprintf(stderr,
- "malformed DW_CFA_register DWARF unwind, reg2 too big\n");
+ _LIBUNWIND_LOG0(
+ "malformed DW_CFA_register DWARF unwind, reg2 too big");
return false;
}
results->savedRegisters[reg].location = kRegisterInRegister;
@@ -512,7 +511,7 @@ bool CFI_Parser<A>::parseInstructions(A &addressSpace, pint_t instructions,
reg = addressSpace.getULEB128(p, instructionsEnd);
offset = (int64_t)addressSpace.getULEB128(p, instructionsEnd);
if (reg > kMaxRegisterNumber) {
- fprintf(stderr, "malformed DW_CFA_def_cfa DWARF unwind, reg too big\n");
+ _LIBUNWIND_LOG0("malformed DW_CFA_def_cfa DWARF unwind, reg too big");
return false;
}
results->cfaRegister = (uint32_t)reg;
@@ -523,9 +522,8 @@ bool CFI_Parser<A>::parseInstructions(A &addressSpace, pint_t instructions,
case DW_CFA_def_cfa_register:
reg = addressSpace.getULEB128(p, instructionsEnd);
if (reg > kMaxRegisterNumber) {
- fprintf(
- stderr,
- "malformed DW_CFA_def_cfa_register DWARF unwind, reg too big\n");
+ _LIBUNWIND_LOG0(
+ "malformed DW_CFA_def_cfa_register DWARF unwind, reg too big");
return false;
}
results->cfaRegister = (uint32_t)reg;
@@ -551,8 +549,8 @@ bool CFI_Parser<A>::parseInstructions(A &addressSpace, pint_t instructions,
case DW_CFA_expression:
reg = addressSpace.getULEB128(p, instructionsEnd);
if (reg > kMaxRegisterNumber) {
- fprintf(stderr,
- "malformed DW_CFA_expression DWARF unwind, reg too big\n");
+ _LIBUNWIND_LOG(
+ "malformed DW_CFA_expression DWARF unwind, reg too big");
return false;
}
results->savedRegisters[reg].location = kRegisterAtExpression;
@@ -568,9 +566,8 @@ bool CFI_Parser<A>::parseInstructions(A &addressSpace, pint_t instructions,
case DW_CFA_offset_extended_sf:
reg = addressSpace.getULEB128(p, instructionsEnd);
if (reg > kMaxRegisterNumber) {
- fprintf(
- stderr,
- "malformed DW_CFA_offset_extended_sf DWARF unwind, reg too big\n");
+ _LIBUNWIND_LOG0(
+ "malformed DW_CFA_offset_extended_sf DWARF unwind, reg too big");
return false;
}
offset =
@@ -586,8 +583,8 @@ bool CFI_Parser<A>::parseInstructions(A &addressSpace, pint_t instructions,
offset =
addressSpace.getSLEB128(p, instructionsEnd) * cieInfo.dataAlignFactor;
if (reg > kMaxRegisterNumber) {
- fprintf(stderr,
- "malformed DW_CFA_def_cfa_sf DWARF unwind, reg too big\n");
+ _LIBUNWIND_LOG0(
+ "malformed DW_CFA_def_cfa_sf DWARF unwind, reg too big");
return false;
}
results->cfaRegister = (uint32_t)reg;
@@ -606,7 +603,7 @@ bool CFI_Parser<A>::parseInstructions(A &addressSpace, pint_t instructions,
case DW_CFA_val_offset:
reg = addressSpace.getULEB128(p, instructionsEnd);
if (reg > kMaxRegisterNumber) {
- fprintf(stderr,
+ _LIBUNWIND_LOG(
"malformed DW_CFA_val_offset DWARF unwind, reg (%" PRIu64
") out of range\n",
reg);
@@ -623,8 +620,8 @@ bool CFI_Parser<A>::parseInstructions(A &addressSpace, pint_t instructions,
case DW_CFA_val_offset_sf:
reg = addressSpace.getULEB128(p, instructionsEnd);
if (reg > kMaxRegisterNumber) {
- fprintf(stderr,
- "malformed DW_CFA_val_offset_sf DWARF unwind, reg too big\n");
+ _LIBUNWIND_LOG0(
+ "malformed DW_CFA_val_offset_sf DWARF unwind, reg too big");
return false;
}
offset =
@@ -638,8 +635,8 @@ bool CFI_Parser<A>::parseInstructions(A &addressSpace, pint_t instructions,
case DW_CFA_val_expression:
reg = addressSpace.getULEB128(p, instructionsEnd);
if (reg > kMaxRegisterNumber) {
- fprintf(stderr,
- "malformed DW_CFA_val_expression DWARF unwind, reg too big\n");
+ _LIBUNWIND_LOG0(
+ "malformed DW_CFA_val_expression DWARF unwind, reg too big");
return false;
}
results->savedRegisters[reg].location = kRegisterIsExpression;
@@ -659,8 +656,8 @@ bool CFI_Parser<A>::parseInstructions(A &addressSpace, pint_t instructions,
case DW_CFA_GNU_negative_offset_extended:
reg = addressSpace.getULEB128(p, instructionsEnd);
if (reg > kMaxRegisterNumber) {
- fprintf(stderr, "malformed DW_CFA_GNU_negative_offset_extended DWARF "
- "unwind, reg too big\n");
+ _LIBUNWIND_LOG0("malformed DW_CFA_GNU_negative_offset_extended DWARF "
+ "unwind, reg too big");
return false;
}
offset = (int64_t)addressSpace.getULEB128(p, instructionsEnd)
@@ -676,8 +673,8 @@ bool CFI_Parser<A>::parseInstructions(A &addressSpace, pint_t instructions,
case DW_CFA_offset:
reg = operand;
if (reg > kMaxRegisterNumber) {
- fprintf(stderr, "malformed DW_CFA_offset DWARF unwind, reg (%" PRIu64
- ") out of range\n",
+ _LIBUNWIND_LOG("malformed DW_CFA_offset DWARF unwind, reg (%" PRIu64
+ ") out of range",
reg);
return false;
}
@@ -696,8 +693,8 @@ bool CFI_Parser<A>::parseInstructions(A &addressSpace, pint_t instructions,
case DW_CFA_restore:
reg = operand;
if (reg > kMaxRegisterNumber) {
- fprintf(stderr, "malformed DW_CFA_restore DWARF unwind, reg (%" PRIu64
- ") out of range\n",
+ _LIBUNWIND_LOG("malformed DW_CFA_restore DWARF unwind, reg (%" PRIu64
+ ") out of range",
reg);
return false;
}
OpenPOWER on IntegriCloud