byebug icon indicating copy to clipboard operation
byebug copied to clipboard

Use TracePoint.allow_reentry to support TracePoint events while eval

Open marshall-lee opened this issue 8 months ago • 2 comments

  • Update Ruby and gems versions (needed to run a new test case using TracePoint API on new Rubies)

  • Undefine alloc funcs of Context and ThreadsTable. This is to suppress a warning of this kind on modern rubies:

    warning: undefining the allocator of T_DATA class Byebug::ThreadsTable
    warning: undefining the allocator of T_DATA class Byebug::Context
    
  • Use TracePoint.allow_reentry to support others' TracePoint events while evaling.

  • Temporarily shut Byebug's TracePoint event handlers in the thread that issued allowing_other_threads { ... } to avoid infinite recursion in event handlers. CTX_FL_IGNORE flag was useful here.

  • Add a test case using TracePoint.new(:class) hook inspired by @fxn's comment https://github.com/deivid-rodriguez/byebug/issues/564#issuecomment-497499214

Fixes #564

marshall-lee avatar Oct 11 '23 21:10 marshall-lee