Skip to content
Snippets Groups Projects
Commit 3116c4e7 authored by Georgiy Lebedev's avatar Georgiy Lebedev Committed by Aleksandr Lyapunov
Browse files

core: introduce parent backtrace collection

With backtrace implementation reworked in afc100d, we can now
efficiently collect unwinding information about parents at fiber
creation time:

* Add `core_backtrace_cat` helper for concatenating backtraces.
* Add 'parent_bt' field to `struct fiber` for storing fiber parent's
  backtrace.
* Add `fiber_parent_backtrace_enabled` and corresponding C/Lua toggles for
  controlling parent backtrace collection for newly created fibers.

Closes #4002

@TarantoolBot document
Title: new handles for fiber parent backtrace feature

local fiber = require('fiber')
local log = require('log')
local yaml = require('yaml')

local function foo()
    log.info("%s", yaml.encode(fiber.info()[fiber.self()[id]].backtrace))
end

-- Parent backtrace collection feature is disable by default.
fiber.parent_backtrace_enable()
-- Backtrace will contain also parent's backtrace.
fiber.create(foo)

fiber.parent_backtrace_disable()
-- Backtrace will not contain parent's backtrace.
fiber.create(foo)

local function bar()
    -- Fibers created before enabling parent backtrace feature will not be
    -- contained in backtrace.
    fiber.parent_backtrace_enable()
    fiber.create(foo)
end

-- Grandchild will not contain child's backtrace.
fiber.create(bar)
parent ef486a09
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment