Commit f8439175 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[d8] Improve error message for illegal --trace-path

Unconditionally check for errors (instead of a DCHECK), and print a
better error message (including the file path) if the file cannot be
opened.

R=tebbi@chromium.org
CC=machenbach@chromium.org

Bug: chromium:1087039
Change-Id: Ia5cb76b309e78631ecf9462de6c7cd3eb4bf9e59
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2224226Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68097}
parent 5fcb414a
......@@ -3601,8 +3601,14 @@ int Shell::Main(int argc, char* argv[]) {
std::ofstream trace_file;
if (options.trace_enabled && !i::FLAG_verify_predictable) {
tracing = std::make_unique<platform::tracing::TracingController>();
trace_file.open(options.trace_path ? options.trace_path : "v8_trace.json");
DCHECK(trace_file.good());
const char* trace_path =
options.trace_path ? options.trace_path : "v8_trace.json";
trace_file.open(trace_path);
if (!trace_file.good()) {
printf("Cannot open trace file '%s' for writing: %s.\n", trace_path,
strerror(errno));
return 1;
}
#ifdef V8_USE_PERFETTO
// Set up the in-process backend that the tracing controller will connect
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment