Index: base/debug/stack_trace_android.cc |
diff --git a/base/debug/stack_trace_android.cc b/base/debug/stack_trace_android.cc |
index 4c11a244d6ee2f5513c560f67702de21ab924c5c..50d3a4ed1036a65d737d5a579c6a6df5d67f5a90 100644 |
--- a/base/debug/stack_trace_android.cc |
+++ b/base/debug/stack_trace_android.cc |
@@ -9,6 +9,7 @@ |
#include "base/debug/proc_maps_linux.h" |
#include "base/strings/stringprintf.h" |
+#include "base/threading/thread_restrictions.h" |
// TODO(dmikurube): Remove when Bionic's get_backtrace() gets popular. |
// See http://crbug.com/236855. |
@@ -98,6 +99,12 @@ void StackTrace::PrintBacktrace() const { |
void StackTrace::OutputToStream(std::ostream* os) const { |
std::string proc_maps; |
std::vector<MappedMemoryRegion> regions; |
+ // Allow IO to read /proc/self/maps. Reading this file doesn't hit the disk |
+ // since it lives in procfs, and this is currently used to print a stack trace |
+ // on fatal log messages in debug builds only. If the restriction is enabled |
+ // then it will recursively trigger fatal failures when this enters on the |
+ // UI thread. |
+ base::ThreadRestrictions::ScopedAllowIO allow_io; |
if (!ReadProcMaps(&proc_maps)) { |
scherkus (not reviewing)
2013/07/10 15:35:30
Q: thoughts on putting the ScopedAllowIO inside Re
Joao da Silva
2013/07/10 15:36:44
Seems like a better place for this to me. Mark, wh
|
__android_log_write( |
ANDROID_LOG_ERROR, "chromium", "Failed to read /proc/self/maps"); |