Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: add interp.FilterStack() method to get interpreter stacktrace #1348

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Commits on Dec 31, 2021

  1. add interp.FilterStack() function to get interpreter stacktrace

    By placing a handle value on several strategic calls in the runtime
    we can then later parse a runtime stacktrace, look for the magic
    values in function parameters, and reconstruct the calling nodes.
    
    We can use that to filter out all the yaegi runtime calls and
    present the user with a stacktrace that includes only interpreted
    frames.
    bailsman committed Dec 31, 2021
    Configuration menu
    Copy the full SHA
    0ff627e View commit details
    Browse the repository at this point in the history
  2. interp/FilterStack: filter out non-callExpr

    this makes the filtered stack look identical to the regular go stacktrace
    bailsman committed Dec 31, 2021
    Configuration menu
    Copy the full SHA
    7acf89f View commit details
    Browse the repository at this point in the history

Commits on Jan 1, 2022

  1. interp.Func: implement same interface as runtime.Func

    this allows calling code to interchange both types
    bailsman authored and Emanuel Rietveld committed Jan 1, 2022
    Configuration menu
    Copy the full SHA
    5262f9a View commit details
    Browse the repository at this point in the history

Commits on Jan 2, 2022

  1. interp.FilterStack: don't sync up with callers only on runCfg

    interpreter may be entered (for example) from genFunctionWrapper
    bailsman committed Jan 2, 2022
    Configuration menu
    Copy the full SHA
    a8f4038 View commit details
    Browse the repository at this point in the history
  2. interp.FilterStack: handle panics and small API improvements

    When a panic happens, we want to get the stack trace from the oldest
    panic, before runCfg unwinds everything.
    
    However, at that point we don't know yet whether we will be recovered.
    As a silly kludge, currently storing the oldest panic in a list on the
    Interpreter struct which can then be queried once we're ready.
    
    The approach taken is not strictly correct: if a panic is recovered, and
    never queried, and later the same error occurs again and then is not
    recovered, the wrong call stack will be returned.
    bailsman committed Jan 2, 2022
    Configuration menu
    Copy the full SHA
    683535b View commit details
    Browse the repository at this point in the history