Skip to content

Commit 810516e

Browse files
author
zzak
committed
* vm_trace.c: Note about TracePoint events set, and comment on
Kernel#set_trace_func to prefer new TracePoint API git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent d48f539 commit 810516e

File tree

2 files changed

+37
-19
lines changed

2 files changed

+37
-19
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
Sat Feb 9 13:13:00 2013 Zachary Scott <[email protected]>
2+
3+
* vm_trace.c: Note about TracePoint events set, and comment on
4+
Kernel#set_trace_func to prefer new TracePoint API
5+
16
Sat Feb 9 10:07:47 2013 Kazuki Tsujimoto <[email protected]>
27

38
* BSDL: update copyright notice for 2013.

vm_trace.c

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,8 @@ static void call_trace_func(rb_event_flag_t, VALUE data, VALUE self, ID id, VALU
391391
* Establishes _proc_ as the handler for tracing, or disables
392392
* tracing if the parameter is +nil+.
393393
*
394+
* *Note:* this method is obsolete, please use TracePoint instead.
395+
*
394396
* _proc_ takes up to six parameters:
395397
*
396398
* * an event name
@@ -474,7 +476,8 @@ thread_add_trace_func(rb_thread_t *th, VALUE trace)
474476
* thr.add_trace_func(proc) -> proc
475477
*
476478
* Adds _proc_ as a handler for tracing.
477-
* See <code>Thread#set_trace_func</code> and +set_trace_func+.
479+
*
480+
* See Thread#set_trace_func and Kernel#set_trace_func.
478481
*/
479482

480483
static VALUE
@@ -495,7 +498,8 @@ thread_add_trace_func_m(VALUE obj, VALUE trace)
495498
*
496499
* Establishes _proc_ on _thr_ as the handler for tracing, or
497500
* disables tracing if the parameter is +nil+.
498-
* See +set_trace_func+.
501+
*
502+
* See Kernel#set_trace_func.
499503
*/
500504

501505
static VALUE
@@ -812,7 +816,7 @@ rb_tracearg_raised_exception(rb_trace_arg_t *trace_arg)
812816
/*
813817
* Type of event
814818
*
815-
* See TracePoint.new for events
819+
* See TracePoint@Events for more information.
816820
*/
817821
static VALUE
818822
tracepoint_attr_event(VALUE tpval)
@@ -1149,20 +1153,7 @@ rb_tracepoint_new(VALUE target_thval, rb_event_flag_t events, void (*func)(VALUE
11491153
*
11501154
* trace.disable
11511155
*
1152-
* To filter what is traced, you can pass any of the following as +events+:
1153-
*
1154-
* +:line+:: execute code on a new line
1155-
* +:class+:: start a class or module definition
1156-
* +:end+:: finish a class or module definition
1157-
* +:call+:: call a Ruby method
1158-
* +:return+:: return from a Ruby method
1159-
* +:c_call+:: call a C-language routine
1160-
* +:c_return+:: return from a C-language routine
1161-
* +:raise+:: raise an exception
1162-
* +:b_call+:: event hook at block entry
1163-
* +:b_return+:: event hook at block ending
1164-
* +:thread_begin+:: event hook at thread beginning
1165-
* +:thread_end+:: event hook at thread ending
1156+
* See TracePoint@Events for possible events and more information.
11661157
*
11671158
* A block must be given, otherwise a ThreadError is raised.
11681159
*
@@ -1284,7 +1275,7 @@ Init_vm_trace(void)
12841275
* A class that provides the functionality of Kernel#set_trace_func in a
12851276
* nice Object-Oriented API.
12861277
*
1287-
* = Example
1278+
* == Example
12881279
*
12891280
* We can use TracePoint to gather information specifically for exceptions:
12901281
*
@@ -1299,7 +1290,29 @@ Init_vm_trace(void)
12991290
* 0 / 0
13001291
* #=> [5, :raise, #<ZeroDivisionError: divided by 0>]
13011292
*
1302-
* See TracePoint.new for possible events.
1293+
* == Events
1294+
*
1295+
* If you don't specify the type of events you want to listen for,
1296+
* TracePoint will include all available events.
1297+
*
1298+
* *Note* do not depend on current event set, as this list is subject to
1299+
* change. Instead, it is recommended you specify the type of events you
1300+
* want to use.
1301+
*
1302+
* To filter what is traced, you can pass any of the following as +events+:
1303+
*
1304+
* +:line+:: execute code on a new line
1305+
* +:class+:: start a class or module definition
1306+
* +:end+:: finish a class or module definition
1307+
* +:call+:: call a Ruby method
1308+
* +:return+:: return from a Ruby method
1309+
* +:c_call+:: call a C-language routine
1310+
* +:c_return+:: return from a C-language routine
1311+
* +:raise+:: raise an exception
1312+
* +:b_call+:: event hook at block entry
1313+
* +:b_return+:: event hook at block ending
1314+
* +:thread_begin+:: event hook at thread beginning
1315+
* +:thread_end+:: event hook at thread ending
13031316
*
13041317
*/
13051318
rb_cTracePoint = rb_define_class("TracePoint", rb_cObject);

0 commit comments

Comments
 (0)