@@ -43,19 +43,26 @@ StackFrame::scopeIP(Process &proc) const
4343 // the process's register state - this is the currently executing
4444 // instruction, so accurately reflects the position in the top stack frame.
4545 //
46- // The other is for signal trampolines - In this case , the return address
46+ // Next, signal trampolines - For the trampoline itself , the return address
4747 // has been synthesized to be the entrypoint of a function (eg,
4848 // __restore_rt) to handle return from the signal handler, and will be the
4949 // first instruction in the function - there's no previous call instruction
5050 // to point at, so we use it directly.
51+ //
52+ // Finally, for the function that was running when the signal was invoked -
53+ // The signal was invoked asynchronously, so again, we have no call
54+ // instruction to walk back into.
5155 auto raw = rawIP ();
5256 if (raw == 0 )
5357 return { proc, raw };
5458 if (mechanism == UnwindMechanism::MACHINEREGS
5559 || mechanism == UnwindMechanism::TRAMPOLINE)
5660 return { proc, raw };
61+
5762 if (isSignalTrampoline)
5863 return { proc, raw };
64+ if (unwoundFromTrampoline)
65+ return { proc, raw };
5966 ProcessLocation location (proc, raw);
6067
6168 const auto *lcie = location.cie ();
@@ -498,7 +505,9 @@ StackFrame::StackFrame(UnwindMechanism mechanism, const Elf::CoreRegisters ®s
498505 , cfa(0 )
499506 , mechanism(mechanism)
500507 , isSignalTrampoline(false )
501- {}
508+ , unwoundFromTrampoline(false )
509+ {
510+ }
502511
503512std::optional<Elf::CoreRegisters> StackFrame::unwind (Process &p) {
504513 ProcessLocation location = scopeIP (p);
@@ -518,8 +527,6 @@ std::optional<Elf::CoreRegisters> StackFrame::unwind(Process &p) {
518527
519528 using namespace Dwarf ;
520529
521-
522-
523530 DWARFReader r (cfi->io , fde->instructions , fde->end );
524531
525532 auto iter = location.dwarf ()->callFrameForAddr .find (objaddr);
0 commit comments