From: Peter DeLong Date: Tue, 11 Jul 2017 20:42:46 +0000 (-0700) Subject: Allow fiber to be called on both type Fiber and Fiber* X-Git-Tag: v2017.07.17.00~24 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3f97ccef159880fc4517d9da5f9215e3b79003dd;p=folly.git Allow fiber to be called on both type Fiber and Fiber* Summary: The fiber command can now be run on a value of type folly::fibers::Fiber or a value of type folly::fibers::Fiber* Reviewed By: andriigrynenko Differential Revision: D5393491 fbshipit-source-id: 1f48e08288f75c59852c939062db616eb06cea73 --- diff --git a/folly/fibers/scripts/gdb.py b/folly/fibers/scripts/gdb.py index da84f3c9..1e3f0e86 100644 --- a/folly/fibers/scripts/gdb.py +++ b/folly/fibers/scripts/gdb.py @@ -246,13 +246,14 @@ class FiberUnwinder(gdb.unwinder.Unwinder): return unwind_info -def fiber_activate(fiber_ptr): +def fiber_activate(fiber): fiber_type = gdb.lookup_type("folly::fibers::Fiber") - fiber = fiber_ptr.cast(fiber_type.pointer()).dereference() + if fiber.type != fiber_type: + fiber = fiber.cast(fiber_type.pointer()).dereference() if not FiberPrinter(fiber).backtrace_available(): return "Can not activate a non-waiting fiber." FiberUnwinder.set_fiber(fiber) - return "Fiber " + str(fiber_ptr) + " activated. You can call 'bt' now." + return "Fiber 0x{:12x} activated. You can call 'bt' now.".format(int(fiber.address)) def fiber_deactivate():