From e49367d214f753f6a158d21d8aa46bc833646d5d Mon Sep 17 00:00:00 2001 From: Tobias Frost Date: Fri, 10 Jun 2022 13:12:37 +0200 Subject: [PATCH 1/5] Fix unused parameter warning. --- sysdeps/linux-gnu/arm/arch.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sysdeps/linux-gnu/arm/arch.c b/sysdeps/linux-gnu/arm/arch.c index 169ee63..79d682c 100644 --- a/sysdeps/linux-gnu/arm/arch.c +++ b/sysdeps/linux-gnu/arm/arch.c @@ -47,6 +47,7 @@ int is_64bit(struct mt_elf *mte) { + (void)(mte); return 0; } From f6b3158574fa0fd257160379cab494b274d14538 Mon Sep 17 00:00:00 2001 From: Tobias Frost Date: Fri, 10 Jun 2022 13:27:15 +0200 Subject: [PATCH 2/5] SW_BP is not defined, it seems to be BP_SW (at least that is what breakpoint.h has) --- sysdeps/linux-gnu/arm/arch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sysdeps/linux-gnu/arm/arch.c b/sysdeps/linux-gnu/arm/arch.c index 79d682c..f4c02ae 100644 --- a/sysdeps/linux-gnu/arm/arch.c +++ b/sysdeps/linux-gnu/arm/arch.c @@ -691,7 +691,7 @@ int do_singlestep(struct task *task, struct breakpoint *bp) bp1 = breakpoint_find(task, next_pcs[0]); if (!bp1) { - bp1 = breakpoint_new(task, next_pcs[0], NULL, SW_BP); + bp1 = breakpoint_new(task, next_pcs[0], NULL, BP_SW); if (!bp1) return -1; } @@ -703,7 +703,7 @@ int do_singlestep(struct task *task, struct breakpoint *bp) if (next_pcs[1]) { bp2 = breakpoint_find(task, next_pcs[1]); if (!bp2) { - bp2 = breakpoint_new(task, next_pcs[1], NULL, SW_BP); + bp2 = breakpoint_new(task, next_pcs[1], NULL, BP_SW); if (!bp2) return -1; } From d103e4f4fb86a23f301d51ca5bd89df09111014c Mon Sep 17 00:00:00 2001 From: Tobias Frost Date: Fri, 10 Jun 2022 13:43:14 +0200 Subject: [PATCH 3/5] Fix include path for dwarf.h and add missing define the compiler included system dwarf.h, not with the project one. DWARF_STOPUNWIND was not defined in the project's dwarf.h --- dwarf.h | 1 + sysdeps/linux-gnu/arm/dwarf-arm.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dwarf.h b/dwarf.h index f40702c..d18d528 100644 --- a/dwarf.h +++ b/dwarf.h @@ -58,6 +58,7 @@ #define DWARF_EINVAL 4 /* unsupported operation or bad value */ #define DWARF_EBADVERSION 5 /* unwind info has unsupported version */ #define DWARF_ENOINFO 6 /* no unwind info found */ +#define DWARF_STOPUNWIND 7 struct dwarf_cie_info { arch_addr_t start_ip; /* first IP covered by this procedure */ diff --git a/sysdeps/linux-gnu/arm/dwarf-arm.c b/sysdeps/linux-gnu/arm/dwarf-arm.c index 9bbaeb1..6547912 100644 --- a/sysdeps/linux-gnu/arm/dwarf-arm.c +++ b/sysdeps/linux-gnu/arm/dwarf-arm.c @@ -32,7 +32,7 @@ #include "common.h" #include "backend.h" #include "debug.h" -#include "dwarf.h" +#include "../../../dwarf.h" #include "library.h" #include "task.h" From 83f3e2b1bea1fe4ca9cf4386a379b048b9a0fdba Mon Sep 17 00:00:00 2001 From: Tobias Frost Date: Fri, 10 Jun 2022 14:06:33 +0200 Subject: [PATCH 4/5] struct libref members have been renamed previously. Do also in the arm specific code. --- sysdeps/linux-gnu/arm/dwarf-arm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sysdeps/linux-gnu/arm/dwarf-arm.c b/sysdeps/linux-gnu/arm/dwarf-arm.c index 6547912..87955dd 100644 --- a/sysdeps/linux-gnu/arm/dwarf-arm.c +++ b/sysdeps/linux-gnu/arm/dwarf-arm.c @@ -177,10 +177,10 @@ static inline int access_mem(struct dwarf_addr_space *as, arch_addr_t addr, void struct dwarf_cursor *c = &as->cursor; struct libref *libref = c->libref; - if (addr < ARCH_ADDR_T(libref->image_addr)) - fatal("invalid access mem: addr %#lx < %p", addr, libref->image_addr); - if (addr >= ARCH_ADDR_T(libref->image_addr + libref->load_size)) - fatal("invalid access mem: addr %#lx >= %p", addr, libref->image_addr + libref->load_size); + if (addr < ARCH_ADDR_T(libref->mmap_addr)) + fatal("invalid access mem: addr %#lx < %p", addr, libref->mmap_addr); + if (addr >= ARCH_ADDR_T(libref->mmap_addr + libref->mmap_size)) + fatal("invalid access mem: addr %#lx >= %p", addr, libref->mmap_addr + libref->mmap_size); } #endif @@ -506,7 +506,7 @@ static unsigned long arm_search_unwind_table(struct dwarf_addr_space *as, arch_a { struct dwarf_cursor *c = &as->cursor; struct libref *libref = c->libref; - unsigned long map_offset = (unsigned long)libref->image_addr + libref->load_offset - libref->load_addr; + unsigned long map_offset = (unsigned long)libref->mmap_addr + libref->mmap_offset - libref->txt_vaddr; unsigned long lo, hi, e, f; arch_addr_t val; From c39c76a2849e6363719be04e9bed4a0901ab4a6c Mon Sep 17 00:00:00 2001 From: Tobias Frost Date: Fri, 10 Jun 2022 14:23:32 +0200 Subject: [PATCH 5/5] More unused parameters fixed. --- sysdeps/linux-gnu/arm/dwarf-arm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sysdeps/linux-gnu/arm/dwarf-arm.c b/sysdeps/linux-gnu/arm/dwarf-arm.c index 87955dd..ce665a4 100644 --- a/sysdeps/linux-gnu/arm/dwarf-arm.c +++ b/sysdeps/linux-gnu/arm/dwarf-arm.c @@ -153,6 +153,7 @@ static int is_signal_frame(struct dwarf_cursor *c) int dwarf_arch_map_reg(struct dwarf_addr_space *as, unsigned int reg) { + (void)(as); if (reg >= ARRAY_SIZE(dwarf_to_regnum_map)) return -DWARF_EBADREG; @@ -182,6 +183,8 @@ static inline int access_mem(struct dwarf_addr_space *as, arch_addr_t addr, void if (addr >= ARCH_ADDR_T(libref->mmap_addr + libref->mmap_size)) fatal("invalid access mem: addr %#lx >= %p", addr, libref->mmap_addr + libref->mmap_size); } +#else + (void)(as); #endif memcpy(valp, (void *)addr, size); @@ -647,6 +650,8 @@ int dwarf_arch_step(struct dwarf_addr_space *as) int dwarf_arch_check_call(struct dwarf_addr_space *as, arch_addr_t ip) { + (void)(as); + (void)(ip); return 1; }