summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog12
-rw-r--r--include/ruby/debug.h4
-rw-r--r--test/ruby/test_settracefunc.rb6
-rw-r--r--vm_core.h6
-rw-r--r--vm_trace.c28
5 files changed, 34 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index 1398ae564a..df18cc8f09 100644
--- a/ChangeLog
+++ b/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
diff --git a/include/ruby/debug.h b/include/ruby/debug.h
index 9b153c1377..631be79d76 100644
--- a/include/ruby/debug.h
+++ b/include/ruby/debug.h
@@ -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);
diff --git a/test/ruby/test_settracefunc.rb b/test/ruby/test_settracefunc.rb
index 9912dc9f4a..935fe3f8b5 100644
--- a/test/ruby/test_settracefunc.rb
+++ b/test/ruby/test_settracefunc.rb
@@ -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}
diff --git a/vm_core.h b/vm_core.h
index 511e324a29..60f34cdc02 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -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); \
} \
diff --git a/vm_trace.c b/vm_trace.c
index e02376324c..ddd8dfd3be 100644
--- a/vm_trace.c
+++ b/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);