aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-09-25 10:45:25 +0200
committerBjörn Gustavsson <[email protected]>2017-09-25 10:45:25 +0200
commit05cf8f48b9956f382eadffb888b130ac0f6bcd36 (patch)
treecb86c9ef7ff658217d1aa4278d984cb1e7e1de0e
parent18e249e61b1c4f831632ebabe0e22f8c636955c6 (diff)
parentb54115e73a56d24618d75b83b89820691503a7da (diff)
downloadotp-05cf8f48b9956f382eadffb888b130ac0f6bcd36.tar.gz
otp-05cf8f48b9956f382eadffb888b130ac0f6bcd36.tar.bz2
otp-05cf8f48b9956f382eadffb888b130ac0f6bcd36.zip
Merge branch 'bjorn/speed-up-disassembler'
* bjorn/speed-up-disassembler: Add testing of erts_debug:df() to the emulator smoke tests Speed up erts_debug:df()
-rw-r--r--erts/emulator/test/emulator_smoke.spec1
-rw-r--r--lib/kernel/src/erts_debug.erl19
2 files changed, 11 insertions, 9 deletions
diff --git a/erts/emulator/test/emulator_smoke.spec b/erts/emulator/test/emulator_smoke.spec
index b2d0de8835..fc98ba6823 100644
--- a/erts/emulator/test/emulator_smoke.spec
+++ b/erts/emulator/test/emulator_smoke.spec
@@ -7,3 +7,4 @@
[consistency],"Not reliable in October and March"}.
{cases,'Dir',crypto_SUITE,[t_md5]}.
{cases,'Dir',float_SUITE,[fpe,cmp_integer]}.
+{cases,'Dir',erts_debug_SUITE,[df]}.
diff --git a/lib/kernel/src/erts_debug.erl b/lib/kernel/src/erts_debug.erl
index 480db6814e..2887014c1c 100644
--- a/lib/kernel/src/erts_debug.erl
+++ b/lib/kernel/src/erts_debug.erl
@@ -378,16 +378,11 @@ df(Mod, Func, Arity) when is_atom(Mod), is_atom(Func) ->
catch _:_ -> {undef,Mod}
end.
-dff(File, Fs) when is_pid(File), is_list(Fs) ->
- lists:foreach(fun(Mfa) ->
- disassemble_function(File, Mfa),
- io:nl(File)
- end, Fs);
-dff(Name, Fs) when is_list(Name) ->
- case file:open(Name, [write]) of
+dff(Name, Fs) ->
+ case file:open(Name, [write,raw,delayed_write]) of
{ok,F} ->
try
- dff(F, Fs)
+ dff_1(F, Fs)
after
_ = file:close(F)
end;
@@ -395,12 +390,18 @@ dff(Name, Fs) when is_list(Name) ->
{error,{badopen,Reason}}
end.
+dff_1(File, Fs) ->
+ lists:foreach(fun(Mfa) ->
+ disassemble_function(File, Mfa),
+ file:write(File, "\n")
+ end, Fs).
+
disassemble_function(File, {_,_,_}=MFA) ->
cont_dis(File, erts_debug:disassemble(MFA), MFA).
cont_dis(_, false, _) -> ok;
cont_dis(File, {Addr,Str,MFA}, MFA) ->
- io:put_chars(File, binary_to_list(Str)),
+ ok = file:write(File, Str),
cont_dis(File, erts_debug:disassemble(Addr), MFA);
cont_dis(_, {_,_,_}, _) -> ok.