close
Commit a22f1db0 authored by Kyle Evans's avatar Kyle Evans
Browse files

devel/gdb: kgdb: fix aarch64 trapframe handling

regcache_map_entry_size() doesn't do the magic to convert size == 0 to
register_size, so we must supply sizes for all registers if we're going
to use it.

This fixes handling of the trapframe so that we can actually unwind
properly, where-as before we would end up with, e.g.,

 #6 0xffff0000004b4860 in kdb_trap (type=60, code=0, tf=<optimized out>)
  at /usr/src/sys/kern/subr_kdb.c:790
 #7 <signal handler called>
 #8 <signal handler called>
 #9 <signal handler called>
 #10 <signal handler called>
 #11 <signal handler called>

Reported by:	Mark Millard
Approved by:	jhb (implicit, kgdb maintainer)
MFH:		2023Q3
parent 4fd25f14
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
PORTNAME=	gdb
DISTVERSION=	13.1
PORTREVISION=	4
PORTREVISION=	5
CATEGORIES=	devel
MASTER_SITES=	GNU

+9 −9
Original line number Diff line number Diff line
@@ -126,13 +126,13 @@ aarch64_fbsd_supply_pcb(struct regcache *regcache, CORE_ADDR pcb_addr)

static const struct regcache_map_entry aarch64_fbsd_trapframe_map[] =
  {
    { 1, AARCH64_SP_REGNUM, 0 },
    { 1, AARCH64_LR_REGNUM, 0 },
    { 1, AARCH64_PC_REGNUM, 0 },
    { 1, AARCH64_CPSR_REGNUM, 0 },
    { 1, AARCH64_SP_REGNUM, 8 },
    { 1, AARCH64_LR_REGNUM, 8 },
    { 1, AARCH64_PC_REGNUM, 8 },
    { 1, AARCH64_CPSR_REGNUM, 8 },
    { 1, REGCACHE_MAP_SKIP, 8 },	/* esr */
    { 1, REGCACHE_MAP_SKIP, 8 },	/* far */
    { 30, AARCH64_X0_REGNUM, 0 },	/* x0 ... x29 */
    { 30, AARCH64_X0_REGNUM, 8 },	/* x0 ... x29 */
    { 0 },
  };

@@ -141,12 +141,12 @@ static const struct regcache_map_entry aarch64_fbsd_trapframe_map[] =

static const struct regcache_map_entry aarch64_fbsd13_trapframe_map[] =
  {
    { 1, AARCH64_SP_REGNUM, 0 },
    { 1, AARCH64_LR_REGNUM, 0 },
    { 1, AARCH64_PC_REGNUM, 0 },
    { 1, AARCH64_SP_REGNUM, 8 },
    { 1, AARCH64_LR_REGNUM, 8 },
    { 1, AARCH64_PC_REGNUM, 8 },
    { 1, AARCH64_CPSR_REGNUM, 4 },
    { 1, REGCACHE_MAP_SKIP, 4 },	/* esr */
    { 30, AARCH64_X0_REGNUM, 0 },	/* x0 ... x29 */
    { 30, AARCH64_X0_REGNUM, 8 },	/* x0 ... x29 */
    { 0 },
  };