[Lldb-commits] [PATCH] D66250: [JIT][Unwinder] Add Trampoline ObjectFile and UnwindPlan support for FCB

Jason Molenda via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 20 15:24:03 PDT 2019


jasonmolenda added a comment.

In D66250#1633455 <https://reviews.llvm.org/D66250#1633455>, @clayborg wrote:

> Why are we not just using ObjectFileJIT? I am guessing these breakpoint expressions create one of these by compiling the breakpoint expression and JIT'ing it just like any other expression. If this is the case, then why do we need to create a ObjectFileTrampoline? Seems like we could add .cfi directives to the assembly we use for the breakpoint condition function so that we can unwind out of it?


I hadn't looked at ObjectFileJIT, we should look at whether we can that existing plugin.  I agree they're conceptually doing the same thing, but one difference is that the trampoline is only a function, it's not a mach-o binary that we've written into memory.  I think it would be possible to represent the trampoline unwind plan in eh_frame using a DW_OP_addr encoding for the caller's pc value, but we would have to manually write out the bytes of the eh_frame header, CIE and FDE entries, then the DW_OP_addr.  I think it's easier to stuff in an UnwindPlan with this unwind rule added manually.  Using the existing eh_frame format is laudable but I think it hand-writing the binary format into memory and then reading it back out again would be less maintainable IMO.



================
Comment at: lldb/source/Commands/CommandObjectTarget.cpp:3561
 
+      if (UnwindPlanSP plan_sp = func_unwinders_sp->GetTrampolineUnwindPlan()) {
+        result.GetOutputStream().Printf("Trampoline UnwindPlan:\n");
----------------
mib wrote:
> shafik wrote:
> > Curious I noticed you stuck this in the middle someplace, does the order matter?
> Not in the `CommandObjectTarget` class but it does in the `FuncUnwinders`.
Yeah, in FuncUnwinders we don't want to give one of the traditional unwind techniques to try to provide an UnwindPlan (e.g. assembly language instruction scanning); they will not succeed.  We must use an unwind plan that hardcodes the return address.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66250/new/

https://reviews.llvm.org/D66250





More information about the lldb-commits mailing list