summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gdb
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2015-04-10 18:20:47 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-04-13 22:33:23 +0100
commit0fa5b047cc7ff339db40ba0615fc58b496621f37 (patch)
treeb9f783c7a2f28c3abd2f7f9715c398101611e45e /meta/recipes-devtools/gdb
parent683942be6fb732fb929cac49e2d59fc9fd4ad02b (diff)
downloadpoky-0fa5b047cc7ff339db40ba0615fc58b496621f37.tar.gz
gdb: Refresh patches against git
Drop dead patches sim-install.patch, uclibc.patch Change-Id: I5bd160d0959154896096ebc93a8a450d04979c73 (From OE-Core rev: 682ab52d776d74fb5ede949505f72b4c15ae8191) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/gdb')
-rw-r--r--meta/recipes-devtools/gdb/gdb-cross_7.9.bb2
-rw-r--r--meta/recipes-devtools/gdb/gdb.inc5
-rw-r--r--meta/recipes-devtools/gdb/gdb/0001-make-man-install-relative-to-DESTDIR.patch28
-rw-r--r--meta/recipes-devtools/gdb/gdb/0002-Change-order-of-CFLAGS.patch (renamed from meta/recipes-devtools/gdb/gdb/gdbserver-cflags-last.diff)23
-rw-r--r--meta/recipes-devtools/gdb/gdb/0003-Add-support-for-Renesas-SH-sh4-architecture.patch (renamed from meta/recipes-devtools/gdb/gdb/renesas-sh-native-support.patch)835
-rw-r--r--meta/recipes-devtools/gdb/gdb/0004-Change-comment-in-gdb-compile.patch48
-rw-r--r--meta/recipes-devtools/gdb/gdb/sim-install-6.6.patch14
-rw-r--r--meta/recipes-devtools/gdb/gdb/sim-install.patch36
-rw-r--r--meta/recipes-devtools/gdb/gdb/uclibc.patch196
9 files changed, 286 insertions, 901 deletions
diff --git a/meta/recipes-devtools/gdb/gdb-cross_7.9.bb b/meta/recipes-devtools/gdb/gdb-cross_7.9.bb
index f9da486d7d..3a95cfb035 100644
--- a/meta/recipes-devtools/gdb/gdb-cross_7.9.bb
+++ b/meta/recipes-devtools/gdb/gdb-cross_7.9.bb
@@ -1,4 +1,4 @@
1require gdb-cross.inc 1require gdb-cross.inc
2require gdb-${PV}.inc 2require gdb-${PV}.inc
3 3
4SRC_URI += "file://sim-install-6.6.patch" 4SRC_URI += "file://0001-make-man-install-relative-to-DESTDIR.patch"
diff --git a/meta/recipes-devtools/gdb/gdb.inc b/meta/recipes-devtools/gdb/gdb.inc
index 2c95e03b1b..e65af4bf8b 100644
--- a/meta/recipes-devtools/gdb/gdb.inc
+++ b/meta/recipes-devtools/gdb/gdb.inc
@@ -2,8 +2,9 @@ require gdb-common.inc
2 2
3inherit gettext 3inherit gettext
4 4
5SRC_URI += "file://gdbserver-cflags-last.diff;striplevel=0 \ 5SRC_URI += "file://0002-Change-order-of-CFLAGS.patch \
6 file://renesas-sh-native-support.patch \ 6 file://0003-Add-support-for-Renesas-SH-sh4-architecture.patch \
7 file://0004-Change-comment-in-gdb-compile.patch \
7 " 8 "
8#LDFLAGS_append = " -s" 9#LDFLAGS_append = " -s"
9#export CFLAGS_append=" -L${STAGING_LIBDIR}" 10#export CFLAGS_append=" -L${STAGING_LIBDIR}"
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
new file mode 100644
index 0000000000..e0221afca1
--- /dev/null
+++ b/meta/recipes-devtools/gdb/gdb/0001-make-man-install-relative-to-DESTDIR.patch
@@ -0,0 +1,28 @@
1From d3ec939b82be23e7c9534cdc7502645f6c5856d1 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 2 Mar 2015 02:27:55 +0000
4Subject: [PATCH 1/3] make man install relative to DESTDIR
5
6Upstream-Status: Pending
7
8Signed-off-by: Khem Raj <raj.khem@gmail.com>
9---
10 sim/common/Makefile.in | 2 +-
11 1 file changed, 1 insertion(+), 1 deletion(-)
12
13diff --git a/sim/common/Makefile.in b/sim/common/Makefile.in
14index d49a93b..2121c46 100644
15--- a/sim/common/Makefile.in
16+++ b/sim/common/Makefile.in
17@@ -35,7 +35,7 @@ tooldir = $(libdir)/$(target_alias)
18 datarootdir = @datarootdir@
19 datadir = @datadir@
20 mandir = @mandir@
21-man1dir = $(mandir)/man1
22+man1dir = $(DESTDIR)$(mandir)/man1
23 infodir = @infodir@
24 includedir = @includedir@
25
26--
272.1.4
28
diff --git a/meta/recipes-devtools/gdb/gdb/gdbserver-cflags-last.diff b/meta/recipes-devtools/gdb/gdb/0002-Change-order-of-CFLAGS.patch
index 16a3aa93d9..26a34d3444 100644
--- a/meta/recipes-devtools/gdb/gdb/gdbserver-cflags-last.diff
+++ b/meta/recipes-devtools/gdb/gdb/0002-Change-order-of-CFLAGS.patch
@@ -1,13 +1,21 @@
1Upstream-Status: Pending 1From 0dcb0a8b139b44ae84e8fd8ff8130cbbb52e444d Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 2 Mar 2015 02:29:23 +0000
4Subject: [PATCH 2/3] Change order of CFLAGS
2 5
6Lets us override Werror if need be
7
8Upstream-Status: Inappropriate
9
10Signed-off-by: Khem Raj <raj.khem@gmail.com>
3--- 11---
4 gdb/gdbserver/Makefile.in | 4 ++-- 12 gdb/gdbserver/Makefile.in | 4 ++--
5 1 file changed, 2 insertions(+), 2 deletions(-) 13 1 file changed, 2 insertions(+), 2 deletions(-)
6 14
7Index: gdb/gdbserver/Makefile.in 15diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
8=================================================================== 16index 1ed2ec8..0cef95b 100644
9--- gdb/gdbserver/Makefile.in.orig 17--- a/gdb/gdbserver/Makefile.in
10+++ gdb/gdbserver/Makefile.in 18+++ b/gdb/gdbserver/Makefile.in
11@@ -131,10 +131,10 @@ CFLAGS = @CFLAGS@ 19@@ -131,10 +131,10 @@ CFLAGS = @CFLAGS@
12 CPPFLAGS = @CPPFLAGS@ 20 CPPFLAGS = @CPPFLAGS@
13 21
@@ -21,3 +29,6 @@ Index: gdb/gdbserver/Makefile.in
21 29
22 # LDFLAGS is specifically reserved for setting from the command line 30 # LDFLAGS is specifically reserved for setting from the command line
23 # when running make. 31 # when running make.
32--
332.1.4
34
diff --git a/meta/recipes-devtools/gdb/gdb/renesas-sh-native-support.patch b/meta/recipes-devtools/gdb/gdb/0003-Add-support-for-Renesas-SH-sh4-architecture.patch
index 2259c6f7ee..d82d269208 100644
--- a/meta/recipes-devtools/gdb/gdb/renesas-sh-native-support.patch
+++ b/meta/recipes-devtools/gdb/gdb/0003-Add-support-for-Renesas-SH-sh4-architecture.patch
@@ -1,41 +1,35 @@
1Description: Add Renesas SH (sh4) support 1From 4e5507488068b3ea2ebf9c84c6c192c7bfd3be82 Mon Sep 17 00:00:00 2001
2 Add support for Renesas SH (sh4) architecture. 2From: Khem Raj <raj.khem@gmail.com>
3 . 3Date: Mon, 2 Mar 2015 02:31:12 +0000
4 gdb (7.4-1~cvs20111117.2) experimental; urgency=low 4Subject: [PATCH 3/3] Add support for Renesas SH (sh4) architecture.
5
6gdb (7.4-1~cvs20111117.2) experimental; urgency=low
5 . 7 .
6 * Add Renesas SH (sh4) support (Closes: #576242) 8 * Add Renesas SH (sh4) support (Closes: #576242)
7 - Thanks Nobuhiro Iwamatsu, Takashi Yoshii. 9 - Thanks Nobuhiro Iwamatsu, Takashi Yoshii.
8Author: Hector Oron <zumbi@debian.org> 10Author: Hector Oron <zumbi@debian.org>
9Bug-Debian: http://bugs.debian.org/576242 11Bug-Debian: http://bugs.debian.org/576242
10 12
11---
12The information above should follow the Patch Tagging Guidelines, please
13checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
14are templates for supplementary fields that you might want to add:
15
16Forwarded: <no|not-needed|url proving that it has been forwarded>
17Last-Update: <2011-11-17>
18
19
20Upstream-Status: Pending 13Upstream-Status: Pending
21Signed-off-by: Khem Raj <raj.khem@gmail.com> 14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15---
16 gdb/Makefile.in | 1 +
17 gdb/configure.host | 1 +
18 gdb/sh-linux-tdep.c | 519 +++++++++++++++++++++++++++++++++++
19 gdb/sh-tdep.c | 54 ++--
20 gdb/sh-tdep.h | 49 ++++
21 gdb/testsuite/gdb.asm/asm-source.exp | 5 +
22 gdb/testsuite/gdb.asm/sh.inc | 3 +-
23 gdb/testsuite/gdb.base/annota1.c | 3 +
24 gdb/testsuite/gdb.base/annota3.c | 4 +
25 gdb/testsuite/gdb.base/sigall.c | 3 +
26 gdb/testsuite/gdb.base/signals.c | 4 +
27 11 files changed, 617 insertions(+), 29 deletions(-)
22 28
23Index: gdb-7.9/gdb/configure.host 29diff --git a/gdb/Makefile.in b/gdb/Makefile.in
24=================================================================== 30index 7937801..63baf81 100644
25--- gdb-7.9.orig/gdb/configure.host 31--- a/gdb/Makefile.in
26+++ gdb-7.9/gdb/configure.host 32+++ b/gdb/Makefile.in
27@@ -150,6 +150,7 @@ powerpc*-*-linux*) gdb_host=linux ;;
28
29 s390*-*-linux*) gdb_host=linux ;;
30
31+sh*-*-linux*) gdb_host=linux ;;
32 sh*-*-netbsdelf* | sh*-*-knetbsd*-gnu)
33 gdb_host=nbsd ;;
34 sh*-*-openbsd*) gdb_host=nbsd ;;
35Index: gdb-7.9/gdb/Makefile.in
36===================================================================
37--- gdb-7.9.orig/gdb/Makefile.in
38+++ gdb-7.9/gdb/Makefile.in
39@@ -1707,6 +1707,7 @@ ALLDEPFILES = \ 33@@ -1707,6 +1707,7 @@ ALLDEPFILES = \
40 score-tdep.c \ 34 score-tdep.c \
41 ser-go32.c ser-pipe.c ser-tcp.c ser-mingw.c \ 35 ser-go32.c ser-pipe.c ser-tcp.c ser-mingw.c \
@@ -44,10 +38,22 @@ Index: gdb-7.9/gdb/Makefile.in
44 sol2-tdep.c \ 38 sol2-tdep.c \
45 solib-svr4.c \ 39 solib-svr4.c \
46 sparc-linux-nat.c sparc-linux-tdep.c \ 40 sparc-linux-nat.c sparc-linux-tdep.c \
47Index: gdb-7.9/gdb/sh-linux-tdep.c 41diff --git a/gdb/configure.host b/gdb/configure.host
48=================================================================== 42index d07be4b..b6391c5 100644
49--- gdb-7.9.orig/gdb/sh-linux-tdep.c 43--- a/gdb/configure.host
50+++ gdb-7.9/gdb/sh-linux-tdep.c 44+++ b/gdb/configure.host
45@@ -150,6 +150,7 @@ powerpc*-*-linux*) gdb_host=linux ;;
46
47 s390*-*-linux*) gdb_host=linux ;;
48
49+sh*-*-linux*) gdb_host=linux ;;
50 sh*-*-netbsdelf* | sh*-*-knetbsd*-gnu)
51 gdb_host=nbsd ;;
52 sh*-*-openbsd*) gdb_host=nbsd ;;
53diff --git a/gdb/sh-linux-tdep.c b/gdb/sh-linux-tdep.c
54index 2ff2ee8..1a11262 100644
55--- a/gdb/sh-linux-tdep.c
56+++ b/gdb/sh-linux-tdep.c
51@@ -18,14 +18,37 @@ 57@@ -18,14 +18,37 @@
52 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 58 along with this program. If not, see <http://www.gnu.org/licenses/>. */
53 59
@@ -86,7 +92,7 @@ Index: gdb-7.9/gdb/sh-linux-tdep.c
86 #include "glibc-tdep.h" 92 #include "glibc-tdep.h"
87 #include "sh-tdep.h" 93 #include "sh-tdep.h"
88 #include "linux-tdep.h" 94 #include "linux-tdep.h"
89@@ -180,9 +203,505 @@ static struct tramp_frame sh_linux_rt_si 95@@ -180,9 +203,505 @@ static struct tramp_frame sh_linux_rt_sigreturn_tramp_frame = {
90 sh_linux_rt_sigreturn_init 96 sh_linux_rt_sigreturn_init
91 }; 97 };
92 98
@@ -592,367 +598,10 @@ Index: gdb-7.9/gdb/sh-linux-tdep.c
592 linux_init_abi (info, gdbarch); 598 linux_init_abi (info, gdbarch);
593 599
594 /* GNU/Linux uses SVR4-style shared libraries. */ 600 /* GNU/Linux uses SVR4-style shared libraries. */
595Index: gdb-7.9/gdb/sh-tdep.h 601diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
596=================================================================== 602index 82cf2f4..b443e46 100644
597--- gdb-7.9.orig/gdb/sh-tdep.h 603--- a/gdb/sh-tdep.c
598+++ gdb-7.9/gdb/sh-tdep.h 604+++ b/gdb/sh-tdep.c
599@@ -21,6 +21,12 @@
600
601 /* Contributed by Steve Chamberlain sac@cygnus.com. */
602
603+struct frame_info;
604+struct gdbarch;
605+struct reggroup;
606+struct regset;
607+struct regcache;
608+
609 /* Registers for all SH variants. Used also by sh3-rom.c. */
610 enum
611 {
612@@ -29,6 +35,7 @@ enum
613 ARG0_REGNUM = 4,
614 ARGLAST_REGNUM = 7,
615 FP_REGNUM = 14,
616+ SP_REGNUM = 15,
617 PC_REGNUM = 16,
618 PR_REGNUM = 17,
619 GBR_REGNUM = 18,
620@@ -81,6 +88,24 @@ enum
621 FV0_REGNUM = 76,
622 FV_LAST_REGNUM = 79
623 };
624+#define SH_NUM_REGS 67
625+
626+struct sh_frame_cache
627+{
628+ /* Base address. */
629+ CORE_ADDR base;
630+ LONGEST sp_offset;
631+ CORE_ADDR pc;
632+
633+ /* Flag showing that a frame has been created in the prologue code. */
634+ int uses_fp;
635+
636+ /* Saved registers. */
637+ CORE_ADDR saved_regs[SH_NUM_REGS];
638+ CORE_ADDR saved_sp;
639+};
640+
641+extern struct sh_frame_cache *sh_frame_cache (struct frame_info *next_frame, void **this_cache);
642
643 /* This structure describes a register in a core-file. */
644 struct sh_corefile_regmap
645@@ -89,8 +114,32 @@ struct sh_corefile_regmap
646 unsigned int offset;
647 };
648
649+/* sh architecture specific information. */
650 struct gdbarch_tdep
651 {
652+ /* General-purpose registers. */
653+ struct regset *gregset;
654+ int *gregset_reg_offset;
655+ int gregset_num_regs;
656+ size_t sizeof_gregset;
657+
658+ /* Floating-point registers. */
659+ struct regset *fpregset;
660+ size_t sizeof_fpregset;
661+
662+ /* Offset of saved PC in jmp_buf. */
663+ int jb_pc_offset;
664+
665+ /* Detect sigtramp. */
666+ int (*sigtramp_p) (struct frame_info *);
667+
668+ /* Get address of sigcontext for sigtramp. */
669+ CORE_ADDR (*sigcontext_addr) (struct frame_info *);
670+
671+ /* Offset of registers in `struct sigcontext'. */
672+ int *sc_reg_offset;
673+ int sc_num_regs;
674+
675 /* Non-NULL when debugging from a core file. Provides the offset
676 where each general-purpose register is stored inside the associated
677 core file section. */
678Index: gdb-7.9/gdb/sh-linux-nat.c
679===================================================================
680--- /dev/null
681+++ gdb-7.9/gdb/sh-linux-nat.c
682@@ -0,0 +1,269 @@
683+/* Low level SH interface to ptrace, for GDB when running native.
684+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
685+
686+This file is part of GDB.
687+
688+This program is free software; you can redistribute it and/or modify
689+it under the terms of the GNU General Public License as published by
690+the Free Software Foundation; either version 2 of the License, or
691+(at your option) any later version.
692+
693+This program is distributed in the hope that it will be useful,
694+but WITHOUT ANY WARRANTY; without even the implied warranty of
695+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
696+GNU General Public License for more details.
697+
698+You should have received a copy of the GNU General Public License
699+along with this program; if not, write to the Free Software
700+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
701+
702+#include "defs.h"
703+#include "inferior.h"
704+#include "gdbcore.h"
705+#include "regcache.h"
706+#include "linux-nat.h"
707+#include "target.h"
708+#include "arch-utils.h"
709+
710+#include "gdb_assert.h"
711+#include "gdb_string.h"
712+#include <sys/ptrace.h>
713+#include <sys/user.h>
714+#include <sys/procfs.h>
715+#include <asm/ptrace.h>
716+
717+/* Prototypes for supply_gregset etc. */
718+#include "gregset.h"
719+#include "sh-tdep.h"
720+
721+/* Defines ps_err_e, struct ps_prochandle. */
722+#include "gdb_proc_service.h"
723+
724+//#include <asm/elf.h>
725+
726+#define SH_LINUX_NUM_REGS 40
727+/* This table must line up with REGISTER_NAME in "sh-tdep.c". */
728+static const int regmap[] =
729+{
730+ /* general registers 0-15 */
731+ REG_REG0 , REG_REG0+1 , REG_REG0+2 , REG_REG0+3,
732+ REG_REG0+4 , REG_REG0+5 , REG_REG0+6 , REG_REG0+7,
733+ REG_REG0+8 , REG_REG0+9 , REG_REG0+10, REG_REG0+11,
734+ REG_REG0+12, REG_REG0+13, REG_REG0+14, REG_REG0+15,
735+ /* 16 - 22 */
736+ REG_PC, REG_PR, REG_GBR, -1, REG_MACH, REG_MACL, REG_SR,
737+ /* 23, 24 */
738+ REG_FPUL, REG_FPSCR,
739+ /* floating point registers 25 - 40 */
740+ REG_FPREG0 , REG_FPREG0+1 , REG_FPREG0+2 , REG_FPREG0+3 ,
741+ REG_FPREG0+4 , REG_FPREG0+5 , REG_FPREG0+6 , REG_FPREG0+7 ,
742+ REG_FPREG0+8 , REG_FPREG0+9 , REG_FPREG0+10, REG_FPREG0+11,
743+ REG_FPREG0+12, REG_FPREG0+13, REG_FPREG0+14, REG_FPREG0+15,
744+};
745+
746+CORE_ADDR
747+register_u_addr (CORE_ADDR blockend, int regnum)
748+{
749+ if (regnum < 0 || regnum >= sizeof regmap/sizeof regmap[0])
750+ return (CORE_ADDR)-1;
751+ return (blockend + 4 * regmap[regnum]);
752+}
753+
754+
755+/* Return the address in the core dump or inferior of register REGNO.
756+ BLOCKEND is the address of the end of the user structure. */
757+
758+CORE_ADDR
759+register_addr (int regno, CORE_ADDR blockend)
760+{
761+ CORE_ADDR addr;
762+
763+ if (regno < 0 || regno >= SH_LINUX_NUM_REGS) {
764+ internal_error (__FILE__, __LINE__,
765+ _("Got request for bad register number %d."), regno);
766+ }
767+
768+ REGISTER_U_ADDR (addr, blockend, regno);
769+
770+ return addr;
771+}
772+
773+/* Fetch one register. */
774+
775+static void
776+fetch_register (struct regcache *regcache, int tid, int regno)
777+{
778+ int val;
779+
780+ if (cannot_fetch_register (regno))
781+ {
782+ regcache_raw_supply (regcache, regno, NULL);
783+ return;
784+ }
785+
786+ errno = 0;
787+ val = ptrace (PTRACE_PEEKUSER, tid, register_addr (regno, 0), 0);
788+ if (errno != 0)
789+ perror_with_name (_("Couldn't get registers"));
790+
791+ regcache_raw_supply (regcache, regno, &val);
792+}
793+
794+/* Store one register. */
795+
796+static void
797+store_register (struct regcache *regcache, int tid, int regno)
798+{
799+ int val;
800+
801+ if (cannot_store_register (regno))
802+ return;
803+
804+ errno = 0;
805+ regcache_raw_collect (regcache, regno, &val);
806+ ptrace (PTRACE_POKEUSER, tid, register_addr (regno, 0), val);
807+ if (errno != 0)
808+ perror_with_name (_("Couldn't write registers"));
809+}
810+
811+/* Transfering the general-purpose registers between GDB, inferiors
812+ and core files. */
813+
814+/* Fill GDB's register array with the general-purpose register values
815+ in *GREGSETP. */
816+
817+void
818+supply_gregset (struct regcache *regcache, const elf_gregset_t *gregsetp)
819+{
820+ elf_greg_t *regp = (elf_greg_t *) gregsetp;
821+ int i;
822+
823+ for (i = 0; i < 23; i++)
824+ if (regmap[i] == -1)
825+ regcache_raw_supply (regcache, i, NULL);
826+ else
827+ regcache_raw_supply (regcache, i, (char *) (regp + regmap[i]));
828+}
829+
830+/* Fill register REGNO (if it is a general-purpose register) in
831+ *GREGSETPS with the value in GDB's register array. If REGNO is -1,
832+ do this for all registers. */
833+
834+void
835+fill_gregset (const struct regcache *regcache, elf_gregset_t *gregsetp, int regno)
836+{
837+ elf_greg_t *regp = (elf_greg_t *) gregsetp;
838+ int i;
839+
840+ for (i = 0; i < 23; i++)
841+ if (regmap[i] != -1 && (regno == -1 || regno == i))
842+ regcache_raw_collect (regcache, i, (char *) (regp + regmap[i]));
843+}
844+
845+/* Transfering floating-point registers between GDB, inferiors and cores. */
846+
847+/* Fill GDB's register array with the floating-point register values in
848+ *FPREGSETP. */
849+
850+void
851+supply_fpregset (struct regcache *regcache, const elf_fpregset_t *fpregsetp)
852+{
853+ int i;
854+ long *regp = (long *)fpregsetp;
855+
856+ for (i = 0; i < 16; i++)
857+ regcache_raw_supply (regcache, 25 + i, (char *) (regp + i));
858+ regcache_raw_supply (regcache, FPUL_REGNUM, (char *) (regp + REG_FPUL - REG_FPREG0));
859+ regcache_raw_supply (regcache, FPSCR_REGNUM, (char *) (regp + REG_FPSCR - REG_FPREG0));
860+}
861+
862+/* Fill register REGNO (if it is a floating-point register) in
863+ *FPREGSETP with the value in GDB's register array. If REGNO is -1,
864+ do this for all registers. */
865+
866+void
867+fill_fpregset (const struct regcache *regcache, elf_fpregset_t *fpregsetp, int regno)
868+{
869+ int i;
870+ long *regp = (long *)fpregsetp;
871+
872+ for (i = 0; i < 16; i++)
873+ if ((regno == -1) || (regno == i))
874+ regcache_raw_collect (regcache, 25 + i, (char *) (regp + i));
875+ if ((regno == -1) || regno == FPSCR_REGNUM)
876+ regcache_raw_collect (regcache, FPSCR_REGNUM, (char *) (regp + REG_FPSCR - REG_FPREG0));
877+ if ((regno == -1) || regno == FPUL_REGNUM)
878+ regcache_raw_collect (regcache, FPUL_REGNUM, (char *) (regp + REG_FPUL - REG_FPREG0));
879+}
880+
881+/* Transferring arbitrary registers between GDB and inferior. */
882+
883+/* Check if register REGNO in the child process is accessible.
884+ If we are accessing registers directly via the U area, only the
885+ general-purpose registers are available.
886+ All registers should be accessible if we have GETREGS support. */
887+
888+int
889+cannot_fetch_register (int regno)
890+{
891+ return (regno < 0 || regno >= sizeof regmap / sizeof regmap[0] || regmap[regno] == -1);
892+}
893+
894+int
895+cannot_store_register (int regno)
896+{
897+ return (regno < 0 || regno >= sizeof regmap / sizeof regmap[0] || regmap[regno] == -1);
898+}
899+
900+/* Fetch register values from the inferior.
901+ If REGNO is negative, do this for all registers.
902+ Otherwise, REGNO specifies which register (so we can save time). */
903+
904+static void
905+sh_linux_fetch_inferior_registers (struct target_ops *ops, struct regcache *regcache, int regno)
906+{
907+ int i;
908+ int tid;
909+
910+ /* GNU/Linux LWP ID's are process ID's. */
911+ if ((tid = TIDGET (inferior_ptid)) == 0)
912+ tid = PIDGET (inferior_ptid); /* Not a threaded program. */
913+
914+ for (i = 0; i < SH_LINUX_NUM_REGS; i++)
915+ if (regno == -1 || regno == i)
916+ fetch_register (regcache, tid, i);
917+}
918+/* Store our register values back into the inferior.
919+ If REGNO is negative, do this for all registers.
920+ Otherwise, REGNO specifies which register (so we can save time). */
921+
922+static void
923+sh_linux_store_inferior_registers (struct target_ops *ops, struct regcache *regcache, int regno)
924+{
925+ int i;
926+ int tid;
927+
928+ /* GNU/Linux LWP ID's are process ID's. */
929+ if ((tid = TIDGET (inferior_ptid)) == 0)
930+ tid = PIDGET (inferior_ptid); /* Not a threaded program. */
931+
932+ for (i = 0; i < SH_LINUX_NUM_REGS; i++)
933+ if (regno == -1 || regno == i)
934+ store_register (regcache, tid, i);
935+}
936+
937+void
938+_initialize_sh_linux_nat (void)
939+{
940+ struct target_ops *t;
941+
942+ /* Fill in the generic GNU/Linux methods. */
943+ t = linux_target ();
944+
945+ /* Add our register access methods. */
946+ t->to_fetch_registers = sh_linux_fetch_inferior_registers;
947+ t->to_store_registers = sh_linux_store_inferior_registers;
948+
949+ /* Register the target. */
950+ linux_nat_add_target (t);
951+}
952Index: gdb-7.9/gdb/sh-tdep.c
953===================================================================
954--- gdb-7.9.orig/gdb/sh-tdep.c
955+++ gdb-7.9/gdb/sh-tdep.c
956@@ -21,6 +21,9 @@ 605@@ -21,6 +21,9 @@
957 sac@cygnus.com. */ 606 sac@cygnus.com. */
958 607
@@ -971,7 +620,7 @@ Index: gdb-7.9/gdb/sh-tdep.c
971 #include "doublest.h" 620 #include "doublest.h"
972 #include "osabi.h" 621 #include "osabi.h"
973 #include "reggroups.h" 622 #include "reggroups.h"
974@@ -67,23 +71,6 @@ static const char *const sh_cc_enum[] = 623@@ -67,23 +71,6 @@ static const char *const sh_cc_enum[] = {
975 624
976 static const char *sh_active_calling_convention = sh_cc_gcc; 625 static const char *sh_active_calling_convention = sh_cc_gcc;
977 626
@@ -1004,7 +653,7 @@ Index: gdb-7.9/gdb/sh-tdep.c
1004 return 1; 653 return 1;
1005 /* Otherwise it's not treated as float. */ 654 /* Otherwise it's not treated as float. */
1006 return 0; 655 return 0;
1007@@ -1093,7 +1080,7 @@ sh_push_dummy_call_fpu (struct gdbarch * 656@@ -1093,7 +1080,7 @@ sh_push_dummy_call_fpu (struct gdbarch *gdbarch,
1008 in four registers available. Loop thru args from first to last. */ 657 in four registers available. Loop thru args from first to last. */
1009 for (argnum = 0; argnum < nargs; argnum++) 658 for (argnum = 0; argnum < nargs; argnum++)
1010 { 659 {
@@ -1013,7 +662,7 @@ Index: gdb-7.9/gdb/sh-tdep.c
1013 len = TYPE_LENGTH (type); 662 len = TYPE_LENGTH (type);
1014 val = sh_justify_value_in_reg (gdbarch, args[argnum], len); 663 val = sh_justify_value_in_reg (gdbarch, args[argnum], len);
1015 664
1016@@ -1821,7 +1808,7 @@ sh_dwarf2_frame_init_reg (struct gdbarch 665@@ -1821,7 +1808,7 @@ sh_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
1017 reg->how = DWARF2_FRAME_REG_UNDEFINED; 666 reg->how = DWARF2_FRAME_REG_UNDEFINED;
1018 } 667 }
1019 668
@@ -1031,7 +680,7 @@ Index: gdb-7.9/gdb/sh-tdep.c
1031 sh_frame_cache (struct frame_info *this_frame, void **this_cache) 680 sh_frame_cache (struct frame_info *this_frame, void **this_cache)
1032 { 681 {
1033 struct gdbarch *gdbarch = get_frame_arch (this_frame); 682 struct gdbarch *gdbarch = get_frame_arch (this_frame);
1034@@ -1915,9 +1902,9 @@ sh_frame_cache (struct frame_info *this_ 683@@ -1915,9 +1902,9 @@ sh_frame_cache (struct frame_info *this_frame, void **this_cache)
1035 return cache; 684 return cache;
1036 } 685 }
1037 686
@@ -1044,7 +693,7 @@ Index: gdb-7.9/gdb/sh-tdep.c
1044 { 693 {
1045 struct gdbarch *gdbarch = get_frame_arch (this_frame); 694 struct gdbarch *gdbarch = get_frame_arch (this_frame);
1046 struct sh_frame_cache *cache = sh_frame_cache (this_frame, this_cache); 695 struct sh_frame_cache *cache = sh_frame_cache (this_frame, this_cache);
1047@@ -1931,7 +1918,7 @@ sh_frame_prev_register (struct frame_inf 696@@ -1931,7 +1918,7 @@ sh_frame_prev_register (struct frame_info *this_frame,
1048 the current frame. Frob regnum so that we pull the value from 697 the current frame. Frob regnum so that we pull the value from
1049 the correct place. */ 698 the correct place. */
1050 if (regnum == gdbarch_pc_regnum (gdbarch)) 699 if (regnum == gdbarch_pc_regnum (gdbarch))
@@ -1053,7 +702,7 @@ Index: gdb-7.9/gdb/sh-tdep.c
1053 702
1054 if (regnum < SH_NUM_REGS && cache->saved_regs[regnum] != -1) 703 if (regnum < SH_NUM_REGS && cache->saved_regs[regnum] != -1)
1055 return frame_unwind_got_memory (this_frame, regnum, 704 return frame_unwind_got_memory (this_frame, regnum,
1056@@ -2237,8 +2224,8 @@ sh_return_in_first_hidden_param_p (struc 705@@ -2237,8 +2224,8 @@ sh_return_in_first_hidden_param_p (struct gdbarch *gdbarch,
1057 static struct gdbarch * 706 static struct gdbarch *
1058 sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) 707 sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1059 { 708 {
@@ -1063,7 +712,7 @@ Index: gdb-7.9/gdb/sh-tdep.c
1063 712
1064 /* SH5 is handled entirely in sh64-tdep.c. */ 713 /* SH5 is handled entirely in sh64-tdep.c. */
1065 if (info.bfd_arch_info->mach == bfd_mach_sh5) 714 if (info.bfd_arch_info->mach == bfd_mach_sh5)
1066@@ -2254,6 +2241,18 @@ sh_gdbarch_init (struct gdbarch_info inf 715@@ -2254,6 +2241,18 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1067 tdep = XCNEW (struct gdbarch_tdep); 716 tdep = XCNEW (struct gdbarch_tdep);
1068 gdbarch = gdbarch_alloc (&info, tdep); 717 gdbarch = gdbarch_alloc (&info, tdep);
1069 718
@@ -1082,7 +731,7 @@ Index: gdb-7.9/gdb/sh-tdep.c
1082 set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT); 731 set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT);
1083 set_gdbarch_int_bit (gdbarch, 4 * TARGET_CHAR_BIT); 732 set_gdbarch_int_bit (gdbarch, 4 * TARGET_CHAR_BIT);
1084 set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT); 733 set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT);
1085@@ -2404,10 +2403,11 @@ sh_gdbarch_init (struct gdbarch_info inf 734@@ -2404,10 +2403,11 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1086 break; 735 break;
1087 } 736 }
1088 737
@@ -1095,108 +744,93 @@ Index: gdb-7.9/gdb/sh-tdep.c
1095 frame_unwind_append_unwinder (gdbarch, &sh_stub_unwind); 744 frame_unwind_append_unwinder (gdbarch, &sh_stub_unwind);
1096 frame_unwind_append_unwinder (gdbarch, &sh_frame_unwind); 745 frame_unwind_append_unwinder (gdbarch, &sh_frame_unwind);
1097 746
1098Index: gdb-7.9/gdb/testsuite/gdb.asm/sh-linux.inc 747diff --git a/gdb/sh-tdep.h b/gdb/sh-tdep.h
1099=================================================================== 748index fc671a5..699f59f 100644
1100--- /dev/null 749--- a/gdb/sh-tdep.h
1101+++ gdb-7.9/gdb/testsuite/gdb.asm/sh-linux.inc 750+++ b/gdb/sh-tdep.h
1102@@ -0,0 +1,78 @@ 751@@ -21,6 +21,12 @@
1103+# You'll find a bunch of nop opcodes in the below macros. They are 752
1104+# there to keep the code correctly aligned. Be careful to maintain 753 /* Contributed by Steve Chamberlain sac@cygnus.com. */
1105+# them when changing the code. 754
1106+ 755+struct frame_info;
1107+ comment "subroutine declare" 756+struct gdbarch;
1108+ .purgem gdbasm_declare 757+struct reggroup;
1109+ .macro gdbasm_declare name 758+struct regset;
1110+ .align 1 759+struct regcache;
1111+ .global \name 760+
1112+\name: 761 /* Registers for all SH variants. Used also by sh3-rom.c. */
1113+ .endm 762 enum
1114+ 763 {
1115+ comment "subroutine prologue" 764@@ -29,6 +35,7 @@ enum
1116+ .macro gdbasm_enter 765 ARG0_REGNUM = 4,
1117+ mov.l r14,@-r15 766 ARGLAST_REGNUM = 7,
1118+ sts.l pr,@-r15 767 FP_REGNUM = 14,
1119+ mov r15,r14 768+ SP_REGNUM = 15,
1120+ nop 769 PC_REGNUM = 16,
1121+ .endm 770 PR_REGNUM = 17,
1122+ 771 GBR_REGNUM = 18,
1123+ comment "subroutine epilogue" 772@@ -81,6 +88,24 @@ enum
1124+ .macro gdbasm_leave 773 FV0_REGNUM = 76,
1125+ mov r14,r15 774 FV_LAST_REGNUM = 79
1126+ lds.l @r15+,pr 775 };
1127+ mov.l @r15+,r14 776+#define SH_NUM_REGS 67
1128+ rts 777+
1129+ nop 778+struct sh_frame_cache
1130+ nop 779+{
1131+ .endm 780+ /* Base address. */
1132+ 781+ CORE_ADDR base;
1133+ comment "subroutine end" 782+ LONGEST sp_offset;
1134+ .purgem gdbasm_end 783+ CORE_ADDR pc;
1135+ .macro gdbasm_end name 784+
1136+ .size \name, .-_foo1 785+ /* Flag showing that a frame has been created in the prologue code. */
1137+ .align 1 786+ int uses_fp;
1138+ .endm 787+
1139+ 788+ /* Saved registers. */
1140+ comment "subroutine call" 789+ CORE_ADDR saved_regs[SH_NUM_REGS];
1141+ .macro gdbasm_call subr 790+ CORE_ADDR saved_sp;
1142+ mov.l .Lconst\@,r1 791+};
1143+ bra .Lafterconst\@ 792+
1144+ nop 793+extern struct sh_frame_cache *sh_frame_cache (struct frame_info *next_frame, void **this_cache);
1145+ .align 2 794
1146+.Lconst\@: 795 /* This structure describes a register in a core-file. */
1147+ .long \subr 796 struct sh_corefile_regmap
1148+.Lafterconst\@: 797@@ -89,8 +114,32 @@ struct sh_corefile_regmap
1149+ jsr @r1 798 unsigned int offset;
1150+ nop 799 };
1151+ .endm 800
1152+ 801+/* sh architecture specific information. */
1153+ .macro gdbasm_several_nops 802 struct gdbarch_tdep
1154+ nop 803 {
1155+ nop 804+ /* General-purpose registers. */
1156+ nop 805+ struct regset *gregset;
1157+ nop 806+ int *gregset_reg_offset;
1158+ .endm 807+ int gregset_num_regs;
1159+ 808+ size_t sizeof_gregset;
1160+ comment "exit (0)" 809+
1161+ .macro gdbasm_exit0 810+ /* Floating-point registers. */
1162+ sleep 811+ struct regset *fpregset;
1163+ nop 812+ size_t sizeof_fpregset;
1164+ .endm 813+
1165+ 814+ /* Offset of saved PC in jmp_buf. */
1166+ comment "crt0 startup" 815+ int jb_pc_offset;
1167+ .macro gdbasm_startup 816+
1168+ mov #0,r14 817+ /* Detect sigtramp. */
1169+ .endm 818+ int (*sigtramp_p) (struct frame_info *);
1170+ 819+
1171+ comment "Declare a data variable" 820+ /* Get address of sigcontext for sigtramp. */
1172+ .purgem gdbasm_datavar 821+ CORE_ADDR (*sigcontext_addr) (struct frame_info *);
1173+ .macro gdbasm_datavar name value 822+
1174+ .data 823+ /* Offset of registers in `struct sigcontext'. */
1175+ .align 2 824+ int *sc_reg_offset;
1176+ .type \name, @object 825+ int sc_num_regs;
1177+ .size \name, 4 826+
1178+\name: 827 /* Non-NULL when debugging from a core file. Provides the offset
1179+ .long \value 828 where each general-purpose register is stored inside the associated
1180+ .endm 829 core file section. */
1181Index: gdb-7.9/gdb/testsuite/gdb.asm/sh.inc 830diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp
1182=================================================================== 831index 8854af0..ef44682 100644
1183--- gdb-7.9.orig/gdb/testsuite/gdb.asm/sh.inc 832--- a/gdb/testsuite/gdb.asm/asm-source.exp
1184+++ gdb-7.9/gdb/testsuite/gdb.asm/sh.inc 833+++ b/gdb/testsuite/gdb.asm/asm-source.exp
1185@@ -40,9 +40,8 @@
1186 mov.l .Lconst\@,r1
1187 bra .Lafterconst\@
1188 nop
1189- nop
1190-.Lconst\@:
1191 .align 2
1192+.Lconst\@:
1193 .long \subr
1194 .align 1
1195 .Lafterconst\@:
1196Index: gdb-7.9/gdb/testsuite/gdb.asm/asm-source.exp
1197===================================================================
1198--- gdb-7.9.orig/gdb/testsuite/gdb.asm/asm-source.exp
1199+++ gdb-7.9/gdb/testsuite/gdb.asm/asm-source.exp
1200@@ -113,6 +113,11 @@ switch -glob -- [istarget] { 834@@ -113,6 +113,11 @@ switch -glob -- [istarget] {
1201 append link-flags " -m elf32ppc" 835 append link-flags " -m elf32ppc"
1202 } 836 }
@@ -1209,170 +843,79 @@ Index: gdb-7.9/gdb/testsuite/gdb.asm/asm-source.exp
1209 "sh*-*-*" { 843 "sh*-*-*" {
1210 set asm-arch sh 844 set asm-arch sh
1211 set debug-flags "-gdwarf-2" 845 set debug-flags "-gdwarf-2"
1212Index: gdb-7.9/gdb/testsuite/gdb.base/sigall.c 846diff --git a/gdb/testsuite/gdb.asm/sh.inc b/gdb/testsuite/gdb.asm/sh.inc
1213=================================================================== 847index a4a5fc5..89efed7 100644
1214--- gdb-7.9.orig/gdb/testsuite/gdb.base/sigall.c 848--- a/gdb/testsuite/gdb.asm/sh.inc
1215+++ gdb-7.9/gdb/testsuite/gdb.base/sigall.c 849+++ b/gdb/testsuite/gdb.asm/sh.inc
850@@ -40,9 +40,8 @@
851 mov.l .Lconst\@,r1
852 bra .Lafterconst\@
853 nop
854- nop
855-.Lconst\@:
856 .align 2
857+.Lconst\@:
858 .long \subr
859 .align 1
860 .Lafterconst\@:
861diff --git a/gdb/testsuite/gdb.base/annota1.c b/gdb/testsuite/gdb.base/annota1.c
862index 424e1b8..0de2e7b 100644
863--- a/gdb/testsuite/gdb.base/annota1.c
864+++ b/gdb/testsuite/gdb.base/annota1.c
1216@@ -1,6 +1,9 @@ 865@@ -1,6 +1,9 @@
866 #include <stdio.h>
1217 #include <signal.h> 867 #include <signal.h>
1218 #include <unistd.h>
1219 868
1220+#ifdef __sh__ 869+#ifdef __sh__
1221+#define signal(a,b) /* Signals not supported on this target - make them go away */ 870+#define signal(a,b) /* Signals not supported on this target - make them go away */
1222+#endif 871+#endif
1223 872
1224 /* Signal handlers, we set breakpoints in them to make sure that the 873 void
1225 signals really get delivered. */ 874 handle_USR1 (int sig)
1226Index: gdb-7.9/gdb/testsuite/gdb.base/signals.c 875diff --git a/gdb/testsuite/gdb.base/annota3.c b/gdb/testsuite/gdb.base/annota3.c
1227=================================================================== 876index 424e1b8..952aaf2 100644
1228--- gdb-7.9.orig/gdb/testsuite/gdb.base/signals.c 877--- a/gdb/testsuite/gdb.base/annota3.c
1229+++ gdb-7.9/gdb/testsuite/gdb.base/signals.c 878+++ b/gdb/testsuite/gdb.base/annota3.c
1230@@ -3,6 +3,10 @@ 879@@ -1,6 +1,10 @@
880 #include <stdio.h>
1231 #include <signal.h> 881 #include <signal.h>
1232 #include <unistd.h>
1233 882
1234+#ifdef __sh__ 883+#ifdef __sh__
1235+#define signal(a,b) /* Signals not supported on this target - make them go away */ 884+#define signal(a,b) /* Signals not supported on this target - make them go away */
1236+#define alarm(a) /* Ditto for alarm() */
1237+#endif 885+#endif
886+
1238 887
1239 static int count = 0; 888 void
1240 889 handle_USR1 (int sig)
1241Index: gdb-7.9/gdb/testsuite/gdb.base/annota1.c 890diff --git a/gdb/testsuite/gdb.base/sigall.c b/gdb/testsuite/gdb.base/sigall.c
1242=================================================================== 891index 81f3b08..1574b2d 100644
1243--- gdb-7.9.orig/gdb/testsuite/gdb.base/annota1.c 892--- a/gdb/testsuite/gdb.base/sigall.c
1244+++ gdb-7.9/gdb/testsuite/gdb.base/annota1.c 893+++ b/gdb/testsuite/gdb.base/sigall.c
1245@@ -1,6 +1,9 @@ 894@@ -1,6 +1,9 @@
1246 #include <stdio.h>
1247 #include <signal.h> 895 #include <signal.h>
896 #include <unistd.h>
1248 897
1249+#ifdef __sh__ 898+#ifdef __sh__
1250+#define signal(a,b) /* Signals not supported on this target - make them go away */ 899+#define signal(a,b) /* Signals not supported on this target - make them go away */
1251+#endif 900+#endif
1252 901
1253 void 902 /* Signal handlers, we set breakpoints in them to make sure that the
1254 handle_USR1 (int sig) 903 signals really get delivered. */
1255Index: gdb-7.9/gdb/testsuite/gdb.base/annota3.c 904diff --git a/gdb/testsuite/gdb.base/signals.c b/gdb/testsuite/gdb.base/signals.c
1256=================================================================== 905index 7566068..1205a9b 100644
1257--- gdb-7.9.orig/gdb/testsuite/gdb.base/annota3.c 906--- a/gdb/testsuite/gdb.base/signals.c
1258+++ gdb-7.9/gdb/testsuite/gdb.base/annota3.c 907+++ b/gdb/testsuite/gdb.base/signals.c
1259@@ -1,6 +1,10 @@ 908@@ -3,6 +3,10 @@
1260 #include <stdio.h>
1261 #include <signal.h> 909 #include <signal.h>
910 #include <unistd.h>
1262 911
1263+#ifdef __sh__ 912+#ifdef __sh__
1264+#define signal(a,b) /* Signals not supported on this target - make them go away */ 913+#define signal(a,b) /* Signals not supported on this target - make them go away */
914+#define alarm(a) /* Ditto for alarm() */
1265+#endif 915+#endif
1266+
1267 916
1268 void 917 static int count = 0;
1269 handle_USR1 (int sig) 918
1270Index: gdb-7.9/gdb/config/sh/xm-linux.h 919--
1271=================================================================== 9202.1.4
1272--- /dev/null 921
1273+++ gdb-7.9/gdb/config/sh/xm-linux.h
1274@@ -0,0 +1,32 @@
1275+/* Native support for GNU/Linux, for GDB, the GNU debugger.
1276+ Copyright (C) 2000 Free Software Foundation, Inc.
1277+
1278+This file is part of GDB.
1279+
1280+This program is free software; you can redistribute it and/or modify
1281+it under the terms of the GNU General Public License as published by
1282+the Free Software Foundation; either version 2 of the License, or
1283+(at your option) any later version.
1284+
1285+This program is distributed in the hope that it will be useful,
1286+but WITHOUT ANY WARRANTY; without even the implied warranty of
1287+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1288+GNU General Public License for more details.
1289+
1290+You should have received a copy of the GNU General Public License
1291+along with this program; if not, write to the Free Software
1292+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
1293+
1294+#ifndef XM_LINUX_H
1295+#define XM_LINUX_H
1296+
1297+#define HOST_BYTE_ORDER LITTLE_ENDIAN
1298+
1299+#define HAVE_TERMIOS
1300+
1301+#define NEED_POSIX_SETPGID
1302+
1303+/* Need R_OK etc, but USG isn't defined. */
1304+#include <unistd.h>
1305+
1306+#endif /* #ifndef XM_LINUX_H */
1307Index: gdb-7.9/gdb/config/sh/nm-linux.h
1308===================================================================
1309--- /dev/null
1310+++ gdb-7.9/gdb/config/sh/nm-linux.h
1311@@ -0,0 +1,54 @@
1312+/* Native-dependent definitions for SuperH running Linux, for GDB.
1313+ Copyright 2004 Free Software Foundation, Inc.
1314+
1315+ This file is part of GDB.
1316+
1317+ This program is free software; you can redistribute it and/or modify
1318+ it under the terms of the GNU General Public License as published by
1319+ the Free Software Foundation; either version 2 of the License, or
1320+ (at your option) any later version.
1321+
1322+ This program is distributed in the hope that it will be useful,
1323+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1324+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1325+ GNU General Public License for more details.
1326+
1327+ You should have received a copy of the GNU General Public License
1328+ along with this program; if not, write to the Free Software
1329+ Foundation, Inc., 59 Temple Place - Suite 330,
1330+ Boston, MA 02111-1307, USA. */
1331+
1332+#ifndef NM_LINUX_H
1333+#define NM_LINUX_H
1334+
1335+/* Get generic Linux native definitions. */
1336+#include "config/nm-linux.h"
1337+/* Support for the user area. */
1338+
1339+/* Return the size of the user struct. */
1340+extern int kernel_u_size (void);
1341+#define KERNEL_U_SIZE kernel_u_size()
1342+
1343+/* This is the amount to substract from u.u_ar0 to get the offset in
1344+ the core file of the register values. */
1345+#define KERNEL_U_ADDR 0
1346+
1347+#define U_REGS_OFFSET 0
1348+
1349+extern CORE_ADDR register_u_addr (CORE_ADDR blockend, int regnum);
1350+#define REGISTER_U_ADDR(addr, blockend, regnum) \
1351+ (addr) = register_u_addr (blockend, regnum)
1352+
1353+/* Override copies of {fetch,store}_inferior_registers in `infptrace.c'. */
1354+#define FETCH_INFERIOR_REGISTERS
1355+
1356+/* Nevertheless, define CANNOT_{FETCH,STORE}_REGISTER, because we
1357+ might fall back on the code `infptrace.c' (well a copy of that code
1358+ in `sh-linux-nat.c' for now) and we can access only the
1359+ general-purpose registers in that way. */
1360+extern int cannot_fetch_register (int regno);
1361+extern int cannot_store_register (int regno);
1362+#define CANNOT_FETCH_REGISTER(regno) cannot_fetch_register (regno)
1363+#define CANNOT_STORE_REGISTER(regno) cannot_store_register (regno)
1364+
1365+#endif /* NM_LINUX_H */
1366Index: gdb-7.9/gdb/config/sh/linux.mh
1367===================================================================
1368--- /dev/null
1369+++ gdb-7.9/gdb/config/sh/linux.mh
1370@@ -0,0 +1,8 @@
1371+# Host: Renesas Super-H running GNU/Linux
1372+NAT_FILE= config/sh/nm-linux.h
1373+NATDEPFILES= inf-ptrace.o fork-child.o corelow.o sh-linux-nat.o \
1374+ proc-service.o linux-thread-db.o gcore.o \
1375+ linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
1376+
1377+NAT_CDEPS = $(srcdir)/proc-service.list
1378+LOADLIBES= -ldl $(RDYNAMIC)
diff --git a/meta/recipes-devtools/gdb/gdb/0004-Change-comment-in-gdb-compile.patch b/meta/recipes-devtools/gdb/gdb/0004-Change-comment-in-gdb-compile.patch
new file mode 100644
index 0000000000..4df552c019
--- /dev/null
+++ b/meta/recipes-devtools/gdb/gdb/0004-Change-comment-in-gdb-compile.patch
@@ -0,0 +1,48 @@
1Upstream-Status: Backport
2
3From 09de64b93c2402e068daf0bce1c4a1dda833b646 Mon Sep 17 00:00:00 2001
4From: Jan Kratochvil <jan.kratochvil@redhat.com>
5Date: Thu, 26 Feb 2015 11:52:28 +0100
6Subject: [PATCH] Change // comment in gdb/compile/
7
8gdb/ChangeLog
92015-02-26 Jan Kratochvil <jan.kratochvil@redhat.com>
10
11 PR build/18033
12 * compile/compile-c-support.c (c_compute_program): Change // comment.
13 * compile/compile-object-load.c (setup_sections): Change // comment.
14---
15 gdb/ChangeLog | 6 ++++++
16 gdb/compile/compile-c-support.c | 2 +-
17 gdb/compile/compile-object-load.c | 2 +-
18 3 files changed, 8 insertions(+), 2 deletions(-)
19
20diff --git a/gdb/compile/compile-c-support.c b/gdb/compile/compile-c-support.c
21index 8f1f45d..1711cda 100644
22--- a/gdb/compile/compile-c-support.c
23+++ b/gdb/compile/compile-c-support.c
24@@ -351,7 +351,7 @@ c_compute_program (struct compile_instance *inst,
25 " __gdb_intptr;\n",
26 buf);
27
28- // Iterate all log2 sizes in bytes supported by c_get_mode_for_size.
29+ /* Iterate all log2 sizes in bytes supported by c_get_mode_for_size. */
30 for (i = 0; i < 4; ++i)
31 {
32 const char *mode = c_get_mode_for_size (1 << i);
33diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c
34index 5903f18..e187970 100644
35--- a/gdb/compile/compile-object-load.c
36+++ b/gdb/compile/compile-object-load.c
37@@ -67,7 +67,7 @@ setup_sections (bfd *abfd, asection *sect, void *data_voidp)
38 if ((bfd_get_section_flags (abfd, sect) & SEC_ALLOC) == 0)
39 return;
40
41- // Make the memory always readable.
42+ /* Make the memory always readable. */
43 prot = GDB_MMAP_PROT_READ;
44 if ((bfd_get_section_flags (abfd, sect) & SEC_READONLY) == 0)
45 prot |= GDB_MMAP_PROT_WRITE;
46--
472.1.4
48
diff --git a/meta/recipes-devtools/gdb/gdb/sim-install-6.6.patch b/meta/recipes-devtools/gdb/gdb/sim-install-6.6.patch
deleted file mode 100644
index f67c25d50e..0000000000
--- a/meta/recipes-devtools/gdb/gdb/sim-install-6.6.patch
+++ /dev/null
@@ -1,14 +0,0 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3--- gdb-6.1/sim/common/Makefile.in~ 2004-01-15 21:25:06.000000000 +0000
4+++ gdb-6.1/sim/common/Makefile.in 2004-07-22 17:07:46.237809032 +0100
5@@ -34,7 +34,7 @@
6
7 datadir = @datadir@
8 mandir = @mandir@
9-man1dir = $(mandir)/man1
10+man1dir = $(DESTDIR)$(mandir)/man1
11 infodir = @infodir@
12 includedir = @includedir@
13
14
diff --git a/meta/recipes-devtools/gdb/gdb/sim-install.patch b/meta/recipes-devtools/gdb/gdb/sim-install.patch
deleted file mode 100644
index a663ba7b81..0000000000
--- a/meta/recipes-devtools/gdb/gdb/sim-install.patch
+++ /dev/null
@@ -1,36 +0,0 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3--- gdb-6.1/sim/common/Makefile.in~ 2004-01-15 21:25:06.000000000 +0000
4+++ gdb-6.1/sim/common/Makefile.in 2004-07-22 17:07:46.237809032 +0100
5@@ -34,7 +34,7 @@
6
7 datadir = @datadir@
8 mandir = @mandir@
9-man1dir = $(mandir)/man1
10+man1dir = $(DESTDIR)$(mandir)/man1
11 infodir = @infodir@
12 includedir = @includedir@
13
14
15--- gdb-6.1/sim/common/Make-common.in~sim-install.patch 2003-09-08 18:24:59.000000000 +0100
16+++ gdb-6.1/sim/common/Make-common.in 2004-07-22 17:56:18.947423032 +0100
17@@ -581,14 +581,14 @@
18
19 install-common: installdirs
20 n=`echo run | sed '$(program_transform_name)'`; \
21- $(INSTALL_PROGRAM) run$(EXEEXT) $(bindir)/$$n$(EXEEXT)
22+ $(INSTALL_PROGRAM) run$(EXEEXT) $(DESTDIR)$(bindir)/$$n$(EXEEXT)
23 n=`echo libsim.a | sed s/libsim.a/lib$(target_alias)-sim.a/`; \
24- $(INSTALL_DATA) libsim.a $(libdir)/$$n ; \
25- ( cd $(libdir) ; $(RANLIB) $$n )
26+ $(INSTALL_DATA) libsim.a $(DESTDIR)$(libdir)/$$n ; \
27+ ( cd $(DESTDIR)$(libdir) ; $(RANLIB) $$n )
28
29 installdirs:
30- $(SHELL) $(srcdir)/../../mkinstalldirs $(bindir)
31- $(SHELL) $(srcdir)/../../mkinstalldirs $(libdir)
32+ $(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(bindir)
33+ $(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(libdir)
34
35 check:
36 cd ../testsuite && $(MAKE) check RUNTESTFLAGS="$(RUNTESTFLAGS)"
diff --git a/meta/recipes-devtools/gdb/gdb/uclibc.patch b/meta/recipes-devtools/gdb/gdb/uclibc.patch
deleted file mode 100644
index f5fd518fcf..0000000000
--- a/meta/recipes-devtools/gdb/gdb/uclibc.patch
+++ /dev/null
@@ -1,196 +0,0 @@
1Upstream-Status: Pending
2
3--- binutils-2.15.91.0.1/bfd/config.bfd~binutils-2.15.90.0.3-uclibc-100-conf
4+++ binutils-2.15.91.0.1/bfd/config.bfd
5@@ -128,7 +128,7 @@
6 targ_defvec=ecoffalpha_little_vec
7 targ_selvecs=bfd_elf64_alpha_vec
8 ;;
9- alpha*-*-linux-gnu* | alpha*-*-elf*)
10+ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc* | alpha*-*-elf*)
11 targ_defvec=bfd_elf64_alpha_vec
12 targ_selvecs=ecoffalpha_little_vec
13 ;;
14@@ -138,7 +138,7 @@
15 alpha*-*-*)
16 targ_defvec=ecoffalpha_little_vec
17 ;;
18- ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu)
19+ ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-elf* | ia64*-*-linux-uclibc* | ia64*-*-kfreebsd*-gnu)
20 targ_defvec=bfd_elf64_ia64_little_vec
21 targ_selvecs="bfd_elf64_ia64_big_vec bfd_efi_app_ia64_vec"
22 ;;
23@@ -215,7 +215,7 @@
24 targ_defvec=bfd_elf32_littlearm_vec
25 targ_selvecs=bfd_elf32_bigarm_vec
26 ;;
27- armeb-*-elf | arm*b-*-linux-gnu*)
28+ armeb-*-elf | arm*b-*-linux-gnu* | arm*b-*-linux-uclibc*)
29 targ_defvec=bfd_elf32_bigarm_vec
30 targ_selvecs=bfd_elf32_littlearm_vec
31 ;;
32@@ -223,8 +223,8 @@
33 targ_defvec=bfd_elf32_littlearm_vec
34 targ_selvecs=bfd_elf32_bigarm_vec
35 ;;
36- arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-conix* | \
37- arm*-*-uclinux* | arm-*-kfreebsd*-gnu | arm-*-vxworks)
38+ arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-linux-uclibc* | \
39+ arm*-*-conix* | arm*-*-uclinux* | arm-*-kfreebsd*-gnu | arm-*-vxworks)
40 targ_defvec=bfd_elf32_littlearm_vec
41 targ_selvecs=bfd_elf32_bigarm_vec
42 ;;
43@@ -367,7 +367,7 @@
44 ;;
45
46 #ifdef BFD64
47- hppa*64*-*-linux-gnu*)
48+ hppa*64*-*-linux-gnu* | hppa*64*-*-linux-uclibc*)
49 targ_defvec=bfd_elf64_hppa_linux_vec
50 targ_selvecs=bfd_elf64_hppa_vec
51 ;;
52@@ -378,7 +378,7 @@
53 ;;
54 #endif
55
56- hppa*-*-linux-gnu* | hppa*-*-netbsd*)
57+ hppa*-*-linux-gnu* | hppa*-*-netbsd* | hppa*-*-linux-uclibc*)
58 targ_defvec=bfd_elf32_hppa_linux_vec
59 targ_selvecs=bfd_elf32_hppa_vec
60 ;;
61@@ -501,7 +501,7 @@
62 targ_selvecs=bfd_elf32_i386_vec
63 targ_underscore=yes
64 ;;
65- i[3-7]86-*-linux-gnu*)
66+ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*)
67 targ_defvec=bfd_elf32_i386_vec
68 targ_selvecs="i386linux_vec bfd_efi_app_ia32_vec"
69 targ64_selvecs=bfd_elf64_x86_64_vec
70@@ -515,7 +515,7 @@
71 targ_defvec=bfd_elf64_x86_64_vec
72 targ_selvecs="bfd_elf32_i386_vec i386netbsd_vec i386coff_vec bfd_efi_app_ia32_vec"
73 ;;
74- x86_64-*-linux-gnu*)
75+ x86_64-*-linux-gnu* | x86_64-*-linux-uclibc*)
76 targ_defvec=bfd_elf64_x86_64_vec
77 targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec"
78 ;;
79@@ -690,7 +690,7 @@
80 targ_selvecs=bfd_elf32_m68k_vec
81 targ_underscore=yes
82 ;;
83- m68*-*-linux-gnu*)
84+ m68*-*-linux-gnu* | m68*-*-linux-uclibc*)
85 targ_defvec=bfd_elf32_m68k_vec
86 targ_selvecs=m68klinux_vec
87 ;;
88@@ -966,7 +966,8 @@
89 ;;
90 #endif
91 powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \
92- powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-rtems* | \
93+ powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-linux-uclibc* | \
94+ powerpc-*-rtems* | \
95 powerpc-*-chorus* | powerpc-*-vxworks* | powerpc-*-windiss*)
96 targ_defvec=bfd_elf32_powerpc_vec
97 targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec"
98@@ -1003,8 +1004,8 @@
99 targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec"
100 ;;
101 powerpcle-*-elf* | powerpcle-*-sysv4* | powerpcle-*-eabi* | \
102- powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-vxworks* |\
103- powerpcle-*-rtems*)
104+ powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-linux-uclibc* |\
105+ powerpcle-*-vxworks* | powerpcle-*-rtems*)
106 targ_defvec=bfd_elf32_powerpcle_vec
107 targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec"
108 targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec"
109@@ -1165,7 +1166,7 @@
110 targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec"
111 targ_underscore=yes
112 ;;
113- sparc-*-linux-gnu*)
114+ sparc-*-linux-gnu* | sparc-*-linux-uclibc*)
115 targ_defvec=bfd_elf32_sparc_vec
116 targ_selvecs="sparclinux_vec bfd_elf64_sparc_vec sunos_big_vec"
117 ;;
118@@ -1212,7 +1213,7 @@
119 targ_defvec=sunos_big_vec
120 targ_underscore=yes
121 ;;
122- sparc64-*-linux-gnu*)
123+ sparc64-*-linux-gnu* | sparc64-*-linux-uclibc*)
124 targ_defvec=bfd_elf64_sparc_vec
125 targ_selvecs="bfd_elf32_sparc_vec sparclinux_vec sunos_big_vec"
126 ;;
127--- binutils-2.15.91.0.1/bfd/configure~binutils-2.15.90.0.3-uclibc-100-conf
128+++ binutils-2.15.91.0.1/bfd/configure
129@@ -1687,6 +1687,11 @@
130 lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
131 ;;
132
133+linux-uclibc*)
134+ lt_cv_deplibs_check_method=pass_all
135+ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
136+ ;;
137+
138 netbsd*)
139 if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
140 lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
141@@ -5266,7 +5271,7 @@
142 alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
143 COREFILE=''
144 ;;
145- alpha*-*-linux-gnu*)
146+ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc*)
147 COREFILE=trad-core.lo
148 TRAD_HEADER='"hosts/alphalinux.h"'
149 ;;
150@@ -5326,7 +5331,7 @@
151 COREFILE=trad-core.lo
152 TRAD_HEADER='"hosts/i386mach3.h"'
153 ;;
154- i[3-7]86-*-linux-gnu*)
155+ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*)
156 COREFILE=trad-core.lo
157 TRAD_HEADER='"hosts/i386linux.h"'
158 ;;
159@@ -5364,7 +5369,7 @@
160 COREFILE=trad-core.lo
161 TRAD_HEADER='"hosts/hp300bsd.h"'
162 ;;
163- m68*-*-linux-gnu*)
164+ m68*-*-linux-gnu* | m68*-*-linux-uclibc*)
165 COREFILE=trad-core.lo
166 TRAD_HEADER='"hosts/m68klinux.h"'
167 ;;
168--- binutils-2.15.91.0.1/bfd/configure.in~binutils-2.15.90.0.3-uclibc-100-conf
169+++ binutils-2.15.91.0.1/bfd/configure.in
170@@ -164,7 +164,7 @@
171 alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
172 COREFILE=''
173 ;;
174- alpha*-*-linux-gnu*)
175+ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc*)
176 COREFILE=trad-core.lo
177 TRAD_HEADER='"hosts/alphalinux.h"'
178 ;;
179@@ -245,7 +245,7 @@
180 TRAD_HEADER='"hosts/i386mach3.h"'
181 ;;
182 changequote(,)dnl
183- i[3-7]86-*-linux-gnu*)
184+ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*)
185 changequote([,])dnl
186 COREFILE=trad-core.lo
187 TRAD_HEADER='"hosts/i386linux.h"'
188@@ -286,7 +286,7 @@
189 COREFILE=trad-core.lo
190 TRAD_HEADER='"hosts/hp300bsd.h"'
191 ;;
192- m68*-*-linux-gnu*)
193+ m68*-*-linux-gnu* | m68*-*-linux-uclibc*)
194 COREFILE=trad-core.lo
195 TRAD_HEADER='"hosts/m68klinux.h"'
196 ;;