diff options
author | Björn Gustavsson <[email protected]> | 2018-10-19 12:40:30 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2018-10-22 09:56:05 +0200 |
commit | e3a31aa4b06659762d94e487a4a3d2918fe91096 (patch) | |
tree | 7ada5dff735b0ac59b8329e41aa6602092e5b27c /lib/observer/test | |
parent | 05bcb5c45860e6cbb9480f8b5de9ff0ce614b548 (diff) | |
download | otp-e3a31aa4b06659762d94e487a4a3d2918fe91096.tar.gz otp-e3a31aa4b06659762d94e487a4a3d2918fe91096.tar.bz2 otp-e3a31aa4b06659762d94e487a4a3d2918fe91096.zip |
Eliminate crash in crashdump_viewer reading some literal maps
Literal maps with complex keys such as:
#{"one"=>1,"two"=>2,"three"=>3,"four"=>4}.
would produce a crash dump that `crashdump_viewer` was unable
to read.
https://bugs.erlang.org/browse/ERL-722
Diffstat (limited to 'lib/observer/test')
-rw-r--r-- | lib/observer/test/crashdump_helper.erl | 21 |
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}. |