From bd04d4e9423485ea0faeb699424bcebf1629fb3f Mon Sep 17 00:00:00 2001 From: Mateusz Moscicki Date: Thu, 13 Aug 2020 17:06:55 +0200 Subject: [PATCH] Fix building on aarch64, after changing the ELF parser. Change-Id: I41557a2149ca4b6c5d89ab16a89199d1cdf33170 --- src/crash-stack/crash-stack-aarch64.c | 10 ++++++---- src/crash-stack/unwind.c | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/crash-stack/crash-stack-aarch64.c b/src/crash-stack/crash-stack-aarch64.c index 0671115..03b8aa1 100644 --- a/src/crash-stack/crash-stack-aarch64.c +++ b/src/crash-stack/crash-stack-aarch64.c @@ -24,8 +24,10 @@ #include "shared/log.h" #include "shared/util.h" +#include #include #include +#include static struct user_regs_struct g_registers; ///< static storage for registers @@ -33,10 +35,10 @@ static struct user_regs_struct g_registers; ///< static storage for registers * @brief Important registers for unwinding stack on aarch64 */ struct Regs { - Dwarf_Addr x29; ///< x29 register contains frame pointer - Dwarf_Addr x30; ///< x30 register contains return address - Dwarf_Addr pc; ///< register: program counter - Dwarf_Addr sp; ///< register: stack pointer + Elf64_Addr x29; ///< x29 register contains frame pointer + Elf64_Addr x30; ///< x30 register contains return address + Elf64_Addr pc; ///< register: program counter + Elf64_Addr sp; ///< register: stack pointer }; #define REG_X29 29 ///< number of x29 register diff --git a/src/crash-stack/unwind.c b/src/crash-stack/unwind.c index a4da0b9..cda0e10 100644 --- a/src/crash-stack/unwind.c +++ b/src/crash-stack/unwind.c @@ -255,12 +255,12 @@ static int find_eh_frame_hdr(int fd, char *image, uint64_t size, if (!teu_getshdr(elf, i, &shdr)) break; - char *str = teu_strptr(&elf, ehdr.e_shstrndx, shdr.sh_name); + char *str = teu_strptr(elf, ehdr.e_shstrndx, shdr.sh_name); if (str != NULL && !strcmp(str, ".eh_frame_hdr")) { void *data = teu_getsdata(elf, &shdr); offset = *segbase = shdr.sh_offset; - parse_eh_frame_hdr(data->d_buf, offset, table_data, fde_count); + parse_eh_frame_hdr(data, offset, table_data, fde_count); break; } } -- 2.7.4