Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1162)

Unified Diff: base/debug/debugger_posix.cc

Issue 7238012: Upstream android debug and log related files (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove the android guard around ctype.h Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/debug/debugger.cc ('k') | base/debug/stack_trace_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/debug/debugger_posix.cc
diff --git a/base/debug/debugger_posix.cc b/base/debug/debugger_posix.cc
index a1551a397187824ac6c52a81ffaad0d4e6b0cf45..b3c9bc803f5218e33d479f22cd8fddd0a0e2c571 100644
--- a/base/debug/debugger_posix.cc
+++ b/base/debug/debugger_posix.cc
@@ -44,6 +44,11 @@
#include "base/third_party/symbolize/symbolize.h"
#endif
+#if defined(OS_ANDROID)
+#include <execinfo.h>
+#include "base/threading/platform_thread.h"
+#endif
+
namespace base {
namespace debug {
@@ -94,7 +99,7 @@ bool BeingDebugged() {
return being_debugged;
}
-#elif defined(OS_LINUX)
+#elif defined(OS_LINUX) || defined(OS_ANDROID)
// We can look in /proc/self/status for TracerPid. We are likely used in crash
// handling, so we are careful not to use the heap or have side effects.
@@ -161,7 +166,7 @@ bool BeingDebugged() {
// Linux: Debug mode, send SIGTRAP; Release mode, send SIGABRT.
// Mac: Always send SIGTRAP.
-#if defined(NDEBUG) && !defined(OS_MACOSX)
+#if defined(NDEBUG) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
#define DEBUG_BREAK() abort()
#elif defined(OS_NACL)
// The NaCl verifier doesn't let use use int3. For now, we call abort(). We
@@ -169,7 +174,21 @@ bool BeingDebugged() {
// http://code.google.com/p/nativeclient/issues/detail?id=645
#define DEBUG_BREAK() abort()
#elif defined(ARCH_CPU_ARM_FAMILY)
+#if defined(OS_ANDROID)
+// Though Android has a "helpful" process called debuggerd to catch native
+// signals on the general assumption that they are fatal errors, we've had great
+// difficulty continuing in a debugger once we stop from SIGINT triggered by
+// native code.
+//
+// Use GDB to set |go| to 1 to resume execution.
+#define DEBUG_BREAK() do { \
+ volatile int go = 0; \
+ while (!go) { base::PlatformThread::Sleep(100); } \
+} while (0)
+#else
+// ARM && !ANDROID
#define DEBUG_BREAK() asm("bkpt 0")
+#endif
#else
#define DEBUG_BREAK() asm("int3")
#endif
« no previous file with comments | « base/debug/debugger.cc ('k') | base/debug/stack_trace_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698