Skip to content

Commit

Permalink
fixup! Add missing specs for observer
Browse files Browse the repository at this point in the history
  • Loading branch information
dgud committed Jan 10, 2024
1 parent 035b5b4 commit 8d25910
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lib/observer/src/observer.erl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
start() ->
observer_wx:start().

-spec start(node()) -> ok | {error, term()}.
-spec start(node()|[node()]) -> ok | {error, term()}.
start(Node) when is_atom(Node) ->
start([Node]);
start([Node]) ->
Expand All @@ -52,7 +52,7 @@ start_and_wait() ->
ok
end.

-spec start_and_wait(node()) -> ok.
-spec start_and_wait(node()|[node()]) -> ok.
start_and_wait(Node) when is_atom(Node) ->
start_and_wait([Node]);
start_and_wait(List) when is_list(List) ->
Expand Down
24 changes: 16 additions & 8 deletions lib/observer/src/ttb.erl
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,16 @@
format | {format, format_opts()} | return_fetch_dir.

-type mfas() :: {Module::atom(), Function::atom(), [term()]}.
-type trace_flag() :: 's' | 'r' | 'm' | 'c' | 'p' | 'ports' | 'sos' | 'sol' | 'sofs' | 'all' | 'clear'.
-type trace_flag() :: 's' | 'r' | 'm' | 'c' | 'p' |
'sos' | 'sol' | 'sofs' | 'all' | 'clear' |
'send' | 'receive' | 'procs' | 'ports' |
'call' | 'arity' | 'return_to' | 'silent' | 'running' |
'exiting' | 'running_procs' | 'running_ports' |
'garbage_collection' | 'timestamp' | 'cpu_timestamp' | 'monotonic_timestamp' |
'strict_monotonic_timestamp' | 'set_on_spawn' |
'set_on_first_spawn' | 'set_on_link' | 'set_on_first_link' |
{tracer, pid() | port()} |
{tracer, module(), term()}.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Shortcut
Expand Down Expand Up @@ -338,7 +347,7 @@ list_history() ->
end.

-spec run_history(Entries) -> ok | {error, term()} when
Entries :: [Entry] | Entry,
Entries :: [Entry] | Entry | all | all_silent,
Entry :: integer().
run_history([H|T]) ->
case run_history(H) of
Expand Down Expand Up @@ -373,8 +382,6 @@ run_printed({M,F,A},Verbose) ->
ConfigFile :: file:filename(),
Config :: all | [integer()] | [mfas()],
Result :: ok | {error, term()}.
write_config(ConfigFile,all) ->
write_config(ConfigFile,['_']);
write_config(ConfigFile,Config) ->
write_config(ConfigFile,Config,[]).

Expand All @@ -384,16 +391,17 @@ write_config(ConfigFile,Config) ->
Opts :: Opt | [Opt],
Opt :: append,
Result :: ok | {error, term()}.
write_config(ConfigFile,all,Opt) ->
write_config(ConfigFile,['_'],Opt);
write_config(ConfigFile,Config,Opt) when not(is_list(Opt)) ->
write_config(ConfigFile,Config,[Opt]);
write_config(ConfigFile,Nums,Opt) when is_list(Nums), is_integer(hd(Nums));
Nums=:=['_'] ->
Nums=:=all ->
F = fun(N) -> ets:select(?history_table,
[{{N,'$1'},[],['$1']}])
end,
Config = lists:append(lists:map(F,Nums)),
Config = case Nums of
all -> lists:append(lists:map(F,['_']));
_ -> lists:append(lists:map(F,Nums))
end,
do_write_config(ConfigFile,Config,Opt);
write_config(ConfigFile,Config,Opt) when is_list(Config) ->
case check_config(Config,[]) of
Expand Down

0 comments on commit 8d25910

Please sign in to comment.