mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* vm_trace.c: rename TracePoint#file and TracePoint#line
to TracePoint#path and TracePoint#lineno respectively. They are consistent to RubyVM::Backtrace::Location. * include/ruby/debug.h: ditto. * vm_core.h: ditto. * test/ruby/test_settracefunc.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a916278900
commit
d187f4bc21
5 changed files with 34 additions and 22 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
Tue Nov 27 08:16:03 2012 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* vm_trace.c: rename TracePoint#file and TracePoint#line
|
||||
to TracePoint#path and TracePoint#lineno respectively.
|
||||
They are consistent to RubyVM::Backtrace::Location.
|
||||
|
||||
* include/ruby/debug.h: ditto.
|
||||
|
||||
* vm_core.h: ditto.
|
||||
|
||||
* test/ruby/test_settracefunc.rb: ditto.
|
||||
|
||||
Tue Nov 27 08:04:26 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
|
||||
|
||||
* thread.c (rb_thread_terminate_all): broadcast eTerminateSignal
|
||||
|
|
|
@ -52,8 +52,8 @@ VALUE rb_tracepoint_disable(VALUE tpval);
|
|||
VALUE rb_tracepoint_enabled_p(VALUE tpval);
|
||||
|
||||
VALUE rb_tracepoint_attr_event(VALUE tpval);
|
||||
VALUE rb_tracepoint_attr_line(VALUE tpval);
|
||||
VALUE rb_tracepoint_attr_file(VALUE tpval);
|
||||
VALUE rb_tracepoint_attr_lineno(VALUE tpval);
|
||||
VALUE rb_tracepoint_attr_path(VALUE tpval);
|
||||
VALUE rb_tracepoint_attr_id(VALUE tpval);
|
||||
VALUE rb_tracepoint_attr_klass(VALUE tpval);
|
||||
VALUE rb_tracepoint_attr_binding(VALUE tpval);
|
||||
|
|
|
@ -418,7 +418,7 @@ class TestSetTraceFunc < Test::Unit::TestCase
|
|||
|
||||
eval <<-EOF.gsub(/^.*?: /, ""), nil, 'xyzzy'
|
||||
1: trace = TracePoint.trace(*trace_events){|tp|
|
||||
2: events << [tp.event, tp.line, tp.file, tp.klass, tp.id, tp.self, tp.binding.eval("local_var"), get_data.(tp)]
|
||||
2: events << [tp.event, tp.lineno, tp.path, tp.klass, tp.id, tp.self, tp.binding.eval("local_var"), get_data.(tp)]
|
||||
3: }
|
||||
4: 1.times{|;local_var| local_var = :inner
|
||||
5: tap{}
|
||||
|
@ -584,9 +584,9 @@ class TestSetTraceFunc < Test::Unit::TestCase
|
|||
tap{}
|
||||
trace.disable
|
||||
|
||||
assert_raise(RuntimeError){tp_store.line}
|
||||
assert_raise(RuntimeError){tp_store.lineno}
|
||||
assert_raise(RuntimeError){tp_store.event}
|
||||
assert_raise(RuntimeError){tp_store.file}
|
||||
assert_raise(RuntimeError){tp_store.path}
|
||||
assert_raise(RuntimeError){tp_store.id}
|
||||
assert_raise(RuntimeError){tp_store.klass}
|
||||
assert_raise(RuntimeError){tp_store.binding}
|
||||
|
|
|
@ -909,8 +909,8 @@ typedef struct rb_trace_arg_struct {
|
|||
int klass_solved;
|
||||
|
||||
/* calc from cfp */
|
||||
int line;
|
||||
VALUE file;
|
||||
int lineno;
|
||||
VALUE path;
|
||||
} rb_trace_arg_t;
|
||||
|
||||
void rb_threadptr_exec_event_hooks(rb_trace_arg_t *trace_arg);
|
||||
|
@ -926,7 +926,7 @@ void rb_threadptr_exec_event_hooks(rb_trace_arg_t *trace_arg);
|
|||
trace_arg.id = (id_); \
|
||||
trace_arg.klass = (klass_); \
|
||||
trace_arg.data = (data_); \
|
||||
trace_arg.file = Qundef; \
|
||||
trace_arg.path = Qundef; \
|
||||
trace_arg.klass_solved = 0; \
|
||||
rb_threadptr_exec_event_hooks(&trace_arg); \
|
||||
} \
|
||||
|
|
28
vm_trace.c
28
vm_trace.c
|
@ -643,38 +643,38 @@ int rb_vm_control_frame_id_and_class(rb_control_frame_t *cfp, ID *idp, VALUE *kl
|
|||
VALUE rb_binding_new_with_cfp(rb_thread_t *th, rb_control_frame_t *src_cfp);
|
||||
|
||||
static void
|
||||
fill_file_and_line(rb_trace_arg_t *trace_arg)
|
||||
fill_path_and_lineno(rb_trace_arg_t *trace_arg)
|
||||
{
|
||||
if (trace_arg->file == Qundef) {
|
||||
if (trace_arg->path == Qundef) {
|
||||
rb_control_frame_t *cfp = rb_vm_get_ruby_level_next_cfp(trace_arg->th, trace_arg->cfp);
|
||||
|
||||
if (cfp) {
|
||||
trace_arg->file = cfp->iseq->location.path;
|
||||
trace_arg->line = rb_vm_get_sourceline(cfp);
|
||||
trace_arg->path = cfp->iseq->location.path;
|
||||
trace_arg->lineno = rb_vm_get_sourceline(cfp);
|
||||
}
|
||||
else {
|
||||
trace_arg->file = Qnil;
|
||||
trace_arg->line = 0;
|
||||
trace_arg->path = Qnil;
|
||||
trace_arg->lineno = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_tracepoint_attr_line(VALUE tpval)
|
||||
rb_tracepoint_attr_lineno(VALUE tpval)
|
||||
{
|
||||
rb_tp_t *tp = tpptr(tpval);
|
||||
tp_attr_check_active(tp);
|
||||
fill_file_and_line(tp->trace_arg);
|
||||
return INT2FIX(tp->trace_arg->line);
|
||||
fill_path_and_lineno(tp->trace_arg);
|
||||
return INT2FIX(tp->trace_arg->lineno);
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_tracepoint_attr_file(VALUE tpval)
|
||||
rb_tracepoint_attr_path(VALUE tpval)
|
||||
{
|
||||
rb_tp_t *tp = tpptr(tpval);
|
||||
tp_attr_check_active(tp);
|
||||
fill_file_and_line(tp->trace_arg);
|
||||
return tp->trace_arg->file;
|
||||
fill_path_and_lineno(tp->trace_arg);
|
||||
return tp->trace_arg->path;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -957,8 +957,8 @@ Init_vm_trace(void)
|
|||
rb_define_method(rb_cTracePoint, "enabled?", rb_tracepoint_enabled_p, 0);
|
||||
|
||||
rb_define_method(rb_cTracePoint, "event", rb_tracepoint_attr_event, 0);
|
||||
rb_define_method(rb_cTracePoint, "line", rb_tracepoint_attr_line, 0);
|
||||
rb_define_method(rb_cTracePoint, "file", rb_tracepoint_attr_file, 0);
|
||||
rb_define_method(rb_cTracePoint, "lineno", rb_tracepoint_attr_lineno, 0);
|
||||
rb_define_method(rb_cTracePoint, "path", rb_tracepoint_attr_path, 0);
|
||||
rb_define_method(rb_cTracePoint, "id", rb_tracepoint_attr_id, 0);
|
||||
rb_define_method(rb_cTracePoint, "klass", rb_tracepoint_attr_klass, 0);
|
||||
rb_define_method(rb_cTracePoint, "binding", rb_tracepoint_attr_binding, 0);
|
||||
|
|
Loading…
Reference in a new issue