proxygen
gdb.FiberUnwinder Class Reference
Inheritance diagram for gdb.FiberUnwinder:

Public Member Functions

def set_fiber (cls, fiber)
 
def __init__ (self)
 
def __call__ (self, pending_frame)
 

Public Attributes

 fiber_context_ptr
 

Static Public Attributes

 instance = None
 

Detailed Description

Definition at line 191 of file gdb.py.

Constructor & Destructor Documentation

def gdb.FiberUnwinder.__init__ (   self)

Definition at line 203 of file gdb.py.

203  def __init__(self):
204  super(FiberUnwinder, self).__init__("Fiber unwinder")
205  self.fiber_context_ptr = None
206 
def __init__(self)
Definition: gdb.py:203

Member Function Documentation

def gdb.FiberUnwinder.__call__ (   self,
  pending_frame 
)

Definition at line 207 of file gdb.py.

References folly::gen.dereference, and gdb.FiberUnwinder.fiber_context_ptr.

207  def __call__(self, pending_frame):
208  if not self.fiber_context_ptr:
209  return None
210 
211  orig_sp = pending_frame.read_register('rsp')
212  orig_pc = pending_frame.read_register('rip')
213 
214  void_star_star = gdb.lookup_type('uint64_t').pointer()
215  ptr = self.fiber_context_ptr.cast(void_star_star)
216 
217  # This code may need to be adjusted to newer versions of boost::context.
218  #
219  # The easiest way to get these offsets is to first attach to any
220  # program which uses folly::fibers and add a break point in
221  # boost::context::jump_fcontext. You then need to save information about
222  # frame 1 via 'info frame 1' command.
223  #
224  # After that you need to resume program until fiber switch is complete
225  # and expore the contents of saved fiber context via
226  # 'x/16gx {fiber pointer}->fiberImpl_.fiberContext_' command.
227  # You then need to match those to the following values you've previously
228  # observed in the output of 'info frame 1' command.
229  #
230  # Value found at "rbp at X" of 'info frame 1' output:
231  rbp = (ptr + 6).dereference()
232  # Value found at "rip = X" of 'info frame 1' output:
233  rip = (ptr + 7).dereference()
234  # Value found at "caller of frame at X" of 'info frame 1' output:
235  rsp = rbp - 96
236 
237  frame_id = FrameId(rsp, orig_pc)
238  unwind_info = pending_frame.create_unwind_info(frame_id)
239  unwind_info.add_saved_register('rbp', rbp)
240  unwind_info.add_saved_register('rsp', rsp)
241  unwind_info.add_saved_register('rip', rip)
242 
243  self.fiber_context_ptr = None
244 
245  FiberUnwinderFrameFilter.set_skip_frame_sp(orig_sp)
246 
247  return unwind_info
248 
249 
def __call__(self, pending_frame)
Definition: gdb.py:207
constexpr detail::Dereference dereference
Definition: Base-inl.h:2575
def gdb.FiberUnwinder.set_fiber (   cls,
  fiber 
)

Definition at line 195 of file gdb.py.

References fizz::client::test::MockClientStateMachineInstance.instance, fizz::server::test::MockServerStateMachineInstance.instance, fizz::server::test::MockTicketCodec.instance, fizz::test::TestStateMachine.instance, gdb.FiberUnwinderFrameFilter.instance, folly::observer_detail::ObserverManager::Singleton.instance, and gdb.FiberUnwinder.instance.

195  def set_fiber(cls, fiber):
196  if cls.instance is None:
197  cls.instance = FiberUnwinder()
198  gdb.unwinder.register_unwinder(None, cls.instance)
199 
200  fiber_impl = fiber['fiberImpl_']
201  cls.instance.fiber_context_ptr = fiber_impl['fiberContext_']
202 
def set_fiber(cls, fiber)
Definition: gdb.py:195

Member Data Documentation

gdb.FiberUnwinder.fiber_context_ptr

Definition at line 205 of file gdb.py.

Referenced by gdb.FiberUnwinder.__call__().

gdb.FiberUnwinder.instance = None
static

Definition at line 192 of file gdb.py.

Referenced by gdb.FiberUnwinder.set_fiber().


The documentation for this class was generated from the following file: