devkitARM: update gdb patch

This commit is contained in:
Dave Murphy 2019-05-14 10:22:19 +01:00
parent b1d5f5c7a6
commit aeb6482da9
3 changed files with 213 additions and 65 deletions

View File

@ -1,6 +1,6 @@
#!/bin/bash
#---------------------------------------------------------------------------------
# devkitARM release 52
# devkitARM release 52-2
# devkitPPC release 35
# devkitA64 release 13
#---------------------------------------------------------------------------------

View File

@ -1,7 +1,29 @@
diff -NBaur gdb-8.2.1/gdb/arm-3ds-tdep.c gdb-8.2.1-apple/gdb/arm-3ds-tdep.c
--- gdb-8.2.1/gdb/arm-3ds-tdep.c 1970-01-01 01:00:00.000000000 +0100
+++ gdb-8.2.1-apple/gdb/arm-3ds-tdep.c 2019-02-19 17:15:22.100604954 +0000
@@ -0,0 +1,157 @@
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 9799a7a65d..ccd3f8a626 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -684,6 +684,7 @@ ALL_TARGET_OBS = \
arch/arm-linux.o \
arch/i386.o \
arch/ppc-linux-common.o \
+ arm-3ds-tdep.o \
arm-bsd-tdep.o \
arm-fbsd-tdep.o \
arm-linux-tdep.o \
@@ -2213,6 +2214,7 @@ ALLDEPFILES = \
amd64-tdep.c \
arc-tdep.c \
arm.c \
+ arm-3ds-tdep.c \
arm-bsd-tdep.c \
arm-fbsd-nat.c \
arm-fbsd-tdep.c \
diff --git a/gdb/arm-3ds-tdep.c b/gdb/arm-3ds-tdep.c
new file mode 100644
index 0000000000..c41336982b
--- /dev/null
+++ b/gdb/arm-3ds-tdep.c
@@ -0,0 +1,291 @@
+/* Target-dependent code for 3DS. */
+
+/* This uses code from GDB, which license is: */
@ -49,6 +71,32 @@ diff -NBaur gdb-8.2.1/gdb/arm-3ds-tdep.c gdb-8.2.1-apple/gdb/arm-3ds-tdep.c
+ NULL,
+};
+
+/* single_step() is called just before we want to resume the inferior,
+ if we want to single-step it but there is no hardware or kernel
+ single-step support. We find the target of the coming instructions
+ and breakpoint them. */
+
+std::vector<CORE_ADDR>
+arm_3ds_software_single_step (struct regcache *regcache)
+{
+ struct gdbarch *gdbarch = regcache->arch ();
+ struct arm_get_next_pcs next_pcs_ctx;
+
+ arm_get_next_pcs_ctor (&next_pcs_ctx,
+ &arm_3ds_get_next_pcs_ops,
+ gdbarch_byte_order (gdbarch),
+ gdbarch_byte_order_for_code (gdbarch),
+ 0,
+ regcache);
+
+ std::vector<CORE_ADDR> next_pcs = arm_get_next_pcs (&next_pcs_ctx);
+
+ for (CORE_ADDR &pc_ref : next_pcs)
+ pc_ref = gdbarch_addr_bits_remove (gdbarch, pc_ref);
+
+ return next_pcs;
+}
+
+static CORE_ADDR
+arm_3ds_get_next_pcs_syscall_next_pc (struct arm_get_next_pcs *self)
+{
@ -124,6 +172,108 @@ diff -NBaur gdb-8.2.1/gdb/arm-3ds-tdep.c gdb-8.2.1-apple/gdb/arm-3ds-tdep.c
+ return svc_number;
+}
+
+/* Implement the breakpoint_kind_from_pc gdbarch method. */
+
+static int
+arm_3ds_breakpoint_kind_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+ enum bfd_endian byte_order_for_code = gdbarch_byte_order_for_code (gdbarch);
+
+ if (arm_pc_is_thumb (gdbarch, *pcptr))
+ {
+ *pcptr = UNMAKE_THUMB_ADDR (*pcptr);
+
+ /* If we have a separate 32-bit breakpoint instruction for Thumb-2,
+ check whether we are replacing a 32-bit instruction. */
+ if (tdep->thumb2_breakpoint != NULL)
+ {
+ gdb_byte buf[2];
+
+ if (target_read_memory (*pcptr, buf, 2) == 0)
+ {
+ unsigned short inst1;
+
+ inst1 = extract_unsigned_integer (buf, 2, byte_order_for_code);
+ if (thumb_insn_size (inst1) == 4)
+ return ARM_BP_KIND_THUMB2;
+ }
+ }
+
+ return ARM_BP_KIND_THUMB;
+ }
+ else
+ return ARM_BP_KIND_ARM;
+
+}
+
+/* Implement the sw_breakpoint_from_kind gdbarch method. */
+
+static const gdb_byte *
+arm_3ds_sw_breakpoint_from_kind (struct gdbarch *gdbarch, int kind, int *size)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+ switch (kind)
+ {
+ case ARM_BP_KIND_ARM:
+ *size = tdep->arm_breakpoint_size;
+ return tdep->arm_breakpoint;
+ case ARM_BP_KIND_THUMB:
+ *size = tdep->thumb_breakpoint_size;
+ return tdep->thumb_breakpoint;
+ case ARM_BP_KIND_THUMB2:
+ *size = tdep->thumb2_breakpoint_size;
+ return tdep->thumb2_breakpoint;
+ default:
+ gdb_assert_not_reached ("unexpected arm breakpoint kind");
+ }
+}
+
+/* Implement the breakpoint_kind_from_current_state gdbarch method. */
+
+static int
+arm_3ds_breakpoint_kind_from_current_state (struct gdbarch *gdbarch,
+ struct regcache *regcache,
+ CORE_ADDR *pcptr)
+{
+ gdb_byte buf[4];
+
+ /* Check the memory pointed by PC is readable. */
+ if (target_read_memory (regcache_read_pc (regcache), buf, 4) == 0)
+ {
+ struct arm_get_next_pcs next_pcs_ctx;
+
+ arm_get_next_pcs_ctor (&next_pcs_ctx,
+ &arm_3ds_get_next_pcs_ops,
+ gdbarch_byte_order (gdbarch),
+ gdbarch_byte_order_for_code (gdbarch),
+ 0,
+ regcache);
+
+ std::vector<CORE_ADDR> next_pcs = arm_get_next_pcs (&next_pcs_ctx);
+
+ /* If MEMADDR is the next instruction of current pc, do the
+ software single step computation, and get the thumb mode by
+ the destination address. */
+ for (CORE_ADDR pc : next_pcs)
+ {
+ if (UNMAKE_THUMB_ADDR (pc) == *pcptr)
+ {
+ if (IS_THUMB_ADDR (pc))
+ {
+ *pcptr = MAKE_THUMB_ADDR (*pcptr);
+ return arm_3ds_breakpoint_kind_from_pc (gdbarch, pcptr);
+ }
+ else
+ return ARM_BP_KIND_ARM;
+ }
+ }
+ }
+
+ return arm_3ds_breakpoint_kind_from_pc (gdbarch, pcptr);
+}
+
+static void
+arm_3ds_init_abi (struct gdbarch_info info,
+ struct gdbarch *gdbarch)
@ -146,7 +296,13 @@ diff -NBaur gdb-8.2.1/gdb/arm-3ds-tdep.c gdb-8.2.1-apple/gdb/arm-3ds-tdep.c
+ tdep->fp_model = ARM_FLOAT_VFP;
+
+ /* Single stepping. */
+ set_gdbarch_software_single_step (gdbarch, arm_software_single_step);
+ set_gdbarch_software_single_step (gdbarch, arm_3ds_software_single_step);
+
+ /* Breakpoint manipulation. */
+ set_gdbarch_breakpoint_kind_from_pc (gdbarch, arm_3ds_breakpoint_kind_from_pc);
+ set_gdbarch_sw_breakpoint_from_kind (gdbarch, arm_3ds_sw_breakpoint_from_kind);
+ set_gdbarch_breakpoint_kind_from_current_state (gdbarch,
+ arm_3ds_breakpoint_kind_from_current_state);
+
+ /* `catch syscall' */
+ set_xml_syscall_file_name (gdbarch, "syscalls/arm-3ds.xml");
@ -159,10 +315,11 @@ diff -NBaur gdb-8.2.1/gdb/arm-3ds-tdep.c gdb-8.2.1-apple/gdb/arm-3ds-tdep.c
+ gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_3DS,
+ arm_3ds_init_abi);
+}
diff -NBaur gdb-8.2.1/gdb/configure.tgt gdb-8.2.1-apple/gdb/configure.tgt
--- gdb-8.2.1/gdb/configure.tgt 2018-12-23 05:51:54.000000000 +0000
+++ gdb-8.2.1-apple/gdb/configure.tgt 2019-02-19 17:15:22.104618045 +0000
@@ -61,7 +61,7 @@
diff --git a/gdb/configure.tgt b/gdb/configure.tgt
index f197160896..e2835ddef5 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -61,7 +61,7 @@ arc*-*-*)
;;
arm*-*-*)
@ -171,10 +328,11 @@ diff -NBaur gdb-8.2.1/gdb/configure.tgt gdb-8.2.1-apple/gdb/configure.tgt
hppa*-*-*)
# Target: HP PA-RISC
diff -NBaur gdb-8.2.1/gdb/data-directory/Makefile.in gdb-8.2.1-apple/gdb/data-directory/Makefile.in
--- gdb-8.2.1/gdb/data-directory/Makefile.in 2018-01-05 04:07:23.000000000 +0000
+++ gdb-8.2.1-apple/gdb/data-directory/Makefile.in 2019-02-19 17:15:22.104618045 +0000
@@ -63,7 +63,7 @@
diff --git a/gdb/data-directory/Makefile.in b/gdb/data-directory/Makefile.in
index 753e0b69a3..645eb043b9 100644
--- a/gdb/data-directory/Makefile.in
+++ b/gdb/data-directory/Makefile.in
@@ -63,7 +63,7 @@ GEN_SYSCALLS_FILES = \
sparc-linux.xml \
sparc64-linux.xml
@ -183,10 +341,11 @@ diff -NBaur gdb-8.2.1/gdb/data-directory/Makefile.in gdb-8.2.1-apple/gdb/data-di
PYTHON_DIR = python
PYTHON_INSTALL_DIR = $(DESTDIR)$(GDB_DATADIR)/$(PYTHON_DIR)
diff -NBaur gdb-8.2.1/gdb/defs.h gdb-8.2.1-apple/gdb/defs.h
--- gdb-8.2.1/gdb/defs.h 2018-12-23 05:51:54.000000000 +0000
+++ gdb-8.2.1-apple/gdb/defs.h 2019-02-19 17:15:22.104618045 +0000
@@ -495,6 +495,7 @@
diff --git a/gdb/defs.h b/gdb/defs.h
index fc4217005a..a179a6d820 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -495,6 +495,7 @@ enum gdb_osabi
GDB_OSABI_LYNXOS178,
GDB_OSABI_NEWLIB,
GDB_OSABI_SDE,
@ -194,10 +353,11 @@ diff -NBaur gdb-8.2.1/gdb/defs.h gdb-8.2.1-apple/gdb/defs.h
GDB_OSABI_INVALID /* keep this last */
};
diff -NBaur gdb-8.2.1/gdb/dtrace-probe.c gdb-8.2.1-apple/gdb/dtrace-probe.c
--- gdb-8.2.1/gdb/dtrace-probe.c 2018-12-23 05:51:54.000000000 +0000
+++ gdb-8.2.1-apple/gdb/dtrace-probe.c 2019-02-19 17:30:16.449175937 +0000
@@ -100,7 +100,7 @@
diff --git a/gdb/dtrace-probe.c b/gdb/dtrace-probe.c
index fa4e06e794..b6afc4cc7c 100644
--- a/gdb/dtrace-probe.c
+++ b/gdb/dtrace-probe.c
@@ -100,7 +100,7 @@ public:
/* DTrace static_probe_ops. */
@ -206,29 +366,11 @@ diff -NBaur gdb-8.2.1/gdb/dtrace-probe.c gdb-8.2.1-apple/gdb/dtrace-probe.c
/* The following structure represents a dtrace probe. */
diff -NBaur gdb-8.2.1/gdb/Makefile.in gdb-8.2.1-apple/gdb/Makefile.in
--- gdb-8.2.1/gdb/Makefile.in 2018-12-23 05:51:54.000000000 +0000
+++ gdb-8.2.1-apple/gdb/Makefile.in 2019-02-19 17:15:22.104618045 +0000
@@ -684,6 +684,7 @@
arch/arm-linux.o \
arch/i386.o \
arch/ppc-linux-common.o \
+ arm-3ds-tdep.o \
arm-bsd-tdep.o \
arm-fbsd-tdep.o \
arm-linux-tdep.o \
@@ -2213,6 +2214,7 @@
amd64-tdep.c \
arc-tdep.c \
arm.c \
+ arm-3ds-tdep.c \
arm-bsd-tdep.c \
arm-fbsd-nat.c \
arm-fbsd-tdep.c \
diff -NBaur gdb-8.2.1/gdb/osabi.c gdb-8.2.1-apple/gdb/osabi.c
--- gdb-8.2.1/gdb/osabi.c 2018-12-23 05:51:54.000000000 +0000
+++ gdb-8.2.1-apple/gdb/osabi.c 2019-02-19 17:15:22.104618045 +0000
@@ -80,6 +80,7 @@
diff --git a/gdb/osabi.c b/gdb/osabi.c
index 7d0540b181..49d3f78331 100644
--- a/gdb/osabi.c
+++ b/gdb/osabi.c
@@ -80,6 +80,7 @@ static const struct osabi_names gdb_osabi_names[] =
{ "LynxOS178", NULL },
{ "Newlib", NULL },
{ "SDE", NULL },
@ -236,10 +378,11 @@ diff -NBaur gdb-8.2.1/gdb/osabi.c gdb-8.2.1-apple/gdb/osabi.c
{ "<invalid>", NULL }
};
diff -NBaur gdb-8.2.1/gdb/probe.c gdb-8.2.1-apple/gdb/probe.c
--- gdb-8.2.1/gdb/probe.c 2018-12-23 05:51:54.000000000 +0000
+++ gdb-8.2.1-apple/gdb/probe.c 2019-02-19 17:31:05.266578008 +0000
@@ -60,7 +60,7 @@
diff --git a/gdb/probe.c b/gdb/probe.c
index 1f3da213ef..4acbeb8704 100644
--- a/gdb/probe.c
+++ b/gdb/probe.c
@@ -60,7 +60,7 @@ public:
/* Static operations associated with a generic probe. */
@ -248,10 +391,11 @@ diff -NBaur gdb-8.2.1/gdb/probe.c gdb-8.2.1-apple/gdb/probe.c
/* A helper for parse_probes that decodes a probe specification in
SEARCH_PSPACE. It appends matching SALs to RESULT. */
diff -NBaur gdb-8.2.1/gdb/record-btrace.c gdb-8.2.1-apple/gdb/record-btrace.c
--- gdb-8.2.1/gdb/record-btrace.c 2018-12-23 05:51:54.000000000 +0000
+++ gdb-8.2.1-apple/gdb/record-btrace.c 2019-02-19 17:31:33.301731324 +0000
@@ -144,7 +144,7 @@
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 09a3f6cc5c..9f90a6b436 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -144,7 +144,7 @@ static record_btrace_target record_btrace_ops;
/* Token associated with a new-thread observer enabling branch tracing
for the new thread. */
@ -260,10 +404,11 @@ diff -NBaur gdb-8.2.1/gdb/record-btrace.c gdb-8.2.1-apple/gdb/record-btrace.c
/* Memory access types used in set/show record btrace replay-memory-access. */
static const char replay_memory_access_read_only[] = "read-only";
diff -NBaur gdb-8.2.1/gdb/stap-probe.c gdb-8.2.1-apple/gdb/stap-probe.c
--- gdb-8.2.1/gdb/stap-probe.c 2018-12-23 05:51:54.000000000 +0000
+++ gdb-8.2.1-apple/gdb/stap-probe.c 2019-02-19 17:29:35.744567941 +0000
@@ -119,7 +119,7 @@
diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c
index ed7e1a0d3f..42fad3835f 100644
--- a/gdb/stap-probe.c
+++ b/gdb/stap-probe.c
@@ -119,7 +119,7 @@ public:
/* SystemTap static_probe_ops. */
@ -272,9 +417,11 @@ diff -NBaur gdb-8.2.1/gdb/stap-probe.c gdb-8.2.1-apple/gdb/stap-probe.c
class stap_probe : public probe
{
diff -NBaur gdb-8.2.1/gdb/syscalls/arm-3ds.xml gdb-8.2.1-apple/gdb/syscalls/arm-3ds.xml
--- gdb-8.2.1/gdb/syscalls/arm-3ds.xml 1970-01-01 01:00:00.000000000 +0100
+++ gdb-8.2.1-apple/gdb/syscalls/arm-3ds.xml 2019-02-19 17:15:22.104618045 +0000
diff --git a/gdb/syscalls/arm-3ds.xml b/gdb/syscalls/arm-3ds.xml
new file mode 100644
index 0000000000..48780b7bd5
--- /dev/null
+++ b/gdb/syscalls/arm-3ds.xml
@@ -0,0 +1,159 @@
+<?xml version="1.0"?>
+<!DOCTYPE syscalls_info SYSTEM "gdb-syscalls.dtd">
@ -435,10 +582,11 @@ diff -NBaur gdb-8.2.1/gdb/syscalls/arm-3ds.xml gdb-8.2.1-apple/gdb/syscalls/arm-
+ <syscall name="TranslateHandle" number="178" groups="custom,synchronization,ipc,thread,process,debug"/>
+
+</syscalls_info>
diff -NBaur gdb-8.2.1/gdb/tui/tui-hooks.c gdb-8.2.1-apple/gdb/tui/tui-hooks.c
--- gdb-8.2.1/gdb/tui/tui-hooks.c 2018-12-23 05:51:54.000000000 +0000
+++ gdb-8.2.1-apple/gdb/tui/tui-hooks.c 2019-02-19 17:28:53.178460364 +0000
@@ -205,7 +205,7 @@
diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c
index efa02e2f08..1c341dcf47 100644
--- a/gdb/tui/tui-hooks.c
+++ b/gdb/tui/tui-hooks.c
@@ -205,7 +205,7 @@ tui_normal_stop (struct bpstats *bs, int print_frame)
/* Token associated with observers registered while TUI hooks are
installed. */

View File

@ -64,7 +64,7 @@ then
--prefix=$prefix \
--enable-lto\
--with-system-zlib \
--with-bugurl="http://wiki.devkitpro.org/index.php/Bug_Reports" --with-pkgversion="devkitARM release 52" \
--with-bugurl="http://wiki.devkitpro.org/index.php/Bug_Reports" --with-pkgversion="devkitARM release 52-2" \
$CROSS_PARAMS \
$CROSS_GCC_PARAMS \
|| { echo "Error configuring gcc"; exit 1; }