[Midnightbsd-cvs] src [10933] trunk/gnu/usr.bin/gdb/kgdb: add architectures

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Thu Jun 14 20:33:08 EDT 2018


Revision: 10933
          http://svnweb.midnightbsd.org/src/?rev=10933
Author:   laffer1
Date:     2018-06-14 20:33:07 -0400 (Thu, 14 Jun 2018)
Log Message:
-----------
add architectures

Modified Paths:
--------------
    trunk/gnu/usr.bin/gdb/kgdb/Makefile
    trunk/gnu/usr.bin/gdb/kgdb/kgdb.1
    trunk/gnu/usr.bin/gdb/kgdb/kgdb.h
    trunk/gnu/usr.bin/gdb/kgdb/kld.c
    trunk/gnu/usr.bin/gdb/kgdb/kthr.c
    trunk/gnu/usr.bin/gdb/kgdb/main.c
    trunk/gnu/usr.bin/gdb/kgdb/trgt.c
    trunk/gnu/usr.bin/gdb/kgdb/trgt_amd64.c
    trunk/gnu/usr.bin/gdb/kgdb/trgt_i386.c
    trunk/gnu/usr.bin/gdb/kgdb/trgt_sparc64.c

Added Paths:
-----------
    trunk/gnu/usr.bin/gdb/kgdb/trgt_arm.c
    trunk/gnu/usr.bin/gdb/kgdb/trgt_ia64.c
    trunk/gnu/usr.bin/gdb/kgdb/trgt_mips.c
    trunk/gnu/usr.bin/gdb/kgdb/trgt_powerpc.c
    trunk/gnu/usr.bin/gdb/kgdb/trgt_powerpc64.c

Property Changed:
----------------
    trunk/gnu/usr.bin/gdb/kgdb/kgdb.1

Modified: trunk/gnu/usr.bin/gdb/kgdb/Makefile
===================================================================
--- trunk/gnu/usr.bin/gdb/kgdb/Makefile	2018-06-15 00:32:31 UTC (rev 10932)
+++ trunk/gnu/usr.bin/gdb/kgdb/Makefile	2018-06-15 00:33:07 UTC (rev 10933)
@@ -1,4 +1,5 @@
 # $MidnightBSD$
+# $FreeBSD: stable/10/gnu/usr.bin/gdb/kgdb/Makefile 215082 2010-11-10 06:39:49Z imp $
 
 PROG=	kgdb${GDB_SUFFIX}
 SRCS=	main.c kld.c kthr.c trgt.c trgt_${TARGET_CPUARCH}.c

Modified: trunk/gnu/usr.bin/gdb/kgdb/kgdb.1
===================================================================
--- trunk/gnu/usr.bin/gdb/kgdb/kgdb.1	2018-06-15 00:32:31 UTC (rev 10932)
+++ trunk/gnu/usr.bin/gdb/kgdb/kgdb.1	2018-06-15 00:33:07 UTC (rev 10933)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 2004 Marcel Moolenaar
 .\" All rights reserved.
 .\"
@@ -22,9 +23,9 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/gnu/usr.bin/gdb/kgdb/kgdb.1 320824 2017-07-09 04:13:33Z jhb $
 .\"
-.Dd October 11, 2006
+.Dd July 5, 2017
 .Dt KGDB 1
 .Os
 .Sh NAME
@@ -33,6 +34,7 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl a | Fl f | Fl fullname
+.Op Fl b Ar rate
 .Op Fl q | Fl quiet
 .Op Fl v
 .Op Fl w
@@ -39,6 +41,16 @@
 .Op Fl d Ar crashdir
 .Op Fl c Ar core | Fl n Ar dumpnr | Fl r Ar device
 .Op Ar kernel Op Ar core
+.Sh DEPRECATION NOTICE
+This version of
+.Nm
+is deprecated and will be removed from future versions of the
+.Fx
+base system.
+A newer version of
+.Nm
+is available from ports or packages
+(devel/gdb).
 .Sh DESCRIPTION
 The
 .Nm
@@ -62,6 +74,9 @@
 or
 .Fl fullname
 options are supported for backward compatibility as well.
+.It Fl b Ar rate
+Set the baudrate to
+.Ar rate .
 .It Fl q
 Suppress printing of the banner when the debugger starts.
 The


Property changes on: trunk/gnu/usr.bin/gdb/kgdb/kgdb.1
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/gnu/usr.bin/gdb/kgdb/kgdb.h
===================================================================
--- trunk/gnu/usr.bin/gdb/kgdb/kgdb.h	2018-06-15 00:32:31 UTC (rev 10932)
+++ trunk/gnu/usr.bin/gdb/kgdb/kgdb.h	2018-06-15 00:33:07 UTC (rev 10933)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 2004 Marcel Moolenaar
  * All rights reserved.
@@ -23,7 +24,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $MidnightBSD$
+ * $FreeBSD: stable/10/gnu/usr.bin/gdb/kgdb/kgdb.h 246893 2013-02-17 02:15:19Z marcel $
  */
 
 #ifndef _KGDB_H_
@@ -49,6 +50,8 @@
 void initialize_kld_target(void);
 void initialize_kgdb_target(void);
 void kgdb_dmesg(void);
+CORE_ADDR kgdb_trgt_core_pcb(u_int);
+CORE_ADDR kgdb_trgt_stop_pcb(u_int, u_int);
 void kgdb_trgt_new_objfile(struct objfile *);
 void kgdb_trgt_fetch_registers(int);
 void kgdb_trgt_store_registers(int);

Modified: trunk/gnu/usr.bin/gdb/kgdb/kld.c
===================================================================
--- trunk/gnu/usr.bin/gdb/kgdb/kld.c	2018-06-15 00:32:31 UTC (rev 10932)
+++ trunk/gnu/usr.bin/gdb/kgdb/kld.c	2018-06-15 00:33:07 UTC (rev 10933)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 2004 Marcel Moolenaar
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/gnu/usr.bin/gdb/kgdb/kld.c 248838 2013-03-28 17:07:02Z will $");
 
 #include <sys/param.h>
 #include <sys/stat.h>
@@ -78,6 +79,7 @@
  */
 static const char *kld_suffixes[] = {
 	".debug",
+	".symbols",
 	"",
 	NULL
 };
@@ -382,7 +384,10 @@
 		 * Try to read the pathname (if it exists) and store
 		 * it in so_name.
 		 */
