summaryrefslogtreecommitdiffstats
path: root/base/debug/debugger_posix.cc
diff options
context:
space:
mode:
authormichaelbai@google.com <michaelbai@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-07 20:46:50 +0000
committermichaelbai@google.com <michaelbai@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-07 20:46:50 +0000
commit3132e35cb49119f36a529f2370d9de5887582bc2 (patch)
treee23bdd40d066e3523e870c46ea9d77189d83d954 /base/debug/debugger_posix.cc
parent16adff66ea7224ddd91d01160a7bcc54f5d8b5a6 (diff)
downloadchromium_src-3132e35cb49119f36a529f2370d9de5887582bc2.zip
chromium_src-3132e35cb49119f36a529f2370d9de5887582bc2.tar.gz
chromium_src-3132e35cb49119f36a529f2370d9de5887582bc2.tar.bz2
Upstream android debug and log related files
BUG= TEST= Review URL: http://codereview.chromium.org/7238012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91748 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/debug/debugger_posix.cc')
-rw-r--r--base/debug/debugger_posix.cc23
1 files changed, 21 insertions, 2 deletions
diff --git a/base/debug/debugger_posix.cc b/base/debug/debugger_posix.cc
index a1551a3..b3c9bc8 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