Граф коммитов

20 Коммитов

Автор SHA1 Сообщение Дата
Koichi Sasada 9180e33ca3 show warning for unused block
With verbopse mode (-w), the interpreter shows a warning if
a block is passed to a method which does not use the given block.

Warning on:

* the invoked method is written in C
* the invoked method is not `initialize`
* not invoked with `super`
* the first time on the call-site with the invoked method
  (`obj.foo{}` will be warned once if `foo` is same method)

[Feature #15554]

`Primitive.attr! :use_block` is introduced to declare that primitive
functions (written in C) will use passed block.

For minitest, test needs some tweak, so use
ea9caafc07
for `test-bundled-gems`.
2024-04-15 12:08:07 +09:00
Victor Shepelev 570d7b2c3e
[DOC] Adjust some new features wording/examples. (#9183)
* Reword Range#overlap? docs last paragraph.

* Docs: add explanation about Queue#freeze

* Docs: Add :rescue event docs for TracePoint

* Docs: Enhance Module#set_temporary_name documentation

* Docs: Slightly expand Process::Status deprecations

* Fix MatchData#named_captures rendering glitch

* Improve Dir.fchdir examples

* Adjust Refinement#target docs
2023-12-14 23:01:48 +02:00
Peter Zhu 52837fcec2 [DOC] Remove Document-class from trace_point.rb 2023-08-14 11:48:39 -04:00
zverok 0c0b9191ce [DOC] Update TracePoint#binding docs for 3.2 behavior 2023-02-19 22:32:52 +02:00
zverok ae455a129e [DOC] Update TracePoint.allow_reentry docs
Adjust call-seq to mention block, and add examples
and explanations.
2022-12-22 13:37:58 +09:00
Jeremy Evans 3cad54a246 Fix comment 2022-03-29 18:14:33 -07:00
Jeremy Evans 750e18594b Update comment for TracePoint#enable
Co-authored-by: Benoit Daloze <eregontp@gmail.com>
2022-03-29 18:14:33 -07:00
Jeremy Evans 3c6a0033e3 Avoid trace events in implementation of TracePoint#enable
This is more backwards compatible, and should fix issues with
power_assert.

Unfortunately, it requires using a sentinel value as the default
value of target_thread, instead of the more natural expression
used in the original approach.
2022-03-29 18:14:33 -07:00
Jeremy Evans 9c1d32a7ad Make TracePoint#enable with block target current thread by default
If TracePoint#enable is passed a block, it previously started
the trace on all threads.  This changes it to trace only the
current thread by default.  To limit the scope of the change,
the current thread is only used by default if target and
target_line are both nil.  You can pass target_thread: nil
to enable tracing on all threads, to get the previous
default behavior.

Fixes [Bug #16889]
2022-03-29 18:14:33 -07:00
Koichi Sasada 9873af0b1a `TracePoint.allow_reentry`
In general, while TracePoint callback is running,
other registerred callbacks are not called to avoid
confusion by reentrace.
This method allow the reentrace. This method should be
used carefully, otherwize the callback can be easily called
infinitely.

[Feature #15912]

Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2021-12-10 00:56:25 +09:00
Masataka Pocke Kuwabara d5ae892519 Add doc for `a_call` and `a_return` events of TracePoint 2021-11-09 17:10:36 +09:00
Ulysse Buonomo 1d0ce1a349 [DOC] Fix `TracePoint.trace` format [ci skip]
Signed-off-by: Ulysse Buonomo <buonomo.ulysse@gmail.com>
2021-10-30 10:23:07 +09:00
Jeremy Evans 72a4e1d3bb Tweak description of TracePoint :line event
"code" here is too ambiguous. TracePoint events only occur if there
is a new statement or expression on that line, not if the line
is a continuation of a previous statement or expression and there
is no new statement or expression on the line.

For example:

```
[
 foo,   # start of expression, line event
 bar    # continuation of expression, no line event
]

[
 foo,   # start of expression, line event
 (bar)  # new expression, line event
]

foo(    # start of expression, line event
  bar   # continuation of expression, no line event
)

foo(    # start of expression, line event
  (bar) # new expression, line event
)
```

Fixes [Bug #15634]
2021-06-19 13:55:28 +12:00
Jeremy Evans d585799d73 Document binding behavior for C call/return events for TracePoint/set_trace_func
C methods do not have bindings, so binding returns the binding of
the nearest C method.

Fixes [Bug #9009]
2021-04-26 15:21:52 -07:00
Nguyễn Quang Minh 1819652578
[Feature #16513] TracePoint#inspect returns "... file:line" (#3391)
* Fix debug documents to match Thread#to_s change (Feature #16412 ticket)

* TracePoint#inspect returns "... file:line" (Feature #16513)

* Guard older version of Ruby in Tracepoint inspection tests

* Focus on current thread only when running TracePoint inspection test
2020-08-06 11:56:24 +09:00
Nobuyoshi Nakada 63aadc237f [Feature #16254] Use `Primitive.func` style 2020-06-19 18:46:55 +09:00
Nobuyoshi Nakada d863f4bccd [Feature #16254] Use `__builtin.func` style 2020-06-19 18:46:55 +09:00
Kazuhiro NISHIYAMA ce4d167778
Fix output of example [ci skip] 2020-01-05 00:52:43 +09:00
Alan Wu df76f2c577
Make TracePoint.stat a singleton method again (#2726)
[Bug #16399]
2019-12-04 21:02:21 -05:00
Koichi Sasada e2a45cb984 use builtin for TracePoint.
Define TracePoint in trace_point.rb and use __builtin_ syntax.
2019-11-08 09:09:29 +09:00