aboutsummaryrefslogtreecommitdiffstats
path: root/lib/observer/test
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2018-10-24 12:52:58 +0200
committerGitHub <[email protected]>2018-10-24 12:52:58 +0200
commit8d34db5c230660f42bd146b6db23096c015c221d (patch)
treeb9491f9c4e723f0ba1fe40e664cfa37f8e99550e /lib/observer/test
parent885ec15333e55e0c2d450d41d9a39cd73f257384 (diff)
parente3a31aa4b06659762d94e487a4a3d2918fe91096 (diff)
downloadotp-8d34db5c230660f42bd146b6db23096c015c221d.tar.gz
otp-8d34db5c230660f42bd146b6db23096c015c221d.tar.bz2
otp-8d34db5c230660f42bd146b6db23096c015c221d.zip
Merge pull request #1996 from bjorng/bjorn/observer/fix-crashdump_viewer/ERL-722/OTP-15365
Eliminate crash in crashdump_viewer reading some literal maps
Diffstat (limited to 'lib/observer/test')
-rw-r--r--lib/observer/test/crashdump_helper.erl21
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/observer/test/crashdump_helper.erl b/lib/observer/test/crashdump_helper.erl
index 145ff56b71..d8f4e046ae 100644
--- a/lib/observer/test/crashdump_helper.erl
+++ b/lib/observer/test/crashdump_helper.erl
@@ -142,4 +142,23 @@ create_maps() ->
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=>#{}}.
+ #{a=>Map0,b=>Map1,c=>Map2,d=>Map3,e=>#{},literal=>literal_map()}.
+
+literal_map() ->
+ %% A literal map such as the one below will produce a heap dump
+ %% like this:
+ %%
+ %% Address1:t4:H<Address3>,H<Address4>,H<Address5>,H<Address6>
+ %% Address2:Mf4:H<Adress1>:I1,I2,I3,I4
+ %% Address3: ... % "one"
+ %% Address4: ... % "two"
+ %% Address5: ... % "three"
+ %% Address6: ... % "four"
+ %%
+ %% The map cannot be reconstructed in a single sequential pass.
+ %%
+ %% To reconstruct the map, first the string keys "one"
+ %% through "four" must be reconstructed, then the tuple at
+ %% Adress1, then the map at Address2.
+
+ #{"one"=>1,"two"=>2,"three"=>3,"four"=>4}.