From b591bc32b73241032d4ba7c54f214f68d8b3b983 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Wed, 27 Dec 2017 11:50:59 +0100 Subject: [cdv] Don't crash when dump is truncated in module attributes This bug was introduced by commit 3b964e8dbaa0cd73ca7a983b3ce948e0dbd2c35c --- lib/observer/src/crashdump_viewer.erl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/observer/src/crashdump_viewer.erl') diff --git a/lib/observer/src/crashdump_viewer.erl b/lib/observer/src/crashdump_viewer.erl index feaec5c678..c100e8d057 100644 --- a/lib/observer/src/crashdump_viewer.erl +++ b/lib/observer/src/crashdump_viewer.erl @@ -2027,12 +2027,16 @@ all_modinfo(Fd,LM,LineHead,DecodeOpts) -> end. get_attribute(Fd, DecodeOpts) -> + Term = do_get_attribute(Fd, DecodeOpts), + io_lib:format("~tp~n",[Term]). + +do_get_attribute(Fd, DecodeOpts) -> Bytes = bytes(Fd, ""), try get_binary(Bytes, DecodeOpts) of {Bin,_} -> try binary_to_term(Bin) of Term -> - io_lib:format("~tp~n",[Term]) + Term catch _:_ -> {"WARNING: The term is probably truncated!", -- cgit v1.2.3