Commit 030e254e authored by Peter DeLong's avatar Peter DeLong Committed by Facebook Github Bot

Improve get_fiber_manager_map_*() error reporting

Summary:
get_fiber_manager_map_vevb() and get_fiber_manager_map_evb() don't
provide very useful feedback when called with an empty map (just the former) or
with a program that doesn't have debug symbols (both)

Reviewed By: andriigrynenko

Differential Revision: D5260114

fbshipit-source-id: c44b4e279e5c88dc08507b969339a4befc23d79b
parent a60bf0bb
...@@ -277,14 +277,25 @@ class Shortcut(gdb.Function): ...@@ -277,14 +277,25 @@ class Shortcut(gdb.Function):
def get_fiber_manager_map(evb_type): def get_fiber_manager_map(evb_type):
global_cache_type = gdb.lookup_type( try:
"folly::fibers::(anonymous namespace)::GlobalCache<" + evb_type + ">") # Exception thrown if unable to find type
# Probably because of missing debug symbols
global_cache_type = gdb.lookup_type(
"folly::fibers::(anonymous namespace)::GlobalCache<" + evb_type + ">")
except gdb.error:
raise gdb.GdbError("Unable to find types. "
"Please make sure debug info is available for this binary.\n"
"Have you run 'fbload debuginfo_fbpkg'?")
global_cache_instance_ptr_ptr = gdb.parse_and_eval( global_cache_instance_ptr_ptr = gdb.parse_and_eval(
"&'" + global_cache_type.name + "::instance()::ret'") "&'" + global_cache_type.name + "::instance()::ret'")
global_cache_instance = global_cache_instance_ptr_ptr.cast( global_cache_instance_ptr = global_cache_instance_ptr_ptr.cast(
global_cache_type.pointer().pointer()).dereference().dereference() global_cache_type.pointer().pointer()).dereference()
return global_cache_instance['map_'] if global_cache_instance_ptr == 0x0:
raise gdb.GdbError("FiberManager map is empty.")
global_cache_instance = global_cache_instance_ptr.dereference()
return global_cache_instance['map_']
def get_fiber_manager_map_evb(): def get_fiber_manager_map_evb():
return get_fiber_manager_map("folly::EventBase") return get_fiber_manager_map("folly::EventBase")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment