Issue #12330 has been updated by Koichi Sasada.

Status changed from Open to Closed

Thank you for your investigation. Now, `RUBY_EVENT_SPECIFIED_LINE` should not be used and I'll remove this feature soon.

Thanks,
Koichi

----------------------------------------
Bug #12330: vm_trace.c (get_event_id) returns :specified_line if SPECIFIED_LINE was occurred
https://bugs.ruby-lang.org/issues/12330#change-61333

* Author: Kaneko Yuichiro
* Status: Closed
* Priority: Normal
* Assignee: Koichi Sasada
* ruby -v: 
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
Because r38728 is last commit about this line, I think this is not intended behavior.

To check which symbol is returned, 

```diff
diff --git a/ext/-test-/tracepoint/tracepoint.c b/ext/-test-/tracepoint/tracepoint.c
index aa8c212..8979853 100644
--- a/ext/-test-/tracepoint/tracepoint.c
+++ b/ext/-test-/tracepoint/tracepoint.c
@@ -84,6 +84,18 @@ tracepoint_specify_normal_and_internal_events(VALUE self)
     return Qnil; /* should not be reached */
 }
 
+static VALUE
+tracepoint_line_event_sym(VALUE self)
+{
+    return ID2SYM(get_event_id(RUBY_EVENT_LINE));
+}
+
+static VALUE
+tracepoint_specified_line_event_sym(VALUE self)
+{
+    return ID2SYM(get_event_id(RUBY_EVENT_SPECIFIED_LINE));
+}
+
 void Init_gc_hook(VALUE);
 
 void
@@ -93,4 +105,6 @@ Init_tracepoint(void)
     Init_gc_hook(mBug);
     rb_define_module_function(mBug, "tracepoint_track_objspace_events", tracepoint_track_objspace_events, 0);
     rb_define_module_function(mBug, "tracepoint_specify_normal_and_internal_events", tracepoint_specify_normal_and_internal_events, 0);
+    rb_define_module_function(mBug, "tracepoint_line_event_sym", tracepoint_line_event_sym, 0);
+    rb_define_module_function(mBug, "tracepoint_specified_line_event_sym", tracepoint_specified_line_event_sym, 0);
 }
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index ef6caa1..36d472d 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -2126,6 +2126,7 @@ typedef void (*rb_event_hook_func_t)(rb_event_flag_t evflag, VALUE data, VALUE s
 #define RB_EVENT_HOOKS_HAVE_CALLBACK_DATA 1
 void rb_add_event_hook(rb_event_hook_func_t func, rb_event_flag_t events, VALUE data);
 int rb_remove_event_hook(rb_event_hook_func_t func);
+ID get_event_id(rb_event_flag_t);
 
 /* locale insensitive functions */
 
diff --git a/test/-ext-/tracepoint/test_tracepoint.rb b/test/-ext-/tracepoint/test_tracepoint.rb
index 33d0c3e..8db8c77 100644
--- a/test/-ext-/tracepoint/test_tracepoint.rb
+++ b/test/-ext-/tracepoint/test_tracepoint.rb
@@ -58,6 +58,14 @@ def test_tracepoint_specify_normal_and_internal_events
     assert_raise(TypeError){ Bug.tracepoint_specify_normal_and_internal_events }
   end
 
+  def test_tracepoint_line_event_sym
+    assert_equal :line, Bug.tracepoint_line_event_sym
+  end
+
+  def test_tracepoint_specified_line_event_sym
+    assert_equal :line, Bug.tracepoint_specified_line_event_sym
+  end
+
   def test_after_gc_start_hook_with_GC_stress
     bug8492 = '[ruby-dev:47400] [Bug #8492]: infinite after_gc_start_hook reentrance'
     assert_nothing_raised(Timeout::Error, bug8492) do
diff --git a/vm_trace.c b/vm_trace.c
index b814a12..eb54569 100644
--- a/vm_trace.c
+++ b/vm_trace.c
@@ -577,7 +577,7 @@ get_event_name(rb_event_flag_t event)
     }
 }
 
-static ID
+ID
 get_event_id(rb_event_flag_t event)
 {
     ID id;

```

and

```shell
$ make test-all TESTS="-- -ext-/tracepoint/test_tracepoint.rb"
	CC = clang
	LD = ld
	LDSHARED = clang -dynamic -bundle
	CFLAGS = -O0 -fno-fast-math -g3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Werror=pointer-arith -Werror=write-strings -Werror=declaration-after-statement -Werror=shorten-64-to-32 -Werror=implicit-function-declaration -Werror=division-by-zero -Werror=deprecated-declarations -Werror=extra-tokens   -pipe
	XCFLAGS = -fstack-protector -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT -fPIE
	CPPFLAGS = -DRUBY_DEBUG_ENV -DARRAY_DEBUG -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT   -I. -I.ext/include/x86_64-darwin14 -I./include -I.
	DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -fstack-protector -Wl,-u,_objc_msgSend -Wl,-pie -framework CoreFoundation
	SOLIBS = -lgmp
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.4.0
Thread model: posix
generating known_errors.inc
known_errors.inc unchanged
generating prelude.c
prelude.c unchanged
Run options: "--ruby=./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems" --excludes-dir=./test/excludes --name=!/memory_leak/ --

# Running tests:

[4/7] TestTracepointObj#test_tracepoint_specified_line_event_sym = 0.00 s
  1) Failure:
TestTracepointObj#test_tracepoint_specified_line_event_sym [/Users/yuichirokaneko/ruby/ruby/test/-ext-/tracepoint/test_tracepoint.rb:66]:
<:line> expected but was
<:specified_line>.

Finished tests in 0.726435s, 9.6361 tests/s, 60.5698 assertions/s.
7 tests, 44 assertions, 1 failures, 0 errors, 0 skips

ruby -v: ruby 2.4.0dev (2016-04-29 trunk 54818) [x86_64-darwin14]
make: *** [yes-test-all] Error 1
```

To fix this

```diff
@@ -597,8 +597,7 @@ get_event_id(rb_event_flag_t event)
        C(thread_begin, THREAD_BEGIN);
        C(thread_end, THREAD_END);
        C(fiber_switch, FIBER_SWITCH);
-       C(specified_line, SPECIFIED_LINE);
-      case RUBY_EVENT_LINE | RUBY_EVENT_SPECIFIED_LINE: CONST_ID(id, "line"); return id;
+       C(line, SPECIFIED_LINE);
 #undef C
       default:
        return 0;
```



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>