Make rb_tracearg_(parameters|eval_script|instruction_sequence) public C-API

This allows C-Extension developers to call those methods to retrieve
information about a TracePoint's parameters, eval script and
instruction sequence.

Implements [Feature #20757]
This commit is contained in:
Richard Böhme 2025-01-11 21:45:32 +01:00 committed by Koichi Sasada
parent fc26004660
commit 04ebedf7f0
Notes: git 2025-03-28 14:08:49 +00:00

View File

@ -518,6 +518,18 @@ RBIMPL_ATTR_NONNULL(())
*/
VALUE rb_tracearg_path(rb_trace_arg_t *trace_arg);
RBIMPL_ATTR_NONNULL(())
/**
*
* Queries the parameters passed on a call or return event.
*
* @param[in] trace_arg A trace instance
* @exception rb_eRuntimeError The tracing event does not support querying parameters.
* @return Array of parameters in the format of `Method#parameters`.
*
*/
VALUE rb_tracearg_parameters(rb_trace_arg_t *trace_arg);
RBIMPL_ATTR_NONNULL(())
/**
* Queries the method name of the point where the trace is at.
@ -595,6 +607,32 @@ RBIMPL_ATTR_NONNULL(())
*/
VALUE rb_tracearg_raised_exception(rb_trace_arg_t *trace_arg);
RBIMPL_ATTR_NONNULL(())
/**
* Queries the compiled source code of the 'script_compiled' event.
* If loaded from a file, it will return nil.
*
* @param[in] trace_arg A trace instance
* @exception rb_eRuntimeError The tracing event is not 'script_compiled'.
* @retval RUBY_Qnil The script was loaded from a file.
* @retval otherwise The compiled source code.
*
*/
VALUE rb_tracearg_eval_script(rb_trace_arg_t *trace_arg);
RBIMPL_ATTR_NONNULL(())
/**
*
* Queries the compiled instruction sequence on a 'script_compiled' event.
* Note that this method is MRI specific.
*
* @param[in] trace_arg A trace instance
* @exception rb_eRuntimeError The tracing event is not 'script_compiled'.
* @return The `RubyVM::InstructionSequence` object representing the instruction sequence.
*
*/
VALUE rb_tracearg_instruction_sequence(rb_trace_arg_t *trace_arg);
RBIMPL_ATTR_NONNULL(())
/**
* Queries the allocated/deallocated object that the trace represents.