proxygen
gdb Namespace Reference

Classes

class  FiberActivateCommand
 
class  FiberDeactivateCommand
 
class  FiberManagerPrinter
 
class  FiberPrinter
 
class  FiberPrintLimitCommand
 
class  FiberUnwinder
 
class  FiberUnwinderFrameFilter
 
class  FiberXMethodMatcher
 
class  FiberXMethodWorker
 
class  FrameId
 
class  GetFiberXMethodMatcher
 
class  GetFiberXMethodWorker
 
class  Shortcut
 

Functions

def fiber_manager_active_fibers (fm)
 
def fiber_activate (fiber)
 
def fiber_deactivate ()
 
def get_fiber_manager_map (evb_type)
 
def get_fiber_manager_map_evb ()
 
def get_fiber_manager_map_vevb ()
 
def build_pretty_printer ()
 
def load ()
 
def info ()
 

Function Documentation

def gdb.build_pretty_printer ( )

Definition at line 350 of file gdb.py.

Referenced by load().

351  pp = gdb.printing.RegexpCollectionPrettyPrinter("folly_fibers")
352  pp.add_printer('fibers::Fiber', '^folly::fibers::Fiber$', FiberPrinter)
353  pp.add_printer('fibers::FiberManager', '^folly::fibers::FiberManager$',
354  FiberManagerPrinter)
355  return pp
356 
357 
def build_pretty_printer()
Definition: gdb.py:350
def gdb.fiber_activate (   fiber)

Definition at line 250 of file gdb.py.

References folly::gen.dereference, and folly.format().

Referenced by gdb.FiberXMethodWorker.__call__(), and gdb.FiberActivateCommand.invoke().

250 def fiber_activate(fiber):
251  fiber_type = gdb.lookup_type("folly::fibers::Fiber")
252  if fiber.type != fiber_type:
253  fiber = fiber.cast(fiber_type.pointer()).dereference()
254  if not FiberPrinter(fiber).backtrace_available():
255  return "Can not activate a non-waiting fiber."
256  gdb.invalidate_cached_frames()
257  FiberUnwinder.set_fiber(fiber)
258  return "Fiber 0x{:12x} activated. You can call 'bt' now.".format(int(fiber.address))
259 
260 
def fiber_activate(fiber)
Definition: gdb.py:250
Formatter< false, Args... > format(StringPiece fmt, Args &&...args)
Definition: Format.h:271
constexpr detail::Dereference dereference
Definition: Base-inl.h:2575
def gdb.fiber_deactivate ( )

Definition at line 261 of file gdb.py.

Referenced by gdb.FiberDeactivateCommand.invoke().

262  FiberUnwinderFrameFilter.set_skip_frame_sp(None)
263  gdb.invalidate_cached_frames()
264  return "Fiber de-activated."
265 
266 
def fiber_deactivate()
Definition: gdb.py:261
def gdb.fiber_manager_active_fibers (   fm)

Definition at line 91 of file gdb.py.

References folly::gen.dereference.

Referenced by gdb.GetFiberXMethodWorker.__call__(), and gdb.FiberManagerPrinter.children().

92  all_fibers = \
93  fm['allFibers_']['data_']['root_plus_size_']['m_header']
94  fiber_hook = all_fibers['next_']
95 
96  fiber_count = 0
97 
98  while fiber_hook != all_fibers.address:
99  fiber = fiber_hook.cast(gdb.lookup_type("int64_t"))
100  fiber = fiber - gdb.parse_and_eval(
101  "(int64_t)&'folly::fibers::Fiber'::globalListHook_")
102  fiber = fiber.cast(
103  gdb.lookup_type('folly::fibers::Fiber').pointer()).dereference()
104 
105  if FiberPrinter(fiber).state != "folly::fibers::Fiber::INVALID":
106  yield fiber
107 
108  fiber_hook = fiber_hook.dereference()['next_']
109 
110  fiber_count = fiber_count + 1
111 
112 
def fiber_manager_active_fibers(fm)
Definition: gdb.py:91
constexpr detail::Dereference dereference
Definition: Base-inl.h:2575
def gdb.get_fiber_manager_map (   evb_type)

Definition at line 320 of file gdb.py.

References folly::gen.dereference.

Referenced by get_fiber_manager_map_evb(), and get_fiber_manager_map_vevb().

320 def get_fiber_manager_map(evb_type):
321  try:
322  # Exception thrown if unable to find type
323  # Probably because of missing debug symbols
324  global_cache_type = gdb.lookup_type(
325  "folly::fibers::(anonymous namespace)::GlobalCache<" + evb_type + ">")
326  except gdb.error:
327  raise gdb.GdbError("Unable to find types. "
328  "Please make sure debug info is available for this binary.\n"
329  "Have you run 'fbload debuginfo_fbpkg'?")
330 
331  global_cache_instance_ptr_ptr = gdb.parse_and_eval(
332  "&'" + global_cache_type.name + "::instance()::ret'")
333  global_cache_instance_ptr = global_cache_instance_ptr_ptr.cast(
334  global_cache_type.pointer().pointer()).dereference()
335  if global_cache_instance_ptr == 0x0:
336  raise gdb.GdbError("FiberManager map is empty.")
337 
338  global_cache_instance = global_cache_instance_ptr.dereference()
339  return global_cache_instance['map_']
340 
341 
def get_fiber_manager_map(evb_type)
Definition: gdb.py:320
constexpr detail::Dereference dereference
Definition: Base-inl.h:2575
def gdb.get_fiber_manager_map_evb ( )

Definition at line 342 of file gdb.py.

References get_fiber_manager_map().

343  return get_fiber_manager_map("folly::EventBase")
344 
345 
def get_fiber_manager_map(evb_type)
Definition: gdb.py:320
def get_fiber_manager_map_evb()
Definition: gdb.py:342
def gdb.get_fiber_manager_map_vevb ( )

Definition at line 346 of file gdb.py.

References get_fiber_manager_map().

347  return get_fiber_manager_map("folly::VirtualEventBase")
348 
349 
def get_fiber_manager_map_vevb()
Definition: gdb.py:346
def get_fiber_manager_map(evb_type)
Definition: gdb.py:320
def gdb.info ( )

Definition at line 369 of file gdb.py.

369 def info():
370  return "Pretty printers for folly::fibers"
371 
def info()
Definition: gdb.py:369
def gdb.load ( )

Definition at line 358 of file gdb.py.

References build_pretty_printer().

358 def load():
359  gdb.printing.register_pretty_printer(gdb, build_pretty_printer())
360  gdb.xmethod.register_xmethod_matcher(gdb, FiberXMethodMatcher())
361  gdb.xmethod.register_xmethod_matcher(gdb, GetFiberXMethodMatcher())
365  Shortcut("get_fiber_manager_map_evb", get_fiber_manager_map_evb)
366  Shortcut("get_fiber_manager_map_vevb", get_fiber_manager_map_vevb)
367 
368 
def build_pretty_printer()
Definition: gdb.py:350
def load()
Definition: gdb.py:358