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

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: Created 9 years, 6 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
Index: base/debug/debugger_posix.cc
diff --git a/base/debug/debugger_posix.cc b/base/debug/debugger_posix.cc
index bf90a0f552fb19e0401316c0dd622751284adbe4..ad8cb848e346c7b1d77b5e266a41b3f560ef7045 100644
--- a/base/debug/debugger_posix.cc
+++ b/base/debug/debugger_posix.cc
@@ -12,7 +12,7 @@
#include <stdlib.h>
#include <sys/param.h>
#include <sys/stat.h>
-#if !defined(OS_NACL)
+#if !defined(OS_NACL) && !defined(OS_ANDROID)
#include <sys/sysctl.h>
#endif
#include <sys/types.h>
@@ -43,6 +43,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 {
@@ -93,7 +98,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.
@@ -160,7 +165,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
@@ -168,7 +173,16 @@ 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)
+// 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")
brettw 2011/06/24 22:23:57 Sorry I don't have much background in this. Why do
michaelbai 2011/06/24 23:30:44 For this issue, I have to get it back to you later
John Grabowski 2011/06/28 17:27:23 In general, Android is Java based. Android has a
brettw 2011/06/29 16:42:28 Can a comment be added to this effect?
michaelbai 2011/06/29 17:18:46 Done.
+#endif
#else
#define DEBUG_BREAK() asm("int3")
#endif

Powered by Google App Engine
This is Rietveld 408576698