summaryrefslogtreecommitdiffstats
path: root/debuggerd/x86_64
diff options
context:
space:
mode:
authorPavel Chupin <pavel.v.chupin@intel.com>2013-11-21 23:17:20 +0400
committerElliott Hughes <enh@google.com>2014-01-30 17:15:24 -0800
commitc6c194ced095df5e777b8fa24527ebd29c8fef54 (patch)
treee8c2872d11d30743d38f915b90ce394d2773ccf2 /debuggerd/x86_64
parente97dad0d95ae1305686bf4294029da947fc2dcf2 (diff)
downloadsystem_core-c6c194ced095df5e777b8fa24527ebd29c8fef54.zip
system_core-c6c194ced095df5e777b8fa24527ebd29c8fef54.tar.gz
system_core-c6c194ced095df5e777b8fa24527ebd29c8fef54.tar.bz2
LP64: Enable debuggerd/libbacktrace/libunwind.
Change-Id: I2e432839f86c33c2adbaac8cc12ca8961956044b Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
Diffstat (limited to 'debuggerd/x86_64')
-rw-r--r--debuggerd/x86_64/crashglue.S15
-rwxr-xr-xdebuggerd/x86_64/machine.cpp51
2 files changed, 66 insertions, 0 deletions
diff --git a/debuggerd/x86_64/crashglue.S b/debuggerd/x86_64/crashglue.S
new file mode 100644
index 0000000..4d2a5c0
--- /dev/null
+++ b/debuggerd/x86_64/crashglue.S
@@ -0,0 +1,15 @@
+.globl crash1
+.globl crashnostack
+
+crash1:
+ movl $0xa5a50000, %eax
+ movl $0xa5a50001, %ebx
+ movl $0xa5a50002, %ecx
+
+ movl $0, %edx
+ jmp *%rdx
+
+
+crashnostack:
+ movl $0, %ebp
+ jmp *%rbp
diff --git a/debuggerd/x86_64/machine.cpp b/debuggerd/x86_64/machine.cpp
new file mode 100755
index 0000000..406851a
--- /dev/null
+++ b/debuggerd/x86_64/machine.cpp
@@ -0,0 +1,51 @@
+/*
+** Copyright 2013, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+#include <stddef.h>
+#include <stdbool.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/ptrace.h>
+#include <sys/user.h>
+
+#include "../utility.h"
+#include "../machine.h"
+
+void dump_memory_and_code(log_t* log, pid_t tid, int scope_flags) {
+}
+
+void dump_registers(log_t* log, pid_t tid, int scope_flags) {
+ struct user_regs_struct r;
+ if (ptrace(PTRACE_GETREGS, tid, 0, &r) == -1) {
+ _LOG(log, scope_flags, "cannot get registers: %s\n", strerror(errno));
+ return;
+ }
+ _LOG(log, scope_flags, " rax %016lx rbx %016lx rcx %016lx rdx %016lx\n",
+ r.rax, r.rbx, r.rcx, r.rdx);
+ _LOG(log, scope_flags, " rsi %016lx rdi %016lx\n",
+ r.rsi, r.rdi);
+ _LOG(log, scope_flags, " r8 %016lx r9 %016lx r10 %016lx r11 %016lx\n",
+ r.r8, r.r9, r.r10, r.r11);
+ _LOG(log, scope_flags, " r12 %016lx r13 %016lx r14 %016lx r15 %016lx\n",
+ r.r12, r.r13, r.r14, r.r15);
+ _LOG(log, scope_flags, " cs %016lx ss %016lx\n",
+ r.cs, r.ss);
+ _LOG(log, scope_flags, " rip %016lx rbp %016lx rsp %016lx eflags %016lx\n",
+ r.rip, r.rbp, r.rsp, r.eflags);
+}