aboutsummaryrefslogtreecommitdiffstats
path: root/lib/observer/src
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2017-09-13 16:32:58 +0200
committerSiri Hansen <[email protected]>2017-09-18 11:07:09 +0200
commit990ddca5415d196bf7543a57a86aa47da13706c6 (patch)
tree24764595ab0570174dbcb234a58c82110bc5f8d8 /lib/observer/src
parent9ee5ad4f99f2540860f5acb357aac6b08d7e494e (diff)
downloadotp-990ddca5415d196bf7543a57a86aa47da13706c6.tar.gz
otp-990ddca5415d196bf7543a57a86aa47da13706c6.tar.bz2
otp-990ddca5415d196bf7543a57a86aa47da13706c6.zip
cdv: Warn about unsafe crashdump
Warn the user if the node executing the crashdump viewer potentially could overwrite the crashdump under inspection.
Diffstat (limited to 'lib/observer/src')
-rw-r--r--lib/observer/src/cdv_wx.erl35
-rw-r--r--lib/observer/src/crashdump_viewer.erl3
2 files changed, 37 insertions, 1 deletions
diff --git a/lib/observer/src/cdv_wx.erl b/lib/observer/src/cdv_wx.erl
index ffd7694ab3..c3f36cd689 100644
--- a/lib/observer/src/cdv_wx.erl
+++ b/lib/observer/src/cdv_wx.erl
@@ -412,6 +412,14 @@ load_dump(Frame,undefined) ->
error
end;
load_dump(Frame,FileName) ->
+ 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"),
@@ -432,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) ->
diff --git a/lib/observer/src/crashdump_viewer.erl b/lib/observer/src/crashdump_viewer.erl
index b01c3a1bac..95e12887cd 100644
--- a/lib/observer/src/crashdump_viewer.erl
+++ b/lib/observer/src/crashdump_viewer.erl
@@ -205,7 +205,8 @@ do_script_start(StartFun) ->
io:format("\ncdv crash: ~tp\n",[Reason])
end;
_ ->
- io:format("\ncdv crash: ~p\n",[unknown_reason])
+ %io:format("\ncdv crash: ~p\n",[unknown_reason])
+ ok
end;
Error ->
io:format("\ncdv start failed: ~tp\n",[Error])