[clang] [llvm] [libunwind] [libunwind] introduce _LIBUNWIND_TRACE_DWARF_EVAL for increased baremetal friendliness (PR #72040)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 11 16:54:00 PST 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff d3d49bca3ed968226ab9dc22f27d779eeb973c22 b58e039dd132518a3a62590d32775c2bc5928499 -- libunwind/src/DwarfInstructions.hpp libunwind/src/config.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libunwind/src/DwarfInstructions.hpp b/libunwind/src/DwarfInstructions.hpp
index 015489bab1d3..82ea9b8a0f82 100644
--- a/libunwind/src/DwarfInstructions.hpp
+++ b/libunwind/src/DwarfInstructions.hpp
@@ -386,7 +386,7 @@ DwarfInstructions<A, R>::evaluateExpression(pint_t expression, A &addressSpace,
pint_t length = (pint_t)addressSpace.getULEB128(p, expressionEnd);
expressionEnd = p + length;
_LIBUNWIND_TRACE_DWARF_EVAL("evaluateExpression(): length=%" PRIu64 "\n",
- (uint64_t)length);
+ (uint64_t)length);
pint_t stack[100];
pint_t *sp = stack;
*(++sp) = initialStackValue;
@@ -414,7 +414,8 @@ DwarfInstructions<A, R>::evaluateExpression(pint_t expression, A &addressSpace,
// pop stack, dereference, push result
value = *sp--;
*(++sp) = addressSpace.getP(value);
- _LIBUNWIND_TRACE_DWARF_EVAL("dereference 0x%" PRIx64 "\n", (uint64_t)value);
+ _LIBUNWIND_TRACE_DWARF_EVAL("dereference 0x%" PRIx64 "\n",
+ (uint64_t)value);
break;
case DW_OP_const1u:
@@ -545,7 +546,8 @@ DwarfInstructions<A, R>::evaluateExpression(pint_t expression, A &addressSpace,
// pop stack, dereference, push result
value = *sp--;
*sp = *((pint_t*)value);
- _LIBUNWIND_TRACE_DWARF_EVAL("x-dereference 0x%" PRIx64 "\n", (uint64_t)value);
+ _LIBUNWIND_TRACE_DWARF_EVAL("x-dereference 0x%" PRIx64 "\n",
+ (uint64_t)value);
break;
case DW_OP_abs:
@@ -727,7 +729,8 @@ DwarfInstructions<A, R>::evaluateExpression(pint_t expression, A &addressSpace,
case DW_OP_lit31:
value = static_cast<pint_t>(opcode - DW_OP_lit0);
*(++sp) = value;
- _LIBUNWIND_TRACE_DWARF_EVAL("push literal 0x%" PRIx64 "\n", (uint64_t)value);
+ _LIBUNWIND_TRACE_DWARF_EVAL("push literal 0x%" PRIx64 "\n",
+ (uint64_t)value);
break;
case DW_OP_reg0:
@@ -770,7 +773,8 @@ DwarfInstructions<A, R>::evaluateExpression(pint_t expression, A &addressSpace,
case DW_OP_regx:
reg = static_cast<uint32_t>(addressSpace.getULEB128(p, expressionEnd));
*(++sp) = registers.getRegister((int)reg);
- _LIBUNWIND_TRACE_DWARF_EVAL("push reg %d + 0x%" PRIx64 "\n", reg, (uint64_t)svalue);
+ _LIBUNWIND_TRACE_DWARF_EVAL("push reg %d + 0x%" PRIx64 "\n", reg,
+ (uint64_t)svalue);
break;
case DW_OP_breg0:
@@ -809,7 +813,8 @@ DwarfInstructions<A, R>::evaluateExpression(pint_t expression, A &addressSpace,
svalue = (sint_t)addressSpace.getSLEB128(p, expressionEnd);
svalue += static_cast<sint_t>(registers.getRegister((int)reg));
*(++sp) = (pint_t)(svalue);
- _LIBUNWIND_TRACE_DWARF_EVAL("push reg %d + 0x%" PRIx64 "\n", reg, (uint64_t)svalue);
+ _LIBUNWIND_TRACE_DWARF_EVAL("push reg %d + 0x%" PRIx64 "\n", reg,
+ (uint64_t)svalue);
break;
case DW_OP_bregx:
@@ -817,7 +822,8 @@ DwarfInstructions<A, R>::evaluateExpression(pint_t expression, A &addressSpace,
svalue = (sint_t)addressSpace.getSLEB128(p, expressionEnd);
svalue += static_cast<sint_t>(registers.getRegister((int)reg));
*(++sp) = (pint_t)(svalue);
- _LIBUNWIND_TRACE_DWARF_EVAL("push reg %d + 0x%" PRIx64 "\n", reg, (uint64_t)svalue);
+ _LIBUNWIND_TRACE_DWARF_EVAL("push reg %d + 0x%" PRIx64 "\n", reg,
+ (uint64_t)svalue);
break;
case DW_OP_fbreg:
@@ -848,7 +854,8 @@ DwarfInstructions<A, R>::evaluateExpression(pint_t expression, A &addressSpace,
_LIBUNWIND_ABORT("DW_OP_deref_size with bad size");
}
*(++sp) = value;
- _LIBUNWIND_TRACE_DWARF_EVAL("sized dereference 0x%" PRIx64 "\n", (uint64_t)value);
+ _LIBUNWIND_TRACE_DWARF_EVAL("sized dereference 0x%" PRIx64 "\n",
+ (uint64_t)value);
break;
case DW_OP_xderef_size:
@@ -862,12 +869,11 @@ DwarfInstructions<A, R>::evaluateExpression(pint_t expression, A &addressSpace,
}
}
- _LIBUNWIND_TRACE_DWARF_EVAL("expression evaluates to 0x%" PRIx64 "\n", (uint64_t)*sp);
+ _LIBUNWIND_TRACE_DWARF_EVAL("expression evaluates to 0x%" PRIx64 "\n",
+ (uint64_t)*sp);
return *sp;
}
-
-
} // namespace libunwind
#endif // __DWARF_INSTRUCTIONS_HPP__
diff --git a/libunwind/src/config.h b/libunwind/src/config.h
index c31d4113401c..7491d726022b 100644
--- a/libunwind/src/config.h
+++ b/libunwind/src/config.h
@@ -229,13 +229,13 @@
#define _LIBUNWIND_TRACE_DWARF_EVAL(msg, ...)
#else
#define _LIBUNWIND_TRACE_DWARF_EVAL0(msg) \
- do { \
- fprintf(stderr, msg); \
- } while(0)
+ do { \
+ fprintf(stderr, msg); \
+ } while (0)
#define _LIBUNWIND_TRACE_DWARF_EVAL(msg, ...) \
- do { \
- fprintf(stderr, msg, __VA_ARGS__); \
- } while(0)
+ do { \
+ fprintf(stderr, msg, __VA_ARGS__); \
+ } while (0)
#endif
#ifdef __cplusplus
``````````
</details>
https://github.com/llvm/llvm-project/pull/72040
More information about the llvm-commits
mailing list