coredump:support arm64 coredump

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
anjiahao 2023-11-09 19:16:45 +08:00 committed by Alan Carvalho de Assis
parent dedb563322
commit 90517b9f11
3 changed files with 25 additions and 4 deletions

View File

@ -71,6 +71,7 @@ config ARCH_CHIP_GOLDFISH
select ARCH_HAVE_POWEROFF select ARCH_HAVE_POWEROFF
select ARCH_HAVE_RESET select ARCH_HAVE_RESET
select ARCH_NEED_ADDRENV_MAPPING select ARCH_NEED_ADDRENV_MAPPING
select LIBC_ARCH_ELF_64BIT if LIBC_ARCH_ELF
---help--- ---help---
Android GoldFish platform for NuttX (ARMv8a), Android GoldFish platform for NuttX (ARMv8a),
based on ARM virt board based on ARM virt board

View File

@ -25,6 +25,12 @@
#ifndef __ARCH_ARM64_INCLUDE_ELF_H #ifndef __ARCH_ARM64_INCLUDE_ELF_H
#define __ARCH_ARM64_INCLUDE_ELF_H #define __ARCH_ARM64_INCLUDE_ELF_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <stdint.h>
/**************************************************************************** /****************************************************************************
* Pre-processor Prototypes * Pre-processor Prototypes
****************************************************************************/ ****************************************************************************/
@ -206,10 +212,24 @@
#define PT_AARCH64_ARCHEXT 0x70000000 /* Reserved for architecture compatibility information */ #define PT_AARCH64_ARCHEXT 0x70000000 /* Reserved for architecture compatibility information */
#define PT_AARCH64_UNWIND 0x70000001 /* Reserved for exception unwinding tables */ #define PT_AARCH64_UNWIND 0x70000001 /* Reserved for exception unwinding tables */
#define EF_FLAG 0
/**************************************************************************** /****************************************************************************
* Public Types * Public Types
****************************************************************************/ ****************************************************************************/
typedef unsigned long elf_greg_t;
struct user_pt_regs
{
uint64_t regs[31];
uint64_t sp;
uint64_t pc;
uint64_t pstate;
};
#define ELF_NGREG (sizeof(struct user_pt_regs) / sizeof(elf_greg_t))
typedef elf_greg_t elf_gregset_t[ELF_NGREG];
/**************************************************************************** /****************************************************************************
* Public Data * Public Data
****************************************************************************/ ****************************************************************************/

View File

@ -231,7 +231,7 @@ static void elf_emit_tcb_note(FAR struct elf_dumpinfo_s *cinfo,
char name[ROUNDUP(CONFIG_TASK_NAME_SIZE, 8)]; char name[ROUNDUP(CONFIG_TASK_NAME_SIZE, 8)];
elf_prstatus_t status; elf_prstatus_t status;
elf_prpsinfo_t info; elf_prpsinfo_t info;
FAR uint32_t *regs; FAR uintptr_t *regs;
Elf_Nhdr nhdr; Elf_Nhdr nhdr;
int i; int i;
@ -267,17 +267,17 @@ static void elf_emit_tcb_note(FAR struct elf_dumpinfo_s *cinfo,
{ {
if (up_interrupt_context()) if (up_interrupt_context())
{ {
regs = (FAR uint32_t *)CURRENT_REGS; regs = (FAR uintptr_t *)CURRENT_REGS;
} }
else else
{ {
up_saveusercontext(g_running_regs); up_saveusercontext(g_running_regs);
regs = (FAR uint32_t *)g_running_regs; regs = (FAR uintptr_t *)g_running_regs;
} }
} }
else else
{ {
regs = tcb->xcp.regs; regs = (uintptr_t *)tcb->xcp.regs;
} }
if (regs != NULL) if (regs != NULL)