DWARF: convert error logs to _LIBUNWIND_LOG

Use the `_LIBUNWIND_LOG` macro instead of the explicit `fprintf` call.
NFC.

llvm-svn: 292721
This commit is contained in:
Saleem Abdulrasool 2017-01-21 16:22:55 +00:00
parent 8ecd010547
commit c3bf7da9cf
2 changed files with 17 additions and 31 deletions

View File

@ -421,8 +421,7 @@ 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_LOG("malformed DWARF DW_CFA_offset_extended, reg too big");
return false;
}
results->savedRegisters[reg].location = kRegisterInCFA;
@ -436,9 +435,7 @@ bool CFI_Parser<A>::parseInstructions(A &addressSpace, pint_t instructions,
reg = addressSpace.getULEB128(p, instructionsEnd);
;
if (reg > kMaxRegisterNumber) {
fprintf(
stderr,
"malformed DW_CFA_restore_extended DWARF unwind, reg too big\n");
_LIBUNWIND_LOG("malformed DWARF DW_CFA_restore_extended, reg too big");
return false;
}
results->savedRegisters[reg] = initialState.savedRegisters[reg];
@ -448,8 +445,7 @@ 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_LOG("malformed DWARF DW_CFA_undefined, reg too big");
return false;
}
results->savedRegisters[reg].location = kRegisterUnused;
@ -459,8 +455,7 @@ 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_LOG("malformed DWARF DW_CFA_same_value, reg too big");
return false;
}
// <rdar://problem/8456377> DW_CFA_same_value unsupported
@ -477,13 +472,11 @@ 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_LOG("malformed DWARF DW_CFA_register, reg too big");
return false;
}
if (reg2 > kMaxRegisterNumber) {
fprintf(stderr,
"malformed DW_CFA_register DWARF unwind, reg2 too big\n");
_LIBUNWIND_LOG("malformed DWARF DW_CFA_register, reg2 too big");
return false;
}
results->savedRegisters[reg].location = kRegisterInRegister;
@ -525,7 +518,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_LOG("malformed DWARF DW_CFA_def_cfa, reg too big");
return false;
}
results->cfaRegister = (uint32_t)reg;
@ -537,9 +530,7 @@ 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_LOG("malformed DWARF DW_CFA_def_cfa_register, reg too big");
return false;
}
results->cfaRegister = (uint32_t)reg;
@ -567,8 +558,7 @@ 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 DWARF DW_CFA_expression, reg too big");
return false;
}
results->savedRegisters[reg].location = kRegisterAtExpression;
@ -583,9 +573,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_LOG(
"malformed DWARF DW_CFA_offset_extended_sf, reg too big");
return false;
}
offset =
@ -602,8 +591,7 @@ 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_LOG("malformed DWARF DW_CFA_def_cfa_sf, reg too big");
return false;
}
results->cfaRegister = (uint32_t)reg;
@ -635,8 +623,7 @@ 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_LOG("malformed DWARF DW_CFA_val_offset_sf, reg too big");
return false;
}
offset =
@ -651,8 +638,7 @@ 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_LOG("malformed DWARF DW_CFA_val_expression, reg too big");
return false;
}
results->savedRegisters[reg].location = kRegisterIsExpression;
@ -673,8 +659,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_LOG(
"malformed DWARF DW_CFA_GNU_negative_offset_extended, reg too big");
return false;
}
offset = (int64_t)addressSpace.getULEB128(p, instructionsEnd)

View File

@ -87,7 +87,7 @@
} while (0)
#define _LIBUNWIND_LOG(msg, ...) \
fprintf(stderr, "libunwind: " msg "\n", __VA_ARGS__)
fprintf(stderr, "libunwind: " msg "\n", ##__VA_ARGS__)
#if defined(_LIBUNWIND_HAS_NO_THREADS)
// only used with pthread calls, not needed for the single-threaded builds