From 4761355a54425df11163fe72a09911a255460968 Mon Sep 17 00:00:00 2001 From: Christopher Ferris Date: Mon, 13 Mar 2023 14:44:22 -0700 Subject: [PATCH] Fix unwind information for crash assembler. Test: Crash on arm, arm64, x86, x86_64 and verified full stack is Test: found in tombstone. Change-Id: I809ec66d6ce9af378c8e8b04cc1c85b51a61779f --- debuggerd/crasher/arm/crashglue.S | 9 +++++++++ debuggerd/crasher/arm64/crashglue.S | 10 ++++++++++ debuggerd/crasher/x86/crashglue.S | 8 ++++++-- debuggerd/crasher/x86_64/crashglue.S | 8 ++++++-- 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/debuggerd/crasher/arm/crashglue.S b/debuggerd/crasher/arm/crashglue.S index 864905687..6f41b21a4 100644 --- a/debuggerd/crasher/arm/crashglue.S +++ b/debuggerd/crasher/arm/crashglue.S @@ -1,6 +1,10 @@ .globl crash1 .type crash1, %function crash1: + .cfi_startproc + push {lr} + .cfi_def_cfa_offset 4 + .cfi_rel_offset lr, 0 ldr r0, =0xa5a50000 ldr r1, =0xa5a50001 ldr r2, =0xa5a50002 @@ -52,11 +56,16 @@ crash1: mov lr, #0 ldr lr, [lr] b . + .cfi_endproc .globl crashnostack .type crashnostack, %function crashnostack: + .cfi_startproc + mov r1, sp + .cfi_def_cfa_register r1 mov sp, #0 mov r0, #0 ldr r0, [r0] b . + .cfi_endproc diff --git a/debuggerd/crasher/arm64/crashglue.S b/debuggerd/crasher/arm64/crashglue.S index e58b54246..014c98c68 100644 --- a/debuggerd/crasher/arm64/crashglue.S +++ b/debuggerd/crasher/arm64/crashglue.S @@ -1,6 +1,11 @@ .globl crash1 .type crash1, %function crash1: + .cfi_startproc + stp x29, x30, [sp, -16]! + .cfi_def_cfa_offset 16 + .cfi_rel_offset x29, 0 + .cfi_rel_offset x30, 8 ldr x0, =0xa5a50000 ldr x1, =0xa5a50001 ldr x2, =0xa5a50002 @@ -68,12 +73,17 @@ crash1: mov x30, xzr ldr x30, [x30] b . + .cfi_endproc .globl crashnostack .type crashnostack, %function crashnostack: + .cfi_startproc + mov x1, sp + .cfi_def_cfa_register x1 mov x0, xzr add sp, x0, xzr ldr x0, [x0] b . + .cfi_endproc diff --git a/debuggerd/crasher/x86/crashglue.S b/debuggerd/crasher/x86/crashglue.S index 59df43250..ffbd816d5 100644 --- a/debuggerd/crasher/x86/crashglue.S +++ b/debuggerd/crasher/x86/crashglue.S @@ -11,5 +11,9 @@ crash1: crashnostack: - movl $0, %ebp - jmp *%ebp + .cfi_startproc + movl %esp, %eax + .cfi_def_cfa_register %eax + movl $0, %esp + movl (%esp), %ebx + .cfi_endproc diff --git a/debuggerd/crasher/x86_64/crashglue.S b/debuggerd/crasher/x86_64/crashglue.S index 4d2a5c023..7e2211859 100644 --- a/debuggerd/crasher/x86_64/crashglue.S +++ b/debuggerd/crasher/x86_64/crashglue.S @@ -11,5 +11,9 @@ crash1: crashnostack: - movl $0, %ebp - jmp *%rbp + .cfi_startproc + movq %rsp, %rax + .cfi_def_cfa_register %rax + movq $0, %rsp + movq (%rsp), %rbx + .cfi_endproc