Fix fiber backtraces in gdb
Summary: When we do the context switch onto the fiber, the stack frame points back to the main context stack. While the fiber is running, this allows backtraces to continue back onto the main context. When the fiber is suspended, we execute code on the main context's stack, the pointers to this stack are now garbage, backtracing in gdb runs into problems, such as garbage frames, gdb crashes, and occasional cycles. The fix here is to write a 0 to the saved return address in the last frame, when a fiber suspends. gdb detects this and stops the trace #38 folly::fibers::FiberManager::activateFiber(folly::fibers::Fiber*) (this=0x0, fiber=0x0) at folly/fibers/FiberManagerInternal-inl.h:82 #39 folly::fibers::FiberManager::runReadyFiber(folly::fibers::Fiber*) (this=0x0, fiber=0x0) at folly/fibers/FiberManagerInternal-inl.h:127 #40 0x0000000000000000 in () I gated the fix to linux since I'm not sure about the ABI for other platforms. Reviewed By: yfeldblum Differential Revision: D22774189 fbshipit-source-id: 2d4ad67a4a01bebc4ff1f9c285f6e3e95d13432c
Showing
Please register or sign in to comment