[go: nahoru, domu]

Add file and line to DCHECK message reporting

The line numbers from stacks in crash reporting will never be as
reliable as __FILE__ and __LINE__.

This also aligns with crashpad reporting of LOG_FATAL, so error-message
reporting will be more consistent.

Bug: 1340649
Change-Id: Ib2b23cae2c38120523034ae049ec5c04e591dbac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3753283
Commit-Queue: Peter Boström <pbos@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1022771}
diff --git a/base/logging.h b/base/logging.h
index 48d1eb2..752286e 100644
--- a/base/logging.h
+++ b/base/logging.h
@@ -648,6 +648,8 @@
 
   LogSeverity severity() const { return severity_; }
   std::string str() const { return stream_.str(); }
+  const char* file() const { return file_; }
+  int line() const { return line_; }
 
   // Gets the log message (w/o prefix).
   std::string GetMessageWithoutPrefix() const;