Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Jan 2018 19:57:24 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r460050 - in head/devel/gdb: . files/kgdb
Message-ID:  <201801261957.w0QJvORW066401@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb (src,doc committer)
Date: Fri Jan 26 19:57:23 2018
New Revision: 460050
URL: https://svnweb.freebsd.org/changeset/ports/460050

Log:
  KGDB fixes for amd64 and aarch64.
  
  - Update the amd64 kernel support to recognize mchk_calltrap as a
    trapframe generator.
  - Remove some unneeded headers from fbsd-kld.c.
  - Various fixes to get stack traces working for aarch64 kernels:
    - Map the LR register from the PCB to PC instead of LR.
    - Skip the PC register from the PCB as it isn't initialized to anything.
    - Correct the register cache map for the PCB.  The old one had the
      offsets of pcb_sp and pcb_pc reversed.
    - Don't map all of the saved general purpose registers in a
      trapframe to X1 rather than X0 .. X29.
    - Use correct name for el0 trapframe entry points.
  
  Reviewed by:	pizzamig (maintainer)
  MFH:		2018Q1
  Differential Revision:	https://reviews.freebsd.org/D13977

Modified:
  head/devel/gdb/Makefile
  head/devel/gdb/files/kgdb/aarch64-fbsd-kern.c
  head/devel/gdb/files/kgdb/amd64fbsd-kern.c
  head/devel/gdb/files/kgdb/fbsd-kld.c

Modified: head/devel/gdb/Makefile
==============================================================================
--- head/devel/gdb/Makefile	Fri Jan 26 19:35:51 2018	(r460049)
+++ head/devel/gdb/Makefile	Fri Jan 26 19:57:23 2018	(r460050)
@@ -3,7 +3,7 @@
 
 PORTNAME=	gdb
 PORTVERSION=	8.0.1
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	devel
 MASTER_SITES=	GNU
 

Modified: head/devel/gdb/files/kgdb/aarch64-fbsd-kern.c
==============================================================================
--- head/devel/gdb/files/kgdb/aarch64-fbsd-kern.c	Fri Jan 26 19:35:51 2018	(r460049)
+++ head/devel/gdb/files/kgdb/aarch64-fbsd-kern.c	Fri Jan 26 19:57:23 2018	(r460050)
@@ -45,9 +45,9 @@
 static const struct regcache_map_entry aarch64_fbsd_pcbmap[] =
   {
     { 30, AARCH64_X0_REGNUM, 8 }, /* x0 ... x29 */
-    { 1, AARCH64_LR_REGNUM, 8 },
-    { 1, AARCH64_SP_REGNUM, 8 },
     { 1, AARCH64_PC_REGNUM, 8 },
+    { 1, REGCACHE_MAP_SKIP, 8 },
+    { 1, AARCH64_SP_REGNUM, 8 },
     { 0 }
   };
 
@@ -100,7 +100,7 @@ aarch64_fbsd_trapframe_cache (struct frame_info *this_
   trad_frame_set_reg_addr (cache, AARCH64_PC_REGNUM, sp + 16);
   trad_frame_set_reg_addr (cache, AARCH64_CPSR_REGNUM, sp + 24);
   for (i = 0; i < 30; i++)
-    trad_frame_set_reg_addr (cache, AARCH64_X0_REGNUM + 1, sp + 32 + i * 8);
+    trad_frame_set_reg_addr (cache, AARCH64_X0_REGNUM + i, sp + 32 + i * 8);
 
   /* Read $PC from trap frame.  */
   pc = read_memory_unsigned_integer (sp + 16, 8, byte_order);
@@ -149,9 +149,9 @@ aarch64_fbsd_trapframe_sniffer (const struct frame_unw
   find_pc_partial_function (get_frame_func (this_frame), &name, NULL, NULL);
   return (name && ((strcmp (name, "handle_el1h_sync") == 0)
 		   || (strcmp (name, "handle_el1h_irq") == 0)
-		   || (strcmp (name, "handle_el0h_sync") == 0)
-		   || (strcmp (name, "handle_el0h_irq") == 0)
-		   || (strcmp (name, "handle_el0h_error") == 0)
+		   || (strcmp (name, "handle_el0_sync") == 0)
+		   || (strcmp (name, "handle_el0_irq") == 0)
+		   || (strcmp (name, "handle_el0_error") == 0)
 		   || (strcmp (name, "fork_trampoline") == 0)));
 }
 

Modified: head/devel/gdb/files/kgdb/amd64fbsd-kern.c
==============================================================================
--- head/devel/gdb/files/kgdb/amd64fbsd-kern.c	Fri Jan 26 19:35:51 2018	(r460049)
+++ head/devel/gdb/files/kgdb/amd64fbsd-kern.c	Fri Jan 26 19:57:23 2018	(r460050)
@@ -205,6 +205,7 @@ amd64fbsd_trapframe_sniffer (const struct frame_unwind
   find_pc_partial_function (get_frame_func (this_frame), &name, NULL, NULL);
   return (name && ((strcmp (name, "calltrap") == 0)
 		   || (strcmp (name, "fork_trampoline") == 0)
+		   || (strcmp (name, "mchk_calltrap") == 0)
 		   || (strcmp (name, "nmi_calltrap") == 0)
 		   || (name[0] == 'X' && name[1] != '_')));
 }

Modified: head/devel/gdb/files/kgdb/fbsd-kld.c
==============================================================================
--- head/devel/gdb/files/kgdb/fbsd-kld.c	Fri Jan 26 19:35:51 2018	(r460049)
+++ head/devel/gdb/files/kgdb/fbsd-kld.c	Fri Jan 26 19:57:23 2018	(r460050)
@@ -27,8 +27,6 @@
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
 
-#include <sys/param.h>
-#include <sys/stat.h>
 #include <fcntl.h>
 #include <libgen.h>
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801261957.w0QJvORW066401>