[libunwind] [libunwind] Introduce _LIBUNWIND_TRACE_DWARF_EVAL for increased baremetal friendliness (PR #72040)
Michael Kenzel via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 16 17:16:32 PST 2023
================
@@ -381,24 +381,22 @@ typename A::pint_t
DwarfInstructions<A, R>::evaluateExpression(pint_t expression, A &addressSpace,
const R ®isters,
pint_t initialStackValue) {
- const bool log = false;
pint_t p = expression;
pint_t expressionEnd = expression + 20; // temp, until len read
pint_t length = (pint_t)addressSpace.getULEB128(p, expressionEnd);
expressionEnd = p + length;
- if (log)
- fprintf(stderr, "evaluateExpression(): length=%" PRIu64 "\n",
- (uint64_t)length);
+ _LIBUNWIND_TRACE_DWARF_EVAL("evaluateExpression(): length=%" PRIu64 "\n",
+ (uint64_t)length);
pint_t stack[100];
pint_t *sp = stack;
*(++sp) = initialStackValue;
while (p < expressionEnd) {
- if (log) {
- for (pint_t *t = sp; t > stack; --t) {
- fprintf(stderr, "sp[] = 0x%" PRIx64 "\n", (uint64_t)(*t));
- }
+#if _LIBUNWIND_TRACING_DWARF_EVAL
----------------
michael-kenzel wrote:
Actually, there seems to be more of the same: https://github.com/llvm/llvm-project/blob/d97981c98a70ebeaa8901f34921b0a69a068ff5d/libunwind/src/UnwindCursor.hpp#L1714
I just overlooked that since that path wasn't being built in my setup. I'll update this patch to do the same thing for this code too and remove the `<stdio.h>` includes.
https://github.com/llvm/llvm-project/pull/72040
More information about the cfe-commits
mailing list