summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/gdb')
-rw-r--r--gnu/usr.bin/gdb/Makefile.inc14
-rw-r--r--gnu/usr.bin/gdb/arch/mips/Makefile2
-rw-r--r--gnu/usr.bin/gdb/arch/mips/init.c5
-rw-r--r--gnu/usr.bin/gdb/kgdb/Makefile2
-rw-r--r--gnu/usr.bin/gdb/kgdb/trgt_mips.c41
-rw-r--r--gnu/usr.bin/gdb/libgdb/Makefile10
6 files changed, 51 insertions, 23 deletions
diff --git a/gnu/usr.bin/gdb/Makefile.inc b/gnu/usr.bin/gdb/Makefile.inc
index c230f95..2888163 100644
--- a/gnu/usr.bin/gdb/Makefile.inc
+++ b/gnu/usr.bin/gdb/Makefile.inc
@@ -16,8 +16,16 @@ OBJ_ROOT= ${.OBJDIR}/../..
OBJ_BU= ${OBJ_ROOT}/binutils
OBJ_GDB= ${OBJ_ROOT}/gdb
-TARGET_ARCH?= ${MACHINE_ARCH}
-TARGET_SUBDIR= ${BMAKE_GDB}/arch/${TARGET_ARCH}
+# These assignments duplicate much of the functionality of
+# MACHINE_CPUARCH, but there's no easy way to export make functions...
+
+.if defined(TARGET_ARCH)
+TARGET_CPUARCH=${TARGET_ARCH:C/mipse[bl]/mips/:C/armeb/arm/}
+.else
+TARGET_CPUARCH=${MACHINE_CPUARCH}
+.endif
+TARGET_ARCH?= ${MACHINE_ARCH}
+TARGET_SUBDIR= ${BMAKE_GDB}/arch/${TARGET_CPUARCH}
.if ${TARGET_ARCH} != ${MACHINE_ARCH}
GDB_CROSS_DEBUGGER=
@@ -31,7 +39,7 @@ GDB_CROSS_DEBUGGER=
CFLAGS+= -DHAVE_CONFIG_H -DRL_NO_COMPAT -DMI_OUT=1 -DTUI=1
CFLAGS+= -I.
CFLAGS+= -I${TARGET_SUBDIR}
-CFLAGS+= -I${BMAKE_BU}/libbfd -I${BMAKE_BU}/libbfd/${TARGET_ARCH}
+CFLAGS+= -I${BMAKE_BU}/libbfd -I${BMAKE_BU}/libbfd/${TARGET_CPUARCH}
CFLAGS+= -I${CNTRB_GDB}/gdb
CFLAGS+= -I${CNTRB_GDB}/gdb/config
CFLAGS+= -I${CNTRB_BU}/include
diff --git a/gnu/usr.bin/gdb/arch/mips/Makefile b/gnu/usr.bin/gdb/arch/mips/Makefile
index 54180d9..a6d4d9e 100644
--- a/gnu/usr.bin/gdb/arch/mips/Makefile
+++ b/gnu/usr.bin/gdb/arch/mips/Makefile
@@ -1,7 +1,7 @@
# $FreeBSD$
.if !defined(GDB_CROSS_DEBUGGER)
-LIBSRCS+= mipsfbsd-nat.c
+LIBSRCS+= mipsfbsd-nat.c fbsd-threads.c
.endif
LIBSRCS+= solib.c solib-svr4.c
LIBSRCS+= mips-tdep.c mipsfbsd-tdep.c fbsd-proc.c
diff --git a/gnu/usr.bin/gdb/arch/mips/init.c b/gnu/usr.bin/gdb/arch/mips/init.c
index 27631f2..491b2b3 100644
--- a/gnu/usr.bin/gdb/arch/mips/init.c
+++ b/gnu/usr.bin/gdb/arch/mips/init.c
@@ -119,6 +119,8 @@ initialize_all_files (void)
_initialize_mips_tdep ();
_initialize_mipsfbsd_tdep ();
_initialize_corelow ();
+ _initialize_solib ();
+ _initialize_svr4_solib ();
_initialize_ser_hardwire ();
_initialize_ser_pipe ();
_initialize_ser_tcp ();
@@ -130,8 +132,7 @@ initialize_all_files (void)
_initialize_kernel_u_addr ();
_initialize_infptrace ();
_initialize_inftarg ();
- _initialize_solib ();
- _initialize_svr4_solib ();
+ _initialize_thread_db ();
#if 0
_initialize_svr4_lm ();
#endif
diff --git a/gnu/usr.bin/gdb/kgdb/Makefile b/gnu/usr.bin/gdb/kgdb/Makefile
index 955394a..1372f17 100644
--- a/gnu/usr.bin/gdb/kgdb/Makefile
+++ b/gnu/usr.bin/gdb/kgdb/Makefile
@@ -1,7 +1,7 @@
# $FreeBSD$
PROG= kgdb${GDB_SUFFIX}
-SRCS= main.c kld.c kthr.c trgt.c trgt_${TARGET_ARCH}.c
+SRCS= main.c kld.c kthr.c trgt.c trgt_${TARGET_CPUARCH}.c
WARNS?= 2
BULIBS= ${OBJ_BU}/libbfd/libbfd.a ${OBJ_BU}/libopcodes/libopcodes.a \
diff --git a/gnu/usr.bin/gdb/kgdb/trgt_mips.c b/gnu/usr.bin/gdb/kgdb/trgt_mips.c
index 9782222..423cacd 100644
--- a/gnu/usr.bin/gdb/kgdb/trgt_mips.c
+++ b/gnu/usr.bin/gdb/kgdb/trgt_mips.c
@@ -46,11 +46,16 @@ __FBSDID("$FreeBSD$");
#include <frame-unwind.h>
#include <mips-tdep.h>
+#ifndef CROSS_DEBUGGER
+#include <machine/pcb.h>
+#endif
+
#include "kgdb.h"
void
kgdb_trgt_fetch_registers(int regno __unused)
{
+#ifndef CROSS_DEBUGGER
struct kthr *kt;
struct pcb pcb;
@@ -61,24 +66,27 @@ kgdb_trgt_fetch_registers(int regno __unused)
warnx("kvm_read: %s", kvm_geterr(kvm));
memset(&pcb, 0, sizeof(pcb));
}
- supply_register(MIPS_S0_REGNUM, (char *)&pcb.pcb_context[0]);
- supply_register(MIPS_S1_REGNUM, (char *)&pcb.pcb_context[1]);
- supply_register(MIPS_S2_REGNUM, (char *)&pcb.pcb_context[2]);
- supply_register(MIPS_S3_REGNUM, (char *)&pcb.pcb_context[3]);
- supply_register(MIPS_S4_REGNUM, (char *)&pcb.pcb_context[4]);
- supply_register(MIPS_S5_REGNUM, (char *)&pcb.pcb_context[5]);
- supply_register(MIPS_S6_REGNUM, (char *)&pcb.pcb_context[6]);
- supply_register(MIPS_S7_REGNUM, (char *)&pcb.pcb_context[7]);
- supply_register(MIPS_SP_REGNUM, (char *)&pcb.pcb_context[8]);
- supply_register(MIPS_FP_REGNUM, (char *)&pcb.pcb_context[9]);
- supply_register(MIPS_RA_REGNUM, (char *)&pcb.pcb_context[10]);
+
+ 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, "XXX: %s\n", __func__);
+ fprintf_unfiltered(gdb_stderr, "Unimplemented function: %s\n", __func__);
}
void
@@ -86,6 +94,7 @@ kgdb_trgt_new_objfile(struct objfile *objfile)
{
}
+#ifndef CROSS_DEBUGGER
struct kgdb_frame_cache {
CORE_ADDR pc;
CORE_ADDR sp;
@@ -127,7 +136,7 @@ static int kgdb_trgt_frame_offset[] = {
};
static struct kgdb_frame_cache *
-kgdb_trgt_frame_cache(struct frame_info *next_frame __unused, void **this_cache __unused)
+kgdb_trgt_frame_cache(struct frame_info *next_frame, void **this_cache)
{
char buf[MAX_REGISTER_SIZE];
struct kgdb_frame_cache *cache;
@@ -190,10 +199,12 @@ static const struct frame_unwind kgdb_trgt_trapframe_unwind = {
&kgdb_trgt_trapframe_this_id,
&kgdb_trgt_trapframe_prev_register
};
+#endif
const struct frame_unwind *
-kgdb_trgt_trapframe_sniffer(struct frame_info *next_frame __unused)
+kgdb_trgt_trapframe_sniffer(struct frame_info *next_frame)
{
+#ifndef CROSS_DEBUGGER
char *pname;
CORE_ADDR pc;
@@ -207,6 +218,6 @@ kgdb_trgt_trapframe_sniffer(struct frame_info *next_frame __unused)
(strcmp(pname, "MipsUserIntr") == 0) ||
(strcmp(pname, "MipsUserGenException") == 0))
return (&kgdb_trgt_trapframe_unwind);
- /* printf("%s: %llx =%s\n", __func__, pc, pname); */
+#endif
return (NULL);
}
diff --git a/gnu/usr.bin/gdb/libgdb/Makefile b/gnu/usr.bin/gdb/libgdb/Makefile
index 8c22a1a..bb18a8e 100644
--- a/gnu/usr.bin/gdb/libgdb/Makefile
+++ b/gnu/usr.bin/gdb/libgdb/Makefile
@@ -1,6 +1,14 @@
# $FreeBSD$
-TARGET_ARCH?= ${MACHINE_ARCH}
+# These assignments duplicate much of the functionality of
+# MACHINE_CPUARCH, but there's no easy way to export make functions...
+
+.if defined(TARGET_ARCH)
+TARGET_CPUARCH=${TARGET_ARCH:C/mipse[bl]/mips/:C/armeb/arm/}
+.else
+TARGET_CPUARCH=${MACHINE_CPUARCH}
+.endif
+TARGET_ARCH?= ${MACHINE_ARCH}
LIB= gdb
INTERNALLIB=
OpenPOWER on IntegriCloud