diff options
author | Vladimir Gordeev <[email protected]> | 2018-03-15 17:26:47 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2018-03-15 17:26:47 +0300 |
commit | 4ec470dedb903e0113416edf3f590b85b1dedc9a (patch) | |
tree | 34861832f6c35935f0180ea304aea53ab45e4b51 /HOWTO | |
parent | d171399bb5a0e9f4c6029564ece4fbf89f3c76f8 (diff) | |
download | otp-4ec470dedb903e0113416edf3f590b85b1dedc9a.tar.gz otp-4ec470dedb903e0113416edf3f590b85b1dedc9a.tar.bz2 otp-4ec470dedb903e0113416edf3f590b85b1dedc9a.zip |
Tracing MatchSpec docs update
I was running this code in shell and expected it to take default `self()` meta tracer,
and start tracing `erlang:put/2`.
```
F = fun F() -> timer:sleep(5000), erlang:get(unique_field), erlang:put(unique_field, 123), F() end.
erlang:trace_pattern({erlang, put, 2}, [{['$1', '_'], [{'==', '$1', unique_field}], []}], [global]).
erlang:trace_pattern({erlang, get, 1}, [{['_'], [], [{trace, [], [call, timestamp]}]}], [meta]).
Pid = spawn(F).
```
But tracing didn't start:
```
6> flush().
Shell got {trace_ts,<0.70.0>,call,
{erlang,get,[unique_field]},
{1521,118606,753838}}
Shell got {trace_ts,<0.70.0>,call,
{erlang,get,[unique_field]},
{1521,118611,754798}}
Shell got {trace_ts,<0.70.0>,call,
{erlang,get,[unique_field]},
{1521,118616,755705}}
ok
7> erlang:trace_info(Pid, flags).
{flags,[]}
```
Turns out that I had false expectations, that `{trace, _, _}` would enable tracing on that process, inheriting meta tracer process as consumer of trace messages.
Instead it tried to take tracer from executing process (which is pointed out in docs). But there was none, so no tracing was started and flags were simply ignored (which is not that obvious from docs).
Updated docs to point out that there are cases when flags would be simply ignored, and no tracing would start.
Diffstat (limited to 'HOWTO')
0 files changed, 0 insertions, 0 deletions