Skip to content

Commit

Permalink
unwind: fix unwind build without heap
Browse files Browse the repository at this point in the history
Add a missing guard for `_LIBUNWIND_NO_HEAP` around code dealing with the
`.cfi_remember_state` and `.cfi_restore_state` instructions.

Patch by Amanieu d'Antras!
  • Loading branch information
compnerd committed May 15, 2020
1 parent ec44e08 commit b31cb3a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions libunwind/src/DwarfParser.hpp
Expand Up @@ -401,6 +401,7 @@ bool CFI_Parser<A>::parseFDEInstructions(A &addressSpace,
fdeInfo.fdeStart + fdeInfo.fdeLength, cieInfo,
upToPC - fdeInfo.pcStart, rememberStack, arch, results);

#if !defined(_LIBUNWIND_NO_HEAP)
// Clean up rememberStack. Even in the case where every DW_CFA_remember_state
// is paired with a DW_CFA_restore_state, parseInstructions can skip restore
// opcodes if it reaches the target PC and stops interpreting, so we have to
Expand All @@ -410,6 +411,7 @@ bool CFI_Parser<A>::parseFDEInstructions(A &addressSpace,
free(rememberStack);
rememberStack = next;
}
#endif

return returnValue;
}
Expand Down

0 comments on commit b31cb3a

Please sign in to comment.