Skip to content

Commit

Permalink
coredump:support arm64 coredump
Browse files Browse the repository at this point in the history
Signed-off-by: anjiahao <[email protected]>
  • Loading branch information
anjiahao1 authored and acassis committed Dec 9, 2023
1 parent dedb563 commit 90517b9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
1 change: 1 addition & 0 deletions arch/arm64/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ config ARCH_CHIP_GOLDFISH
select ARCH_HAVE_POWEROFF
select ARCH_HAVE_RESET
select ARCH_NEED_ADDRENV_MAPPING
select LIBC_ARCH_ELF_64BIT if LIBC_ARCH_ELF
---help---
Android GoldFish platform for NuttX (ARMv8a),
based on ARM virt board
Expand Down
20 changes: 20 additions & 0 deletions arch/arm64/include/elf.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
#ifndef __ARCH_ARM64_INCLUDE_ELF_H
#define __ARCH_ARM64_INCLUDE_ELF_H

/****************************************************************************
* Included Files
****************************************************************************/

#include <stdint.h>

/****************************************************************************
* Pre-processor Prototypes
****************************************************************************/
Expand Down Expand Up @@ -206,10 +212,24 @@
#define PT_AARCH64_ARCHEXT 0x70000000 /* Reserved for architecture compatibility information */
#define PT_AARCH64_UNWIND 0x70000001 /* Reserved for exception unwinding tables */

#define EF_FLAG 0

/****************************************************************************
* 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
****************************************************************************/
Expand Down
8 changes: 4 additions & 4 deletions binfmt/libelf/libelf_coredump.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ static void elf_emit_tcb_note(FAR struct elf_dumpinfo_s *cinfo,
char name[ROUNDUP(CONFIG_TASK_NAME_SIZE, 8)];
elf_prstatus_t status;
elf_prpsinfo_t info;
FAR uint32_t *regs;
FAR uintptr_t *regs;
Elf_Nhdr nhdr;
int i;

Expand Down Expand Up @@ -267,17 +267,17 @@ static void elf_emit_tcb_note(FAR struct elf_dumpinfo_s *cinfo,
{
if (up_interrupt_context())
{
regs = (FAR uint32_t *)CURRENT_REGS;
regs = (FAR uintptr_t *)CURRENT_REGS;
}
else
{
up_saveusercontext(g_running_regs);
regs = (FAR uint32_t *)g_running_regs;
regs = (FAR uintptr_t *)g_running_regs;
}
}
else
{
regs = tcb->xcp.regs;
regs = (uintptr_t *)tcb->xcp.regs;
}

if (regs != NULL)
Expand Down

0 comments on commit 90517b9

Please sign in to comment.