-		if (off_pathname != 0) {
+		if (find_kld_path(new->so_original_name, new->so_name,
+		    sizeof(new->so_name))) {
+			/* we found the kld */;
+		} else if (off_pathname != 0) {
 			target_read_string(read_pointer(kld + off_pathname),
 			    &path, sizeof(new->so_name), &error);
 			if (error != 0) {

Modified: trunk/gnu/usr.bin/gdb/kgdb/kthr.c
===================================================================
--- trunk/gnu/usr.bin/gdb/kgdb/kthr.c	2018-06-15 00:32:31 UTC (rev 10932)
+++ trunk/gnu/usr.bin/gdb/kgdb/kthr.c	2018-06-15 00:33:07 UTC (rev 10933)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 2004 Marcel Moolenaar
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/gnu/usr.bin/gdb/kgdb/kthr.c 246893 2013-02-17 02:15:19Z marcel $");
 
 #include <sys/param.h>
 #include <sys/cpuset.h>
@@ -44,12 +45,10 @@
 #include <frame-unwind.h>
 
 #include "kgdb.h"
-#include <machine/pcb.h>
 
 static CORE_ADDR dumppcb;
 static int dumptid;
 
-static CORE_ADDR stoppcbs;
 static cpuset_t stopped_cpus;
 
 static struct kthr *first;
@@ -98,10 +97,9 @@
 			kt->kaddr = addr;
 			if (td.td_tid == dumptid)
 				kt->pcb = dumppcb;
-			else if (td.td_state == TDS_RUNNING && stoppcbs != 0 &&
+			else if (td.td_state == TDS_RUNNING &&
 			    CPU_ISSET(td.td_oncpu, &stopped_cpus))
-				kt->pcb = (uintptr_t)stoppcbs +
-				    sizeof(struct pcb) * td.td_oncpu;
+				kt->pcb = kgdb_trgt_core_pcb(td.td_oncpu);
 			else
 				kt->pcb = (uintptr_t)td.td_pcb;
 			kt->kstack = td.td_kstack;
@@ -152,8 +150,6 @@
 	    addr != 0)
 		kvm_read(kvm, addr, &stopped_cpus, cpusetsize);
 
-	stoppcbs = kgdb_lookup("stoppcbs");
-
 	kgdb_thr_add_procs(paddr);
 	addr = kgdb_lookup("zombproc");
 	if (addr != 0) {

Modified: trunk/gnu/usr.bin/gdb/kgdb/main.c
===================================================================
--- trunk/gnu/usr.bin/gdb/kgdb/main.c	2018-06-15 00:32:31 UTC (rev 10932)
+++ trunk/gnu/usr.bin/gdb/kgdb/main.c	2018-06-15 00:33:07 UTC (rev 10933)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 2004 Marcel Moolenaar
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/gnu/usr.bin/gdb/kgdb/main.c 246958 2013-02-19 02:09:18Z adrian $");
 
 #include <sys/param.h>
 #include <sys/stat.h>
@@ -83,7 +84,7 @@
 {
 
 	fprintf(stderr,
-	    "usage: %s [-afqvw] [-d crashdir] [-c core | -n dumpnr | -r device]\n"
+	    "usage: %s [-afqvw] [-b rate] [-d crashdir] [-c core | -n dumpnr | -r device]\n"
 	    "\t[kernel [core]]\n", getprogname());
 	exit(1);
 }
@@ -333,11 +334,23 @@
 	args.argv = malloc(sizeof(char *));
 	args.argv[0] = argv[0];
 
-	while ((ch = getopt(argc, argv, "ac:d:fn:qr:vw")) != -1) {
+	while ((ch = getopt(argc, argv, "ab:c:d:fn:qr:vw")) != -1) {
 		switch (ch) {
 		case 'a':
 			annotation_level++;
 			break;
+		case 'b': {
+			int i;
+			char *p;
+
+			i = strtol(optarg, &p, 0);
+			if (*p != '\0' || p == optarg)
+				warnx("warning: could not set baud rate to `%s'.\n",
+				    optarg);
+			else
+				baud_rate = i;
+			break;
+		}
 		case 'c':	/* use given core file. */
 			if (vmcore != NULL) {
 				warnx("option %c: can only be specified once",

Modified: trunk/gnu/usr.bin/gdb/kgdb/trgt.c
===================================================================
--- trunk/gnu/usr.bin/gdb/kgdb/trgt.c	2018-06-15 00:32:31 UTC (rev 10932)
+++ trunk/gnu/usr.bin/gdb/kgdb/trgt.c	2018-06-15 00:33:07 UTC (rev 10933)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 2004 Marcel Moolenaar
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/gnu/usr.bin/gdb/kgdb/trgt.c 286305 2015-08-05 07:21:44Z kib $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -53,6 +54,8 @@
 
 #include "kgdb.h"
 
+static CORE_ADDR stoppcbs;
+
 static void	kgdb_core_cleanup(void *);
 
 static char *vmcore;
@@ -62,7 +65,7 @@
 static char kvm_err[_POSIX2_LINE_MAX];
 
 #define	KERNOFF		(kgdb_kernbase ())
-#define	INKERNEL(x)	((x) >= KERNOFF)
+#define	PINKERNEL(x)	((x) >= KERNOFF)
 
 static CORE_ADDR
 kgdb_kernbase (void)
@@ -282,7 +285,7 @@
 
 	addr = (CORE_ADDR) parse_and_eval_address (arg);
 
-	if (!INKERNEL (addr)) {
+	if (!PINKERNEL (addr)) {
 		thr = kgdb_thr_lookup_pid((int)addr);
 		if (thr == NULL)
 			error ("invalid pid");
@@ -305,7 +308,7 @@
 
 	addr = (CORE_ADDR) parse_and_eval_address (arg);
 
-	if (kvm != NULL && INKERNEL (addr)) {
+	if (kvm != NULL && PINKERNEL (addr)) {
 		thr = kgdb_thr_lookup_taddr(addr);
 		if (thr == NULL)
 			error("invalid thread address");
@@ -352,3 +355,18 @@
 	add_com ("tid", class_obscure, kgdb_set_tid_cmd,
 	   "Set current thread context");
 }
+
+CORE_ADDR
+kgdb_trgt_stop_pcb(u_int cpuid, u_int pcbsz)
+{
+	static int once = 0;
+
+	if (stoppcbs == 0 && !once) {
+		once = 1;
+		stoppcbs = kgdb_lookup("stoppcbs");
+	}
+	if (stoppcbs == 0)
+		return 0;
+
+	return (stoppcbs + pcbsz * cpuid);
+}

Modified: trunk/gnu/usr.bin/gdb/kgdb/trgt_amd64.c
===================================================================
--- trunk/gnu/usr.bin/gdb/kgdb/trgt_amd64.c	2018-06-15 00:32:31 UTC (rev 10932)
+++ trunk/gnu/usr.bin/gdb/kgdb/trgt_amd64.c	2018-06-15 00:33:07 UTC (rev 10933)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 2004 Marcel Moolenaar
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/gnu/usr.bin/gdb/kgdb/trgt_amd64.c 290413 2015-11-05 21:22:23Z jhb $");
 
 #include <sys/types.h>
 #include <machine/pcb.h>
@@ -44,6 +45,12 @@
 
 #include "kgdb.h"
 
+CORE_ADDR
+kgdb_trgt_core_pcb(u_int cpuid)
+{
+	return (kgdb_trgt_stop_pcb(cpuid, sizeof(struct pcb)));
+}
+
 void
 kgdb_trgt_fetch_registers(int regno __unused)
 {
@@ -66,7 +73,6 @@
 	supply_register(AMD64_R8_REGNUM + 6, (char *)&pcb.pcb_r14);
 	supply_register(AMD64_R15_REGNUM, (char *)&pcb.pcb_r15);
 	supply_register(AMD64_RIP_REGNUM, (char *)&pcb.pcb_rip);
-	amd64_supply_fxsave(current_regcache, -1, (struct fpusave *)(&pcb + 1));
 }
 
 void

Added: trunk/gnu/usr.bin/gdb/kgdb/trgt_arm.c
===================================================================
--- trunk/gnu/usr.bin/gdb/kgdb/trgt_arm.c	                        (rev 0)
+++ trunk/gnu/usr.bin/gdb/kgdb/trgt_arm.c	2018-06-15 00:33:07 UTC (rev 10933)
@@ -0,0 +1,236 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2004 Marcel Moolenaar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/gnu/usr.bin/gdb/kgdb/trgt_arm.c 278614 2015-02-12 04:15:55Z ian $");
+
+#include <sys/types.h>
+#ifndef CROSS_DEBUGGER
+#include <machine/pcb.h>
+#include <machine/frame.h>
+#include <machine/armreg.h>
+#endif
+#include <err.h>
+#include <kvm.h>
+#include <string.h>
+
+#include <defs.h>
+#include <target.h>
+#include <gdbthread.h>
+#include <inferior.h>
+#include <regcache.h>
+#include <frame-unwind.h>
+#include <arm-tdep.h>
+
+#include "kgdb.h"
+
+CORE_ADDR
+kgdb_trgt_core_pcb(u_int cpuid)
+{
+	return (kgdb_trgt_stop_pcb(cpuid, sizeof(struct pcb)));
+}
+
+void
+kgdb_trgt_fetch_registers(int regno __unused)
+{
+#ifndef CROSS_DEBUGGER
+	struct kthr *kt;
+	struct pcb pcb;
+	int i, reg;
+
+	kt = kgdb_thr_lookup_tid(ptid_get_pid(inferior_ptid));
+	if (kt == NULL)
+		return;
+	if (kvm_read(kvm, kt->pcb, &pcb, sizeof(pcb)) != sizeof(pcb)) {
+		warnx("kvm_read: %s", kvm_geterr(kvm));
+		memset(&pcb, 0, sizeof(pcb));
+	}
+	for (i = ARM_A1_REGNUM + 4; i <= ARM_SP_REGNUM; i++) {
+		supply_register(i, (char *)&pcb.pcb_regs.sf_r4 +
+		    (i - (ARM_A1_REGNUM + 4 )) * 4);
+	}
+	if (pcb.pcb_regs.sf_sp != 0) {
+		if (kvm_read(kvm, pcb.pcb_regs.sf_sp + 4 * 4, &reg, 4) != 4)
+			warnx("kvm_read :%s", kvm_geterr(kvm));
+		else
+			supply_register(ARM_PC_REGNUM, (char *)&reg);
+	}
+#endif
+}
+
+void
+kgdb_trgt_store_registers(int regno __unused)
+{
+	fprintf_unfiltered(gdb_stderr, "XXX: %s\n", __func__);
+}
+
+void
+kgdb_trgt_new_objfile(struct objfile *objfile)
+{
+}
+
+#ifndef CROSS_DEBUGGER
+struct kgdb_frame_cache {
+	CORE_ADDR	fp;
+	CORE_ADDR	sp;
+};
+
+static int kgdb_trgt_frame_offset[26] = {
+	offsetof(struct trapframe, tf_r0),
+	offsetof(struct trapframe, tf_r1),
+	offsetof(struct trapframe, tf_r2),
+	offsetof(struct trapframe, tf_r3),
+	offsetof(struct trapframe, tf_r4),
+	offsetof(struct trapframe, tf_r5),
+	offsetof(struct trapframe, tf_r6),
+	offsetof(struct trapframe, tf_r7),
+	offsetof(struct trapframe, tf_r8),
+	offsetof(struct trapframe, tf_r9),
+	offsetof(struct trapframe, tf_r10),
+	offsetof(struct trapframe, tf_r11),
+	offsetof(struct trapframe, tf_r12),
+	offsetof(struct trapframe, tf_svc_sp),
+	offsetof(struct trapframe, tf_svc_lr),
+	offsetof(struct trapframe, tf_pc),
+	-1, -1, -1, -1, -1, -1, -1, -1, -1,
+	offsetof(struct trapframe, tf_spsr)
+};
+
+static struct kgdb_frame_cache *
+kgdb_trgt_frame_cache(struct frame_info *next_frame, void **this_cache)
+{
+	char buf[MAX_REGISTER_SIZE];
+	struct kgdb_frame_cache *cache;
+
+	cache = *this_cache;
+	if (cache == NULL) {
+		cache = FRAME_OBSTACK_ZALLOC(struct kgdb_frame_cache);
+		*this_cache = cache;
+		frame_unwind_register(next_frame, ARM_SP_REGNUM, buf);
+		cache->sp = extract_unsigned_integer(buf,
+		    register_size(current_gdbarch, ARM_SP_REGNUM));
+		frame_unwind_register(next_frame, ARM_FP_REGNUM, buf);
+		cache->fp = extract_unsigned_integer(buf,
+		    register_size(current_gdbarch, ARM_FP_REGNUM));
+	}
+	return (cache);
+}
+
+static int is_undef;
+
+static void
+kgdb_trgt_trapframe_this_id(struct frame_info *next_frame, void **this_cache,
+    struct frame_id *this_id)
+{
+	struct kgdb_frame_cache *cache;
+
+	cache = kgdb_trgt_frame_cache(next_frame, this_cache);
+	*this_id = frame_id_build(cache->fp, 0);
+}
+
+static void
+kgdb_trgt_trapframe_prev_register(struct frame_info *next_frame,
+    void **this_cache, int regnum, int *optimizedp, enum lval_type *lvalp,
+    CORE_ADDR *addrp, int *realnump, void *valuep)
+{
+	char dummy_valuep[MAX_REGISTER_SIZE];
+	struct kgdb_frame_cache *cache;
+	int ofs, regsz;
+	int is_undefined = 0;
+
+	regsz = register_size(current_gdbarch, regnum);
+
+	if (valuep == NULL)
+		valuep = dummy_valuep;
+	memset(valuep, 0, regsz);
+	*optimizedp = 0;
+	*addrp = 0;
+	*lvalp = not_lval;
+	*realnump = -1;
+
+	ofs = (regnum >= 0 && regnum <= ARM_PS_REGNUM)
+	    ? kgdb_trgt_frame_offset[regnum] : -1;
+	if (ofs == -1)
+		return;
+
+	cache = kgdb_trgt_frame_cache(next_frame, this_cache);
+
+	if (is_undef && (regnum == ARM_SP_REGNUM || regnum == ARM_PC_REGNUM)) {
+		*addrp = cache->sp + offsetof(struct trapframe, tf_spsr);
+		target_read_memory(*addrp, valuep, regsz);
+		is_undefined = 1;
+		ofs = kgdb_trgt_frame_offset[ARM_SP_REGNUM];
+
+	}
+	*addrp = cache->sp + ofs;
+	*lvalp = lval_memory;
+	target_read_memory(*addrp, valuep, regsz);
+
+	if (is_undefined) {
+		*addrp = *(unsigned int *)valuep + (regnum == ARM_SP_REGNUM ?
+		    0 : 8);
+		target_read_memory(*addrp, valuep, regsz);
+
+	}
+}
+
+static const struct frame_unwind kgdb_trgt_trapframe_unwind = {
+        UNKNOWN_FRAME,
+        &kgdb_trgt_trapframe_this_id,
+        &kgdb_trgt_trapframe_prev_register
+};
+#endif
+
+const struct frame_unwind *
+kgdb_trgt_trapframe_sniffer(struct frame_info *next_frame)
+{
+#ifndef CROSS_DEBUGGER
+	char *pname;
+	CORE_ADDR pc;
+
+	pc = frame_pc_unwind(next_frame);
+	pname = NULL;
+	find_pc_partial_function(pc, &pname, NULL, NULL);
+	if (pname == NULL) {
+		is_undef = 0;
+		return (NULL);
+	}
+	if (!strcmp(pname, "undefinedinstruction"))
+		is_undef = 1;
+	if (strcmp(pname, "Laddress_exception_entry") == 0 ||
+	    strcmp(pname, "undefined_entry") == 0 ||
+	    strcmp(pname, "exception_exit") == 0 ||
+	    strcmp(pname, "Laddress_exception_msg") == 0 ||
+	    strcmp(pname, "irq_entry") == 0)
+		return (&kgdb_trgt_trapframe_unwind);
+	if (!strcmp(pname, "undefinedinstruction"))
+		is_undef = 1;
+	else
+		is_undef = 0;
+#endif
+	return (NULL);
+}


Property changes on: trunk/gnu/usr.bin/gdb/kgdb/trgt_arm.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/gnu/usr.bin/gdb/kgdb/trgt_i386.c
===================================================================
--- trunk/gnu/usr.bin/gdb/kgdb/trgt_i386.c	2018-06-15 00:32:31 UTC (rev 10932)
+++ trunk/gnu/usr.bin/gdb/kgdb/trgt_i386.c	2018-06-15 00:33:07 UTC (rev 10933)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 2004 Marcel Moolenaar
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/gnu/usr.bin/gdb/kgdb/trgt_i386.c 246893 2013-02-17 02:15:19Z marcel $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -49,6 +50,12 @@
 
 static int ofs_fix;
 
+CORE_ADDR
+kgdb_trgt_core_pcb(u_int cpuid)
+{
+	return (kgdb_trgt_stop_pcb(cpuid, sizeof(struct pcb)));
+}
+
 void
 kgdb_trgt_fetch_registers(int regno __unused)
 {

Added: trunk/gnu/usr.bin/gdb/kgdb/trgt_ia64.c
===================================================================
--- trunk/gnu/usr.bin/gdb/kgdb/trgt_ia64.c	                        (rev 0)
+++ trunk/gnu/usr.bin/gdb/kgdb/trgt_ia64.c	2018-06-15 00:33:07 UTC (rev 10933)
@@ -0,0 +1,339 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2004 Marcel Moolenaar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/gnu/usr.bin/gdb/kgdb/trgt_ia64.c 246893 2013-02-17 02:15:19Z marcel $");
+
+#include <sys/types.h>
+#ifdef CROSS_DEBUGGER
+#include <sys/ia64/include/_regset.h>
+#include <sys/ia64/include/frame.h>
+#include <sys/ia64/include/md_var.h>
+#include <sys/ia64/include/pcb.h>
+#else
+#include <machine/frame.h>
+#include <machine/md_var.h>
+#include <machine/pcb.h>
+#endif
+#include <err.h>
+#include <kvm.h>
+#include <string.h>
+
+#include <defs.h>
+#include <target.h>
+#include <gdbthread.h>
+#include <inferior.h>
+#include <regcache.h>
+#include <frame-unwind.h>
+#include <ia64-tdep.h>
+
+#include "kgdb.h"
+
+CORE_ADDR
+kgdb_trgt_core_pcb(u_int cpuid)
+{
+	CORE_ADDR addr;
+	char *expr;
+
+	asprintf(&expr, "&cpuid_to_pcpu[%d]->pc_md.pcb", cpuid);
+	addr = kgdb_parse(expr);
+	free(expr);
+	return (addr);
+}
+
+void
+kgdb_trgt_fetch_registers(int regno __unused)
+{
+	struct kthr *kt;
+	struct pcb pcb;
+	uint64_t r;
+
+	kt = kgdb_thr_lookup_tid(ptid_get_pid(inferior_ptid));
+	if (kt == NULL)
+		return;
+	if (kvm_read(kvm, kt->pcb, &pcb, sizeof(pcb)) != sizeof(pcb)) {
+		warnx("kvm_read: %s", kvm_geterr(kvm));
+		memset(&pcb, 0, sizeof(pcb));
+	}
+
+	/* Registers 0-127: general registers. */
+	supply_register(IA64_GR1_REGNUM, (char *)&pcb.pcb_special.gp);
+	supply_register(IA64_GR4_REGNUM, (char *)&pcb.pcb_preserved.gr4);
+	supply_register(IA64_GR5_REGNUM, (char *)&pcb.pcb_preserved.gr5);
+	supply_register(IA64_GR6_REGNUM, (char *)&pcb.pcb_preserved.gr6);
+	supply_register(IA64_GR7_REGNUM, (char *)&pcb.pcb_preserved.gr7);
+	supply_register(IA64_GR12_REGNUM, (char *)&pcb.pcb_special.sp);
+	supply_register(IA64_GR12_REGNUM+1, (char *)&pcb.pcb_special.tp);
+
+	/* Registers 128-255: floating-point registers. */
+	supply_register(IA64_FR2_REGNUM, (char *)&pcb.pcb_preserved_fp.fr2);
+	supply_register(IA64_FR2_REGNUM+1, (char *)&pcb.pcb_preserved_fp.fr3);
+	supply_register(IA64_FR2_REGNUM+2, (char *)&pcb.pcb_preserved_fp.fr4);
+	supply_register(IA64_FR2_REGNUM+3, (char *)&pcb.pcb_preserved_fp.fr5);
+	supply_register(IA64_FR16_REGNUM, (char *)&pcb.pcb_preserved_fp.fr16);
+	supply_register(IA64_FR16_REGNUM+1, (char*)&pcb.pcb_preserved_fp.fr17);
+	supply_register(IA64_FR16_REGNUM+2, (char*)&pcb.pcb_preserved_fp.fr18);
+	supply_register(IA64_FR16_REGNUM+3, (char*)&pcb.pcb_preserved_fp.fr19);
+	supply_register(IA64_FR16_REGNUM+4, (char*)&pcb.pcb_preserved_fp.fr20);
+	supply_register(IA64_FR16_REGNUM+5, (char*)&pcb.pcb_preserved_fp.fr21);
+	supply_register(IA64_FR16_REGNUM+6, (char*)&pcb.pcb_preserved_fp.fr22);
+	supply_register(IA64_FR16_REGNUM+7, (char*)&pcb.pcb_preserved_fp.fr23);
+	supply_register(IA64_FR16_REGNUM+8, (char*)&pcb.pcb_preserved_fp.fr24);
+	supply_register(IA64_FR16_REGNUM+9, (char*)&pcb.pcb_preserved_fp.fr25);
+	supply_register(IA64_FR16_REGNUM+10,(char*)&pcb.pcb_preserved_fp.fr26);
+	supply_register(IA64_FR16_REGNUM+11,(char*)&pcb.pcb_preserved_fp.fr27);
+	supply_register(IA64_FR16_REGNUM+12,(char*)&pcb.pcb_preserved_fp.fr28);
+	supply_register(IA64_FR16_REGNUM+13,(char*)&pcb.pcb_preserved_fp.fr29);
+	supply_register(IA64_FR16_REGNUM+14,(char*)&pcb.pcb_preserved_fp.fr30);
+	supply_register(IA64_FR16_REGNUM+15,(char*)&pcb.pcb_preserved_fp.fr31);
+
+	/* Registers 320-327: branch registers. */
+	if (pcb.pcb_special.__spare == ~0UL)
+		supply_register(IA64_BR0_REGNUM, (char *)&pcb.pcb_special.rp);
+	supply_register(IA64_BR1_REGNUM, (char *)&pcb.pcb_preserved.br1);
+	supply_register(IA64_BR2_REGNUM, (char *)&pcb.pcb_preserved.br2);
+	supply_register(IA64_BR3_REGNUM, (char *)&pcb.pcb_preserved.br3);
+	supply_register(IA64_BR4_REGNUM, (char *)&pcb.pcb_preserved.br4);
+	supply_register(IA64_BR5_REGNUM, (char *)&pcb.pcb_preserved.br5);
+
+	/* Registers 328-333: misc. other registers. */
+	supply_register(IA64_PR_REGNUM, (char *)&pcb.pcb_special.pr);
+	if (pcb.pcb_special.__spare == ~0UL) {
+		r = pcb.pcb_special.iip + ((pcb.pcb_special.psr >> 41) & 3);
+		supply_register(IA64_IP_REGNUM, (char *)&r);
+		supply_register(IA64_CFM_REGNUM, (char *)&pcb.pcb_special.cfm);
+	} else {
+		supply_register(IA64_IP_REGNUM, (char *)&pcb.pcb_special.rp);
+		supply_register(IA64_CFM_REGNUM, (char *)&pcb.pcb_special.pfs);
+	}
+
+	/* Registers 334-461: application registers. */
+	supply_register(IA64_RSC_REGNUM, (char *)&pcb.pcb_special.rsc);
+	r = pcb.pcb_special.bspstore;
+	if (pcb.pcb_special.__spare == ~0UL)
+		r += pcb.pcb_special.ndirty;
+	else
+		r = ia64_bsp_adjust(r, IA64_CFM_SOF(pcb.pcb_special.pfs) -
+		    IA64_CFM_SOL(pcb.pcb_special.pfs));
+	supply_register(IA64_BSP_REGNUM, (char *)&r);
+	supply_register(IA64_BSPSTORE_REGNUM, (char *)&r);
+	supply_register(IA64_RNAT_REGNUM, (char *)&pcb.pcb_special.rnat);
+	supply_register(IA64_UNAT_REGNUM, (char *)&pcb.pcb_special.unat);
+	supply_register(IA64_FPSR_REGNUM, (char *)&pcb.pcb_special.fpsr);
+	if (pcb.pcb_special.__spare == ~0UL)
+		supply_register(IA64_PFS_REGNUM, (char *)&pcb.pcb_special.pfs);
+	supply_register(IA64_LC_REGNUM, (char *)&pcb.pcb_preserved.lc);
+}
+
+void
+kgdb_trgt_store_registers(int regno __unused)
+{
+	fprintf_unfiltered(gdb_stderr, "XXX: %s\n", __func__);
+}
+
+void
+kgdb_trgt_new_objfile(struct objfile *objfile)
+{
+}
+
+struct kgdb_frame_cache {
+	CORE_ADDR	bsp;
+	CORE_ADDR	ip;
+	CORE_ADDR	sp;
+	CORE_ADDR	saved_bsp;
+};
+
+#define	SPECIAL(x)	offsetof(struct trapframe, tf_special)		\
+			+ offsetof(struct _special, x)
+#define	SCRATCH(x)	offsetof(struct trapframe, tf_scratch)		\
+			+ offsetof(struct _caller_saved, x)
+#define	SCRATCH_FP(x)	offsetof(struct trapframe, tf_scratch_fp)	\
+			+ offsetof(struct _caller_saved_fp, x)
+
+static int kgdb_trgt_frame_ofs_gr[32] = {
+	-1,					/* gr0 */
+	SPECIAL(gp),
+	SCRATCH(gr2),   SCRATCH(gr3),
+	-1, -1, -1, -1,				/* gr4-gr7 */
+	SCRATCH(gr8),   SCRATCH(gr9),   SCRATCH(gr10),  SCRATCH(gr11),
+	SPECIAL(sp),    SPECIAL(tp),
+	SCRATCH(gr14),  SCRATCH(gr15),  SCRATCH(gr16),  SCRATCH(gr17),
+	SCRATCH(gr18),  SCRATCH(gr19),  SCRATCH(gr20),  SCRATCH(gr21),
+	SCRATCH(gr22),  SCRATCH(gr23),  SCRATCH(gr24),  SCRATCH(gr25),
+	SCRATCH(gr26),  SCRATCH(gr27),  SCRATCH(gr28),  SCRATCH(gr29),
+	SCRATCH(gr30),  SCRATCH(gr31)
+};
+
+static int kgdb_trgt_frame_ofs_fr[32] = {
+	-1,					/* fr0: constant 0.0 */
+	-1,					/* fr1: constant 1.0 */
+	-1, -1, -1, -1,				/* fr2-fr5 */
+	SCRATCH_FP(fr6), SCRATCH_FP(fr7), SCRATCH_FP(fr8), SCRATCH_FP(fr9),
+	SCRATCH_FP(fr10), SCRATCH_FP(fr11), SCRATCH_FP(fr12), SCRATCH_FP(fr13),
+	SCRATCH_FP(fr14), SCRATCH_FP(fr15)
+};
+
+static int kgdb_trgt_frame_ofs_br[8] = {
+        SPECIAL(rp),
+	-1, -1, -1, -1, -1,			/* br1-br5 */
+	SCRATCH(br6), SCRATCH(br7)
+};
+
+static int kgdb_trgt_frame_ofs_ar[49] = {
+	/* ar0-ar15 */
+	SPECIAL(rsc),
+	-1,					/* ar.bsp */
+	SPECIAL(bspstore), SPECIAL(rnat),
+	-1, -1, -1, -1, -1,			/* ar20-ar24 */
+	SCRATCH(csd), SCRATCH(ssd),
+	-1, -1, -1, -1, -1,			/* ar27-ar31 */
+	SCRATCH(ccv),
+	-1, -1, -1,				/* ar33-ar35 */
+	SPECIAL(unat),
+	-1, -1, -1,				/* ar37-ar39 */
+	SPECIAL(fpsr),
+	-1, -1, -1, -1, -1, -1, -1,		/* ar41-ar47 */
+	-1, -1, -1, -1, -1, -1, -1, -1,		/* ar48-ar55 */
+	-1, -1, -1, -1, -1, -1, -1, -1,		/* ar56-ar63 */
+	SPECIAL(pfs)
+};
+
+static struct kgdb_frame_cache *
+kgdb_trgt_frame_cache(struct frame_info *next_frame, void **this_cache)
+{
+	char buf[MAX_REGISTER_SIZE];
+	struct kgdb_frame_cache *cache;
+
+	cache = *this_cache;
+	if (cache == NULL) {
+		cache = FRAME_OBSTACK_ZALLOC(struct kgdb_frame_cache);
+		*this_cache = cache;
+		frame_unwind_register(next_frame, IA64_BSP_REGNUM, buf);
+		cache->bsp = extract_unsigned_integer(buf,
+		    register_size(current_gdbarch, IA64_BSP_REGNUM));
+		cache->ip = frame_func_unwind(next_frame);
+		frame_unwind_register(next_frame, SP_REGNUM, buf);
+		cache->sp = extract_unsigned_integer(buf,
+		    register_size(current_gdbarch, SP_REGNUM));
+	}
+	return (cache);
+}
+
+static void
+kgdb_trgt_trapframe_this_id(struct frame_info *next_frame, void **this_cache,
+    struct frame_id *this_id)
+{
+	struct kgdb_frame_cache *cache;
+
+	cache = kgdb_trgt_frame_cache(next_frame, this_cache);
+	*this_id = frame_id_build_special(cache->sp, cache->ip, cache->bsp);
+}
+
+static void
+kgdb_trgt_trapframe_prev_register(struct frame_info *next_frame,
+    void **this_cache, int regnum, int *optimizedp, enum lval_type *lvalp,
+    CORE_ADDR *addrp, int *realnump, void *valuep)
+{
+	char buf[MAX_REGISTER_SIZE];
+	char dummy_valuep[MAX_REGISTER_SIZE];
+	struct kgdb_frame_cache *cache;
+	CORE_ADDR bsp;
+	int ofs, regsz;
+
+	regsz = register_size(current_gdbarch, regnum);
+
+	if (valuep == NULL)
+		valuep = dummy_valuep;
+	memset(valuep, 0, regsz);
+	*optimizedp = 0;
+	*addrp = 0;
+	*lvalp = not_lval;
+	*realnump = -1;
+
+	cache = kgdb_trgt_frame_cache(next_frame, this_cache);
+
+	if (regnum == IA64_BSP_REGNUM) {
+		if (cache->saved_bsp == 0) {
+			target_read_memory(cache->sp + 16 + SPECIAL(bspstore),
+			    buf, regsz);
+			bsp = extract_unsigned_integer(buf, regsz);
+			target_read_memory(cache->sp + 16 + SPECIAL(ndirty),
+			    buf, regsz);
+			bsp += extract_unsigned_integer(buf, regsz);
+			cache->saved_bsp = bsp;
+		}
+		store_unsigned_integer(valuep, regsz, cache->saved_bsp);
+		return;
+	}
+	if (regnum == IA64_PR_REGNUM)
+		ofs = SPECIAL(pr);
+	else if (regnum == IA64_IP_REGNUM)
+		ofs = SPECIAL(iip);
+	else if (regnum == IA64_PSR_REGNUM)
+		ofs = SPECIAL(psr);
+	else if (regnum == IA64_CFM_REGNUM)
+		ofs = SPECIAL(cfm);
+	else if (regnum >= IA64_GR0_REGNUM && regnum <= IA64_GR31_REGNUM)
+		ofs = kgdb_trgt_frame_ofs_gr[regnum - IA64_GR0_REGNUM];
+	else if (regnum >= IA64_FR0_REGNUM && regnum <= IA64_FR15_REGNUM)
+		ofs = kgdb_trgt_frame_ofs_fr[regnum - IA64_FR0_REGNUM];
+	else if (regnum >= IA64_BR0_REGNUM && regnum <= IA64_BR7_REGNUM)
+		ofs = kgdb_trgt_frame_ofs_br[regnum - IA64_BR0_REGNUM];
+	else if (regnum >= IA64_RSC_REGNUM && regnum <= IA64_PFS_REGNUM)
+		ofs = kgdb_trgt_frame_ofs_ar[regnum - IA64_RSC_REGNUM];
+	else
+		ofs = -1;
+	if (ofs == -1)
+		return;
+
+	*addrp = cache->sp + 16 + ofs;
+	*lvalp = lval_memory;
+	target_read_memory(*addrp, valuep, regsz);
+}
+
+static const struct frame_unwind kgdb_trgt_trapframe_unwind = {
+        UNKNOWN_FRAME,
+        &kgdb_trgt_trapframe_this_id,
+        &kgdb_trgt_trapframe_prev_register
+};
+
+const struct frame_unwind *
+kgdb_trgt_trapframe_sniffer(struct frame_info *next_frame)
+{
+	char *pname;
+	CORE_ADDR ip;
+
+	ip = frame_func_unwind(next_frame);
+	pname = NULL;
+	find_pc_partial_function(ip, &pname, NULL, NULL);
+	if (pname == NULL)
+		return (NULL);
+	if (strncmp(pname, "ivt_", 4) == 0)
+		return (&kgdb_trgt_trapframe_unwind);
+	/* printf("%s: %lx =%s\n", __func__, ip, pname); */
+	return (NULL);
+}


Property changes on: trunk/gnu/usr.bin/gdb/kgdb/trgt_ia64.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/gnu/usr.bin/gdb/kgdb/trgt_mips.c
===================================================================
--- trunk/gnu/usr.bin/gdb/kgdb/trgt_mips.c	                        (rev 0)
+++ trunk/gnu/usr.bin/gdb/kgdb/trgt_mips.c	2018-06-15 00:33:07 UTC (rev 10933)
@@ -0,0 +1,241 @@
+/* $MidnightBSD$ */
+/*
+ * Copyright (c) 2007 Juniper Networks, Inc.
+ * Copyright (c) 2004 Marcel Moolenaar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * from: src/gnu/usr.bin/gdb/kgdb/trgt_alpha.c,v 1.2.2.1 2005/09/15 05:32:10 marcel
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/gnu/usr.bin/gdb/kgdb/trgt_mips.c 249878 2013-04-25 04:53:01Z imp $");
+
+#include <sys/types.h>
+#include <machine/asm.h>
+#include <machine/pcb.h>
+#include <machine/frame.h>
+#include <err.h>
+#include <kvm.h>
+#include <string.h>
+
+#include <defs.h>
+#include <target.h>
+#include <gdbthread.h>
+#include <inferior.h>
+#include <regcache.h>
+#include <frame-unwind.h>
+#include <mips-tdep.h>
+
+#ifndef	CROSS_DEBUGGER
+#include <machine/pcb.h>
+#endif
+
+#include "kgdb.h"
+
+CORE_ADDR
+kgdb_trgt_core_pcb(u_int cpuid)
+{
+	return (kgdb_trgt_stop_pcb(cpuid, sizeof(struct pcb)));
+}
+
+void
+kgdb_trgt_fetch_registers(int regno __unused)
+{
+#ifndef	CROSS_DEBUGGER
+	struct kthr *kt;
+	struct pcb pcb;
+
+	kt = kgdb_thr_lookup_tid(ptid_get_pid(inferior_ptid));
+	if (kt == NULL)
+		return;
+	if (kvm_read(kvm, kt->pcb, &pcb, sizeof(pcb)) != sizeof(pcb)) {
+		warnx("kvm_read: %s", kvm_geterr(kvm));
+		memset(&pcb, 0, sizeof(pcb));
+	}
+
+	supply_register(MIPS_S0_REGNUM, (char *)&pcb.pcb_context[PCB_REG_S0]);
+	supply_register(MIPS_S1_REGNUM, (char *)&pcb.pcb_context[PCB_REG_S1]);
+	supply_register(MIPS_S2_REGNUM, (char *)&pcb.pcb_context[PCB_REG_S2]);
+	supply_register(MIPS_S3_REGNUM, (char *)&pcb.pcb_context[PCB_REG_S3]);
+	supply_register(MIPS_S4_REGNUM, (char *)&pcb.pcb_context[PCB_REG_S4]);
+	supply_register(MIPS_S5_REGNUM, (char *)&pcb.pcb_context[PCB_REG_S5]);
+	supply_register(MIPS_S6_REGNUM, (char *)&pcb.pcb_context[PCB_REG_S6]);
+	supply_register(MIPS_S7_REGNUM, (char *)&pcb.pcb_context[PCB_REG_S7]);
+	supply_register(MIPS_SP_REGNUM, (char *)&pcb.pcb_context[PCB_REG_SP]);
+	supply_register(MIPS_FP_REGNUM, (char *)&pcb.pcb_context[PCB_REG_GP]);
+	supply_register(MIPS_RA_REGNUM, (char *)&pcb.pcb_context[PCB_REG_RA]);
+	supply_register(MIPS_EMBED_PC_REGNUM, (char *)&pcb.pcb_context[PCB_REG_PC]);
+#endif
+}
+
+void
+kgdb_trgt_store_registers(int regno __unused)
+{
+
+	fprintf_unfiltered(gdb_stderr, "Unimplemented function: %s\n", __func__);
+}
+
+void
+kgdb_trgt_new_objfile(struct objfile *objfile)
+{
+}
+
+#ifndef CROSS_DEBUGGER
+struct kgdb_frame_cache {
+	CORE_ADDR	pc;
+	CORE_ADDR	sp;
+};
+
+static int kgdb_trgt_frame_offset[] = {
+	offsetof(struct trapframe, zero),
+	offsetof(struct trapframe, ast),
+	offsetof(struct trapframe, v0),
+	offsetof(struct trapframe, v1),
+	offsetof(struct trapframe, a0),
+	offsetof(struct trapframe, a1),
+	offsetof(struct trapframe, a2),
+	offsetof(struct trapframe, a3),
+#if defined(__mips_n32) || defined(__mips_n64)
+	offsetof(struct trapframe, a4),
+	offsetof(struct trapframe, a5),
+	offsetof(struct trapframe, a6),
+	offsetof(struct trapframe, a7),
+	offsetof(struct trapframe, t0),
+	offsetof(struct trapframe, t1),
+	offsetof(struct trapframe, t2),
+	offsetof(struct trapframe, t3),
+#else
+	offsetof(struct trapframe, t0),
+	offsetof(struct trapframe, t1),
+	offsetof(struct trapframe, t2),
+	offsetof(struct trapframe, t3),
+	offsetof(struct trapframe, t4),
+	offsetof(struct trapframe, t5),
+	offsetof(struct trapframe, t6),
+	offsetof(struct trapframe, t7),
+#endif
+	offsetof(struct trapframe, s0),
+	offsetof(struct trapframe, s1),
+	offsetof(struct trapframe, s2),
+	offsetof(struct trapframe, s3),
+	offsetof(struct trapframe, s4),
+	offsetof(struct trapframe, s5),
+	offsetof(struct trapframe, s6),
+	offsetof(struct trapframe, s7),
+	offsetof(struct trapframe, t8),
+	offsetof(struct trapframe, t9),
+	offsetof(struct trapframe, k0),
+	offsetof(struct trapframe, k1),
+	offsetof(struct trapframe, gp),
+	offsetof(struct trapframe, sp),
+	offsetof(struct trapframe, s8),
+	offsetof(struct trapframe, ra),
+};
+
+static struct kgdb_frame_cache *
+kgdb_trgt_frame_cache(struct frame_info *next_frame, void **this_cache)
+{
+	char buf[MAX_REGISTER_SIZE];
+	struct kgdb_frame_cache *cache;
+
+	cache = *this_cache;
+	if (cache == NULL) {
+		cache = FRAME_OBSTACK_ZALLOC(struct kgdb_frame_cache);
+		*this_cache = cache;
+		cache->pc = frame_func_unwind(next_frame);
+		frame_unwind_register(next_frame, SP_REGNUM, buf);
+		cache->sp = extract_unsigned_integer(buf,
+		    register_size(current_gdbarch, SP_REGNUM));
+	}
+	return (cache);
+}
+
+static void
+kgdb_trgt_trapframe_this_id(struct frame_info *next_frame, void **this_cache,
+    struct frame_id *this_id)
+{
+	struct kgdb_frame_cache *cache;
+
+	cache = kgdb_trgt_frame_cache(next_frame, this_cache);
+	*this_id = frame_id_build(cache->sp, cache->pc);
+}
+
+static void
+kgdb_trgt_trapframe_prev_register(struct frame_info *next_frame __unused,
+    void **this_cache __unused, int regnum __unused, int *optimizedp __unused,
+    enum lval_type *lvalp __unused, CORE_ADDR *addrp __unused,
+    int *realnump __unused, void *valuep __unused)
+{
+	char dummy_valuep[MAX_REGISTER_SIZE];
+	struct kgdb_frame_cache *cache;
+	int ofs, regsz;
+
+	regsz = register_size(current_gdbarch, regnum);
+
+	if (valuep == NULL)
+		valuep = dummy_valuep;
+	memset(valuep, 0, regsz);
+	*optimizedp = 0;
+	*addrp = 0;
+	*lvalp = not_lval;
+	*realnump = -1;
+
+	ofs = (regnum >= 0 && regnum <= MIPS_RA_REGNUM) ?
+	    kgdb_trgt_frame_offset[regnum] : -1;
+	if (ofs == -1)
+		return;
+
+	cache = kgdb_trgt_frame_cache(next_frame, this_cache);
+	*addrp = cache->sp + ofs * 8;
+	*lvalp = lval_memory;
+	target_read_memory(*addrp, valuep, regsz);
+}
+
+static const struct frame_unwind kgdb_trgt_trapframe_unwind = {
+	UNKNOWN_FRAME,
+	&kgdb_trgt_trapframe_this_id,
+	&kgdb_trgt_trapframe_prev_register
+};
+#endif
+
+const struct frame_unwind *
+kgdb_trgt_trapframe_sniffer(struct frame_info *next_frame)
+{
+#ifndef CROSS_DEBUGGER
+	char *pname;
+	CORE_ADDR pc;
+
+	pc = frame_pc_unwind(next_frame);
+	pname = NULL;
+	find_pc_partial_function(pc, &pname, NULL, NULL);
+	if (pname == NULL)
+		return (NULL);
+	if ((strcmp(pname, "MipsKernIntr") == 0) ||
+	    (strcmp(pname, "MipsKernGenException") == 0) ||
+	    (strcmp(pname, "MipsUserIntr") == 0) ||
+	    (strcmp(pname, "MipsUserGenException") == 0))
+		return (&kgdb_trgt_trapframe_unwind);
+#endif
+	return (NULL);
+}


Property changes on: trunk/gnu/usr.bin/gdb/kgdb/trgt_mips.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/gnu/usr.bin/gdb/kgdb/trgt_powerpc.c
===================================================================
--- trunk/gnu/usr.bin/gdb/kgdb/trgt_powerpc.c	                        (rev 0)
+++ trunk/gnu/usr.bin/gdb/kgdb/trgt_powerpc.c	2018-06-15 00:33:07 UTC (rev 10933)
@@ -0,0 +1,202 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2006 Marcel Moolenaar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/gnu/usr.bin/gdb/kgdb/trgt_powerpc.c 246893 2013-02-17 02:15:19Z marcel $");
+
+#include <sys/types.h>
+#ifdef CROSS_DEBUGGER
+#include <sys/powerpc/include/pcb.h>
+#include <sys/powerpc/include/frame.h>
+#else
+#include <machine/pcb.h>
+#include <machine/frame.h>
+#endif
+#include <err.h>
+#include <kvm.h>
+#include <string.h>
+
+#include <defs.h>
+#include <target.h>
+#include <gdbthread.h>
+#include <inferior.h>
+#include <regcache.h>
+#include <frame-unwind.h>
+#include <ppc-tdep.h>
+
+#include "kgdb.h"
+
+CORE_ADDR
+kgdb_trgt_core_pcb(u_int cpuid)
+{
+	return (kgdb_trgt_stop_pcb(cpuid, sizeof(struct pcb)));
+}
+
+void
+kgdb_trgt_fetch_registers(int regno __unused)
+{
+	struct kthr *kt;
+	struct pcb pcb;
+	struct gdbarch_tdep *tdep;
+	int i;
+
+	tdep = gdbarch_tdep (current_gdbarch);
+
+	kt = kgdb_thr_lookup_tid(ptid_get_pid(inferior_ptid));
+	if (kt == NULL)
+		return;
+	if (kvm_read(kvm, kt->pcb, &pcb, sizeof(pcb)) != sizeof(pcb)) {
+		warnx("kvm_read: %s", kvm_geterr(kvm));
+		memset(&pcb, 0, sizeof(pcb));
+	}
+
+	/*
+	 * r14-r31 are saved in the pcb
+	 */
+	for (i = 14; i <= 31; i++) {
+		supply_register(tdep->ppc_gp0_regnum + i,
+		    (char *)&pcb.pcb_context[i]);
+	}
+
+	/* r1 is saved in the sp field */
+	supply_register(tdep->ppc_gp0_regnum + 1, (char *)&pcb.pcb_sp);
+
+	supply_register(tdep->ppc_lr_regnum, (char *)&pcb.pcb_lr);
+	supply_register(tdep->ppc_cr_regnum, (char *)&pcb.pcb_cr);
+}
+
+void
+kgdb_trgt_store_registers(int regno __unused)
+{
+	fprintf_unfiltered(gdb_stderr, "XXX: %s\n", __func__);
+}
+
+void
+kgdb_trgt_new_objfile(struct objfile *objfile)
+{
+}
+
+struct kgdb_frame_cache {
+	CORE_ADDR	pc;
+	CORE_ADDR	sp;
+};
+
+static struct kgdb_frame_cache *
+kgdb_trgt_frame_cache(struct frame_info *next_frame, void **this_cache)
+{
+	char buf[MAX_REGISTER_SIZE];
+	struct kgdb_frame_cache *cache;
+
+	cache = *this_cache;
+	if (cache == NULL) {
+		cache = FRAME_OBSTACK_ZALLOC(struct kgdb_frame_cache);
+		*this_cache = cache;
+		cache->pc = frame_func_unwind(next_frame);
+		frame_unwind_register(next_frame, SP_REGNUM, buf);
+		cache->sp = extract_unsigned_integer(buf,
+		    register_size(current_gdbarch, SP_REGNUM));
+	}
+	return (cache);
+}
+
+static void
+kgdb_trgt_trapframe_this_id(struct frame_info *next_frame, void **this_cache,
+    struct frame_id *this_id)
+{
+	struct kgdb_frame_cache *cache;
+
+	cache = kgdb_trgt_frame_cache(next_frame, this_cache);
+	*this_id = frame_id_build(cache->sp, cache->pc);
+}
+
+static void
+kgdb_trgt_trapframe_prev_register(struct frame_info *next_frame,
+    void **this_cache, int regnum, int *optimizedp, enum lval_type *lvalp,
+    CORE_ADDR *addrp, int *realnump, void *valuep)
+{
+	char dummy_valuep[MAX_REGISTER_SIZE];
+	struct gdbarch_tdep *tdep;
+	struct kgdb_frame_cache *cache;
+	int ofs, regsz;
+
+	tdep = gdbarch_tdep(current_gdbarch);
+	regsz = register_size(current_gdbarch, regnum);
+
+	if (valuep == NULL)
+		valuep = dummy_valuep;
+	memset(valuep, 0, regsz);
+	*optimizedp = 0;
+	*addrp = 0;
+	*lvalp = not_lval;
+	*realnump = -1;
+
+	if (regnum >= tdep->ppc_gp0_regnum &&
+	    regnum <= tdep->ppc_gplast_regnum)
+		ofs = offsetof(struct trapframe,
+		    fixreg[regnum - tdep->ppc_gp0_regnum]);
+	else if (regnum == tdep->ppc_lr_regnum)
+		ofs = offsetof(struct trapframe, lr);
+	else if (regnum == tdep->ppc_cr_regnum)
+		ofs = offsetof(struct trapframe, cr);
+	else if (regnum == tdep->ppc_xer_regnum)
+		ofs = offsetof(struct trapframe, xer);
+	else if (regnum == tdep->ppc_ctr_regnum)
+		ofs = offsetof(struct trapframe, ctr);
+	else if (regnum == PC_REGNUM)
+		ofs = offsetof(struct trapframe, srr0);
+	else
+		return;
+
+	cache = kgdb_trgt_frame_cache(next_frame, this_cache);
+	*addrp = cache->sp + 8 + ofs;
+	*lvalp = lval_memory;
+	target_read_memory(*addrp, valuep, regsz);
+}
+
+static const struct frame_unwind kgdb_trgt_trapframe_unwind = {
+        UNKNOWN_FRAME,
+        &kgdb_trgt_trapframe_this_id,
+        &kgdb_trgt_trapframe_prev_register
+};
+
+const struct frame_unwind *
+kgdb_trgt_trapframe_sniffer(struct frame_info *next_frame)
+{
+	char *pname;
+	CORE_ADDR pc;
+
+	pc = frame_pc_unwind(next_frame);
+	pname = NULL;
+	find_pc_partial_function(pc, &pname, NULL, NULL);
+	if (pname == NULL)
+		return (NULL);
+	if (strcmp(pname, "asttrapexit") == 0 ||
+	    strcmp(pname, "trapexit") == 0)
+		return (&kgdb_trgt_trapframe_unwind);
+	/* printf("%s: %llx =%s\n", __func__, pc, pname); */
+	return (NULL);
+}


Property changes on: trunk/gnu/usr.bin/gdb/kgdb/trgt_powerpc.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/gnu/usr.bin/gdb/kgdb/trgt_powerpc64.c
===================================================================
--- trunk/gnu/usr.bin/gdb/kgdb/trgt_powerpc64.c	                        (rev 0)
+++ trunk/gnu/usr.bin/gdb/kgdb/trgt_powerpc64.c	2018-06-15 00:33:07 UTC (rev 10933)
@@ -0,0 +1,199 @@
+/* $MidnightBSD$ */
+/*-
+ * Copyright (c) 2006 Marcel Moolenaar
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: stable/10/gnu/usr.bin/gdb/kgdb/trgt_powerpc64.c 246893 2013-02-17 02:15:19Z marcel $");
+
+#include <sys/types.h>
+#include <machine/pcb.h>
+#include <machine/frame.h>
+#include <err.h>
+#include <kvm.h>
+#include <string.h>
+
+#include <defs.h>
+#include <target.h>
+#include <gdbthread.h>
+#include <inferior.h>
+#include <regcache.h>
+#include <frame-unwind.h>
+#include <ppc-tdep.h>
+
+#include "kgdb.h"
+
+CORE_ADDR
+kgdb_trgt_core_pcb(u_int cpuid)
+{
+	return (kgdb_trgt_stop_pcb(cpuid, sizeof(struct pcb)));
+}
+
+void
+kgdb_trgt_fetch_registers(int regno __unused)
+{
+	struct kthr *kt;
+	struct pcb pcb;
+	struct gdbarch_tdep *tdep;
+	int i;
+
+	tdep = gdbarch_tdep (current_gdbarch);
+
+	kt = kgdb_thr_lookup_tid(ptid_get_pid(inferior_ptid));
+	if (kt == NULL)
+		return;
+	if (kvm_read(kvm, kt->pcb, &pcb, sizeof(pcb)) != sizeof(pcb)) {
+		warnx("kvm_read: %s", kvm_geterr(kvm));
+		memset(&pcb, 0, sizeof(pcb));
+	}
+
+	/*
+	 * r14-r31 are saved in the pcb
+	 */
+	for (i = 14; i <= 31; i++) {
+		supply_register(tdep->ppc_gp0_regnum + i,
+		    (char *)&pcb.pcb_context[i]);
+	}
+
+	/* r1 is saved in the sp field */
+	supply_register(tdep->ppc_gp0_regnum + 1, (char *)&pcb.pcb_sp);
+	/* r2 is saved in the toc field */
+	supply_register(tdep->ppc_gp0_regnum + 2, (char *)&pcb.pcb_toc);
+
+	supply_register(tdep->ppc_lr_regnum, (char *)&pcb.pcb_lr);
+	supply_register(tdep->ppc_cr_regnum, (char *)&pcb.pcb_cr);
+}
+
+void
+kgdb_trgt_store_registers(int regno __unused)
+{
+	fprintf_unfiltered(gdb_stderr, "XXX: %s\n", __func__);
+}
+
+void
+kgdb_trgt_new_objfile(struct objfile *objfile)
+{
+}
+
+struct kgdb_frame_cache {
+	CORE_ADDR	pc;
+	CORE_ADDR	sp;
+};
+
+static struct kgdb_frame_cache *
+kgdb_trgt_frame_cache(struct frame_info *next_frame, void **this_cache)
+{
+	char buf[MAX_REGISTER_SIZE];
+	struct kgdb_frame_cache *cache;
+
+	cache = *this_cache;
+	if (cache == NULL) {
+		cache = FRAME_OBSTACK_ZALLOC(struct kgdb_frame_cache);
+		*this_cache = cache;
+		cache->pc = frame_func_unwind(next_frame);
+		frame_unwind_register(next_frame, SP_REGNUM, buf);
+		cache->sp = extract_unsigned_integer(buf,
+		    register_size(current_gdbarch, SP_REGNUM));
+	}
+	return (cache);
+}
+
+static void
+kgdb_trgt_trapframe_this_id(struct frame_info *next_frame, void **this_cache,
+    struct frame_id *this_id)
+{
+	struct kgdb_frame_cache *cache;
+
+	cache = kgdb_trgt_frame_cache(next_frame, this_cache);
+	*this_id = frame_id_build(cache->sp, cache->pc);
+}
+
+static void
+kgdb_trgt_trapframe_prev_register(struct frame_info *next_frame,
+    void **this_cache, int regnum, int *optimizedp, enum lval_type *lvalp,
+    CORE_ADDR *addrp, int *realnump, void *valuep)
+{
+	char dummy_valuep[MAX_REGISTER_SIZE];
+	struct gdbarch_tdep *tdep;
+	struct kgdb_frame_cache *cache;
+	int ofs, regsz;
+
+	tdep = gdbarch_tdep(current_gdbarch);
+	regsz = register_size(current_gdbarch, regnum);
+
+	if (valuep == NULL)
+		valuep = dummy_valuep;
+	memset(valuep, 0, regsz);
+	*optimizedp = 0;
+	*addrp = 0;
+	*lvalp = not_lval;
+	*realnump = -1;
+
+	if (regnum >= tdep->ppc_gp0_regnum &&
+	    regnum <= tdep->ppc_gplast_regnum)
+		ofs = offsetof(struct trapframe,
+		    fixreg[regnum - tdep->ppc_gp0_regnum]);
+	else if (regnum == tdep->ppc_lr_regnum)
+		ofs = offsetof(struct trapframe, lr);
+	else if (regnum == tdep->ppc_cr_regnum)
+		ofs = offsetof(struct trapframe, cr);
+	else if (regnum == tdep->ppc_xer_regnum)
+		ofs = offsetof(struct trapframe, xer);
+	else if (regnum == tdep->ppc_ctr_regnum)
+		ofs = offsetof(struct trapframe, ctr);
+	else if (regnum == PC_REGNUM)
+		ofs = offsetof(struct trapframe, srr0);
+	else
+		return;
+
+	cache = kgdb_trgt_frame_cache(next_frame, this_cache);
+	*addrp = cache->sp + 48 + ofs;
+	*lvalp = lval_memory;
+	target_read_memory(*addrp, valuep, regsz);
+}
+
+static const struct frame_unwind kgdb_trgt_trapframe_unwind = {
+        UNKNOWN_FRAME,
+        &kgdb_trgt_trapframe_this_id,
+        &kgdb_trgt_trapframe_prev_register
+};
+
+const struct frame_unwind *
+kgdb_trgt_trapframe_sniffer(struct frame_info *next_frame)
+{
+	char *pname;
+	CORE_ADDR pc;
+
+	pc = frame_pc_unwind(next_frame);
+	pname = NULL;
+	find_pc_partial_function(pc, &pname, NULL, NULL);
+	if (pname == NULL)
+		return (NULL);
+	if (strcmp(pname, "asttrapexit") == 0 ||
+	    strcmp(pname, "trapexit") == 0)
+		return (&kgdb_trgt_trapframe_unwind);
+	/* printf("%s: %llx =%s\n", __func__, pc, pname); */
+	return (NULL);
+}


Property changes on: trunk/gnu/usr.bin/gdb/kgdb/trgt_powerpc64.c
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/gnu/usr.bin/gdb/kgdb/trgt_sparc64.c
===================================================================
--- trunk/gnu/usr.bin/gdb/kgdb/trgt_sparc64.c	2018-06-15 00:32:31 UTC (rev 10932)
+++ trunk/gnu/usr.bin/gdb/kgdb/trgt_sparc64.c	2018-06-15 00:33:07 UTC (rev 10933)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 2004 Marcel Moolenaar
  * All rights reserved.
@@ -25,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/gnu/usr.bin/gdb/kgdb/trgt_sparc64.c 246893 2013-02-17 02:15:19Z marcel $");
 
 #include <sys/types.h>
 #include <machine/asm.h>
@@ -46,6 +47,12 @@
 
 #include "kgdb.h"
 
+CORE_ADDR
+kgdb_trgt_core_pcb(u_int cpuid)
+{
+	return (kgdb_trgt_stop_pcb(cpuid, sizeof(struct pcb)));
+}
+
 void
 kgdb_trgt_fetch_registers(int regno __unused)
 {



More information about the Midnightbsd-cvs mailing list