diff options
Diffstat (limited to 'debuggerd')
-rw-r--r-- | debuggerd/Android.mk | 26 | ||||
-rw-r--r-- | debuggerd/arm/machine.cpp (renamed from debuggerd/arm/machine.c) | 0 | ||||
-rw-r--r-- | debuggerd/backtrace.cpp (renamed from debuggerd/backtrace.c) | 0 | ||||
-rw-r--r-- | debuggerd/debuggerd.cpp (renamed from debuggerd/debuggerd.c) | 6 | ||||
-rw-r--r-- | debuggerd/getevent.cpp (renamed from debuggerd/getevent.c) | 6 | ||||
-rw-r--r-- | debuggerd/mips/machine.cpp (renamed from debuggerd/mips/machine.c) | 0 | ||||
-rw-r--r-- | debuggerd/tombstone.cpp (renamed from debuggerd/tombstone.c) | 13 | ||||
-rw-r--r-- | debuggerd/utility.cpp (renamed from debuggerd/utility.c) | 0 | ||||
-rw-r--r-- | debuggerd/x86/machine.cpp (renamed from debuggerd/x86/machine.c) | 0 |
9 files changed, 32 insertions, 19 deletions
diff --git a/debuggerd/Android.mk b/debuggerd/Android.mk index 2fe7c7a..422a86a 100644 --- a/debuggerd/Android.mk +++ b/debuggerd/Android.mk @@ -6,14 +6,20 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_SRC_FILES:= \ - backtrace.c \ - debuggerd.c \ - getevent.c \ - tombstone.c \ - utility.c \ - $(TARGET_ARCH)/machine.c - -LOCAL_CFLAGS := -Wall -Wno-unused-parameter -std=gnu99 + backtrace.cpp \ + debuggerd.cpp \ + getevent.cpp \ + tombstone.cpp \ + utility.cpp \ + $(TARGET_ARCH)/machine.cpp \ + +LOCAL_CONLYFLAGS := -std=gnu99 +LOCAL_CPPFLAGS := -std=gnu++11 +LOCAL_CFLAGS := \ + -Wall \ + -Wno-array-bounds \ + -Werror \ + LOCAL_MODULE := debuggerd ifeq ($(ARCH_ARM_HAVE_VFP),true) @@ -30,6 +36,8 @@ LOCAL_SHARED_LIBRARIES := \ liblog \ libselinux \ +include external/stlport/libstlport.mk + include $(BUILD_EXECUTABLE) include $(CLEAR_VARS) @@ -38,7 +46,7 @@ LOCAL_SRC_FILES += $(TARGET_ARCH)/crashglue.S LOCAL_MODULE := crasher LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) LOCAL_MODULE_TAGS := optional -LOCAL_CFLAGS += -fstack-protector-all +LOCAL_CFLAGS += -fstack-protector-all -Wno-unused-parameter -Wno-free-nonheap-object #LOCAL_FORCE_STATIC_EXECUTABLE := true LOCAL_SHARED_LIBRARIES := libcutils liblog libc include $(BUILD_EXECUTABLE) diff --git a/debuggerd/arm/machine.c b/debuggerd/arm/machine.cpp index 4ab6026..4ab6026 100644 --- a/debuggerd/arm/machine.c +++ b/debuggerd/arm/machine.cpp diff --git a/debuggerd/backtrace.c b/debuggerd/backtrace.cpp index aa7a3c2..aa7a3c2 100644 --- a/debuggerd/backtrace.c +++ b/debuggerd/backtrace.cpp diff --git a/debuggerd/debuggerd.c b/debuggerd/debuggerd.cpp index 756f7bb..a9f59c8 100644 --- a/debuggerd/debuggerd.c +++ b/debuggerd/debuggerd.cpp @@ -27,7 +27,7 @@ #include <sys/ptrace.h> #include <sys/wait.h> -#include <sys/exec_elf.h> +#include <elf.h> #include <sys/stat.h> #include <sys/poll.h> @@ -123,7 +123,7 @@ static void wait_for_user_action(pid_t pid) { int _ = -dit; int ___ = 3*_; int _______ = 7*_; - const signed char codes[] = { + const int codes[] = { dit,_,dit,_,dit,___,dah,_,dah,_,dah,___,dit,_,dit,_,dit,_______ }; size_t s = 0; @@ -132,7 +132,7 @@ static void wait_for_user_action(pid_t pid) { init_debug_led(); enable_debug_led(); do { - int timeout = abs((int)(codes[s])) * ms; + int timeout = abs(codes[s]) * ms; int res = get_event(&e, timeout); if (res == 0) { if (e.type == EV_KEY diff --git a/debuggerd/getevent.c b/debuggerd/getevent.cpp index ebd070c..8d0b149 100644 --- a/debuggerd/getevent.c +++ b/debuggerd/getevent.cpp @@ -54,13 +54,13 @@ static int open_device(const char *device) idstr[0] = '\0'; } - new_ufds = realloc(ufds, sizeof(ufds[0]) * (nfds + 1)); + new_ufds = reinterpret_cast<pollfd*>(realloc(ufds, sizeof(ufds[0]) * (nfds + 1))); if(new_ufds == NULL) { fprintf(stderr, "out of memory\n"); return -1; } ufds = new_ufds; - new_device_names = realloc(device_names, sizeof(device_names[0]) * (nfds + 1)); + new_device_names = reinterpret_cast<char**>(realloc(device_names, sizeof(device_names[0]) * (nfds + 1))); if(new_device_names == NULL) { fprintf(stderr, "out of memory\n"); return -1; @@ -162,7 +162,7 @@ int init_getevent() const char *device_path = "/dev/input"; nfds = 1; - ufds = calloc(1, sizeof(ufds[0])); + ufds = reinterpret_cast<pollfd*>(calloc(1, sizeof(ufds[0]))); ufds[0].fd = inotify_init(); ufds[0].events = POLLIN; diff --git a/debuggerd/mips/machine.c b/debuggerd/mips/machine.cpp index 489f3c5..489f3c5 100644 --- a/debuggerd/mips/machine.c +++ b/debuggerd/mips/machine.cpp diff --git a/debuggerd/tombstone.c b/debuggerd/tombstone.cpp index aa63547..1b08e8e 100644 --- a/debuggerd/tombstone.c +++ b/debuggerd/tombstone.cpp @@ -415,7 +415,7 @@ static void dump_thread(const backtrace_context_t* context, log_t* log, /* Return true if some thread is not detached cleanly */ static bool dump_sibling_thread_report( - log_t* log, pid_t pid, pid_t tid, int* total_sleep_time_usec) { + log_t* log, pid_t pid, pid_t tid, int* total_sleep_time_usec, backtrace_map_info_t* map_info) { char task_path[64]; snprintf(task_path, sizeof(task_path), "/proc/%d/task", pid); @@ -449,7 +449,7 @@ static bool dump_sibling_thread_report( _LOG(log, 0, "--- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---\n"); dump_thread_info(log, pid, new_tid, 0); backtrace_context_t new_context; - if (backtrace_create_context(&new_context, pid, new_tid, 0)) { + if (backtrace_create_context_with_map(&new_context, pid, new_tid, 0, map_info)) { dump_thread(&new_context, log, 0, total_sleep_time_usec); backtrace_destroy_context(&new_context); } @@ -676,7 +676,9 @@ static bool dump_crash(log_t* log, pid_t pid, pid_t tid, int signal, uintptr_t a } backtrace_context_t context; - if (backtrace_create_context(&context, pid, tid, 0)) { + /* Gather the map info once for all this process' threads. */ + backtrace_map_info_t* map_info = backtrace_create_map_info_list(pid); + if (backtrace_create_context_with_map(&context, pid, tid, 0, map_info)) { dump_abort_message(&context, log, abort_msg_address); dump_thread(&context, log, SCOPE_AT_FAULT, total_sleep_time_usec); backtrace_destroy_context(&context); @@ -688,9 +690,12 @@ static bool dump_crash(log_t* log, pid_t pid, pid_t tid, int signal, uintptr_t a bool detach_failed = false; if (dump_sibling_threads) { - detach_failed = dump_sibling_thread_report(log, pid, tid, total_sleep_time_usec); + detach_failed = dump_sibling_thread_report(log, pid, tid, total_sleep_time_usec, map_info); } + /* Destroy the previously created map info. */ + backtrace_destroy_map_info_list(map_info); + if (want_logs) { dump_logs(log, pid, false); } diff --git a/debuggerd/utility.c b/debuggerd/utility.cpp index 41be982..41be982 100644 --- a/debuggerd/utility.c +++ b/debuggerd/utility.cpp diff --git a/debuggerd/x86/machine.c b/debuggerd/x86/machine.cpp index db44b11..db44b11 100644 --- a/debuggerd/x86/machine.c +++ b/debuggerd/x86/machine.cpp |