aboutsummaryrefslogtreecommitdiffstats
path: root/lib/observer/src/cdv_wx.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2017-09-19 16:19:24 +0200
committerSiri Hansen <[email protected]>2017-09-19 16:19:24 +0200
commit3979e914660993a06f1a84dd6e4196181964609a (patch)
tree917e04f9f023477544329c8c01e8da194d96408e /lib/observer/src/cdv_wx.erl
parent84c1db49f0dabac3f000b2bf25af1dc483cfed05 (diff)
parentde4e620a3fbd40e598d8f7da01258979246d0bd0 (diff)
downloadotp-3979e914660993a06f1a84dd6e4196181964609a.tar.gz
otp-3979e914660993a06f1a84dd6e4196181964609a.tar.bz2
otp-3979e914660993a06f1a84dd6e4196181964609a.zip
Merge branch 'siri/cdv/crash-on-large-dump/OTP-14386' into maint
* siri/cdv/crash-on-large-dump/OTP-14386: observer: Improve debugging code in test suite cdv: Add ~tw as formatting option when expanding a term observer: Remove compiler warnings in test and set warnings_as_errors cdv: Warn about unsafe crashdump cdv: Show progress bar while reading big data cdv: Optimize reading of crashdump with many binaries cdv: Find end of 'Last calls' section cdv: Don't mark process as truncated if truncation is after all proc_heaps cdv: Set ERL_CRASH_DUMP_SECONDS to 0 in cdv scripts
Diffstat (limited to 'lib/observer/src/cdv_wx.erl')
-rw-r--r--lib/observer/src/cdv_wx.erl38
1 files changed, 37 insertions, 1 deletions
diff --git a/lib/observer/src/cdv_wx.erl b/lib/observer/src/cdv_wx.erl
index 898f39ded2..c3f36cd689 100644
--- a/lib/observer/src/cdv_wx.erl
+++ b/lib/observer/src/cdv_wx.erl
@@ -412,7 +412,16 @@ load_dump(Frame,undefined) ->
error
end;
load_dump(Frame,FileName) ->
- ok = observer_lib:display_progress_dialog("Crashdump Viewer",
+ case maybe_warn_filename(FileName) of
+ continue ->
+ do_load_dump(Frame,FileName);
+ stop ->
+ error
+ end.
+
+do_load_dump(Frame,FileName) ->
+ ok = observer_lib:display_progress_dialog(wx:null(),
+ "Crashdump Viewer",
"Loading crashdump"),
crashdump_viewer:read_file(FileName),
case observer_lib:wait_for_progress() of
@@ -431,6 +440,33 @@ load_dump(Frame,FileName) ->
error
end.
+maybe_warn_filename(FileName) ->
+ case os:getenv("ERL_CRASH_DUMP_SECONDS")=="0" orelse
+ os:getenv("ERL_CRASH_DUMP_BYTES")=="0" of
+ true ->
+ continue;
+ false ->
+ DumpName = case os:getenv("ERL_CRASH_DUMP") of
+ false -> filename:absname("erl_crash.dump");
+ Name -> filename:absname(Name)
+ end,
+ case filename:absname(FileName) of
+ DumpName ->
+ Warning =
+ "WARNING: the current crashdump might be overwritten "
+ "if the crashdump_viewer node crashes.\n\n"
+ "Renaming the file before inspecting it will "
+ "remove the problem.\n\n"
+ "Do you want to continue?",
+ case observer_lib:display_yes_no_dialog(Warning) of
+ ?wxID_YES -> continue;
+ ?wxID_NO -> stop
+ end;
+ _ ->
+ continue
+ end
+ end.
+
%%%-----------------------------------------------------------------
%%% Find help document (HTML files)
get_help_doc(HelpId) ->