aboutsummaryrefslogtreecommitdiffstats
path: root/lib/observer/test/crashdump_helper.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2018-10-24 12:54:44 +0200
committerBjörn Gustavsson <[email protected]>2018-10-24 12:54:44 +0200
commitc37f7a2215646c85c1ae12303f07bc9bc27b75ae (patch)
tree97b36672c1ae4f0fe5bd0ab424ec21d6135c0c54 /lib/observer/test/crashdump_helper.erl
parent747001c51a28a35130fa23c9da86683b0801b0a8 (diff)
parente3a31aa4b06659762d94e487a4a3d2918fe91096 (diff)
downloadotp-c37f7a2215646c85c1ae12303f07bc9bc27b75ae.tar.gz
otp-c37f7a2215646c85c1ae12303f07bc9bc27b75ae.tar.bz2
otp-c37f7a2215646c85c1ae12303f07bc9bc27b75ae.zip
Merge branch 'bjorn/observer/fix-crashdump_viewer/ERL-722/OTP-15365' into maint
* bjorn/observer/fix-crashdump_viewer/ERL-722/OTP-15365: Eliminate crash in crashdump_viewer reading some literal maps
Diffstat (limited to 'lib/observer/test/crashdump_helper.erl')
-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}.