aboutsummaryrefslogtreecommitdiffstats
path: root/lib/observer/test/crashdump_helper.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2017-10-09 12:35:15 +0200
committerBjörn Gustavsson <[email protected]>2017-10-18 14:05:00 +0200
commit008b44b75a5abf32b26365334597835a3c6fcfd1 (patch)
treeff148b45cef03860a81c303ed27dfde176882d3b /lib/observer/test/crashdump_helper.erl
parent360d26b21c169b0c88d6ca43265cbcfa3ce9ef74 (diff)
downloadotp-008b44b75a5abf32b26365334597835a3c6fcfd1.tar.gz
otp-008b44b75a5abf32b26365334597835a3c6fcfd1.tar.bz2
otp-008b44b75a5abf32b26365334597835a3c6fcfd1.zip
Implement dumping of maps in crash dumps
Maps would be dumped as the atom 'undefined', which is not very informative.
Diffstat (limited to 'lib/observer/test/crashdump_helper.erl')
-rw-r--r--lib/observer/test/crashdump_helper.erl31
1 files changed, 30 insertions, 1 deletions
diff --git a/lib/observer/test/crashdump_helper.erl b/lib/observer/test/crashdump_helper.erl
index f37d9057cb..04c8773498 100644
--- a/lib/observer/test/crashdump_helper.erl
+++ b/lib/observer/test/crashdump_helper.erl
@@ -19,7 +19,8 @@
%%
-module(crashdump_helper).
--export([n1_proc/2,remote_proc/2]).
+-export([n1_proc/2,remote_proc/2,
+ dump_maps/0,create_maps/0]).
-compile(r18).
-include_lib("common_test/include/ct.hrl").
@@ -92,3 +93,31 @@ remote_proc(P1,Creator) ->
Creator ! {self(),done},
receive after infinity -> ok end
end).
+
+
+%%%
+%%% Test dumping of maps. Dumping of maps only from OTP 20.2.
+%%%
+
+dump_maps() ->
+ Parent = self(),
+ F = fun() ->
+ register(aaaaaaaa_maps, self()),
+ put(maps, create_maps()),
+ Parent ! {self(),done},
+ receive _ -> ok end
+ end,
+ Pid = spawn_link(F),
+ receive
+ {Pid,done} ->
+ {ok,Pid}
+ end.
+
+create_maps() ->
+ Map0 = maps:from_list([{I,[I,I+1]} || I <- lists:seq(1, 40)]),
+ Map1 = maps:from_list([{I,{a,[I,I*I],{}}} || I <- lists:seq(1, 100)]),
+ Map2 = maps:from_list([{{I},(I*I) bsl 24} || I <- lists:seq(1, 10000)]),
+ Map3 = lists:foldl(fun(I, A) ->
+ A#{I=>I*I}
+ end, Map2, lists:seq(-10, 0)),
+ #{a=>Map0,b=>Map1,c=>Map2,d=>Map3,e=>#{}}.