summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gdb')
-rw-r--r--meta/recipes-devtools/gdb/gdb-10.2.inc23
-rw-r--r--meta/recipes-devtools/gdb/gdb-common.inc15
-rw-r--r--meta/recipes-devtools/gdb/gdb-cross-canadian.inc6
-rw-r--r--meta/recipes-devtools/gdb/gdb-cross-canadian_14.2.bb (renamed from meta/recipes-devtools/gdb/gdb-cross-canadian_10.2.bb)2
-rw-r--r--meta/recipes-devtools/gdb/gdb-cross.inc2
-rw-r--r--meta/recipes-devtools/gdb/gdb-cross_14.2.bb (renamed from meta/recipes-devtools/gdb/gdb-cross_10.2.bb)2
-rw-r--r--meta/recipes-devtools/gdb/gdb.inc26
-rw-r--r--meta/recipes-devtools/gdb/gdb/0001-make-man-install-relative-to-DESTDIR.patch28
-rw-r--r--meta/recipes-devtools/gdb/gdb/0001-mips-linux-nat-Define-_ABIO32-if-not-defined.patch (renamed from meta/recipes-devtools/gdb/gdb/0002-mips-linux-nat-Define-_ABIO32-if-not-defined.patch)9
-rw-r--r--meta/recipes-devtools/gdb/gdb/0002-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch (renamed from meta/recipes-devtools/gdb/gdb/0003-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch)12
-rw-r--r--meta/recipes-devtools/gdb/gdb/0003-Dont-disable-libreadline.a-when-using-disable-static.patch (renamed from meta/recipes-devtools/gdb/gdb/0005-Dont-disable-libreadline.a-when-using-disable-static.patch)15
-rw-r--r--meta/recipes-devtools/gdb/gdb/0004-Add-support-for-Renesas-SH-sh4-architecture.patch913
-rw-r--r--meta/recipes-devtools/gdb/gdb/0004-use-asm-sgidefs.h.patch (renamed from meta/recipes-devtools/gdb/gdb/0006-use-asm-sgidefs.h.patch)9
-rw-r--r--meta/recipes-devtools/gdb/gdb/0005-Change-order-of-CFLAGS.patch (renamed from meta/recipes-devtools/gdb/gdb/0008-Change-order-of-CFLAGS.patch)13
-rw-r--r--meta/recipes-devtools/gdb/gdb/0006-resolve-restrict-keyword-conflict.patch (renamed from meta/recipes-devtools/gdb/gdb/0009-resolve-restrict-keyword-conflict.patch)9
-rw-r--r--meta/recipes-devtools/gdb/gdb/0007-Fix-invalid-sigprocmask-call.patch (renamed from meta/recipes-devtools/gdb/gdb/0010-Fix-invalid-sigprocmask-call.patch)9
-rw-r--r--meta/recipes-devtools/gdb/gdb/0008-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch48
-rw-r--r--meta/recipes-devtools/gdb/gdb/0011-gdbserver-ctrl-c-handling.patch40
-rw-r--r--meta/recipes-devtools/gdb/gdb/0012-arc-Add-support-for-signal-handlers.patch218
-rw-r--r--meta/recipes-devtools/gdb/gdb/0013-arc-Add-support-for-signal-frames-for-Linux-targets.patch232
-rw-r--r--meta/recipes-devtools/gdb/gdb/0014-arc-Take-into-account-the-REGNUM-in-supply-collect-g.patch104
-rw-r--r--meta/recipes-devtools/gdb/gdb/0015-gdb-Add-native-support-for-ARC-in-GNU-Linux.patch414
-rw-r--r--meta/recipes-devtools/gdb/gdb_14.2.bb (renamed from meta/recipes-devtools/gdb/gdb_10.2.bb)13
23 files changed, 118 insertions, 2044 deletions
diff --git a/meta/recipes-devtools/gdb/gdb-10.2.inc b/meta/recipes-devtools/gdb/gdb-10.2.inc
deleted file mode 100644
index 0d275075e6..0000000000
--- a/meta/recipes-devtools/gdb/gdb-10.2.inc
+++ /dev/null
@@ -1,23 +0,0 @@
-LICENSE = "GPLv2 & GPLv3 & LGPLv2 & LGPLv3"
-LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
- file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
- file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
- file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674"
-
-SRC_URI = "${GNU_MIRROR}/gdb/gdb-${PV}.tar.xz \
- file://0001-make-man-install-relative-to-DESTDIR.patch \
- file://0002-mips-linux-nat-Define-_ABIO32-if-not-defined.patch \
- file://0003-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch \
- file://0004-Add-support-for-Renesas-SH-sh4-architecture.patch \
- file://0005-Dont-disable-libreadline.a-when-using-disable-static.patch \
- file://0006-use-asm-sgidefs.h.patch \
- file://0008-Change-order-of-CFLAGS.patch \
- file://0009-resolve-restrict-keyword-conflict.patch \
- file://0010-Fix-invalid-sigprocmask-call.patch \
- file://0011-gdbserver-ctrl-c-handling.patch \
- file://0012-arc-Add-support-for-signal-handlers.patch \
- file://0013-arc-Add-support-for-signal-frames-for-Linux-targets.patch \
- file://0014-arc-Take-into-account-the-REGNUM-in-supply-collect-g.patch \
- file://0015-gdb-Add-native-support-for-ARC-in-GNU-Linux.patch \
- "
-SRC_URI[sha256sum] = "aaa1223d534c9b700a8bec952d9748ee1977513f178727e1bee520ee000b4f29"
diff --git a/meta/recipes-devtools/gdb/gdb-common.inc b/meta/recipes-devtools/gdb/gdb-common.inc
index 0fe7b4e5b0..ea1fc27a61 100644
--- a/meta/recipes-devtools/gdb/gdb-common.inc
+++ b/meta/recipes-devtools/gdb/gdb-common.inc
@@ -2,7 +2,7 @@ SUMMARY = "GNU debugger"
HOMEPAGE = "http://www.gnu.org/software/gdb/"
DESCRIPTION = "GDB, the GNU Project debugger, allows you to see what is going on inside another program while it executes -- or what another program was doing at the moment it crashed."
SECTION = "devel"
-DEPENDS = "expat zlib ncurses virtual/libiconv ${LTTNGUST} bison-native"
+DEPENDS = "expat gmp mpfr zlib ncurses virtual/libiconv ${LTTNGUST} bison-native"
LTTNGUST = "lttng-ust"
LTTNGUST:arc = ""
@@ -27,16 +27,18 @@ EXTRA_OECONF = "--disable-gdbtk --disable-x --disable-werror \
--disable-gas --disable-binutils \
--disable-ld --disable-gold \
--disable-gprof \
+ --with-libgmp-prefix=${STAGING_EXECPREFIXDIR} \
"
-PACKAGECONFIG ??= "readline ${@bb.utils.filter('DISTRO_FEATURES', 'debuginfod', d)}"
+PACKAGECONFIG ??= "readline ${@bb.utils.filter('DISTRO_FEATURES', 'debuginfod', d)} python \
+ ${@bb.utils.contains('DISTRO_FEATURES', 'minidebuginfo', 'xz', '', d)} \
+ "
# Use --without-system-readline to compile with readline 5.
PACKAGECONFIG[readline] = "--with-system-readline,--without-system-readline,readline"
-PACKAGECONFIG[python] = "--with-python=${WORKDIR}/python,--without-python,python3,python3 python3-codecs"
+PACKAGECONFIG[python] = "--with-python=${WORKDIR}/python,--without-python,python3,python3-codecs"
PACKAGECONFIG[babeltrace] = "--with-babeltrace,--without-babeltrace,babeltrace"
-# ncurses is already a hard DEPENDS, but would be added here if it weren't
-PACKAGECONFIG[tui] = "--enable-tui,--disable-tui"
-PACKAGECONFIG[xz] = "--with-lzma,--without-lzma,xz"
+PACKAGECONFIG[tui] = "--enable-tui,--disable-tui,,ncurses-terminfo-base"
+PACKAGECONFIG[xz] = "--with-lzma --with-liblzma-prefix=${STAGING_DIR_HOST},--without-lzma,xz"
PACKAGECONFIG[debuginfod] = "--with-debuginfod, --without-debuginfod, elfutils"
GDBPROPREFIX = "--program-prefix=''"
@@ -57,6 +59,7 @@ do_install:append() {
rm -rf ${D}${includedir}
rm -rf ${D}${datadir}/locale
rm -f ${D}${infodir}/bfd.info
+ rm -f ${D}${infodir}/sframe-spec.info
}
RRECOMMENDS:gdb:append:linux = " glibc-thread-db "
diff --git a/meta/recipes-devtools/gdb/gdb-cross-canadian.inc b/meta/recipes-devtools/gdb/gdb-cross-canadian.inc
index dfacba29a0..058ffbc9c5 100644
--- a/meta/recipes-devtools/gdb/gdb-cross-canadian.inc
+++ b/meta/recipes-devtools/gdb/gdb-cross-canadian.inc
@@ -6,8 +6,8 @@ SUMMARY = "GNU debugger (cross-canadian gdb for ${TARGET_ARCH} target)"
PN = "gdb-cross-canadian-${TRANSLATED_TARGET_ARCH}"
BPN = "gdb"
-DEPENDS = "nativesdk-ncurses nativesdk-expat nativesdk-gettext \
- virtual/${HOST_PREFIX}gcc-crosssdk virtual/${HOST_PREFIX}binutils-crosssdk virtual/nativesdk-libc"
+DEPENDS = "nativesdk-ncurses nativesdk-expat nativesdk-gettext nativesdk-gmp nativesdk-mpfr \
+ virtual/${HOST_PREFIX}gcc virtual/${HOST_PREFIX}binutils virtual/nativesdk-libc"
GDBPROPREFIX = "--program-prefix='${TARGET_PREFIX}'"
@@ -20,7 +20,7 @@ PACKAGECONFIG[python] = "--with-python=${WORKDIR}/python,--without-python,native
PACKAGECONFIG[readline] = "--with-system-readline,--without-system-readline,nativesdk-readline"
PACKAGECONFIG[debuginfod] = "--with-debuginfod, --without-debuginfod, nativesdk-elfutils"
-SSTATE_DUPWHITELIST += "${STAGING_DATADIR}/gdb"
+SSTATE_ALLOW_OVERLAP_FILES += "${STAGING_DATADIR}/gdb"
do_configure:prepend() {
cat > ${WORKDIR}/python << EOF
diff --git a/meta/recipes-devtools/gdb/gdb-cross-canadian_10.2.bb b/meta/recipes-devtools/gdb/gdb-cross-canadian_14.2.bb
index 301035940c..4ab2b7156d 100644
--- a/meta/recipes-devtools/gdb/gdb-cross-canadian_10.2.bb
+++ b/meta/recipes-devtools/gdb/gdb-cross-canadian_14.2.bb
@@ -1,3 +1,3 @@
require gdb-common.inc
require gdb-cross-canadian.inc
-require gdb-${PV}.inc
+require gdb.inc
diff --git a/meta/recipes-devtools/gdb/gdb-cross.inc b/meta/recipes-devtools/gdb/gdb-cross.inc
index 4e50cd5ab0..399f4bba97 100644
--- a/meta/recipes-devtools/gdb/gdb-cross.inc
+++ b/meta/recipes-devtools/gdb/gdb-cross.inc
@@ -1,6 +1,6 @@
require gdb-common.inc
-DEPENDS = "expat-native ncurses-native flex-native bison-native"
+DEPENDS = "expat-native gmp-native mpfr-native ncurses-native flex-native bison-native"
inherit python3native pkgconfig
diff --git a/meta/recipes-devtools/gdb/gdb-cross_10.2.bb b/meta/recipes-devtools/gdb/gdb-cross_14.2.bb
index 50cf159fdb..3b654a2f0d 100644
--- a/meta/recipes-devtools/gdb/gdb-cross_10.2.bb
+++ b/meta/recipes-devtools/gdb/gdb-cross_14.2.bb
@@ -1,2 +1,2 @@
require gdb-cross.inc
-require gdb-${PV}.inc
+require gdb.inc
diff --git a/meta/recipes-devtools/gdb/gdb.inc b/meta/recipes-devtools/gdb/gdb.inc
index 2c95ed3ca0..81ac441462 100644
--- a/meta/recipes-devtools/gdb/gdb.inc
+++ b/meta/recipes-devtools/gdb/gdb.inc
@@ -1,11 +1,17 @@
-require gdb-common.inc
-
-inherit gettext pkgconfig
-
-#LDFLAGS:append = " -s"
-#export CFLAGS:append=" -L${STAGING_LIBDIR}"
-
-# cross-canadian must not see this
-PACKAGES =+ "gdbserver"
-FILES:gdbserver = "${bindir}/gdbserver"
+LICENSE = "GPL-2.0-only & GPL-3.0-only & LGPL-2.0-only & LGPL-3.0-only"
+LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
+ file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
+ file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
+ file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674"
+SRC_URI = "${GNU_MIRROR}/gdb/gdb-${PV}.tar.xz \
+ file://0001-mips-linux-nat-Define-_ABIO32-if-not-defined.patch \
+ file://0002-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch \
+ file://0003-Dont-disable-libreadline.a-when-using-disable-static.patch \
+ file://0004-use-asm-sgidefs.h.patch \
+ file://0005-Change-order-of-CFLAGS.patch \
+ file://0006-resolve-restrict-keyword-conflict.patch \
+ file://0007-Fix-invalid-sigprocmask-call.patch \
+ file://0008-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch \
+ "
+SRC_URI[sha256sum] = "2d4dd8061d8ded12b6c63f55e45344881e8226105f4d2a9b234040efa5ce7772"
diff --git a/meta/recipes-devtools/gdb/gdb/0001-make-man-install-relative-to-DESTDIR.patch b/meta/recipes-devtools/gdb/gdb/0001-make-man-install-relative-to-DESTDIR.patch
deleted file mode 100644
index 84d178332d..0000000000
--- a/meta/recipes-devtools/gdb/gdb/0001-make-man-install-relative-to-DESTDIR.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From e5126c7167e26f865990dc5f86344602603aa8c6 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Mon, 2 Mar 2015 02:27:55 +0000
-Subject: [PATCH 01/11] make man install relative to DESTDIR
-
-Upstream-Status: Pending
-
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- sim/common/Makefile.in | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/sim/common/Makefile.in b/sim/common/Makefile.in
-index f713fcaa35b..7c553709d3f 100644
---- a/sim/common/Makefile.in
-+++ b/sim/common/Makefile.in
-@@ -35,7 +35,7 @@ tooldir = $(libdir)/$(target_alias)
- datarootdir = @datarootdir@
- datadir = @datadir@
- mandir = @mandir@
--man1dir = $(mandir)/man1
-+man1dir = $(DESTDIR)$(mandir)/man1
- infodir = @infodir@
- includedir = @includedir@
-
---
-2.29.2
-
diff --git a/meta/recipes-devtools/gdb/gdb/0002-mips-linux-nat-Define-_ABIO32-if-not-defined.patch b/meta/recipes-devtools/gdb/gdb/0001-mips-linux-nat-Define-_ABIO32-if-not-defined.patch
index f830993d5e..86f6e2642d 100644
--- a/meta/recipes-devtools/gdb/gdb/0002-mips-linux-nat-Define-_ABIO32-if-not-defined.patch
+++ b/meta/recipes-devtools/gdb/gdb/0001-mips-linux-nat-Define-_ABIO32-if-not-defined.patch
@@ -1,7 +1,7 @@
-From 0680242c9a3a0149a23e63034ecb4404de2293dd Mon Sep 17 00:00:00 2001
+From ff77aebf533758f0b6f7d22b272d32e08ed06e45 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 23 Mar 2016 06:30:09 +0000
-Subject: [PATCH 02/11] mips-linux-nat: Define _ABIO32 if not defined
+Subject: [PATCH] mips-linux-nat: Define _ABIO32 if not defined
This helps building gdb on mips64 on musl, since
musl does not provide sgidefs.h this define is
@@ -16,7 +16,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
1 file changed, 4 insertions(+)
diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
-index 38ff461a35b..4337795bac8 100644
+index 8a7cc95f2a4..bfd1c72cba6 100644
--- a/gdb/mips-linux-nat.c
+++ b/gdb/mips-linux-nat.c
@@ -41,6 +41,10 @@
@@ -30,6 +30,3 @@ index 38ff461a35b..4337795bac8 100644
class mips_linux_nat_target final : public linux_nat_trad_target
{
---
-2.29.2
-
diff --git a/meta/recipes-devtools/gdb/gdb/0003-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch b/meta/recipes-devtools/gdb/gdb/0002-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch
index cbe1779db7..897cfd0df9 100644
--- a/meta/recipes-devtools/gdb/gdb/0003-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch
+++ b/meta/recipes-devtools/gdb/gdb/0002-ppc-ptrace-Define-pt_regs-uapi_pt_regs-on-GLIBC-syst.patch
@@ -1,8 +1,7 @@
-From afbb66c244b1ae0aaaa90d88d3cd484f741c614f Mon Sep 17 00:00:00 2001
+From 78748dc55b1ceafe9a64beb9628f1d51b215482f Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 30 Apr 2016 18:32:14 -0700
-Subject: [PATCH 03/11] ppc/ptrace: Define pt_regs uapi_pt_regs on !GLIBC
- systems
+Subject: [PATCH] ppc/ptrace: Define pt_regs uapi_pt_regs on !GLIBC systems
Upstream-Status: Pending
@@ -13,7 +12,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
2 files changed, 12 insertions(+)
diff --git a/gdb/nat/ppc-linux.h b/gdb/nat/ppc-linux.h
-index d937a65b69c..1fd54b4a0e0 100644
+index c84f9146bbd..8c8580c95e1 100644
--- a/gdb/nat/ppc-linux.h
+++ b/gdb/nat/ppc-linux.h
@@ -18,7 +18,13 @@
@@ -31,7 +30,7 @@ index d937a65b69c..1fd54b4a0e0 100644
/* This sometimes isn't defined. */
diff --git a/gdbserver/linux-ppc-low.cc b/gdbserver/linux-ppc-low.cc
-index 337d555aee7..5d518f37268 100644
+index 86fbc8f5d96..8a1a39bc750 100644
--- a/gdbserver/linux-ppc-low.cc
+++ b/gdbserver/linux-ppc-low.cc
@@ -23,7 +23,13 @@
@@ -48,6 +47,3 @@ index 337d555aee7..5d518f37268 100644
#include "arch/ppc-linux-common.h"
#include "arch/ppc-linux-tdesc.h"
---
-2.29.2
-
diff --git a/meta/recipes-devtools/gdb/gdb/0005-Dont-disable-libreadline.a-when-using-disable-static.patch b/meta/recipes-devtools/gdb/gdb/0003-Dont-disable-libreadline.a-when-using-disable-static.patch
index 71eab1c2b1..e41be8209e 100644
--- a/meta/recipes-devtools/gdb/gdb/0005-Dont-disable-libreadline.a-when-using-disable-static.patch
+++ b/meta/recipes-devtools/gdb/gdb/0003-Dont-disable-libreadline.a-when-using-disable-static.patch
@@ -1,7 +1,7 @@
-From ec566877c50bdae0013a38dd457004e1db725d86 Mon Sep 17 00:00:00 2001
+From 683650564cd231bbf09c7cbc35543b77ca0b10d0 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 30 Apr 2016 15:25:03 -0700
-Subject: [PATCH 05/11] Dont disable libreadline.a when using --disable-static
+Subject: [PATCH] Dont disable libreadline.a when using --disable-static
If gdb is configured with --disable-static then this is dutifully passed to
readline which then disables libreadline.a, which causes a problem when gdb
@@ -19,10 +19,10 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/Makefile.def b/Makefile.def
-index 76d062bb671..e0a1e2b14b1 100644
+index 870150183b9..eb3788da0d2 100644
--- a/Makefile.def
+++ b/Makefile.def
-@@ -105,7 +105,8 @@ host_modules= { module= libiconv;
+@@ -119,7 +119,8 @@ host_modules= { module= libiconv;
missing= install-html;
missing= install-info; };
host_modules= { module= m4; };
@@ -33,10 +33,10 @@ index 76d062bb671..e0a1e2b14b1 100644
host_modules= { module= sim; };
host_modules= { module= texinfo; no_install= true; };
diff --git a/Makefile.in b/Makefile.in
-index 9dfd39fae13..eaf1dd0f229 100644
+index c97130a2338..a83f98e4778 100644
--- a/Makefile.in
+++ b/Makefile.in
-@@ -25548,7 +25548,7 @@ configure-readline:
+@@ -31691,7 +31691,7 @@ configure-readline:
$$s/$$module_srcdir/configure \
--srcdir=$${topdir}/$$module_srcdir \
$(HOST_CONFIGARGS) --build=${build_alias} --host=${host_alias} \
@@ -45,6 +45,3 @@ index 9dfd39fae13..eaf1dd0f229 100644
|| exit 1
@endif readline
---
-2.29.2
-
diff --git a/meta/recipes-devtools/gdb/gdb/0004-Add-support-for-Renesas-SH-sh4-architecture.patch b/meta/recipes-devtools/gdb/gdb/0004-Add-support-for-Renesas-SH-sh4-architecture.patch
deleted file mode 100644
index 561cfff943..0000000000
--- a/meta/recipes-devtools/gdb/gdb/0004-Add-support-for-Renesas-SH-sh4-architecture.patch
+++ /dev/null
@@ -1,913 +0,0 @@
-From 26e406962cf7298837b350b979afff0ac34ecb0b Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Mon, 2 Mar 2015 02:31:12 +0000
-Subject: [PATCH 04/11] Add support for Renesas SH (sh4) architecture.
-
-gdb (7.4-1~cvs20111117.2) experimental; urgency=low
- .
- * Add Renesas SH (sh4) support (Closes: #576242)
- - Thanks Nobuhiro Iwamatsu, Takashi Yoshii.
-Author: Hector Oron <zumbi@debian.org>
-Bug-Debian: http://bugs.debian.org/576242
-
-Upstream-Status: Pending
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- gdb/Makefile.in | 2 +
- gdb/configure.host | 1 +
- gdb/sh-linux-tdep.c | 519 +++++++++++++++++++++++++++
- gdb/sh-tdep.c | 52 +--
- gdb/sh-tdep.h | 49 +++
- gdb/testsuite/gdb.asm/asm-source.exp | 5 +
- gdb/testsuite/gdb.asm/sh.inc | 3 +-
- gdb/testsuite/gdb.base/annota1.c | 3 +
- gdb/testsuite/gdb.base/annota3.c | 4 +
- gdb/testsuite/gdb.base/sigall.c | 3 +
- gdb/testsuite/gdb.base/signals.c | 4 +
- 11 files changed, 617 insertions(+), 28 deletions(-)
-
-diff --git a/gdb/Makefile.in b/gdb/Makefile.in
-index 4808357e651..a009004ab05 100644
---- a/gdb/Makefile.in
-+++ b/gdb/Makefile.in
-@@ -2273,6 +2273,8 @@ ALLDEPFILES = \
- sh-nbsd-nat.c \
- sh-nbsd-tdep.c \
- sh-tdep.c \
-+ sh-linux-tdep.c \
-+ sh-linux-nat.c \
- sol2-tdep.c \
- solib-aix.c \
- solib-svr4.c \
-diff --git a/gdb/configure.host b/gdb/configure.host
-index ce528237291..5b5173a71aa 100644
---- a/gdb/configure.host
-+++ b/gdb/configure.host
-@@ -148,6 +148,7 @@ riscv*-*-linux*) gdb_host=linux ;;
-
- s390*-*-linux*) gdb_host=linux ;;
-
-+sh*-*-linux*) gdb_host=linux ;;
- sh*-*-netbsdelf* | sh*-*-knetbsd*-gnu)
- gdb_host=nbsd ;;
- sh*-*-openbsd*) gdb_host=nbsd ;;
-diff --git a/gdb/sh-linux-tdep.c b/gdb/sh-linux-tdep.c
-index 5d2f38f5801..06a45b74827 100644
---- a/gdb/sh-linux-tdep.c
-+++ b/gdb/sh-linux-tdep.c
-@@ -18,14 +18,37 @@
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
- #include "defs.h"
-+#include "gdbcore.h"
-+#include "frame.h"
-+#include "frame-base.h"
-+#include "frame-unwind.h"
-+#include "dwarf2-frame.h"
-+#include "value.h"
-+#include "regcache.h"
-+#include "inferior.h"
- #include "osabi.h"
-
-+#include "reggroups.h"
-+#include "arch-utils.h"
-+#include "floatformat.h"
- #include "solib-svr4.h"
- #include "symtab.h"
-+#include "gdb_string.h"
-+#include "command.h"
-+#include "gdb_assert.h"
-
- #include "trad-frame.h"
- #include "tramp-frame.h"
-
-+#include <sys/ptrace.h>
-+#include <sys/types.h>
-+#include <sys/param.h>
-+#include <sys/user.h>
-+#include <sys/syscall.h>
-+
-+#include <asm/ptrace.h>
-+
-+#include "regset.h"
- #include "glibc-tdep.h"
- #include "sh-tdep.h"
- #include "linux-tdep.h"
-@@ -181,9 +204,505 @@ static struct tramp_frame sh_linux_rt_sigreturn_tramp_frame = {
- sh_linux_rt_sigreturn_init
- };
-
-+/* Recognizing signal handler frames. */
-+
-+/* GNU/Linux has two flavors of signals. Normal signal handlers, and
-+ "realtime" (RT) signals. The RT signals can provide additional
-+ information to the signal handler if the SA_SIGINFO flag is set
-+ when establishing a signal handler using `sigaction'. It is not
-+ unlikely that future versions of GNU/Linux will support SA_SIGINFO
-+ for normal signals too. */
-+
-+/* When the SH Linux kernel calls a signal handler and the
-+ SA_RESTORER flag isn't set, the return address points to a bit of
-+ code on the stack. This function returns whether the PC appears to
-+ be within this bit of code.
-+
-+ The instruction sequence for normal signals is
-+ mov.w 1f,r3
-+ trapa #16
-+ or r0, r0
-+ or r0, r0
-+ or r0, r0
-+ or r0, r0
-+ or r0, r0
-+ 1: .word __NR_sigreturn
-+ or 0x9305 0xc310 0x200b 0x200b 0x200b 0x200b 0x200b 0x0077.
-+
-+ Checking for the code sequence should be somewhat reliable, because
-+ the effect is to call the system call sigreturn. This is unlikely
-+ to occur anywhere other than a signal trampoline.
-+
-+ It kind of sucks that we have to read memory from the process in
-+ order to identify a signal trampoline, but there doesn't seem to be
-+ any other way. The PC_IN_SIGTRAMP macro in tm-linux.h arranges to
-+ only call us if no function name could be identified, which should
-+ be the case since the code is on the stack.
-+
-+ Detection of signal trampolines for handlers that set the
-+ SA_RESTORER flag is in general not possible. Unfortunately this is
-+ what the GNU C Library has been doing for quite some time now.
-+ However, as of version 2.1.2, the GNU C Library uses signal
-+ trampolines (named __restore and __restore_rt) that are identical
-+ to the ones used by the kernel. Therefore, these trampolines are
-+ supported too. */
-+
-+#define MOVW(n) (0x9300|((n)-2)) /* Move mem word at PC+n to R3 */
-+#define TRAP16 0xc310 /* Syscall w/no args (NR in R3) */
-+#define OR_R0_R0 0x200b /* or r0,r0 (insert to avoid hardware bug) */
-+
-+#define LINUX_SIGTRAMP_INSN0 MOVW(7) /* Move mem word at PC+7 to R3 */
-+#define LINUX_SIGTRAMP_INSN1 TRAP16 /* Syscall w/no args (NR in R3) */
-+#define LINUX_SIGTRAMP_INSN2 OR_R0_R0 /* or r0,r0 (insert to avoid hardware bug) */
-+
-+static const unsigned short linux_sigtramp_code[] =
-+{
-+ LINUX_SIGTRAMP_INSN0,
-+ LINUX_SIGTRAMP_INSN1,
-+ LINUX_SIGTRAMP_INSN2,
-+ LINUX_SIGTRAMP_INSN2,
-+ LINUX_SIGTRAMP_INSN2,
-+ LINUX_SIGTRAMP_INSN2,
-+ LINUX_SIGTRAMP_INSN2,
-+ __NR_sigreturn
-+};
-+
-+#define LINUX_SIGTRAMP_LEN (sizeof linux_sigtramp_code)
-+
-+/* If PC is in a sigtramp routine, return the address of the start of
-+ the routine. Otherwise, return 0. */
-+
-+static CORE_ADDR
-+sh_linux_sigtramp_start (struct frame_info *next_frame)
-+{
-+ CORE_ADDR pc = get_frame_pc (next_frame);
-+ gdb_byte buf[LINUX_SIGTRAMP_LEN];
-+
-+ /* We only recognize a signal trampoline if PC is at the start of
-+ one of the three instructions. We optimize for finding the PC at
-+ the start, as will be the case when the trampoline is not the
-+ first frame on the stack. We assume that in the case where the
-+ PC is not at the start of the instruction sequence, there will be
-+ a few trailing readable bytes on the stack. */
-+
-+ if (!safe_frame_unwind_memory (next_frame, pc, buf, LINUX_SIGTRAMP_LEN))
-+ return 0;
-+
-+ if (buf[0] != LINUX_SIGTRAMP_INSN0)
-+ {
-+ if (buf[0] != LINUX_SIGTRAMP_INSN1)
-+ return 0;
-+
-+ pc -= 2;
-+
-+ if (!safe_frame_unwind_memory (next_frame, pc, buf, LINUX_SIGTRAMP_LEN))
-+ return 0;
-+ }
-+
-+ if (memcmp (buf, linux_sigtramp_code, LINUX_SIGTRAMP_LEN) != 0)
-+ return 0;
-+
-+ return pc;
-+}
-+
-+/* This function does the same for RT signals. Here the instruction
-+ sequence is
-+ mov.w 1f,r3
-+ trapa #16
-+ or r0, r0
-+ or r0, r0
-+ or r0, r0
-+ or r0, r0
-+ or r0, r0
-+ 1: .word __NR_rt_sigreturn
-+ or 0x9305 0xc310 0x200b 0x200b 0x200b 0x200b 0x200b 0x00ad.
-+
-+ The effect is to call the system call rt_sigreturn. */
-+
-+#define LINUX_RT_SIGTRAMP_INSN0 MOVW(7) /* Move mem word at PC+7 to R3 */
-+#define LINUX_RT_SIGTRAMP_INSN1 TRAP16 /* Syscall w/no args (NR in R3) */
-+#define LINUX_RT_SIGTRAMP_INSN2 OR_R0_R0 /* or r0,r0 (insert to avoid hardware bug) */
-+
-+static const unsigned short linux_rt_sigtramp_code[] =
-+{
-+ LINUX_RT_SIGTRAMP_INSN0,
-+ LINUX_RT_SIGTRAMP_INSN1,
-+ LINUX_RT_SIGTRAMP_INSN2,
-+ LINUX_RT_SIGTRAMP_INSN2,
-+ LINUX_RT_SIGTRAMP_INSN2,
-+ LINUX_RT_SIGTRAMP_INSN2,
-+ LINUX_RT_SIGTRAMP_INSN2,
-+ __NR_rt_sigreturn
-+};
-+
-+#define LINUX_RT_SIGTRAMP_LEN (sizeof linux_rt_sigtramp_code)
-+
-+/* If PC is in a RT sigtramp routine, return the address of the start
-+ of the routine. Otherwise, return 0. */
-+
-+static CORE_ADDR
-+sh_linux_rt_sigtramp_start (struct frame_info *next_frame)
-+{
-+ CORE_ADDR pc = get_frame_pc (next_frame);
-+ gdb_byte buf[LINUX_RT_SIGTRAMP_LEN];
-+
-+ /* We only recognize a signal trampoline if PC is at the start of
-+ one of the two instructions. We optimize for finding the PC at
-+ the start, as will be the case when the trampoline is not the
-+ first frame on the stack. We assume that in the case where the
-+ PC is not at the start of the instruction sequence, there will be
-+ a few trailing readable bytes on the stack. */
-+
-+ if (!safe_frame_unwind_memory (next_frame, pc, buf, LINUX_RT_SIGTRAMP_LEN))
-+ return 0;
-+
-+ if (buf[0] != LINUX_RT_SIGTRAMP_INSN0)
-+ {
-+ if (buf[0] != LINUX_RT_SIGTRAMP_INSN1)
-+ return 0;
-+
-+ pc -= 2;
-+
-+ if (!safe_frame_unwind_memory (next_frame, pc, buf,
-+ LINUX_RT_SIGTRAMP_LEN))
-+ return 0;
-+ }
-+
-+ if (memcmp (buf, linux_rt_sigtramp_code, LINUX_RT_SIGTRAMP_LEN) != 0)
-+ return 0;
-+
-+ return pc;
-+}
-+
-+/* Return whether PC is in a GNU/Linux sigtramp routine. */
-+
-+static int
-+sh_linux_sigtramp_p (struct frame_info *this_frame)
-+{
-+ CORE_ADDR pc = get_frame_pc (this_frame);
-+ char *name;
-+
-+ find_pc_partial_function (pc, &name, NULL, NULL);
-+
-+ /* If we have NAME, we can optimize the search. The trampolines are
-+ named __restore and __restore_rt. However, they aren't dynamically
-+ exported from the shared C library, so the trampoline may appear to
-+ be part of the preceding function. This should always be sigaction,
-+ __sigaction, or __libc_sigaction (all aliases to the same function). */
-+ if (name == NULL || strstr (name, "sigaction") != NULL)
-+ return (sh_linux_sigtramp_start (this_frame) != 0
-+ || sh_linux_rt_sigtramp_start (this_frame) != 0);
-+
-+ return (strcmp ("__restore", name) == 0
-+ || strcmp ("__restore_rt", name) == 0);
-+}
-+
-+/* Offset to struct sigcontext in ucontext, from <asm/ucontext.h>. */
-+#define SH_LINUX_UCONTEXT_SIGCONTEXT_OFFSET 12
-+
-+
-+/* Assuming NEXT_FRAME is a frame following a GNU/Linux sigtramp
-+ routine, return the address of the associated sigcontext structure. */
-+
-+static CORE_ADDR
-+sh_linux_sigcontext_addr (struct frame_info *this_frame)
-+{
-+ CORE_ADDR pc;
-+ CORE_ADDR sp;
-+
-+ sp = get_frame_register_unsigned (this_frame, SP_REGNUM);
-+
-+ pc = sh_linux_sigtramp_start (this_frame);
-+ if (pc)
-+ {
-+ return sp;
-+ }
-+
-+ pc = sh_linux_rt_sigtramp_start (this_frame);
-+ if (pc)
-+ {
-+ CORE_ADDR ucontext_addr;
-+
-+ /* The sigcontext structure is part of the user context. A
-+ pointer to the user context is passed as the third argument
-+ to the signal handler. */
-+ ucontext_addr = get_frame_register_unsigned (this_frame, ARG0_REGNUM+2);
-+ return ucontext_addr + SH_LINUX_UCONTEXT_SIGCONTEXT_OFFSET;
-+ }
-+
-+ error ("Couldn't recognize signal trampoline.");
-+ return 0;
-+}
-+
-+/* Signal trampolines. */
-+extern struct sh_frame_cache *sh_alloc_frame_cache (void);
-+
-+static struct sh_frame_cache *
-+sh_linux_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
-+{
-+ struct sh_frame_cache *cache;
-+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_current_arch ());
-+ CORE_ADDR sigcontext_addr;
-+
-+ if (*this_cache)
-+ return *this_cache;
-+
-+ cache = sh_alloc_frame_cache ();
-+
-+ cache->base = get_frame_register_unsigned (this_frame, SP_REGNUM);
-+ sigcontext_addr = tdep->sigcontext_addr (this_frame);
-+ if (tdep->sc_reg_offset)
-+ {
-+ int i;
-+
-+ gdb_assert (tdep->sc_num_regs <= SH_NUM_REGS);
-+
-+ for (i = 0; i < tdep->sc_num_regs; i++)
-+ if (tdep->sc_reg_offset[i] != -1)
-+ cache->saved_regs[i] = sigcontext_addr + tdep->sc_reg_offset[i];
-+ }
-+
-+ *this_cache = cache;
-+ return cache;
-+}
-+
-+static void
-+sh_linux_sigtramp_frame_this_id (struct frame_info *this_frame, void **this_cache,
-+ struct frame_id *this_id)
-+{
-+ struct sh_frame_cache *cache =
-+ sh_linux_sigtramp_frame_cache (this_frame, this_cache);
-+
-+ (*this_id) = frame_id_build (cache->base + 64, cache->pc);
-+}
-+
-+extern struct value * sh_frame_prev_register ();
-+static struct value *
-+sh_linux_sigtramp_frame_prev_register (struct frame_info *this_frame,
-+ void **this_cache, int regnum)
-+{
-+ sh_linux_sigtramp_frame_cache (this_frame, this_cache);
-+
-+ return sh_frame_prev_register (this_frame, this_cache, regnum);
-+}
-+
-+static int
-+sh_linux_sigtramp_frame_sniffer (const struct frame_unwind *self,
-+ struct frame_info *this_frame,
-+ void **this_prologue_cache)
-+{
-+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
-+
-+ /* We shouldn't even bother if we don't have a sigcontext_addr
-+ handler. */
-+ if (tdep->sigcontext_addr == NULL)
-+ return 0;
-+
-+ if (tdep->sigtramp_p != NULL)
-+ {
-+ if (tdep->sigtramp_p (this_frame))
-+ return 1;
-+ }
-+
-+ return 0;
-+}
-+
-+static const struct frame_unwind sh_linux_sigtramp_frame_unwind =
-+{
-+ SIGTRAMP_FRAME,
-+ sh_linux_sigtramp_frame_this_id,
-+ sh_linux_sigtramp_frame_prev_register,
-+ NULL,
-+ sh_linux_sigtramp_frame_sniffer
-+};
-+
-+/* Supply register REGNUM from the buffer specified by GREGS and LEN
-+ in the general-purpose register set REGSET to register cache
-+ REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
-+
-+void
-+sh_supply_gregset (const struct regset *regset, struct regcache *regcache,
-+ int regnum, const void *gregs, size_t len)
-+{
-+ const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
-+ const char *regs = gregs;
-+ int i;
-+
-+ gdb_assert (len == tdep->sizeof_gregset);
-+
-+ for (i = 0; i < tdep->gregset_num_regs; i++)
-+ {
-+ if ((regnum == i || regnum == -1)
-+ && tdep->gregset_reg_offset[i] != -1)
-+ regcache_raw_supply (regcache, i, regs + tdep->gregset_reg_offset[i]);
-+ }
-+}
-+
-+/* Collect register REGNUM from the register cache REGCACHE and store
-+ it in the buffer specified by GREGS and LEN as described by the
-+ general-purpose register set REGSET. If REGNUM is -1, do this for
-+ all registers in REGSET. */
-+
-+void
-+sh_collect_gregset (const struct regset *regset,
-+ const struct regcache *regcache,
-+ int regnum, void *gregs, size_t len)
-+{
-+ const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
-+ char *regs = gregs;
-+ int i;
-+
-+ gdb_assert (len == tdep->sizeof_gregset);
-+
-+ for (i = 0; i < tdep->gregset_num_regs; i++)
-+ {
-+ if ((regnum == i || regnum == -1)
-+ && tdep->gregset_reg_offset[i] != -1)
-+ regcache_raw_collect (regcache, i, regs + tdep->gregset_reg_offset[i]);
-+ }
-+}
-+
-+/* Supply register REGNUM from the buffer specified by FPREGS and LEN
-+ in the floating-point register set REGSET to register cache
-+ REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
-+
-+static void
-+sh_supply_fpregset (const struct regset *regset, struct regcache *regcache,
-+ int regnum, const void *fpregs, size_t len)
-+{
-+ const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
-+ const char *regs = fpregs;
-+ int i;
-+
-+ gdb_assert (len == tdep->sizeof_fpregset);
-+ for (i = 0; i < 16; i++)
-+ {
-+ if (regnum == i+25 || regnum == -1)
-+ regcache_raw_supply (regcache, i+25, regs + i*4);
-+ }
-+ if (regnum == FPSCR_REGNUM || regnum == -1)
-+ regcache_raw_supply (regcache, FPSCR_REGNUM, regs + 32*4);
-+ if (regnum == FPUL_REGNUM || regnum == -1)
-+ regcache_raw_supply (regcache, FPUL_REGNUM, regs + 33*4);
-+}
-+
-+/* Collect register REGNUM from the register cache REGCACHE and store
-+ it in the buffer specified by FPREGS and LEN as described by the
-+ floating-point register set REGSET. If REGNUM is -1, do this for
-+ all registers in REGSET. */
-+
-+static void
-+sh_collect_fpregset (const struct regset *regset,
-+ const struct regcache *regcache,
-+ int regnum, void *fpregs, size_t len)
-+{
-+ const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
-+ char *regs = fpregs;
-+ int i;
-+
-+ gdb_assert (len == tdep->sizeof_fpregset);
-+ for (i = 0; i < 16; i++)
-+ {
-+ if (regnum == i+25 || regnum == -1)
-+ regcache_raw_collect (regcache, i+25, regs + i*4);
-+ }
-+ if (regnum == FPSCR_REGNUM || regnum == -1)
-+ regcache_raw_collect (regcache, FPSCR_REGNUM, regs + 32*4);
-+ if (regnum == FPUL_REGNUM || regnum == -1)
-+ regcache_raw_collect (regcache, FPUL_REGNUM, regs + 33*4);
-+}
-+
-+/* Return the appropriate register set for the core section identified
-+ by SECT_NAME and SECT_SIZE. */
-+
-+const struct regset *
-+sh_linux_regset_from_core_section (struct gdbarch *gdbarch,
-+ const char *sect_name, size_t sect_size)
-+{
-+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-+
-+ if (strcmp (sect_name, ".reg") == 0 && sect_size == tdep->sizeof_gregset)
-+ {
-+ if (tdep->gregset == NULL)
-+ tdep->gregset = regset_alloc (gdbarch, sh_supply_gregset,
-+ sh_collect_gregset);
-+ return tdep->gregset;
-+ }
-+
-+ if ((strcmp (sect_name, ".reg2") == 0 && sect_size == tdep->sizeof_fpregset))
-+ {
-+ if (tdep->fpregset == NULL)
-+ tdep->fpregset = regset_alloc (gdbarch, sh_supply_fpregset,
-+ sh_collect_fpregset);
-+ return tdep->fpregset;
-+ }
-+
-+ return NULL;
-+}
-+
-+/* The register sets used in GNU/Linux ELF core-dumps are identical to
-+ the register sets in `struct user' that are used for a.out
-+ core-dumps. These are also used by ptrace(2). The corresponding
-+ types are `elf_gregset_t' for the general-purpose registers (with
-+ `elf_greg_t' the type of a single GP register) and `elf_fpregset_t'
-+ for the floating-point registers.
-+
-+ Those types used to be available under the names `gregset_t' and
-+ `fpregset_t' too, and GDB used those names in the past. But those
-+ names are now used for the register sets used in the `mcontext_t'
-+ type, which have a different size and layout. */
-+
-+/* Mapping between the general-purpose registers in `struct user'
-+ format and GDB's register cache layout. */
-+
-+/* From <sys/reg.h>. */
-+static int sh_linux_gregset_reg_offset[] =
-+{
-+ 0, 4, 8, 12, 16, 20, 24, 28,
-+ 32, 36, 40, 44, 48, 52, 56, 60,
-+
-+ REG_PC*4, REG_PR*4, REG_GBR*4, -1,
-+ REG_MACH*4, REG_MACL*4, REG_SR*4,
-+};
-+
-+/* Mapping between the general-purpose registers in `struct
-+ sigcontext' format and GDB's register cache layout. */
-+
-+/* From <asm/sigcontext.h>. */
-+static int sh_linux_sc_reg_offset[] =
-+{
-+ 4, 8, 12, 16, 20, 24, 28, 32,
-+ 36, 40, 44, 48, 52, 56, 60, 64,
-+ 68, 72, 80, -1,
-+ 84, 88, 76
-+};
-+
- static void
- sh_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
- {
-+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-+ bfd abfd;
-+
-+ tdep->gregset_reg_offset = sh_linux_gregset_reg_offset;
-+ tdep->gregset_num_regs = ARRAY_SIZE (sh_linux_gregset_reg_offset);
-+ tdep->sizeof_gregset = 23 * 4;
-+
-+ tdep->jb_pc_offset = 32; /* From <bits/setjmp.h>. */
-+
-+ tdep->sigtramp_p = sh_linux_sigtramp_p;
-+ tdep->sigcontext_addr = sh_linux_sigcontext_addr;
-+ tdep->sc_reg_offset = sh_linux_sc_reg_offset;
-+ tdep->sc_num_regs = ARRAY_SIZE (sh_linux_sc_reg_offset);
-+
-+ frame_unwind_append_unwinder(gdbarch, &sh_linux_sigtramp_frame_unwind);
-+
-+ /* If we have a register mapping, enable the generic core file
-+ support, unless it has already been enabled. */
-+ if (tdep->gregset_reg_offset
-+ && !gdbarch_regset_from_core_section_p (gdbarch))
-+ set_gdbarch_regset_from_core_section (gdbarch,
-+ sh_linux_regset_from_core_section);
-+
- linux_init_abi (info, gdbarch);
-
- /* GNU/Linux uses SVR4-style shared libraries. */
-diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
-index 7aadf9165ca..e173e215a2d 100644
---- a/gdb/sh-tdep.c
-+++ b/gdb/sh-tdep.c
-@@ -21,6 +21,9 @@
- sac@cygnus.com. */
-
- #include "defs.h"
-+#include "arch-utils.h"
-+#include "command.h"
-+#include "dummy-frame.h"
- #include "frame.h"
- #include "frame-base.h"
- #include "frame-unwind.h"
-@@ -66,23 +69,6 @@ static const char *const sh_cc_enum[] = {
-
- static const char *sh_active_calling_convention = sh_cc_gcc;
-
--#define SH_NUM_REGS 67
--
--struct sh_frame_cache
--{
-- /* Base address. */
-- CORE_ADDR base;
-- LONGEST sp_offset;
-- CORE_ADDR pc;
--
-- /* Flag showing that a frame has been created in the prologue code. */
-- int uses_fp;
--
-- /* Saved registers. */
-- CORE_ADDR saved_regs[SH_NUM_REGS];
-- CORE_ADDR saved_sp;
--};
--
- static int
- sh_is_renesas_calling_convention (struct type *func_type)
- {
-@@ -1050,6 +1036,7 @@ sh_treat_as_flt_p (struct type *type)
- return 0;
- /* Otherwise if the type of that member is float, the whole type is
- treated as float. */
-+ type = check_typedef (type);
- if (type->field (0).type ()->code () == TYPE_CODE_FLT)
- return 1;
- /* Otherwise it's not treated as float. */
-@@ -1100,7 +1087,7 @@ sh_push_dummy_call_fpu (struct gdbarch *gdbarch,
- in four registers available. Loop thru args from first to last. */
- for (argnum = 0; argnum < nargs; argnum++)
- {
-- type = value_type (args[argnum]);
-+ type = check_typedef (value_type (args[argnum]));
- len = TYPE_LENGTH (type);
- val = sh_justify_value_in_reg (gdbarch, args[argnum], len);
-
-@@ -1835,7 +1822,7 @@ sh_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
- reg->how = DWARF2_FRAME_REG_UNDEFINED;
- }
-
--static struct sh_frame_cache *
-+struct sh_frame_cache *
- sh_alloc_frame_cache (void)
- {
- struct sh_frame_cache *cache;
-@@ -1862,7 +1849,7 @@ sh_alloc_frame_cache (void)
- return cache;
- }
-
--static struct sh_frame_cache *
-+struct sh_frame_cache *
- sh_frame_cache (struct frame_info *this_frame, void **this_cache)
- {
- struct gdbarch *gdbarch = get_frame_arch (this_frame);
-@@ -1929,9 +1916,9 @@ sh_frame_cache (struct frame_info *this_frame, void **this_cache)
- return cache;
- }
-
--static struct value *
--sh_frame_prev_register (struct frame_info *this_frame,
-- void **this_cache, int regnum)
-+struct value *
-+sh_frame_prev_register (struct frame_info *this_frame, void **this_cache,
-+ int regnum)
- {
- struct gdbarch *gdbarch = get_frame_arch (this_frame);
- struct sh_frame_cache *cache = sh_frame_cache (this_frame, this_cache);
-@@ -1945,7 +1932,7 @@ sh_frame_prev_register (struct frame_info *this_frame,
- the current frame. Frob regnum so that we pull the value from
- the correct place. */
- if (regnum == gdbarch_pc_regnum (gdbarch))
-- regnum = PR_REGNUM;
-+ regnum = PR_REGNUM; /* XXX: really? */
-
- if (regnum < SH_NUM_REGS && cache->saved_regs[regnum] != -1)
- return frame_unwind_got_memory (this_frame, regnum,
-@@ -2234,8 +2221,8 @@ sh_return_in_first_hidden_param_p (struct gdbarch *gdbarch,
- static struct gdbarch *
- sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
- {
-- struct gdbarch *gdbarch;
- struct gdbarch_tdep *tdep;
-+ struct gdbarch *gdbarch;
-
- /* If there is already a candidate, use it. */
- arches = gdbarch_list_lookup_by_info (arches, &info);
-@@ -2247,6 +2234,18 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
- tdep = XCNEW (struct gdbarch_tdep);
- gdbarch = gdbarch_alloc (&info, tdep);
-
-+ /* General-purpose registers. */
-+ tdep->gregset = NULL;
-+ tdep->gregset_reg_offset = NULL;
-+ tdep->gregset_num_regs = 23;
-+ tdep->sizeof_gregset = 0;
-+
-+ /* Floating-point registers. */
-+ tdep->fpregset = NULL;
-+ tdep->sizeof_fpregset = 34*4;
-+
-+ tdep->jb_pc_offset = -1;
-+
- set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT);
- set_gdbarch_int_bit (gdbarch, 4 * TARGET_CHAR_BIT);
- set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT);
-@@ -2398,10 +2397,11 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
- break;
- }
-
-+ dwarf2_append_unwinders (gdbarch);
-+
- /* Hook in ABI-specific overrides, if they have been registered. */
- gdbarch_init_osabi (info, gdbarch);
-
-- dwarf2_append_unwinders (gdbarch);
- frame_unwind_append_unwinder (gdbarch, &sh_stub_unwind);
- frame_unwind_append_unwinder (gdbarch, &sh_frame_unwind);
-
-diff --git a/gdb/sh-tdep.h b/gdb/sh-tdep.h
-index 76e2e76e39b..2710f63010c 100644
---- a/gdb/sh-tdep.h
-+++ b/gdb/sh-tdep.h
-@@ -21,6 +21,12 @@
-
- /* Contributed by Steve Chamberlain sac@cygnus.com. */
-
-+struct frame_info;
-+struct gdbarch;
-+struct reggroup;
-+struct regset;
-+struct regcache;
-+
- /* Registers for all SH variants. Used also by sh3-rom.c. */
- enum
- {
-@@ -29,6 +35,7 @@ enum
- ARG0_REGNUM = 4,
- ARGLAST_REGNUM = 7,
- FP_REGNUM = 14,
-+ SP_REGNUM = 15,
- PC_REGNUM = 16,
- PR_REGNUM = 17,
- GBR_REGNUM = 18,
-@@ -81,6 +88,24 @@ enum
- FV0_REGNUM = 76,
- FV_LAST_REGNUM = 79
- };
-+#define SH_NUM_REGS 67
-+
-+struct sh_frame_cache
-+{
-+ /* Base address. */
-+ CORE_ADDR base;
-+ LONGEST sp_offset;
-+ CORE_ADDR pc;
-+
-+ /* Flag showing that a frame has been created in the prologue code. */
-+ int uses_fp;
-+
-+ /* Saved registers. */
-+ CORE_ADDR saved_regs[SH_NUM_REGS];
-+ CORE_ADDR saved_sp;
-+};
-+
-+extern struct sh_frame_cache *sh_frame_cache (struct frame_info *next_frame, void **this_cache);
-
- /* This structure describes a register in a core-file. */
- struct sh_corefile_regmap
-@@ -89,8 +114,32 @@ struct sh_corefile_regmap
- unsigned int offset;
- };
-
-+/* sh architecture specific information. */
- struct gdbarch_tdep
- {
-+ /* General-purpose registers. */
-+ struct regset *gregset;
-+ int *gregset_reg_offset;
-+ int gregset_num_regs;
-+ size_t sizeof_gregset;
-+
-+ /* Floating-point registers. */
-+ struct regset *fpregset;
-+ size_t sizeof_fpregset;
-+
-+ /* Offset of saved PC in jmp_buf. */
-+ int jb_pc_offset;
-+
-+ /* Detect sigtramp. */
-+ int (*sigtramp_p) (struct frame_info *);
-+
-+ /* Get address of sigcontext for sigtramp. */
-+ CORE_ADDR (*sigcontext_addr) (struct frame_info *);
-+
-+ /* Offset of registers in `struct sigcontext'. */
-+ int *sc_reg_offset;
-+ int sc_num_regs;
-+
- /* Non-NULL when debugging from a core file. Provides the offset
- where each general-purpose register is stored inside the associated
- core file section. */
-diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp
-index 4914498f98c..6e25cbed185 100644
---- a/gdb/testsuite/gdb.asm/asm-source.exp
-+++ b/gdb/testsuite/gdb.asm/asm-source.exp
-@@ -116,6 +116,11 @@ switch -glob -- [istarget] {
- append link-flags " -m elf32ppc"
- }
- }
-+ "sh*-linux*" {
-+ set asm-arch sh-linux
-+ set asm-flags "-I${srcdir}/${subdir} -I${objdir}/${subdir}"
-+ set debug-flags "-gdwarf-2"
-+ }
- "sh*-*-*" {
- set asm-arch sh
- set debug-flags "-gdwarf-2"
-diff --git a/gdb/testsuite/gdb.asm/sh.inc b/gdb/testsuite/gdb.asm/sh.inc
-index a4a5fc545e4..89efed7795c 100644
---- a/gdb/testsuite/gdb.asm/sh.inc
-+++ b/gdb/testsuite/gdb.asm/sh.inc
-@@ -40,9 +40,8 @@
- mov.l .Lconst\@,r1
- bra .Lafterconst\@
- nop
-- nop
--.Lconst\@:
- .align 2
-+.Lconst\@:
- .long \subr
- .align 1
- .Lafterconst\@:
-diff --git a/gdb/testsuite/gdb.base/annota1.c b/gdb/testsuite/gdb.base/annota1.c
-index 424e1b83278..0de2e7b633a 100644
---- a/gdb/testsuite/gdb.base/annota1.c
-+++ b/gdb/testsuite/gdb.base/annota1.c
-@@ -1,6 +1,9 @@
- #include <stdio.h>
- #include <signal.h>
-
-+#ifdef __sh__
-+#define signal(a,b) /* Signals not supported on this target - make them go away */
-+#endif
-
- void
- handle_USR1 (int sig)
-diff --git a/gdb/testsuite/gdb.base/annota3.c b/gdb/testsuite/gdb.base/annota3.c
-index 424e1b83278..952aaf218ab 100644
---- a/gdb/testsuite/gdb.base/annota3.c
-+++ b/gdb/testsuite/gdb.base/annota3.c
-@@ -1,6 +1,10 @@
- #include <stdio.h>
- #include <signal.h>
-
-+#ifdef __sh__
-+#define signal(a,b) /* Signals not supported on this target - make them go away */
-+#endif
-+
-
- void
- handle_USR1 (int sig)
-diff --git a/gdb/testsuite/gdb.base/sigall.c b/gdb/testsuite/gdb.base/sigall.c
-index 81f3b08d6bc..1574b2d6cb8 100644
---- a/gdb/testsuite/gdb.base/sigall.c
-+++ b/gdb/testsuite/gdb.base/sigall.c
-@@ -1,6 +1,9 @@
- #include <signal.h>
- #include <unistd.h>
-
-+#ifdef __sh__
-+#define signal(a,b) /* Signals not supported on this target - make them go away */
-+#endif
-
- /* Signal handlers, we set breakpoints in them to make sure that the
- signals really get delivered. */
-diff --git a/gdb/testsuite/gdb.base/signals.c b/gdb/testsuite/gdb.base/signals.c
-index 756606880fa..1205a9bc9c5 100644
---- a/gdb/testsuite/gdb.base/signals.c
-+++ b/gdb/testsuite/gdb.base/signals.c
-@@ -3,6 +3,10 @@
- #include <signal.h>
- #include <unistd.h>
-
-+#ifdef __sh__
-+#define signal(a,b) /* Signals not supported on this target - make them go away */
-+#define alarm(a) /* Ditto for alarm() */
-+#endif
-
- static int count = 0;
-
---
-2.29.2
-
diff --git a/meta/recipes-devtools/gdb/gdb/0006-use-asm-sgidefs.h.patch b/meta/recipes-devtools/gdb/gdb/0004-use-asm-sgidefs.h.patch
index a2932be6fb..413610d71f 100644
--- a/meta/recipes-devtools/gdb/gdb/0006-use-asm-sgidefs.h.patch
+++ b/meta/recipes-devtools/gdb/gdb/0004-use-asm-sgidefs.h.patch
@@ -1,7 +1,7 @@
-From 4b02e54b87d435e1715ce871bcce720561a7afb1 Mon Sep 17 00:00:00 2001
+From 04eba78ea6bd167b7eeef3af668c8f49888dc688 Mon Sep 17 00:00:00 2001
From: Andre McCurdy <amccurdy@gmail.com>
Date: Sat, 30 Apr 2016 15:29:06 -0700
-Subject: [PATCH 06/11] use <asm/sgidefs.h>
+Subject: [PATCH] use <asm/sgidefs.h>
Build fix for MIPS with musl libc
@@ -19,7 +19,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/mips-linux-nat.c b/gdb/mips-linux-nat.c
-index 4337795bac8..7c8e54cabe0 100644
+index bfd1c72cba6..13dc9cdb703 100644
--- a/gdb/mips-linux-nat.c
+++ b/gdb/mips-linux-nat.c
@@ -31,7 +31,7 @@
@@ -31,6 +31,3 @@ index 4337795bac8..7c8e54cabe0 100644
#include "nat/gdb_ptrace.h"
#include <asm/ptrace.h>
#include "inf-ptrace.h"
---
-2.29.2
-
diff --git a/meta/recipes-devtools/gdb/gdb/0008-Change-order-of-CFLAGS.patch b/meta/recipes-devtools/gdb/gdb/0005-Change-order-of-CFLAGS.patch
index 4622752247..7631e75048 100644
--- a/meta/recipes-devtools/gdb/gdb/0008-Change-order-of-CFLAGS.patch
+++ b/meta/recipes-devtools/gdb/gdb/0005-Change-order-of-CFLAGS.patch
@@ -1,7 +1,7 @@
-From 07175ae348c9d07581e1db94762d5a2d577a75ad Mon Sep 17 00:00:00 2001
+From e7041e9346aa0c3aee0b76315559e3ab2ef8977e Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 30 Apr 2016 15:35:39 -0700
-Subject: [PATCH 08/11] Change order of CFLAGS
+Subject: [PATCH] Change order of CFLAGS
Lets us override Werror if need be
@@ -13,11 +13,11 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in
-index 2b1a77f2de7..cb5ddb12fd5 100644
+index b597515d428..9e615e2842d 100644
--- a/gdbserver/Makefile.in
+++ b/gdbserver/Makefile.in
-@@ -161,7 +161,7 @@ WIN32APILIBS = @WIN32APILIBS@
- INTERNAL_CFLAGS_BASE = ${CXXFLAGS} ${GLOBAL_CFLAGS} \
+@@ -156,7 +156,7 @@ WIN32APILIBS = @WIN32APILIBS@
+ INTERNAL_CFLAGS_BASE = ${GLOBAL_CFLAGS} \
${PROFILE_CFLAGS} ${INCLUDE_CFLAGS} ${CPPFLAGS} $(PTHREAD_CFLAGS)
INTERNAL_WARN_CFLAGS = ${INTERNAL_CFLAGS_BASE} $(WARN_CFLAGS)
-INTERNAL_CFLAGS = ${INTERNAL_WARN_CFLAGS} $(WERROR_CFLAGS) -DGDBSERVER
@@ -25,6 +25,3 @@ index 2b1a77f2de7..cb5ddb12fd5 100644
# LDFLAGS is specifically reserved for setting from the command line
# when running make.
---
-2.29.2
-
diff --git a/meta/recipes-devtools/gdb/gdb/0009-resolve-restrict-keyword-conflict.patch b/meta/recipes-devtools/gdb/gdb/0006-resolve-restrict-keyword-conflict.patch
index 698fdb0672..45388c5ac5 100644
--- a/meta/recipes-devtools/gdb/gdb/0009-resolve-restrict-keyword-conflict.patch
+++ b/meta/recipes-devtools/gdb/gdb/0006-resolve-restrict-keyword-conflict.patch
@@ -1,7 +1,7 @@
-From 73a3babe48c7948f71683d0862eddc1609fdaa3d Mon Sep 17 00:00:00 2001
+From 477f1b2049c7f940b8e8fda4ac396cfe322b269f Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 10 May 2016 08:47:05 -0700
-Subject: [PATCH 09/11] resolve restrict keyword conflict
+Subject: [PATCH] resolve restrict keyword conflict
GCC detects that we call 'restrict' as param name in function
signatures and complains since both params are called 'restrict'
@@ -15,7 +15,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/gnulib/import/sys_time.in.h b/gnulib/import/sys_time.in.h
-index d30b26719b2..fd76af5e6d9 100644
+index 87db1a88745..e6b98c7e467 100644
--- a/gnulib/import/sys_time.in.h
+++ b/gnulib/import/sys_time.in.h
@@ -93,20 +93,20 @@ struct timeval
@@ -43,6 +43,3 @@ index d30b26719b2..fd76af5e6d9 100644
# endif
_GL_CXXALIASWARN (gettimeofday);
# if defined __cplusplus && defined GNULIB_NAMESPACE
---
-2.29.2
-
diff --git a/meta/recipes-devtools/gdb/gdb/0010-Fix-invalid-sigprocmask-call.patch b/meta/recipes-devtools/gdb/gdb/0007-Fix-invalid-sigprocmask-call.patch
index 7cf3eae753..26e3ad9098 100644
--- a/meta/recipes-devtools/gdb/gdb/0010-Fix-invalid-sigprocmask-call.patch
+++ b/meta/recipes-devtools/gdb/gdb/0007-Fix-invalid-sigprocmask-call.patch
@@ -1,7 +1,7 @@
-From c5c5372c6a319cac8b3f9f86304fcebcbb5ea06f Mon Sep 17 00:00:00 2001
+From ebeb6125acf6b4e4a8a4eaa59e2830b9ca02d683 Mon Sep 17 00:00:00 2001
From: Yousong Zhou <yszhou4tech@gmail.com>
Date: Fri, 24 Mar 2017 10:36:03 +0800
-Subject: [PATCH 10/11] Fix invalid sigprocmask call
+Subject: [PATCH] Fix invalid sigprocmask call
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
@@ -32,7 +32,7 @@ Signed-off-by: Khem Raj <raj.khem@gmail.com>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdbsupport/signals-state-save-restore.cc b/gdbsupport/signals-state-save-restore.cc
-index c292d498daf..af9dcaeb08e 100644
+index 3ec7a259c9c..0702eca7725 100644
--- a/gdbsupport/signals-state-save-restore.cc
+++ b/gdbsupport/signals-state-save-restore.cc
@@ -38,7 +38,7 @@ save_original_signals_state (bool quiet)
@@ -44,6 +44,3 @@ index c292d498daf..af9dcaeb08e 100644
if (res == -1)
perror_with_name (("sigprocmask"));
---
-2.29.2
-
diff --git a/meta/recipes-devtools/gdb/gdb/0008-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch b/meta/recipes-devtools/gdb/gdb/0008-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch
new file mode 100644
index 0000000000..819f1c9f17
--- /dev/null
+++ b/meta/recipes-devtools/gdb/gdb/0008-Define-alignof-using-_Alignof-when-using-C11-or-newe.patch
@@ -0,0 +1,48 @@
+From cb7c8df338184d2d2f31ee1fd238653e3162da44 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 15 Jan 2023 00:16:25 -0800
+Subject: [PATCH] Define alignof using _Alignof when using C11 or newer
+
+WG14 N2350 made very clear that it is an UB having type definitions
+within "offsetof" [1]. This patch enhances the implementation of macro
+alignof to use builtin "_Alignof" to avoid undefined behavior on
+when using std=c11 or newer
+
+clang 16+ has started to flag this [2]
+
+Fixes build when using -std >= gnu11 and using clang16+
+
+Older compilers gcc < 4.9 or clang < 8 has buggy _Alignof even though it
+may support C11, exclude those compilers too
+
+[1] https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2350.htm
+[2] https://reviews.llvm.org/D133574
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ libiberty/sha1.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/libiberty/sha1.c b/libiberty/sha1.c
+index 6c71e3ebb41..a2caf947d31 100644
+--- a/libiberty/sha1.c
++++ b/libiberty/sha1.c
+@@ -229,7 +229,17 @@ sha1_process_bytes (const void *buffer, size_t len, struct sha1_ctx *ctx)
+ if (len >= 64)
+ {
+ #if !_STRING_ARCH_unaligned
++/* GCC releases before GCC 4.9 had a bug in _Alignof. See GCC bug 52023
++ <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52023>.
++ clang versions < 8.0.0 have the same bug. */
++#if (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112 \
++ || (defined __GNUC__ && __GNUC__ < 4 + (__GNUC_MINOR__ < 9) \
++ && !defined __clang__) \
++ || (defined __clang__ && __clang_major__ < 8))
+ # define alignof(type) offsetof (struct { char c; type x; }, x)
++#else
++# define alignof(type) _Alignof(type)
++#endif
+ # define UNALIGNED_P(p) (((size_t) p) % alignof (sha1_uint32) != 0)
+ if (UNALIGNED_P (buffer))
+ while (len > 64)
diff --git a/meta/recipes-devtools/gdb/gdb/0011-gdbserver-ctrl-c-handling.patch b/meta/recipes-devtools/gdb/gdb/0011-gdbserver-ctrl-c-handling.patch
deleted file mode 100644
index 0a596b522f..0000000000
--- a/meta/recipes-devtools/gdb/gdb/0011-gdbserver-ctrl-c-handling.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From 63df98fa78c8a6e12b40ebdc5c155838d2bf8b5f Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Thu, 29 Nov 2018 18:00:23 -0800
-Subject: [PATCH 11/11] gdbserver ctrl-c handling
-
-This problem was created by the upstream commit 78708b7c8c
-After applying the commit, it will send SIGINT to the process
-group(-signal_pid).
-But if we use gdbserver send SIGINT, and the attached process is not a
-process
-group leader, then the "kill (-signal_pid, SIGINT)" returns error and
-fails to
-interrupt the attached process.
-
-Upstream-Status: Submitted
-[https://sourceware.org/bugzilla/show_bug.cgi?id=18945]
-
-Author: Josh Gao
-Signed-off-by: Zhixiong Chi <zhixiong.chi@windriver.com>
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- gdbserver/linux-low.cc | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/gdbserver/linux-low.cc b/gdbserver/linux-low.cc
-index e45493339d2..aabc099b456 100644
---- a/gdbserver/linux-low.cc
-+++ b/gdbserver/linux-low.cc
-@@ -5714,7 +5714,7 @@ linux_process_target::request_interrupt ()
- {
- /* Send a SIGINT to the process group. This acts just like the user
- typed a ^C on the controlling terminal. */
-- ::kill (-signal_pid, SIGINT);
-+ ::kill (signal_pid, SIGINT);
- }
-
- bool
---
-2.29.2
-
diff --git a/meta/recipes-devtools/gdb/gdb/0012-arc-Add-support-for-signal-handlers.patch b/meta/recipes-devtools/gdb/gdb/0012-arc-Add-support-for-signal-handlers.patch
deleted file mode 100644
index 6a98b65766..0000000000
--- a/meta/recipes-devtools/gdb/gdb/0012-arc-Add-support-for-signal-handlers.patch
+++ /dev/null
@@ -1,218 +0,0 @@
-From bfee93403b46ae4f050282b7721ba39073905c69 Mon Sep 17 00:00:00 2001
-From: Anton Kolesov <Anton.Kolesov@synopsys.com>
-Date: Mon, 22 Aug 2016 19:39:46 +0300
-Subject: [PATCH 1/4] arc: Add support for signal handlers
-
-This patch adds the necessary infrastructure to handle signal frames for
-ARC architecture. It is fairly similar to what any other architecture
-would have. Linux specific parts will be in a separate patch.
-
-v2 [1]:
-- Make the logic of "arc_sigtramp_frame_sniffer ()" simpler.
-
-[1] Tom's remark for the first version
-https://sourceware.org/pipermail/gdb-patches/2020-November/173221.html
-
-gdb/ChangeLog:
-
- * arc-tdep.c (arc_make_sigtramp_frame_cache): New function.
- (arc_sigtramp_frame_this_id): Likewise.
- (arc_sigtramp_frame_prev_register): Likewise.
- (arc_sigtramp_frame_sniffer): Likewise.
- (arc_siftramp_frame_unwind): New global variable.
- (arc_gdbarch_init): Use sigtramp capabilities.
- (arc_dump_tdep): Print sigtramp fields.
- * arc-tdep.h (gdbarch_tdep): Add sigtramp fields.
-
-Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=b4e3cd0440109d0a5552d3313ccbd35c8103335b]
-
-Signed-off-by: Anton Kolesov <Anton.Kolesov@synopsys.com>
-Signed-off-by: Shahab Vahedi <shahab@synopsys.com>
-Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
----
- gdb/arc-tdep.c | 123 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- gdb/arc-tdep.h | 13 ++++++
- 2 files changed, 136 insertions(+)
-
-diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
-index 93e2fd88a9a..3356252525d 100644
---- a/gdb/arc-tdep.c
-+++ b/gdb/arc-tdep.c
-@@ -1843,6 +1843,104 @@ arc_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
- reg->how = DWARF2_FRAME_REG_CFA;
- }
-
-+/* Signal trampoline frame unwinder. Allows frame unwinding to happen
-+ from within signal handlers. */
-+
-+static struct arc_frame_cache *
-+arc_make_sigtramp_frame_cache (struct frame_info *this_frame)
-+{
-+ if (arc_debug)
-+ debug_printf ("arc: sigtramp_frame_cache\n");
-+
-+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
-+
-+ /* Allocate new frame cache instance and space for saved register info. */
-+ struct arc_frame_cache *cache = FRAME_OBSTACK_ZALLOC (struct arc_frame_cache);
-+ cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
-+
-+ /* Get the stack pointer and use it as the frame base. */
-+ cache->prev_sp = arc_frame_base_address (this_frame, NULL);
-+
-+ /* If the ARC-private target-dependent info doesn't have a table of
-+ offsets of saved register contents within an OS signal context
-+ structure, then there is nothing to analyze. */
-+ if (tdep->sc_reg_offset == NULL)
-+ return cache;
-+
-+ /* Find the address of the sigcontext structure. */
-+ CORE_ADDR addr = tdep->sigcontext_addr (this_frame);
-+
-+ /* For each register, if its contents have been saved within the
-+ sigcontext structure, determine the address of those contents. */
-+ gdb_assert (tdep->sc_num_regs <= (ARC_LAST_REGNUM + 1));
-+ for (int i = 0; i < tdep->sc_num_regs; i++)
-+ {
-+ if (tdep->sc_reg_offset[i] != ARC_OFFSET_NO_REGISTER)
-+ cache->saved_regs[i].addr = addr + tdep->sc_reg_offset[i];
-+ }
-+
-+ return cache;
-+}
-+
-+/* Implement the "this_id" frame_unwind method for signal trampoline
-+ frames. */
-+
-+static void
-+arc_sigtramp_frame_this_id (struct frame_info *this_frame,
-+ void **this_cache, struct frame_id *this_id)
-+{
-+ if (arc_debug)
-+ debug_printf ("arc: sigtramp_frame_this_id\n");
-+
-+ if (*this_cache == NULL)
-+ *this_cache = arc_make_sigtramp_frame_cache (this_frame);
-+
-+ struct gdbarch *gdbarch = get_frame_arch (this_frame);
-+ struct arc_frame_cache *cache = (struct arc_frame_cache *) *this_cache;
-+ CORE_ADDR stack_addr = cache->prev_sp;
-+ CORE_ADDR code_addr
-+ = get_frame_register_unsigned (this_frame, gdbarch_pc_regnum (gdbarch));
-+ *this_id = frame_id_build (stack_addr, code_addr);
-+}
-+
-+/* Get a register from a signal handler frame. */
-+
-+static struct value *
-+arc_sigtramp_frame_prev_register (struct frame_info *this_frame,
-+ void **this_cache, int regnum)
-+{
-+ if (arc_debug)
-+ debug_printf ("arc: sigtramp_frame_prev_register (regnum = %d)\n", regnum);
-+
-+ /* Make sure we've initialized the cache. */
-+ if (*this_cache == NULL)
-+ *this_cache = arc_make_sigtramp_frame_cache (this_frame);
-+
-+ struct arc_frame_cache *cache = (struct arc_frame_cache *) *this_cache;
-+ return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum);
-+}
-+
-+/* Frame sniffer for signal handler frame. Only recognize a frame if we
-+ have a sigcontext_addr handler in the target dependency. */
-+
-+static int
-+arc_sigtramp_frame_sniffer (const struct frame_unwind *self,
-+ struct frame_info *this_frame,
-+ void **this_cache)
-+{
-+ struct gdbarch_tdep *tdep;
-+
-+ if (arc_debug)
-+ debug_printf ("arc: sigtramp_frame_sniffer\n");
-+
-+ tdep = gdbarch_tdep (get_frame_arch (this_frame));
-+
-+ /* If we have a sigcontext_addr handler, then just return 1 (same as the
-+ "default_frame_sniffer ()"). */
-+ return (tdep->sigcontext_addr != NULL && tdep->is_sigtramp != NULL
-+ && tdep->is_sigtramp (this_frame));
-+}
-+
- /* Structure defining the ARC ordinary frame unwind functions. Since we are
- the fallback unwinder, we use the default frame sniffer, which always
- accepts the frame. */
-@@ -1858,6 +1956,21 @@ static const struct frame_unwind arc_frame_unwind = {
- NULL
- };
-
-+/* Structure defining the ARC signal frame unwind functions. Custom
-+ sniffer is used, because this frame must be accepted only in the right
-+ context. */
-+
-+static const struct frame_unwind arc_sigtramp_frame_unwind = {
-+ SIGTRAMP_FRAME,
-+ default_frame_unwind_stop_reason,
-+ arc_sigtramp_frame_this_id,
-+ arc_sigtramp_frame_prev_register,
-+ NULL,
-+ arc_sigtramp_frame_sniffer,
-+ NULL,
-+ NULL
-+};
-+
-
- static const struct frame_base arc_normal_base = {
- &arc_frame_unwind,
-@@ -2272,6 +2385,7 @@ arc_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
- /* Frame unwinders and sniffers. */
- dwarf2_frame_set_init_reg (gdbarch, arc_dwarf2_frame_init_reg);
- dwarf2_append_unwinders (gdbarch);
-+ frame_unwind_append_unwinder (gdbarch, &arc_sigtramp_frame_unwind);
- frame_unwind_append_unwinder (gdbarch, &arc_frame_unwind);
- frame_base_set_default (gdbarch, &arc_normal_base);
-
-@@ -2350,6 +2464,15 @@ arc_dump_tdep (struct gdbarch *gdbarch, struct ui_file *file)
- struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
- fprintf_unfiltered (file, "arc_dump_tdep: jb_pc = %i\n", tdep->jb_pc);
-+
-+ fprintf_unfiltered (file, "arc_dump_tdep: is_sigtramp = <%s>\n",
-+ host_address_to_string (tdep->is_sigtramp));
-+ fprintf_unfiltered (file, "arc_dump_tdep: sigcontext_addr = <%s>\n",
-+ host_address_to_string (tdep->sigcontext_addr));
-+ fprintf_unfiltered (file, "arc_dump_tdep: sc_reg_offset = <%s>\n",
-+ host_address_to_string (tdep->sc_reg_offset));
-+ fprintf_unfiltered (file, "arc_dump_tdep: sc_num_regs = %d\n",
-+ tdep->sc_num_regs);
- }
-
- /* This command accepts single argument - address of instruction to
-diff --git a/gdb/arc-tdep.h b/gdb/arc-tdep.h
-index 50b14905134..70fc3d95c48 100644
---- a/gdb/arc-tdep.h
-+++ b/gdb/arc-tdep.h
-@@ -124,6 +124,19 @@ struct gdbarch_tdep
-
- /* Whether target has hardware (aka zero-delay) loops. */
- bool has_hw_loops;
-+
-+ /* Detect sigtramp. */
-+ bool (*is_sigtramp) (struct frame_info *);
-+
-+ /* Get address of sigcontext for sigtramp. */
-+ CORE_ADDR (*sigcontext_addr) (struct frame_info *);
-+
-+ /* Offset of registers in `struct sigcontext'. */
-+ const int *sc_reg_offset;
-+
-+ /* Number of registers in sc_reg_offsets. Most likely a ARC_LAST_REGNUM,
-+ but in theory it could be less, so it is kept separate. */
-+ int sc_num_regs;
- };
-
- /* Utility functions used by other ARC-specific modules. */
---
-2.16.2
-
diff --git a/meta/recipes-devtools/gdb/gdb/0013-arc-Add-support-for-signal-frames-for-Linux-targets.patch b/meta/recipes-devtools/gdb/gdb/0013-arc-Add-support-for-signal-frames-for-Linux-targets.patch
deleted file mode 100644
index f699a5888d..0000000000
--- a/meta/recipes-devtools/gdb/gdb/0013-arc-Add-support-for-signal-frames-for-Linux-targets.patch
+++ /dev/null
@@ -1,232 +0,0 @@
-From 16ddc17b4f403a38701e0108b02aff967900cc66 Mon Sep 17 00:00:00 2001
-From: Anton Kolesov <Anton.Kolesov@synopsys.com>
-Date: Thu, 22 Dec 2016 21:52:16 +0300
-Subject: [PATCH 2/4] arc: Add support for signal frames for Linux targets
-
-Implement functions needed to unwind signal frames on ARC Linux targets.
-
-gdb/ChangeLog
-
- * arc-linux-tdep.c (arc_linux_sc_reg_offsets): New static variable.
- (arc_linux_is_sigtramp): New function.
- (arc_linux_sigcontext_addr): Likewise.
- (arc_linux_init_osabi): Use them.
-
-Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=d4af727286e3a9f177ba11677fbd3a012d36558a]
-
-Signed-off-by: Anton Kolesov <Anton.Kolesov@synopsys.com>
-Signed-off-by: Shahab Vahedi <shahab@synopsys.com>
-Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
----
- gdb/arc-linux-tdep.c | 181 +++++++++++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 181 insertions(+)
-
-diff --git a/gdb/arc-linux-tdep.c b/gdb/arc-linux-tdep.c
-index a7bace12623..17bb3e7b276 100644
---- a/gdb/arc-linux-tdep.c
-+++ b/gdb/arc-linux-tdep.c
-@@ -33,6 +33,60 @@
-
- #define REGOFF(offset) (offset * ARC_REGISTER_SIZE)
-
-+/* arc_linux_sc_reg_offsets[i] is the offset of register i in the `struct
-+ sigcontext'. Array index is an internal GDB register number, as defined in
-+ arc-tdep.h:arc_regnum.
-+
-+ From <include/uapi/asm/sigcontext.h> and <include/uapi/asm/ptrace.h>.
-+
-+ The layout of this struct is tightly bound to "arc_regnum" enum
-+ in arc-tdep.h. Any change of order in there, must be reflected
-+ here as well. */
-+static const int arc_linux_sc_reg_offsets[] = {
-+ /* R0 - R12. */
-+ REGOFF (22), REGOFF (21), REGOFF (20), REGOFF (19),
-+ REGOFF (18), REGOFF (17), REGOFF (16), REGOFF (15),
-+ REGOFF (14), REGOFF (13), REGOFF (12), REGOFF (11),
-+ REGOFF (10),
-+
-+ /* R13 - R25. */
-+ ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER,
-+ ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER,
-+ ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER,
-+ ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER,
-+ ARC_OFFSET_NO_REGISTER,
-+
-+ REGOFF (9), /* R26 (GP) */
-+ REGOFF (8), /* FP */
-+ REGOFF (23), /* SP */
-+ ARC_OFFSET_NO_REGISTER, /* ILINK */
-+ ARC_OFFSET_NO_REGISTER, /* R30 */
-+ REGOFF (7), /* BLINK */
-+
-+ /* R32 - R59. */
-+ ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER,
-+ ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER,
-+ ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER,
-+ ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER,
-+ ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER,
-+ ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER,
-+ ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER,
-+ ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER,
-+ ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER, ARC_OFFSET_NO_REGISTER,
-+ ARC_OFFSET_NO_REGISTER,
-+
-+ REGOFF (4), /* LP_COUNT */
-+ ARC_OFFSET_NO_REGISTER, /* RESERVED */
-+ ARC_OFFSET_NO_REGISTER, /* LIMM */
-+ ARC_OFFSET_NO_REGISTER, /* PCL */
-+
-+ REGOFF (6), /* PC */
-+ REGOFF (5), /* STATUS32 */
-+ REGOFF (2), /* LP_START */
-+ REGOFF (3), /* LP_END */
-+ REGOFF (1), /* BTA */
-+};
-+
- /* arc_linux_core_reg_offsets[i] is the offset in the .reg section of GDB
- regnum i. Array index is an internal GDB register number, as defined in
- arc-tdep.h:arc_regnum.
-@@ -87,6 +141,127 @@ static const int arc_linux_core_reg_offsets[] = {
- REGOFF (6) /* ERET */
- };
-
-+/* Is THIS_FRAME a sigtramp function - the function that returns from
-+ signal handler into normal execution flow? This is the case if the PC is
-+ either at the start of, or in the middle of the two instructions:
-+
-+ mov r8, __NR_rt_sigreturn ; __NR_rt_sigreturn == 139
-+ trap_s 0 ; `swi' for ARC700
-+
-+ On ARC uClibc Linux this function is called __default_rt_sa_restorer.
-+
-+ Returns TRUE if this is a sigtramp frame. */
-+
-+static bool
-+arc_linux_is_sigtramp (struct frame_info *this_frame)
-+{
-+ struct gdbarch *gdbarch = get_frame_arch (this_frame);
-+ CORE_ADDR pc = get_frame_pc (this_frame);
-+
-+ if (arc_debug)
-+ {
-+ debug_printf ("arc-linux: arc_linux_is_sigtramp, pc=%s\n",
-+ paddress(gdbarch, pc));
-+ }
-+
-+ static const gdb_byte insns_be_hs[] = {
-+ 0x20, 0x8a, 0x12, 0xc2, /* mov r8,nr_rt_sigreturn */
-+ 0x78, 0x1e /* trap_s 0 */
-+ };
-+ static const gdb_byte insns_be_700[] = {
-+ 0x20, 0x8a, 0x12, 0xc2, /* mov r8,nr_rt_sigreturn */
-+ 0x22, 0x6f, 0x00, 0x3f /* swi */
-+ };
-+
-+ gdb_byte arc_sigtramp_insns[sizeof (insns_be_700)];
-+ size_t insns_sz;
-+ if (arc_mach_is_arcv2 (gdbarch))
-+ {
-+ insns_sz = sizeof (insns_be_hs);
-+ memcpy (arc_sigtramp_insns, insns_be_hs, insns_sz);
-+ }
-+ else
-+ {
-+ insns_sz = sizeof (insns_be_700);
-+ memcpy (arc_sigtramp_insns, insns_be_700, insns_sz);
-+ }
-+ if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
-+ {
-+ /* On little endian targets, ARC code section is in what is called
-+ "middle endian", where half-words are in the big-endian order,
-+ only bytes inside the halfwords are in the little endian order.
-+ As a result it is very easy to convert big endian instruction to
-+ little endian, since it is needed to swap bytes in the halfwords,
-+ so there is no need to have information on whether that is a
-+ 4-byte instruction or 2-byte. */
-+ gdb_assert ((insns_sz % 2) == 0);
-+ for (int i = 0; i < insns_sz; i += 2)
-+ std::swap (arc_sigtramp_insns[i], arc_sigtramp_insns[i+1]);
-+ }
-+
-+ gdb_byte buf[insns_sz];
-+
-+ /* Read the memory at the PC. Since we are stopped, any breakpoint must
-+ have been removed. */
-+ if (!safe_frame_unwind_memory (this_frame, pc, buf, insns_sz))
-+ {
-+ /* Failed to unwind frame. */
-+ return FALSE;
-+ }
-+
-+ /* Is that code the sigtramp instruction sequence? */
-+ if (memcmp (buf, arc_sigtramp_insns, insns_sz) == 0)
-+ return TRUE;
-+
-+ /* No - look one instruction earlier in the code... */
-+ if (!safe_frame_unwind_memory (this_frame, pc - 4, buf, insns_sz))
-+ {
-+ /* Failed to unwind frame. */
-+ return FALSE;
-+ }
-+
-+ return (memcmp (buf, arc_sigtramp_insns, insns_sz) == 0);
-+}
-+
-+/* Get sigcontext structure of sigtramp frame - it contains saved
-+ registers of interrupted frame.
-+
-+ Stack pointer points to the rt_sigframe structure, and sigcontext can
-+ be found as in:
-+
-+ struct rt_sigframe {
-+ struct siginfo info;
-+ struct ucontext uc;
-+ ...
-+ };
-+
-+ struct ucontext {
-+ unsigned long uc_flags;
-+ struct ucontext *uc_link;
-+ stack_t uc_stack;
-+ struct sigcontext uc_mcontext;
-+ sigset_t uc_sigmask;
-+ };
-+
-+ sizeof (struct siginfo) == 0x80
-+ offsetof (struct ucontext, uc_mcontext) == 0x14
-+
-+ GDB cannot include linux headers and use offsetof () because those are
-+ target headers and GDB might be built for a different run host. There
-+ doesn't seem to be an established mechanism to figure out those offsets
-+ via gdbserver, so the only way is to hardcode values in the GDB,
-+ meaning that GDB will be broken if values will change. That seems to
-+ be a very unlikely scenario and other arches (aarch64, alpha, amd64,
-+ etc) in GDB hardcode values. */
-+
-+static CORE_ADDR
-+arc_linux_sigcontext_addr (struct frame_info *this_frame)
-+{
-+ const int ucontext_offset = 0x80;
-+ const int sigcontext_offset = 0x14;
-+ return get_frame_sp (this_frame) + ucontext_offset + sigcontext_offset;
-+}
-+
- /* Implement the "cannot_fetch_register" gdbarch method. */
-
- static int
-@@ -504,6 +679,12 @@ arc_linux_init_osabi (struct gdbarch_info info, struct gdbarch *gdbarch)
- if (arc_debug)
- debug_printf ("arc-linux: GNU/Linux OS/ABI initialization.\n");
-
-+ /* Fill in target-dependent info in ARC-private structure. */
-+ tdep->is_sigtramp = arc_linux_is_sigtramp;
-+ tdep->sigcontext_addr = arc_linux_sigcontext_addr;
-+ tdep->sc_reg_offset = arc_linux_sc_reg_offsets;
-+ tdep->sc_num_regs = ARRAY_SIZE (arc_linux_sc_reg_offsets);
-+
- /* If we are using Linux, we have in uClibc
- (libc/sysdeps/linux/arc/bits/setjmp.h):
-
---
-2.16.2
-
diff --git a/meta/recipes-devtools/gdb/gdb/0014-arc-Take-into-account-the-REGNUM-in-supply-collect-g.patch b/meta/recipes-devtools/gdb/gdb/0014-arc-Take-into-account-the-REGNUM-in-supply-collect-g.patch
deleted file mode 100644
index a7256065cc..0000000000
--- a/meta/recipes-devtools/gdb/gdb/0014-arc-Take-into-account-the-REGNUM-in-supply-collect-g.patch
+++ /dev/null
@@ -1,104 +0,0 @@
-From 5eb97d5e92ad23ee81cebc1ebd5eafe0aa55fc17 Mon Sep 17 00:00:00 2001
-From: Shahab Vahedi <shahab@synopsys.com>
-Date: Tue, 10 Nov 2020 19:34:57 +0100
-Subject: [PATCH 3/4] arc: Take into account the REGNUM in supply/collect gdb
- hooks
-
-All the arc_linux_supply_*() target operations and the
-arc_linux_collect_v2_regset() in arc-linux-tdep.c were
-supplying/collecting all the registers in regcache as if the
-REGNUM was set to -1.
-
-The more efficient behavior is to examine the REGNUM and act
-accordingly. That is what this patch does.
-
-gdb/ChangeLog:
-
- * arc-linux-tdep.c (supply_register): New.
- (arc_linux_supply_gregset, arc_linux_supply_v2_regset,
- arc_linux_collect_v2_regset): Consider REGNUM.
-
-Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=46023bbe81355230b4e7b76d3084337823d02362]
-
-Signed-off-by: Shahab Vahedi <shahab@synopsys.com>
-Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
----
- gdb/arc-linux-tdep.c | 41 ++++++++++++++++++++++++++++++++---------
- 1 file changed, 32 insertions(+), 9 deletions(-)
-
-diff --git a/gdb/arc-linux-tdep.c b/gdb/arc-linux-tdep.c
-index 17bb3e7b276..e83d82b6f5c 100644
---- a/gdb/arc-linux-tdep.c
-+++ b/gdb/arc-linux-tdep.c
-@@ -535,6 +535,18 @@ arc_linux_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
- }
- }
-
-+/* Populate REGCACHE with register REGNUM from BUF. */
-+
-+static void
-+supply_register (struct regcache *regcache, int regnum, const gdb_byte *buf)
-+{
-+ /* Skip non-existing registers. */
-+ if ((arc_linux_core_reg_offsets[regnum] == ARC_OFFSET_NO_REGISTER))
-+ return;
-+
-+ regcache->raw_supply (regnum, buf + arc_linux_core_reg_offsets[regnum]);
-+}
-+
- void
- arc_linux_supply_gregset (const struct regset *regset,
- struct regcache *regcache,
-@@ -545,9 +557,14 @@ arc_linux_supply_gregset (const struct regset *regset,
-
- const bfd_byte *buf = (const bfd_byte *) gregs;
-
-- for (int reg = 0; reg <= ARC_LAST_REGNUM; reg++)
-- if (arc_linux_core_reg_offsets[reg] != ARC_OFFSET_NO_REGISTER)
-- regcache->raw_supply (reg, buf + arc_linux_core_reg_offsets[reg]);
-+ /* regnum == -1 means writing all the registers. */
-+ if (regnum == -1)
-+ for (int reg = 0; reg <= ARC_LAST_REGNUM; reg++)
-+ supply_register (regcache, reg, buf);
-+ else if (regnum <= ARC_LAST_REGNUM)
-+ supply_register (regcache, regnum, buf);
-+ else
-+ gdb_assert_not_reached ("Invalid regnum in arc_linux_supply_gregset.");
- }
-
- void
-@@ -558,9 +575,12 @@ arc_linux_supply_v2_regset (const struct regset *regset,
- const bfd_byte *buf = (const bfd_byte *) v2_regs;
-
- /* user_regs_arcv2 is defined in linux arch/arc/include/uapi/asm/ptrace.h. */
-- regcache->raw_supply (ARC_R30_REGNUM, buf);
-- regcache->raw_supply (ARC_R58_REGNUM, buf + REGOFF (1));
-- regcache->raw_supply (ARC_R59_REGNUM, buf + REGOFF (2));
-+ if (regnum == -1 || regnum == ARC_R30_REGNUM)
-+ regcache->raw_supply (ARC_R30_REGNUM, buf);
-+ if (regnum == -1 || regnum == ARC_R58_REGNUM)
-+ regcache->raw_supply (ARC_R58_REGNUM, buf + REGOFF (1));
-+ if (regnum == -1 || regnum == ARC_R59_REGNUM)
-+ regcache->raw_supply (ARC_R59_REGNUM, buf + REGOFF (2));
- }
-
- /* Populate BUF with register REGNUM from the REGCACHE. */
-@@ -618,9 +638,12 @@ arc_linux_collect_v2_regset (const struct regset *regset,
- {
- bfd_byte *buf = (bfd_byte *) v2_regs;
-
-- regcache->raw_collect (ARC_R30_REGNUM, buf);
-- regcache->raw_collect (ARC_R58_REGNUM, buf + REGOFF (1));
-- regcache->raw_collect (ARC_R59_REGNUM, buf + REGOFF (2));
-+ if (regnum == -1 || regnum == ARC_R30_REGNUM)
-+ regcache->raw_collect (ARC_R30_REGNUM, buf);
-+ if (regnum == -1 || regnum == ARC_R58_REGNUM)
-+ regcache->raw_collect (ARC_R58_REGNUM, buf + REGOFF (1));
-+ if (regnum == -1 || regnum == ARC_R59_REGNUM)
-+ regcache->raw_collect (ARC_R59_REGNUM, buf + REGOFF (2));
- }
-
- /* Linux regset definitions. */
---
-2.16.2
-
diff --git a/meta/recipes-devtools/gdb/gdb/0015-gdb-Add-native-support-for-ARC-in-GNU-Linux.patch b/meta/recipes-devtools/gdb/gdb/0015-gdb-Add-native-support-for-ARC-in-GNU-Linux.patch
deleted file mode 100644
index 31cf0b0be2..0000000000
--- a/meta/recipes-devtools/gdb/gdb/0015-gdb-Add-native-support-for-ARC-in-GNU-Linux.patch
+++ /dev/null
@@ -1,414 +0,0 @@
-From 32b366249fd42d74cbc4a91039431554ebadcfd0 Mon Sep 17 00:00:00 2001
-From: Anton Kolesov <anton.kolesov@synopsys.com>
-Date: Fri, 14 Feb 2014 11:56:23 +0400
-Subject: [PATCH 4/4] gdb: Add native support for ARC in GNU/Linux
-
-With this patch in place it is possible to build a GDB that
-can run on ARC (GNU/Linux) hosts for debugging ARC targets.
-
-The "arc-linux-nat.c" is a rather small one that mostly deals
-with registers and a few thread related hooks.
-
-v2 [1]:
-- Remove "void" from the input of "_initialize_arc_linux_nat ()"
-
-[1] Tom's remark after the first patch
-https://sourceware.org/pipermail/gdb-patches/2020-November/173223.html
-
-gdb/ChangeLog:
-
- * Makefile.in (ALLDEPFILES): Add arc-linux-nat.c.
- * configure.host (host to gdb names): Add arc*-*-linux*.
- * configure.nat (gdb_host_cpu): Add arc.
- * arc-linux-nat.c: New.
-
-Upstream-Status: Backport [https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=04c9f85efcd8df5fc482ce97c0104cc7dd5d19e6]
-
-Signed-off-by: Anton Kolesov <Anton.Kolesov@synopsys.com>
-Signed-off-by: Shahab Vahedi <shahab@synopsys.com>
-Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
----
- gdb/Makefile.in | 1 +
- gdb/arc-linux-nat.c | 320 ++++++++++++++++++++++++++++++++++++++++++++++++++++
- gdb/configure.host | 3 +
- gdb/configure.nat | 4 +
- 4 files changed, 328 insertions(+)
- create mode 100644 gdb/arc-linux-nat.c
-
-diff --git a/gdb/Makefile.in b/gdb/Makefile.in
-index ec371fc7e52..c76136907ae 100644
---- a/gdb/Makefile.in
-+++ b/gdb/Makefile.in
-@@ -2136,6 +2136,7 @@ ALLDEPFILES = \
- amd64-obsd-tdep.c \
- amd64-sol2-tdep.c \
- amd64-tdep.c \
-+ arc-linux-nat.c \
- arc-tdep.c \
- arm.c \
- arm-bsd-tdep.c \
-diff --git a/gdb/arc-linux-nat.c b/gdb/arc-linux-nat.c
-new file mode 100644
-index 00000000000..41301fd4fed
---- /dev/null
-+++ b/gdb/arc-linux-nat.c
-@@ -0,0 +1,320 @@
-+/* Native-dependent code for GNU/Linux ARC.
-+
-+ Copyright 2020 Free Software Foundation, Inc.
-+
-+ This file is part of GDB.
-+
-+ This program is free software; you can redistribute it and/or modify
-+ it under the terms of the GNU General Public License as published by
-+ the Free Software Foundation; either version 3 of the License, or
-+ (at your option) any later version.
-+
-+ This program is distributed in the hope that it will be useful,
-+ but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-+ GNU General Public License for more details.
-+
-+ You should have received a copy of the GNU General Public License
-+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
-+
-+#include "defs.h"
-+#include "frame.h"
-+#include "inferior.h"
-+#include "gdbcore.h"
-+#include "regcache.h"
-+#include "gdbsupport/gdb_assert.h"
-+#include "target.h"
-+#include "linux-nat.h"
-+#include "nat/gdb_ptrace.h"
-+
-+#include <stdint.h>
-+#include <sys/types.h>
-+#include <sys/param.h>
-+#include <signal.h>
-+#include <sys/user.h>
-+#include <sys/ioctl.h>
-+#include "gdbsupport/gdb_wait.h"
-+#include <fcntl.h>
-+#include <sys/procfs.h>
-+#include <linux/elf.h>
-+
-+#include "gregset.h"
-+#include "arc-tdep.h"
-+#include "arc-linux-tdep.h"
-+#include "arch/arc.h"
-+
-+/* Defines ps_err_e, struct ps_prochandle. */
-+#include "gdb_proc_service.h"
-+
-+/* Linux starting with 4.12 supports NT_ARC_V2 note type, which adds R30,
-+ R58 and R59 registers, which are specific to ARC HS and aren't
-+ available in ARC 700. */
-+#if defined (NT_ARC_V2) && defined (__ARCHS__)
-+#define ARC_HAS_V2_REGSET
-+#endif
-+
-+class arc_linux_nat_target final : public linux_nat_target
-+{
-+public:
-+ /* Add ARC register access methods. */
-+ void fetch_registers (struct regcache *, int) override;
-+ void store_registers (struct regcache *, int) override;
-+
-+ const struct target_desc *read_description () override;
-+
-+ /* Handle threads */
-+ void low_prepare_to_resume (struct lwp_info *lp) override;
-+};
-+
-+static arc_linux_nat_target the_arc_linux_nat_target;
-+
-+/* Read general registers from target process/thread (via ptrace)
-+ into REGCACHE. */
-+
-+static void
-+fetch_gregs (struct regcache *regcache, int regnum)
-+{
-+ const int tid = get_ptrace_pid (regcache->ptid ());
-+ struct iovec iov;
-+ gdb_gregset_t regs;
-+
-+ iov.iov_base = &regs;
-+ iov.iov_len = sizeof (gdb_gregset_t);
-+
-+ if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, (void *) &iov) < 0)
-+ perror_with_name (_("Couldn't get general registers"));
-+ else
-+ arc_linux_supply_gregset (NULL, regcache, regnum, &regs, 0);
-+}
-+
-+#ifdef ARC_HAS_V2_REGSET
-+/* Read ARC v2 registers from target process/thread (via ptrace)
-+ into REGCACHE. */
-+
-+static void
-+fetch_v2_regs (struct regcache *regcache, int regnum)
-+{
-+ const int tid = get_ptrace_pid (regcache->ptid ());
-+ struct iovec iov;
-+ bfd_byte v2_buffer[ARC_LINUX_SIZEOF_V2_REGSET];
-+
-+ iov.iov_base = &v2_buffer;
-+ iov.iov_len = ARC_LINUX_SIZEOF_V2_REGSET;
-+
-+ if (ptrace (PTRACE_GETREGSET, tid, NT_ARC_V2, (void *) &iov) < 0)
-+ perror_with_name (_("Couldn't get ARC HS registers"));
-+ else
-+ arc_linux_supply_v2_regset (NULL, regcache, regnum, v2_buffer, 0);
-+}
-+#endif
-+
-+/* Store general registers from REGCACHE into the target process/thread. */
-+
-+static void
-+store_gregs (const struct regcache *regcache, int regnum)
-+{
-+ const int tid = get_ptrace_pid (regcache->ptid ());
-+ struct iovec iov;
-+ gdb_gregset_t regs;
-+
-+ iov.iov_base = &regs;
-+ iov.iov_len = sizeof (gdb_gregset_t);
-+
-+ if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, (void *) &iov) < 0)
-+ perror_with_name (_("Couldn't get general registers"));
-+ else
-+ {
-+ arc_linux_collect_gregset (NULL, regcache, regnum, regs, 0);
-+
-+ if (ptrace (PTRACE_SETREGSET, tid, NT_PRSTATUS, (void *) &iov) < 0)
-+ perror_with_name (_("Couldn't write general registers"));
-+ }
-+}
-+
-+#ifdef ARC_HAS_V2_REGSET
-+/* Store ARC v2 registers from REGCACHE into the target process/thread. */
-+
-+static void
-+store_v2_regs (const struct regcache *regcache, int regnum)
-+{
-+ const int tid = get_ptrace_pid (regcache->ptid ());
-+ struct iovec iov;
-+ bfd_byte v2_buffer[ARC_LINUX_SIZEOF_V2_REGSET];
-+
-+ iov.iov_base = &v2_buffer;
-+ iov.iov_len = ARC_LINUX_SIZEOF_V2_REGSET;
-+
-+ if (ptrace (PTRACE_GETREGSET, tid, NT_ARC_V2, (void *) &iov) < 0)
-+ perror_with_name (_("Couldn't get ARC HS registers"));
-+ else
-+ {
-+ arc_linux_collect_v2_regset (NULL, regcache, regnum, v2_buffer, 0);
-+
-+ if (ptrace (PTRACE_SETREGSET, tid, NT_ARC_V2, (void *) &iov) < 0)
-+ perror_with_name (_("Couldn't write ARC HS registers"));
-+ }
-+}
-+#endif
-+
-+/* Target operation: Read REGNUM register (all registers if REGNUM == -1)
-+ from target process into REGCACHE. */
-+
-+void
-+arc_linux_nat_target::fetch_registers (struct regcache *regcache, int regnum)
-+{
-+
-+ if (regnum == -1 || regnum <= ARC_LAST_REGNUM)
-+ fetch_gregs (regcache, regnum);
-+
-+#ifdef ARC_HAS_V2_REGSET
-+ if (regnum == -1
-+ || regnum == ARC_R30_REGNUM
-+ || regnum == ARC_R58_REGNUM
-+ || regnum == ARC_R59_REGNUM)
-+ fetch_v2_regs (regcache, regnum);
-+#endif
-+}
-+
-+/* Target operation: Store REGNUM register (all registers if REGNUM == -1)
-+ to the target process from REGCACHE. */
-+
-+void
-+arc_linux_nat_target::store_registers (struct regcache *regcache, int regnum)
-+{
-+ if (regnum == -1 || regnum <= ARC_LAST_REGNUM)
-+ store_gregs (regcache, regnum);
-+
-+#ifdef ARC_HAS_V2_REGSET
-+ if (regnum == -1
-+ || regnum == ARC_R30_REGNUM
-+ || regnum == ARC_R58_REGNUM
-+ || regnum == ARC_R59_REGNUM)
-+ store_v2_regs (regcache, regnum);
-+#endif
-+}
-+
-+/* Copy general purpose register(s) from REGCACHE into regset GREGS.
-+ This function is exported to proc-service.c */
-+
-+void
-+fill_gregset (const struct regcache *regcache,
-+ gdb_gregset_t *gregs, int regnum)
-+{
-+ arc_linux_collect_gregset (NULL, regcache, regnum, gregs, 0);
-+}
-+
-+/* Copy all the general purpose registers from regset GREGS into REGCACHE.
-+ This function is exported to proc-service.c. */
-+
-+void
-+supply_gregset (struct regcache *regcache, const gdb_gregset_t *gregs)
-+{
-+ arc_linux_supply_gregset (NULL, regcache, -1, gregs, 0);
-+}
-+
-+/* ARC doesn't have separate FP registers. This function is exported
-+ to proc-service.c. */
-+
-+void
-+fill_fpregset (const struct regcache *regcache,
-+ gdb_fpregset_t *fpregsetp, int regnum)
-+{
-+ if (arc_debug)
-+ debug_printf ("arc-linux-nat: fill_fpregset called.");
-+ return;
-+}
-+
-+/* ARC doesn't have separate FP registers. This function is exported
-+ to proc-service.c. */
-+
-+void
-+supply_fpregset (struct regcache *regcache, const gdb_fpregset_t *fpregsetp)
-+{
-+ if (arc_debug)
-+ debug_printf ("arc-linux-nat: supply_fpregset called.");
-+ return;
-+}
-+
-+/* Implement the "read_description" method of linux_nat_target. */
-+
-+const struct target_desc *
-+arc_linux_nat_target::read_description ()
-+{
-+ /* This is a native target, hence description is hardcoded. */
-+#ifdef __ARCHS__
-+ arc_arch_features features (4, ARC_ISA_ARCV2);
-+#else
-+ arc_arch_features features (4, ARC_ISA_ARCV1);
-+#endif
-+ return arc_lookup_target_description (features);
-+}
-+
-+/* As described in arc_linux_collect_gregset(), we need to write resume-PC
-+ to ERET. However by default GDB for native targets doesn't write
-+ registers if they haven't been changed. This is a callback called by
-+ generic GDB, and in this callback we have to rewrite PC value so it
-+ would force rewrite of register on target. It seems that the only
-+ other arch that utilizes this hook is x86/x86-64 for HW breakpoint
-+ support. But then, AFAIK no other arch has this stop_pc/eret
-+ complexity.
-+
-+ No better way was found, other than this fake write of register value,
-+ to force GDB into writing register to target. Is there any? */
-+
-+void
-+arc_linux_nat_target::low_prepare_to_resume (struct lwp_info *lwp)
-+{
-+ /* When new processes and threads are created we do not have the address
-+ space for them and calling get_thread_regcache will cause an internal
-+ error in GDB. It looks like that checking for last_resume_kind is the
-+ sensible way to determine processes for which we cannot get regcache.
-+ Ultimately, a better way would be removing the need for
-+ low_prepare_to_resume in the first place. */
-+ if (lwp->last_resume_kind == resume_stop)
-+ return;
-+
-+ struct regcache *regcache = get_thread_regcache (this, lwp->ptid);
-+ struct gdbarch *gdbarch = regcache->arch ();
-+
-+ /* Read current PC value, then write it back. It is required to call
-+ invalidate(), otherwise GDB will note that new value is equal to old
-+ value and will skip write. */
-+ ULONGEST new_pc;
-+ regcache_cooked_read_unsigned (regcache, gdbarch_pc_regnum (gdbarch),
-+ &new_pc);
-+ regcache->invalidate (gdbarch_pc_regnum (gdbarch));
-+ regcache_cooked_write_unsigned (regcache, gdbarch_pc_regnum (gdbarch),
-+ new_pc);
-+}
-+
-+/* Fetch the thread-local storage pointer for libthread_db. Note that
-+ this function is not called from GDB, but is called from libthread_db.
-+ This is required to debug multithreaded applications with NPTL. */
-+
-+ps_err_e
-+ps_get_thread_area (struct ps_prochandle *ph, lwpid_t lwpid, int idx,
-+ void **base)
-+{
-+ if (arc_debug >= 2)
-+ debug_printf ("arc-linux-nat: ps_get_thread_area called");
-+
-+ if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
-+ return PS_ERR;
-+
-+ /* IDX is the bias from the thread pointer to the beginning of the
-+ thread descriptor. It has to be subtracted due to implementation
-+ quirks in libthread_db. */
-+ *base = (void *) ((char *) *base - idx);
-+
-+ return PS_OK;
-+}
-+
-+/* Suppress warning from -Wmissing-prototypes. */
-+void _initialize_arc_linux_nat ();
-+void
-+_initialize_arc_linux_nat ()
-+{
-+ /* Register the target. */
-+ linux_target = &the_arc_linux_nat_target;
-+ add_inf_child_target (&the_arc_linux_nat_target);
-+}
-diff --git a/gdb/configure.host b/gdb/configure.host
-index ce528237291..e94a19b0332 100644
---- a/gdb/configure.host
-+++ b/gdb/configure.host
-@@ -60,6 +60,7 @@ case "${host_cpu}" in
-
- aarch64*) gdb_host_cpu=aarch64 ;;
- alpha*) gdb_host_cpu=alpha ;;
-+arc*) gdb_host_cpu=arc ;;
- arm*) gdb_host_cpu=arm ;;
- hppa*) gdb_host_cpu=pa ;;
- i[34567]86*) gdb_host_cpu=i386 ;;
-@@ -91,6 +92,8 @@ alpha*-*-netbsd* | alpha*-*-knetbsd*-gnu)
- gdb_host=nbsd ;;
- alpha*-*-openbsd*) gdb_host=nbsd ;;
-
-+arc*-*-linux*) gdb_host=linux ;;
-+
- arm*-*-freebsd*) gdb_host=fbsd ;;
- arm*-*-linux*) gdb_host=linux ;;
- arm*-*-netbsdelf* | arm*-*-knetbsd*-gnu)
-diff --git a/gdb/configure.nat b/gdb/configure.nat
-index bb70e303384..cd11bc86dca 100644
---- a/gdb/configure.nat
-+++ b/gdb/configure.nat
-@@ -238,6 +238,10 @@ case ${gdb_host} in
- nat/aarch64-linux.o \
- nat/aarch64-sve-linux-ptrace.o"
- ;;
-+ arc)
-+ # Host: ARC based machine running GNU/Linux
-+ NATDEPFILES="${NATDEPFILES} arc-linux-nat.o"
-+ ;;
- arm)
- # Host: ARM based machine running GNU/Linux
- NATDEPFILES="${NATDEPFILES} arm-linux-nat.o \
---
-2.16.2
-
diff --git a/meta/recipes-devtools/gdb/gdb_10.2.bb b/meta/recipes-devtools/gdb/gdb_14.2.bb
index e73e3a2c5c..9c6db4ca2c 100644
--- a/meta/recipes-devtools/gdb/gdb_10.2.bb
+++ b/meta/recipes-devtools/gdb/gdb_14.2.bb
@@ -1,5 +1,15 @@
+require gdb-common.inc
+
+inherit gettext pkgconfig
+
+#LDFLAGS:append = " -s"
+#export CFLAGS:append=" -L${STAGING_LIBDIR}"
+
+# cross-canadian must not see this
+PACKAGES =+ "gdbserver"
+FILES:gdbserver = "${bindir}/gdbserver"
+
require gdb.inc
-require gdb-${PV}.inc
inherit python3-dir
@@ -26,3 +36,4 @@ EOF
chmod +x ${WORKDIR}/python
fi
}
+