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-7.6.2.inc12
-rw-r--r--meta/recipes-devtools/gdb/gdb-common.inc68
-rw-r--r--meta/recipes-devtools/gdb/gdb-cross-canadian.inc35
-rw-r--r--meta/recipes-devtools/gdb/gdb-cross-canadian_7.6.2.bb3
-rw-r--r--meta/recipes-devtools/gdb/gdb-cross.inc14
-rw-r--r--meta/recipes-devtools/gdb/gdb-cross_7.6.2.bb4
-rw-r--r--meta/recipes-devtools/gdb/gdb.inc51
-rw-r--r--meta/recipes-devtools/gdb/gdb/0001-add-delay-before-run-exp-file.patch26
-rw-r--r--meta/recipes-devtools/gdb/gdb/0002-function-name-is-used-by-mistake.patch30
-rw-r--r--meta/recipes-devtools/gdb/gdb/gdb-fix-cygwin-check-in-configure-script.patch38
-rw-r--r--meta/recipes-devtools/gdb/gdb/gdb-ptest-attach.patch30
-rw-r--r--meta/recipes-devtools/gdb/gdb/gdbserver-cflags-last.diff25
-rw-r--r--meta/recipes-devtools/gdb/gdb/kill_arm_map_symbols.patch26
-rw-r--r--meta/recipes-devtools/gdb/gdb/renesas-sh-native-support.patch1379
-rwxr-xr-xmeta/recipes-devtools/gdb/gdb/run-ptest2
-rw-r--r--meta/recipes-devtools/gdb/gdb/runtest-flags.patch30
-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
-rw-r--r--meta/recipes-devtools/gdb/gdb_7.6.2.bb23
20 files changed, 2042 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gdb/gdb-7.6.2.inc b/meta/recipes-devtools/gdb/gdb-7.6.2.inc
new file mode 100644
index 0000000000..ea69b397f5
--- /dev/null
+++ b/meta/recipes-devtools/gdb/gdb-7.6.2.inc
@@ -0,0 +1,12 @@
1LICENSE = "GPLv2 & GPLv3 & LGPLv2 & LGPLv3"
2LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
3 file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
4 file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6 \
5 file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674"
6
7SRC_URI += " file://gdb-fix-cygwin-check-in-configure-script.patch "
8
9S = "${WORKDIR}/${BPN}-${PV}"
10
11SRC_URI[md5sum] = "9ebf09fa76e4ca6034157086e9b20348"
12SRC_URI[sha256sum] = "17f7bcda1b24336aadcb1c5e703c355551e59467e221c6f4353b720dffad73a7"
diff --git a/meta/recipes-devtools/gdb/gdb-common.inc b/meta/recipes-devtools/gdb/gdb-common.inc
new file mode 100644
index 0000000000..211a574217
--- /dev/null
+++ b/meta/recipes-devtools/gdb/gdb-common.inc
@@ -0,0 +1,68 @@
1SUMMARY = "GNU debugger"
2HOMEPAGE = "http://www.gnu.org/software/gdb/"
3LICENSE = "GPLv3+"
4SECTION = "devel"
5DEPENDS = "expat ncurses readline ${LTTNGUST}"
6
7LTTNGUST = "lttng-ust"
8LTTNGUST_aarch64 = ""
9LTTNGUST_libc-uclibc = ""
10LTTNGUST_mips = ""
11LTTNGUST_mipsel = ""
12LTTNGUST_mips64 = ""
13LTTNGUST_mips64el = ""
14LTTNGUST_sh4 = ""
15
16INC_PR = "r0"
17
18LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552 \
19 file://COPYING.LIB;md5=9f604d8a4f8e74f4f5140845a21b6674 \
20 file://COPYING3;md5=d32239bcb673463ab874e80d47fae504 \
21 file://COPYING3.LIB;md5=6a6a8e020838b23406c81b19c1d46df6"
22inherit autotools
23
24SRC_URI = "${GNU_MIRROR}/gdb/gdb-${PV}.tar.gz \
25 "
26export CC_FOR_BUILD = "${BUILD_CC}"
27export CXX_FOR_BUILD = "${BUILD_CXX}"
28export CPP_FOR_BUILD = "${BUILD_CPP}"
29export CFLAGS_FOR_BUILD = "${BUILD_CFLAGS}"
30export CXXFLAGS_FOR_BUILD = "${BUILD_CXXFLAGS}"
31export CPPFLAGS_FOR_BUILD = "${BUILD_CPPFLAGS}"
32
33B = "${WORKDIR}/build-${TARGET_SYS}"
34
35EXTRA_OEMAKE = "'SUBDIRS=intl mmalloc libiberty opcodes bfd sim gdb etc utils'"
36
37EXPAT = "--with-expat --with-libexpat-prefix=${STAGING_DIR_HOST}"
38
39EXTRA_OECONF = "--disable-gdbtk --disable-tui --disable-x --disable-werror \
40 --with-curses --disable-multilib --with-system-readline --disable-sim \
41 --without-lzma \
42 ${GDBPROPREFIX} ${EXPAT} \
43 ${@base_contains('DISTRO_FEATURES', 'multiarch', '--enable-64-bit-bfd', '', d)} \
44 --disable-rpath \
45 "
46
47GDBPROPREFIX = "--program-prefix=''"
48
49do_configure () {
50 # override this function to avoid the autoconf/automake/aclocal/autoheader
51 # calls for now
52 (cd ${S} && gnu-configize) || die "failure in running gnu-configize"
53 oe_runconf
54}
55
56# we don't want gdb to provide bfd/iberty/opcodes, which instead will override the
57# right bits installed by binutils.
58do_install_append() {
59 rm -rf ${D}${libdir}
60 rm -rf ${D}${includedir}
61 rm -rf ${D}${datadir}/locale
62}
63
64RRECOMMENDS_gdb_append_linux = " glibc-thread-db "
65RRECOMMENDS_gdb_append_linux-gnueabi = " glibc-thread-db "
66RRECOMMENDS_gdbserver_append_linux = " glibc-thread-db "
67RRECOMMENDS_gdbserver_append_linux-gnueabi = " glibc-thread-db "
68
diff --git a/meta/recipes-devtools/gdb/gdb-cross-canadian.inc b/meta/recipes-devtools/gdb/gdb-cross-canadian.inc
new file mode 100644
index 0000000000..8b2dbe057f
--- /dev/null
+++ b/meta/recipes-devtools/gdb/gdb-cross-canadian.inc
@@ -0,0 +1,35 @@
1inherit cross-canadian
2inherit python-dir
3
4SUMMARY = "GNU debugger (cross-canadian gdb for ${TARGET_ARCH} target)"
5PN = "gdb-cross-canadian-${TRANSLATED_TARGET_ARCH}"
6BPN = "gdb"
7
8DEPENDS = "nativesdk-ncurses nativesdk-expat nativesdk-gettext nativesdk-readline nativesdk-python"
9RDEPENDS_${PN} += "nativesdk-python-core nativesdk-python-lang nativesdk-python-re \
10 nativesdk-python-codecs nativesdk-python-netclient"
11
12GDBPROPREFIX = "--program-prefix='${TARGET_PREFIX}'"
13
14EXTRA_OECONF_append = "--with-python=${WORKDIR}/python"
15
16do_configure_prepend() {
17cat > ${WORKDIR}/python << EOF
18#! /bin/sh
19case "\$2" in
20 --includes) echo "-I${STAGING_INCDIR}/${PYTHON_DIR}/" ;;
21 --ldflags) echo "-Wl,-rpath-link,${STAGING_LIBDIR}/.. -Wl,-rpath,${libdir}/.. -lpthread -ldl -lutil -lm -lpython${PYTHON_BASEVERSION}" ;;
22 --exec-prefix) echo "${exec_prefix}" ;;
23 *) exit 1 ;;
24esac
25exit 0
26EOF
27 chmod +x ${WORKDIR}/python
28}
29
30# we don't want gdb to provide bfd/iberty/opcodes, which instead will override the
31# right bits installed by binutils.
32do_install_append() {
33 rm -rf ${D}${exec_prefix}/lib
34}
35
diff --git a/meta/recipes-devtools/gdb/gdb-cross-canadian_7.6.2.bb b/meta/recipes-devtools/gdb/gdb-cross-canadian_7.6.2.bb
new file mode 100644
index 0000000000..301035940c
--- /dev/null
+++ b/meta/recipes-devtools/gdb/gdb-cross-canadian_7.6.2.bb
@@ -0,0 +1,3 @@
1require gdb-common.inc
2require gdb-cross-canadian.inc
3require gdb-${PV}.inc
diff --git a/meta/recipes-devtools/gdb/gdb-cross.inc b/meta/recipes-devtools/gdb/gdb-cross.inc
new file mode 100644
index 0000000000..6fc98ff110
--- /dev/null
+++ b/meta/recipes-devtools/gdb/gdb-cross.inc
@@ -0,0 +1,14 @@
1require gdb-common.inc
2
3DEPENDS = "expat-native ncurses-native readline-native"
4
5EXTRA_OECONF += "--without-python"
6
7#EXTRA_OEMAKE += "LDFLAGS='${BUILD_LDFLAGS}'"
8
9GDBPROPREFIX = ""
10
11inherit cross
12inherit gettext
13
14datadir .= "/gdb-${TUNE_PKGARCH}${TARGET_VENDOR}-${TARGET_OS}"
diff --git a/meta/recipes-devtools/gdb/gdb-cross_7.6.2.bb b/meta/recipes-devtools/gdb/gdb-cross_7.6.2.bb
new file mode 100644
index 0000000000..f9da486d7d
--- /dev/null
+++ b/meta/recipes-devtools/gdb/gdb-cross_7.6.2.bb
@@ -0,0 +1,4 @@
1require gdb-cross.inc
2require gdb-${PV}.inc
3
4SRC_URI += "file://sim-install-6.6.patch"
diff --git a/meta/recipes-devtools/gdb/gdb.inc b/meta/recipes-devtools/gdb/gdb.inc
new file mode 100644
index 0000000000..ab84737468
--- /dev/null
+++ b/meta/recipes-devtools/gdb/gdb.inc
@@ -0,0 +1,51 @@
1require gdb-common.inc
2
3inherit gettext ptest
4
5SRC_URI += "file://kill_arm_map_symbols.patch \
6 file://gdbserver-cflags-last.diff;striplevel=0 \
7 file://renesas-sh-native-support.patch \
8 file://run-ptest \
9 file://runtest-flags.patch \
10 file://0001-add-delay-before-run-exp-file.patch \
11 file://0002-function-name-is-used-by-mistake.patch \
12 file://gdb-ptest-attach.patch \
13 "
14#LDFLAGS_append = " -s"
15#export CFLAGS_append=" -L${STAGING_LIBDIR}"
16
17# cross-canadian must not see this
18PACKAGES =+ "gdbserver"
19FILES_gdbserver = "${bindir}/gdbserver"
20
21
22
23DEPENDS_${PN}-ptest += "expect dejagnu tcl"
24RDEPENDS_${PN}-ptest += "eglibc-charmap-ibm1047 \
25 eglibc-gconv-ibm1047 \
26 eglibc-charmap-ebcdic-us \
27 eglibc-gconv-ebcdic-us \
28 eglibc-gconv-utf-32 \
29 eglibc-gconv-utf-16 \
30 prelink \
31 expect \
32 dejagnu \
33 make \
34 "
35do_configure_ptest () {
36 if [ "${PN}" = "${BPN}" ]; then
37 cd ${S}/gdb/testsuite/
38 ./configure --host=${HOST_SYS} --build=${BUILD_SYS}
39 make site.exp
40 fi
41}
42
43do_install_ptest () {
44 if [ "${PN}" = "${BPN}" ]; then
45 cp -r ${S}/gdb/testsuite/ ${D}${PTEST_PATH}
46 cp -r ${S}/gdb/features/ ${D}${PTEST_PATH}
47 cp ${S}/config.sub ${D}${PTEST_PATH}/testsuite/
48 cp ${S}/config.guess ${D}${PTEST_PATH}/testsuite/
49 cp ${S}/install-sh ${D}${PTEST_PATH}/testsuite/
50 fi
51}
diff --git a/meta/recipes-devtools/gdb/gdb/0001-add-delay-before-run-exp-file.patch b/meta/recipes-devtools/gdb/gdb/0001-add-delay-before-run-exp-file.patch
new file mode 100644
index 0000000000..1c415622e7
--- /dev/null
+++ b/meta/recipes-devtools/gdb/gdb/0001-add-delay-before-run-exp-file.patch
@@ -0,0 +1,26 @@
1Description: Add delay for stable running
2
3Author: jack zhang <jack.zhang@enea.com>
4Date: Mon, 12 Nov 2012 04:10:20 +0100
5
6Upstream-Status: Pending
7
8Signed-off-by: jack zhang <jack.zhang@enea.com>
9Signed-off-by: Ciprian Barbu <ciprian.barbu@enea.com>
10---
11 gdb/testsuite/dg-extract-results.sh | 1 +
12 1 files changed, 1 insertions(+), 0 deletions(-)
13
14diff --git a/gdb/testsuite/dg-extract-results.sh b/gdb/testsuite/dg-extract-results.sh
15--- a/gdb/testsuite/dg-extract-results.sh
16+++ b/gdb/testsuite/dg-extract-results.sh
17@@ -322,6 +322,7 @@ END {
18 n=1
19 while (n < expfileno) {
20 if (expfileseen[expfiles[n]]) {
21+ sleep 1
22 print "Running "expfiles[n]" ..."
23 if (filewritten["${TMP}/list"n]) {
24 if (expfileseen[expfiles[n]] == 1)
25--
261.7.5.4
diff --git a/meta/recipes-devtools/gdb/gdb/0002-function-name-is-used-by-mistake.patch b/meta/recipes-devtools/gdb/gdb/0002-function-name-is-used-by-mistake.patch
new file mode 100644
index 0000000000..7f25a357e0
--- /dev/null
+++ b/meta/recipes-devtools/gdb/gdb/0002-function-name-is-used-by-mistake.patch
@@ -0,0 +1,30 @@
1Description: function name is used by mistake
2
3Author: jack zhang <jack.zhang@enea.com>
4Date: Tue, 13 Nov 2012 09:56:54 +0100
5
6Upstream-Status: Pending
7
8Signed-off-by: jack zhang <jack.zhang@enea.com>
9Signed-off-by: Ciprian Barbu <ciprian.barbu@enea.com>
10---
11 gdb/testsuite/gdb.base/skip.exp | 4 ++--
12 1 files changed, 2 insertions(+), 2 deletions(-)
13
14diff --git a/gdb/testsuite/gdb.base/skip.exp b/gdb/testsuite/gdb.base/skip.exp
15--- a/gdb/testsuite/gdb.base/skip.exp
16+++ b/gdb/testsuite/gdb.base/skip.exp
17@@ -113,9 +113,9 @@ gdb_test "info skip 3" ".*\\n3\\s+file\\s+n.*" \
18 "info skip shows entry as disabled"
19
20 if ![runto_main] { fail "skip tests suppressed" }
21-gdb_test "step" "bar \\(\\) at.*" "step after disabling 3 (1)"
22+gdb_test "step" "foo \\(\\) at.*" "step after disabling 3 (1)"
23 gdb_test "step" ".*" "step after disabling 3 (2)"; # Return from foo()
24-gdb_test "step" "foo \\(\\) at.*" "step after disabling 3 (3)"
25+gdb_test "step" "bar \\(\\) at.*" "step after disabling 3 (3)"
26 gdb_test "step" ".*" "step after disabling 3 (4)"; # Return from bar()
27 gdb_test "step" "main \\(\\) at.*" "step after disabling 3 (5)"
28
29--
301.7.5.4
diff --git a/meta/recipes-devtools/gdb/gdb/gdb-fix-cygwin-check-in-configure-script.patch b/meta/recipes-devtools/gdb/gdb/gdb-fix-cygwin-check-in-configure-script.patch
new file mode 100644
index 0000000000..4e4647b0d9
--- /dev/null
+++ b/meta/recipes-devtools/gdb/gdb/gdb-fix-cygwin-check-in-configure-script.patch
@@ -0,0 +1,38 @@
1Avoid false positives if the search pattern "lose" is found in path
2descriptions in comments generated by the preprocessor.
3
4See <https://sourceware.org/bugzilla/show_bug.cgi?id=16152>.
5---
6 gdb/configure | 2 +-
7 gdb/configure.ac | 2 +-
8 3 files changed, 7 insertions(+), 2 deletions(-)
9
10diff --git a/gdb/configure b/gdb/configure
11index 5514b2f..b38e183 100755
12--- a/gdb/configure
13+++ b/gdb/configure
14@@ -12446,7 +12446,7 @@ lose
15 #endif
16 _ACEOF
17 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
18- $EGREP "lose" >/dev/null 2>&1; then :
19+ $EGREP "^lose$" >/dev/null 2>&1; then :
20 gdb_cv_os_cygwin=yes
21 else
22 gdb_cv_os_cygwin=no
23diff --git a/gdb/configure.ac b/gdb/configure.ac
24index 9b73887..2947293 100644
25--- a/gdb/configure.ac
26+++ b/gdb/configure.ac
27@@ -1877,7 +1877,7 @@ AC_SUBST(WERROR_CFLAGS)
28
29 # In the Cygwin environment, we need some additional flags.
30 AC_CACHE_CHECK([for cygwin], gdb_cv_os_cygwin,
31-[AC_EGREP_CPP(lose, [
32+[AC_EGREP_CPP(^lose$, [
33 #if defined (__CYGWIN__) || defined (__CYGWIN32__)
34 lose
35 #endif],[gdb_cv_os_cygwin=yes],[gdb_cv_os_cygwin=no])])
36--
371.8.4
38
diff --git a/meta/recipes-devtools/gdb/gdb/gdb-ptest-attach.patch b/meta/recipes-devtools/gdb/gdb/gdb-ptest-attach.patch
new file mode 100644
index 0000000000..b95ac2c163
--- /dev/null
+++ b/meta/recipes-devtools/gdb/gdb/gdb-ptest-attach.patch
@@ -0,0 +1,30 @@
1From f442dc426b0346e1e413a7c3ae5b07725837135c Mon Sep 17 00:00:00 2001
2From: "Rick.Yang" <rick.yang@enea.com>
3Date: Sun, 11 Nov 2012 10:05:50 +0100
4Subject: [PATCH] Fix the failed test case.
5
6Description: Fixed failing test case
7 In fact, the test case is passing, but the output does not completely
8 match the expected pattern in some special case. Modified the pattern
9 to resolve it.
10
11Signed-off-by: Rick.Yang <rick.yang@enea.com>
12Signed-off-by: Ciprian Barbu <ciprian.barbu@enea.com>
13---
14 gdb/testsuite/gdb.base/attach.exp | 2 +-
15 1 files changed, 1 insertions(+), 1 deletions(-)
16
17diff --git a/gdb/testsuite/gdb.base/attach.exp b/gdb/testsuite/gdb.base/attach.exp
18--- a/gdb/testsuite/gdb.base/attach.exp
19+++ b/gdb/testsuite/gdb.base/attach.exp
20@@ -285,7 +285,7 @@ proc do_attach_tests {} {
21 gdb_test "dir ${objdir}/${subdir}" "Source directories searched: .*" \
22 "set source path"
23
24- gdb_test "cd /tmp" "Working directory /tmp." \
25+ gdb_test "cd /tmp" "Working directory /tmp.*" \
26 "cd away from process working directory"
27
28 # Explicitly flush out any knowledge of the previous attachment.
29--
301.7.5.4
diff --git a/meta/recipes-devtools/gdb/gdb/gdbserver-cflags-last.diff b/meta/recipes-devtools/gdb/gdb/gdbserver-cflags-last.diff
new file mode 100644
index 0000000000..4dfc419c43
--- /dev/null
+++ b/meta/recipes-devtools/gdb/gdb/gdbserver-cflags-last.diff
@@ -0,0 +1,25 @@
1Upstream-Status: Pending
2
3---
4 gdb/gdbserver/Makefile.in | 4 ++--
5 1 file changed, 2 insertions(+), 2 deletions(-)
6
7--- gdb/gdbserver/Makefile.in.orig
8+++ gdb/gdbserver/Makefile.in
9@@ -118,14 +118,14 @@ WARN_CFLAGS_NO_FORMAT = `echo " $(WARN_C
10 # CFLAGS is specifically reserved for setting from the command line
11 # when running make. I.E. "make CFLAGS=-Wmissing-prototypes".
12 CFLAGS = @CFLAGS@
13
14 # INTERNAL_CFLAGS is the aggregate of all other *CFLAGS macros.
15-INTERNAL_CFLAGS_BASE = ${CFLAGS} ${GLOBAL_CFLAGS} \
16+INTERNAL_CFLAGS_BASE = ${GLOBAL_CFLAGS} \
17 ${PROFILE_CFLAGS} ${INCLUDE_CFLAGS}
18 INTERNAL_WARN_CFLAGS = ${INTERNAL_CFLAGS_BASE} $(WARN_CFLAGS)
19-INTERNAL_CFLAGS = ${INTERNAL_WARN_CFLAGS} $(WERROR_CFLAGS) -DGDBSERVER
20+INTERNAL_CFLAGS = ${INTERNAL_WARN_CFLAGS} $(WERROR_CFLAGS) ${CFLAGS} -DGDBSERVER
21
22 # LDFLAGS is specifically reserved for setting from the command line
23 # when running make.
24 LDFLAGS = @LDFLAGS@
25 INTERNAL_LDFLAGS = $(LDFLAGS) @RDYNAMIC@
diff --git a/meta/recipes-devtools/gdb/gdb/kill_arm_map_symbols.patch b/meta/recipes-devtools/gdb/gdb/kill_arm_map_symbols.patch
new file mode 100644
index 0000000000..9fc45b9f2a
--- /dev/null
+++ b/meta/recipes-devtools/gdb/gdb/kill_arm_map_symbols.patch
@@ -0,0 +1,26 @@
1Upstream-Status: Inappropriate [embedded specific]
2
3Index: gdb-7.3/gdb/arm-tdep.c
4===================================================================
5--- gdb-7.3.orig/gdb/arm-tdep.c 2011-05-17 14:27:01.000000000 -0700
6+++ gdb-7.3/gdb/arm-tdep.c 2011-08-05 22:29:58.784201850 -0700
7@@ -7806,6 +7806,19 @@
8 static void
9 arm_elf_make_msymbol_special(asymbol *sym, struct minimal_symbol *msym)
10 {
11+
12+ /* FIXME: We want gdb to ignore the ARM ELF mapping symbols when
13+ displaying disassembly so we use this horrible hack here to
14+ artifically set their address to the highest possible value.
15+ This is wrong of course, and it prevents the symbols from being
16+ used for their intended purpose - to distinguish between ARM
17+ and THUMB code. So we ought to find a better way to do this. */
18+ if (bfd_asymbol_name (sym)
19+ && bfd_asymbol_name (sym)[0] == '$'
20+ && bfd_asymbol_name (sym)[1] != 0
21+ && bfd_asymbol_name (sym)[2] == 0)
22+ SYMBOL_VALUE_ADDRESS(msym) = (CORE_ADDR) 0x7ffffffc;
23+
24 if (ARM_SYM_BRANCH_TYPE (&((elf_symbol_type *)sym)->internal_elf_sym)
25 == ST_BRANCH_TO_THUMB)
26 MSYMBOL_SET_SPECIAL (msym);
diff --git a/meta/recipes-devtools/gdb/gdb/renesas-sh-native-support.patch b/meta/recipes-devtools/gdb/gdb/renesas-sh-native-support.patch
new file mode 100644
index 0000000000..15ff62013e
--- /dev/null
+++ b/meta/recipes-devtools/gdb/gdb/renesas-sh-native-support.patch
@@ -0,0 +1,1379 @@
1Description: Add Renesas SH (sh4) support
2 Add support for Renesas SH (sh4) architecture.
3 .
4 gdb (7.4-1~cvs20111117.2) experimental; urgency=low
5 .
6 * Add Renesas SH (sh4) support (Closes: #576242)
7 - Thanks Nobuhiro Iwamatsu, Takashi Yoshii.
8Author: Hector Oron <zumbi@debian.org>
9Bug-Debian: http://bugs.debian.org/576242
10
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
21Signed-off-by: Khem Raj <raj.khem@gmail.com>
22
23Index: gdb-7.5/gdb/configure.host
24===================================================================
25--- gdb-7.5.orig/gdb/configure.host 2012-05-30 12:41:34.000000000 -0700
26+++ gdb-7.5/gdb/configure.host 2012-09-19 14:40:42.974609772 -0700
27@@ -140,6 +140,7 @@
28
29 s390*-*-*) gdb_host=s390 ;;
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.5/gdb/Makefile.in
36===================================================================
37--- gdb-7.5.orig/gdb/Makefile.in 2012-07-02 08:29:33.000000000 -0700
38+++ gdb-7.5/gdb/Makefile.in 2012-09-19 14:40:42.974609772 -0700
39@@ -1493,6 +1493,7 @@
40 score-tdep.c \
41 ser-go32.c ser-pipe.c ser-tcp.c ser-mingw.c \
42 sh-tdep.c sh64-tdep.c shnbsd-tdep.c shnbsd-nat.c \
43+ sh-linux-tdep.c sh-linux-nat.c \
44 sol2-tdep.c \
45 solib-irix.c solib-svr4.c solib-sunos.c \
46 sparc-linux-nat.c sparc-linux-tdep.c \
47Index: gdb-7.5/gdb/sh-linux-tdep.c
48===================================================================
49--- gdb-7.5.orig/gdb/sh-linux-tdep.c 2012-05-07 06:17:29.000000000 -0700
50+++ gdb-7.5/gdb/sh-linux-tdep.c 2012-09-19 14:46:50.610623784 -0700
51@@ -18,14 +18,37 @@
52 along with this program. If not, see <http://www.gnu.org/licenses/>. */
53
54 #include "defs.h"
55+#include "gdbcore.h"
56+#include "frame.h"
57+#include "frame-base.h"
58+#include "frame-unwind.h"
59+#include "dwarf2-frame.h"
60+#include "value.h"
61+#include "regcache.h"
62+#include "inferior.h"
63 #include "osabi.h"
64
65+#include "reggroups.h"
66+#include "arch-utils.h"
67+#include "floatformat.h"
68 #include "solib-svr4.h"
69 #include "symtab.h"
70+#include "gdb_string.h"
71+#include "command.h"
72+#include "gdb_assert.h"
73
74 #include "trad-frame.h"
75 #include "tramp-frame.h"
76
77+#include <sys/ptrace.h>
78+#include <sys/types.h>
79+#include <sys/param.h>
80+#include <sys/user.h>
81+#include <sys/syscall.h>
82+
83+#include <asm/ptrace.h>
84+
85+#include "regset.h"
86 #include "glibc-tdep.h"
87 #include "sh-tdep.h"
88 #include "linux-tdep.h"
89@@ -180,9 +203,505 @@
90 sh_linux_rt_sigreturn_init
91 };
92
93+/* Recognizing signal handler frames. */
94+
95+/* GNU/Linux has two flavors of signals. Normal signal handlers, and
96+ "realtime" (RT) signals. The RT signals can provide additional
97+ information to the signal handler if the SA_SIGINFO flag is set
98+ when establishing a signal handler using `sigaction'. It is not
99+ unlikely that future versions of GNU/Linux will support SA_SIGINFO
100+ for normal signals too. */
101+
102+/* When the SH Linux kernel calls a signal handler and the
103+ SA_RESTORER flag isn't set, the return address points to a bit of
104+ code on the stack. This function returns whether the PC appears to
105+ be within this bit of code.
106+
107+ The instruction sequence for normal signals is
108+ mov.w 1f,r3
109+ trapa #16
110+ or r0, r0
111+ or r0, r0
112+ or r0, r0
113+ or r0, r0
114+ or r0, r0
115+ 1: .word __NR_sigreturn
116+ or 0x9305 0xc310 0x200b 0x200b 0x200b 0x200b 0x200b 0x0077.
117+
118+ Checking for the code sequence should be somewhat reliable, because
119+ the effect is to call the system call sigreturn. This is unlikely
120+ to occur anywhere other than a signal trampoline.
121+
122+ It kind of sucks that we have to read memory from the process in
123+ order to identify a signal trampoline, but there doesn't seem to be
124+ any other way. The PC_IN_SIGTRAMP macro in tm-linux.h arranges to
125+ only call us if no function name could be identified, which should
126+ be the case since the code is on the stack.
127+
128+ Detection of signal trampolines for handlers that set the
129+ SA_RESTORER flag is in general not possible. Unfortunately this is
130+ what the GNU C Library has been doing for quite some time now.
131+ However, as of version 2.1.2, the GNU C Library uses signal
132+ trampolines (named __restore and __restore_rt) that are identical
133+ to the ones used by the kernel. Therefore, these trampolines are
134+ supported too. */
135+
136+#define MOVW(n) (0x9300|((n)-2)) /* Move mem word at PC+n to R3 */
137+#define TRAP16 0xc310 /* Syscall w/no args (NR in R3) */
138+#define OR_R0_R0 0x200b /* or r0,r0 (insert to avoid hardware bug) */
139+
140+#define LINUX_SIGTRAMP_INSN0 MOVW(7) /* Move mem word at PC+7 to R3 */
141+#define LINUX_SIGTRAMP_INSN1 TRAP16 /* Syscall w/no args (NR in R3) */
142+#define LINUX_SIGTRAMP_INSN2 OR_R0_R0 /* or r0,r0 (insert to avoid hardware bug) */
143+
144+static const unsigned short linux_sigtramp_code[] =
145+{
146+ LINUX_SIGTRAMP_INSN0,
147+ LINUX_SIGTRAMP_INSN1,
148+ LINUX_SIGTRAMP_INSN2,
149+ LINUX_SIGTRAMP_INSN2,
150+ LINUX_SIGTRAMP_INSN2,
151+ LINUX_SIGTRAMP_INSN2,
152+ LINUX_SIGTRAMP_INSN2,
153+ __NR_sigreturn
154+};
155+
156+#define LINUX_SIGTRAMP_LEN (sizeof linux_sigtramp_code)
157+
158+/* If PC is in a sigtramp routine, return the address of the start of
159+ the routine. Otherwise, return 0. */
160+
161+static CORE_ADDR
162+sh_linux_sigtramp_start (struct frame_info *next_frame)
163+{
164+ CORE_ADDR pc = get_frame_pc (next_frame);
165+ gdb_byte buf[LINUX_SIGTRAMP_LEN];
166+
167+ /* We only recognize a signal trampoline if PC is at the start of
168+ one of the three instructions. We optimize for finding the PC at
169+ the start, as will be the case when the trampoline is not the
170+ first frame on the stack. We assume that in the case where the
171+ PC is not at the start of the instruction sequence, there will be
172+ a few trailing readable bytes on the stack. */
173+
174+ if (!safe_frame_unwind_memory (next_frame, pc, buf, LINUX_SIGTRAMP_LEN))
175+ return 0;
176+
177+ if (buf[0] != LINUX_SIGTRAMP_INSN0)
178+ {
179+ if (buf[0] != LINUX_SIGTRAMP_INSN1)
180+ return 0;
181+
182+ pc -= 2;
183+
184+ if (!safe_frame_unwind_memory (next_frame, pc, buf, LINUX_SIGTRAMP_LEN))
185+ return 0;
186+ }
187+
188+ if (memcmp (buf, linux_sigtramp_code, LINUX_SIGTRAMP_LEN) != 0)
189+ return 0;
190+
191+ return pc;
192+}
193+
194+/* This function does the same for RT signals. Here the instruction
195+ sequence is
196+ mov.w 1f,r3
197+ trapa #16
198+ or r0, r0
199+ or r0, r0
200+ or r0, r0
201+ or r0, r0
202+ or r0, r0
203+ 1: .word __NR_rt_sigreturn
204+ or 0x9305 0xc310 0x200b 0x200b 0x200b 0x200b 0x200b 0x00ad.
205+
206+ The effect is to call the system call rt_sigreturn. */
207+
208+#define LINUX_RT_SIGTRAMP_INSN0 MOVW(7) /* Move mem word at PC+7 to R3 */
209+#define LINUX_RT_SIGTRAMP_INSN1 TRAP16 /* Syscall w/no args (NR in R3) */
210+#define LINUX_RT_SIGTRAMP_INSN2 OR_R0_R0 /* or r0,r0 (insert to avoid hardware bug) */
211+
212+static const unsigned short linux_rt_sigtramp_code[] =
213+{
214+ LINUX_RT_SIGTRAMP_INSN0,
215+ LINUX_RT_SIGTRAMP_INSN1,
216+ LINUX_RT_SIGTRAMP_INSN2,
217+ LINUX_RT_SIGTRAMP_INSN2,
218+ LINUX_RT_SIGTRAMP_INSN2,
219+ LINUX_RT_SIGTRAMP_INSN2,
220+ LINUX_RT_SIGTRAMP_INSN2,
221+ __NR_rt_sigreturn
222+};
223+
224+#define LINUX_RT_SIGTRAMP_LEN (sizeof linux_rt_sigtramp_code)
225+
226+/* If PC is in a RT sigtramp routine, return the address of the start
227+ of the routine. Otherwise, return 0. */
228+
229+static CORE_ADDR
230+sh_linux_rt_sigtramp_start (struct frame_info *next_frame)
231+{
232+ CORE_ADDR pc = get_frame_pc (next_frame);
233+ gdb_byte buf[LINUX_RT_SIGTRAMP_LEN];
234+
235+ /* We only recognize a signal trampoline if PC is at the start of
236+ one of the two instructions. We optimize for finding the PC at
237+ the start, as will be the case when the trampoline is not the
238+ first frame on the stack. We assume that in the case where the
239+ PC is not at the start of the instruction sequence, there will be
240+ a few trailing readable bytes on the stack. */
241+
242+ if (!safe_frame_unwind_memory (next_frame, pc, buf, LINUX_RT_SIGTRAMP_LEN))
243+ return 0;
244+
245+ if (buf[0] != LINUX_RT_SIGTRAMP_INSN0)
246+ {
247+ if (buf[0] != LINUX_RT_SIGTRAMP_INSN1)
248+ return 0;
249+
250+ pc -= 2;
251+
252+ if (!safe_frame_unwind_memory (next_frame, pc, buf,
253+ LINUX_RT_SIGTRAMP_LEN))
254+ return 0;
255+ }
256+
257+ if (memcmp (buf, linux_rt_sigtramp_code, LINUX_RT_SIGTRAMP_LEN) != 0)
258+ return 0;
259+
260+ return pc;
261+}
262+
263+/* Return whether PC is in a GNU/Linux sigtramp routine. */
264+
265+static int
266+sh_linux_sigtramp_p (struct frame_info *this_frame)
267+{
268+ CORE_ADDR pc = get_frame_pc (this_frame);
269+ char *name;
270+
271+ find_pc_partial_function (pc, &name, NULL, NULL);
272+
273+ /* If we have NAME, we can optimize the search. The trampolines are
274+ named __restore and __restore_rt. However, they aren't dynamically
275+ exported from the shared C library, so the trampoline may appear to
276+ be part of the preceding function. This should always be sigaction,
277+ __sigaction, or __libc_sigaction (all aliases to the same function). */
278+ if (name == NULL || strstr (name, "sigaction") != NULL)
279+ return (sh_linux_sigtramp_start (this_frame) != 0
280+ || sh_linux_rt_sigtramp_start (this_frame) != 0);
281+
282+ return (strcmp ("__restore", name) == 0
283+ || strcmp ("__restore_rt", name) == 0);
284+}
285+
286+/* Offset to struct sigcontext in ucontext, from <asm/ucontext.h>. */
287+#define SH_LINUX_UCONTEXT_SIGCONTEXT_OFFSET 12
288+
289+
290+/* Assuming NEXT_FRAME is a frame following a GNU/Linux sigtramp
291+ routine, return the address of the associated sigcontext structure. */
292+
293+static CORE_ADDR
294+sh_linux_sigcontext_addr (struct frame_info *this_frame)
295+{
296+ CORE_ADDR pc;
297+ CORE_ADDR sp;
298+
299+ sp = get_frame_register_unsigned (this_frame, SP_REGNUM);
300+
301+ pc = sh_linux_sigtramp_start (this_frame);
302+ if (pc)
303+ {
304+ return sp;
305+ }
306+
307+ pc = sh_linux_rt_sigtramp_start (this_frame);
308+ if (pc)
309+ {
310+ CORE_ADDR ucontext_addr;
311+
312+ /* The sigcontext structure is part of the user context. A
313+ pointer to the user context is passed as the third argument
314+ to the signal handler. */
315+ ucontext_addr = get_frame_register_unsigned (this_frame, ARG0_REGNUM+2);
316+ return ucontext_addr + SH_LINUX_UCONTEXT_SIGCONTEXT_OFFSET;
317+ }
318+
319+ error ("Couldn't recognize signal trampoline.");
320+ return 0;
321+}
322+
323+/* Signal trampolines. */
324+extern struct sh_frame_cache *sh_alloc_frame_cache (void);
325+
326+static struct sh_frame_cache *
327+sh_linux_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
328+{
329+ struct sh_frame_cache *cache;
330+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_current_arch ());
331+ CORE_ADDR sigcontext_addr;
332+
333+ if (*this_cache)
334+ return *this_cache;
335+
336+ cache = sh_alloc_frame_cache ();
337+
338+ cache->base = get_frame_register_unsigned (this_frame, SP_REGNUM);
339+ sigcontext_addr = tdep->sigcontext_addr (this_frame);
340+ if (tdep->sc_reg_offset)
341+ {
342+ int i;
343+
344+ gdb_assert (tdep->sc_num_regs <= SH_NUM_REGS);
345+
346+ for (i = 0; i < tdep->sc_num_regs; i++)
347+ if (tdep->sc_reg_offset[i] != -1)
348+ cache->saved_regs[i] = sigcontext_addr + tdep->sc_reg_offset[i];
349+ }
350+
351+ *this_cache = cache;
352+ return cache;
353+}
354+
355+static void
356+sh_linux_sigtramp_frame_this_id (struct frame_info *this_frame, void **this_cache,
357+ struct frame_id *this_id)
358+{
359+ struct sh_frame_cache *cache =
360+ sh_linux_sigtramp_frame_cache (this_frame, this_cache);
361+
362+ (*this_id) = frame_id_build (cache->base + 64, cache->pc);
363+}
364+
365+extern struct value * sh_frame_prev_register ();
366+static struct value *
367+sh_linux_sigtramp_frame_prev_register (struct frame_info *this_frame,
368+ void **this_cache, int regnum)
369+{
370+ sh_linux_sigtramp_frame_cache (this_frame, this_cache);
371+
372+ return sh_frame_prev_register (this_frame, this_cache, regnum);
373+}
374+
375+static int
376+sh_linux_sigtramp_frame_sniffer (const struct frame_unwind *self,
377+ struct frame_info *this_frame,
378+ void **this_prologue_cache)
379+{
380+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
381+
382+ /* We shouldn't even bother if we don't have a sigcontext_addr
383+ handler. */
384+ if (tdep->sigcontext_addr == NULL)
385+ return 0;
386+
387+ if (tdep->sigtramp_p != NULL)
388+ {
389+ if (tdep->sigtramp_p (this_frame))
390+ return 1;
391+ }
392+
393+ return 0;
394+}
395+
396+static const struct frame_unwind sh_linux_sigtramp_frame_unwind =
397+{
398+ SIGTRAMP_FRAME,
399+ sh_linux_sigtramp_frame_this_id,
400+ sh_linux_sigtramp_frame_prev_register,
401+ NULL,
402+ sh_linux_sigtramp_frame_sniffer
403+};
404+
405+/* Supply register REGNUM from the buffer specified by GREGS and LEN
406+ in the general-purpose register set REGSET to register cache
407+ REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
408+
409+void
410+sh_supply_gregset (const struct regset *regset, struct regcache *regcache,
411+ int regnum, const void *gregs, size_t len)
412+{
413+ const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
414+ const char *regs = gregs;
415+ int i;
416+
417+ gdb_assert (len == tdep->sizeof_gregset);
418+
419+ for (i = 0; i < tdep->gregset_num_regs; i++)
420+ {
421+ if ((regnum == i || regnum == -1)
422+ && tdep->gregset_reg_offset[i] != -1)
423+ regcache_raw_supply (regcache, i, regs + tdep->gregset_reg_offset[i]);
424+ }
425+}
426+
427+/* Collect register REGNUM from the register cache REGCACHE and store
428+ it in the buffer specified by GREGS and LEN as described by the
429+ general-purpose register set REGSET. If REGNUM is -1, do this for
430+ all registers in REGSET. */
431+
432+void
433+sh_collect_gregset (const struct regset *regset,
434+ const struct regcache *regcache,
435+ int regnum, void *gregs, size_t len)
436+{
437+ const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
438+ char *regs = gregs;
439+ int i;
440+
441+ gdb_assert (len == tdep->sizeof_gregset);
442+
443+ for (i = 0; i < tdep->gregset_num_regs; i++)
444+ {
445+ if ((regnum == i || regnum == -1)
446+ && tdep->gregset_reg_offset[i] != -1)
447+ regcache_raw_collect (regcache, i, regs + tdep->gregset_reg_offset[i]);
448+ }
449+}
450+
451+/* Supply register REGNUM from the buffer specified by FPREGS and LEN
452+ in the floating-point register set REGSET to register cache
453+ REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */
454+
455+static void
456+sh_supply_fpregset (const struct regset *regset, struct regcache *regcache,
457+ int regnum, const void *fpregs, size_t len)
458+{
459+ const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
460+ const char *regs = fpregs;
461+ int i;
462+
463+ gdb_assert (len == tdep->sizeof_fpregset);
464+ for (i = 0; i < 16; i++)
465+ {
466+ if (regnum == i+25 || regnum == -1)
467+ regcache_raw_supply (regcache, i+25, regs + i*4);
468+ }
469+ if (regnum == FPSCR_REGNUM || regnum == -1)
470+ regcache_raw_supply (regcache, FPSCR_REGNUM, regs + 32*4);
471+ if (regnum == FPUL_REGNUM || regnum == -1)
472+ regcache_raw_supply (regcache, FPUL_REGNUM, regs + 33*4);
473+}
474+
475+/* Collect register REGNUM from the register cache REGCACHE and store
476+ it in the buffer specified by FPREGS and LEN as described by the
477+ floating-point register set REGSET. If REGNUM is -1, do this for
478+ all registers in REGSET. */
479+
480+static void
481+sh_collect_fpregset (const struct regset *regset,
482+ const struct regcache *regcache,
483+ int regnum, void *fpregs, size_t len)
484+{
485+ const struct gdbarch_tdep *tdep = gdbarch_tdep (regset->arch);
486+ char *regs = fpregs;
487+ int i;
488+
489+ gdb_assert (len == tdep->sizeof_fpregset);
490+ for (i = 0; i < 16; i++)
491+ {
492+ if (regnum == i+25 || regnum == -1)
493+ regcache_raw_collect (regcache, i+25, regs + i*4);
494+ }
495+ if (regnum == FPSCR_REGNUM || regnum == -1)
496+ regcache_raw_collect (regcache, FPSCR_REGNUM, regs + 32*4);
497+ if (regnum == FPUL_REGNUM || regnum == -1)
498+ regcache_raw_collect (regcache, FPUL_REGNUM, regs + 33*4);
499+}
500+
501+/* Return the appropriate register set for the core section identified
502+ by SECT_NAME and SECT_SIZE. */
503+
504+const struct regset *
505+sh_linux_regset_from_core_section (struct gdbarch *gdbarch,
506+ const char *sect_name, size_t sect_size)
507+{
508+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
509+
510+ if (strcmp (sect_name, ".reg") == 0 && sect_size == tdep->sizeof_gregset)
511+ {
512+ if (tdep->gregset == NULL)
513+ tdep->gregset = regset_alloc (gdbarch, sh_supply_gregset,
514+ sh_collect_gregset);
515+ return tdep->gregset;
516+ }
517+
518+ if ((strcmp (sect_name, ".reg2") == 0 && sect_size == tdep->sizeof_fpregset))
519+ {
520+ if (tdep->fpregset == NULL)
521+ tdep->fpregset = regset_alloc (gdbarch, sh_supply_fpregset,
522+ sh_collect_fpregset);
523+ return tdep->fpregset;
524+ }
525+
526+ return NULL;
527+}
528+
529+/* The register sets used in GNU/Linux ELF core-dumps are identical to
530+ the register sets in `struct user' that are used for a.out
531+ core-dumps. These are also used by ptrace(2). The corresponding
532+ types are `elf_gregset_t' for the general-purpose registers (with
533+ `elf_greg_t' the type of a single GP register) and `elf_fpregset_t'
534+ for the floating-point registers.
535+
536+ Those types used to be available under the names `gregset_t' and
537+ `fpregset_t' too, and GDB used those names in the past. But those
538+ names are now used for the register sets used in the `mcontext_t'
539+ type, which have a different size and layout. */
540+
541+/* Mapping between the general-purpose registers in `struct user'
542+ format and GDB's register cache layout. */
543+
544+/* From <sys/reg.h>. */
545+static int sh_linux_gregset_reg_offset[] =
546+{
547+ 0, 4, 8, 12, 16, 20, 24, 28,
548+ 32, 36, 40, 44, 48, 52, 56, 60,
549+
550+ REG_PC*4, REG_PR*4, REG_GBR*4, -1,
551+ REG_MACH*4, REG_MACL*4, REG_SR*4,
552+};
553+
554+/* Mapping between the general-purpose registers in `struct
555+ sigcontext' format and GDB's register cache layout. */
556+
557+/* From <asm/sigcontext.h>. */
558+static int sh_linux_sc_reg_offset[] =
559+{
560+ 4, 8, 12, 16, 20, 24, 28, 32,
561+ 36, 40, 44, 48, 52, 56, 60, 64,
562+ 68, 72, 80, -1,
563+ 84, 88, 76
564+};
565+
566 static void
567 sh_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
568 {
569+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
570+ bfd abfd;
571+
572+ tdep->gregset_reg_offset = sh_linux_gregset_reg_offset;
573+ tdep->gregset_num_regs = ARRAY_SIZE (sh_linux_gregset_reg_offset);
574+ tdep->sizeof_gregset = 23 * 4;
575+
576+ tdep->jb_pc_offset = 32; /* From <bits/setjmp.h>. */
577+
578+ tdep->sigtramp_p = sh_linux_sigtramp_p;
579+ tdep->sigcontext_addr = sh_linux_sigcontext_addr;
580+ tdep->sc_reg_offset = sh_linux_sc_reg_offset;
581+ tdep->sc_num_regs = ARRAY_SIZE (sh_linux_sc_reg_offset);
582+
583+ frame_unwind_append_unwinder(gdbarch, &sh_linux_sigtramp_frame_unwind);
584+
585+ /* If we have a register mapping, enable the generic core file
586+ support, unless it has already been enabled. */
587+ if (tdep->gregset_reg_offset
588+ && !gdbarch_regset_from_core_section_p (gdbarch))
589+ set_gdbarch_regset_from_core_section (gdbarch,
590+ sh_linux_regset_from_core_section);
591+
592 linux_init_abi (info, gdbarch);
593
594 /* GNU/Linux uses SVR4-style shared libraries. */
595Index: gdb-7.5/gdb/sh-tdep.h
596===================================================================
597--- gdb-7.5.orig/gdb/sh-tdep.h 2012-03-01 15:55:40.000000000 -0800
598+++ gdb-7.5/gdb/sh-tdep.h 2012-09-19 14:48:32.406627602 -0700
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 @@
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 @@
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 @@
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.5/gdb/sh-linux-nat.c
679===================================================================
680--- /dev/null 1970-01-01 00:00:00.000000000 +0000
681+++ gdb-7.5/gdb/sh-linux-nat.c 2012-09-19 14:40:42.978609771 -0700
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.5/gdb/sh-tdep.c
953===================================================================
954--- gdb-7.5.orig/gdb/sh-tdep.c 2012-06-08 07:24:57.000000000 -0700
955+++ gdb-7.5/gdb/sh-tdep.c 2012-09-19 14:45:09.770619943 -0700
956@@ -21,6 +21,9 @@
957 sac@cygnus.com. */
958
959 #include "defs.h"
960+#include "arch-utils.h"
961+#include "command.h"
962+#include "dummy-frame.h"
963 #include "frame.h"
964 #include "frame-base.h"
965 #include "frame-unwind.h"
966@@ -37,6 +40,7 @@
967 #include "arch-utils.h"
968 #include "floatformat.h"
969 #include "regcache.h"
970+#include "regset.h"
971 #include "doublest.h"
972 #include "osabi.h"
973 #include "reggroups.h"
974@@ -69,23 +73,6 @@
975
976 static const char *sh_active_calling_convention = sh_cc_gcc;
977
978-#define SH_NUM_REGS 67
979-
980-struct sh_frame_cache
981-{
982- /* Base address. */
983- CORE_ADDR base;
984- LONGEST sp_offset;
985- CORE_ADDR pc;
986-
987- /* Flag showing that a frame has been created in the prologue code. */
988- int uses_fp;
989-
990- /* Saved registers. */
991- CORE_ADDR saved_regs[SH_NUM_REGS];
992- CORE_ADDR saved_sp;
993-};
994-
995 static int
996 sh_is_renesas_calling_convention (struct type *func_type)
997 {
998@@ -1045,7 +1032,7 @@
999 return 0;
1000 /* Otherwise if the type of that member is float, the whole type is
1001 treated as float. */
1002- if (TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) == TYPE_CODE_FLT)
1003+ if (TYPE_CODE (check_typedef (TYPE_FIELD_TYPE (type, 0))) == TYPE_CODE_FLT)
1004 return 1;
1005 /* Otherwise it's not treated as float. */
1006 return 0;
1007@@ -1095,7 +1082,7 @@
1008 in four registers available. Loop thru args from first to last. */
1009 for (argnum = 0; argnum < nargs; argnum++)
1010 {
1011- type = value_type (args[argnum]);
1012+ type = check_typedef (value_type (args[argnum]));
1013 len = TYPE_LENGTH (type);
1014 val = sh_justify_value_in_reg (gdbarch, args[argnum], len);
1015
1016@@ -1809,7 +1796,7 @@
1017 reg->how = DWARF2_FRAME_REG_UNDEFINED;
1018 }
1019
1020-static struct sh_frame_cache *
1021+struct sh_frame_cache *
1022 sh_alloc_frame_cache (void)
1023 {
1024 struct sh_frame_cache *cache;
1025@@ -1836,7 +1823,7 @@
1026 return cache;
1027 }
1028
1029-static struct sh_frame_cache *
1030+struct sh_frame_cache *
1031 sh_frame_cache (struct frame_info *this_frame, void **this_cache)
1032 {
1033 struct gdbarch *gdbarch = get_frame_arch (this_frame);
1034@@ -1903,9 +1890,9 @@
1035 return cache;
1036 }
1037
1038-static struct value *
1039-sh_frame_prev_register (struct frame_info *this_frame,
1040- void **this_cache, int regnum)
1041+struct value *
1042+sh_frame_prev_register (struct frame_info *this_frame, void **this_cache,
1043+ int regnum)
1044 {
1045 struct gdbarch *gdbarch = get_frame_arch (this_frame);
1046 struct sh_frame_cache *cache = sh_frame_cache (this_frame, this_cache);
1047@@ -1919,7 +1906,7 @@
1048 the current frame. Frob regnum so that we pull the value from
1049 the correct place. */
1050 if (regnum == gdbarch_pc_regnum (gdbarch))
1051- regnum = PR_REGNUM;
1052+ regnum = PR_REGNUM; /* XXX: really? */
1053
1054 if (regnum < SH_NUM_REGS && cache->saved_regs[regnum] != -1)
1055 return frame_unwind_got_memory (this_frame, regnum,
1056@@ -2225,8 +2212,8 @@
1057 static struct gdbarch *
1058 sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
1059 {
1060- struct gdbarch *gdbarch;
1061 struct gdbarch_tdep *tdep;
1062+ struct gdbarch *gdbarch;
1063
1064 /* SH5 is handled entirely in sh64-tdep.c. */
1065 if (info.bfd_arch_info->mach == bfd_mach_sh5)
1066@@ -2242,6 +2229,18 @@
1067 tdep = XZALLOC (struct gdbarch_tdep);
1068 gdbarch = gdbarch_alloc (&info, tdep);
1069
1070+ /* General-purpose registers. */
1071+ tdep->gregset = NULL;
1072+ tdep->gregset_reg_offset = NULL;
1073+ tdep->gregset_num_regs = 23;
1074+ tdep->sizeof_gregset = 0;
1075+
1076+ /* Floating-point registers. */
1077+ tdep->fpregset = NULL;
1078+ tdep->sizeof_fpregset = 34*4;
1079+
1080+ tdep->jb_pc_offset = -1;
1081+
1082 set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT);
1083 set_gdbarch_int_bit (gdbarch, 4 * TARGET_CHAR_BIT);
1084 set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT);
1085@@ -2389,10 +2388,11 @@
1086 break;
1087 }
1088
1089+ dwarf2_append_unwinders (gdbarch);
1090+
1091 /* Hook in ABI-specific overrides, if they have been registered. */
1092 gdbarch_init_osabi (info, gdbarch);
1093
1094- dwarf2_append_unwinders (gdbarch);
1095 frame_unwind_append_unwinder (gdbarch, &sh_stub_unwind);
1096 frame_unwind_append_unwinder (gdbarch, &sh_frame_unwind);
1097
1098Index: gdb-7.5/gdb/testsuite/gdb.asm/sh-linux.inc
1099===================================================================
1100--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1101+++ gdb-7.5/gdb/testsuite/gdb.asm/sh-linux.inc 2012-09-19 14:40:42.978609771 -0700
1102@@ -0,0 +1,78 @@
1103+# You'll find a bunch of nop opcodes in the below macros. They are
1104+# there to keep the code correctly aligned. Be careful to maintain
1105+# them when changing the code.
1106+
1107+ comment "subroutine declare"
1108+ .purgem gdbasm_declare
1109+ .macro gdbasm_declare name
1110+ .align 1
1111+ .global \name
1112+\name:
1113+ .endm
1114+
1115+ comment "subroutine prologue"
1116+ .macro gdbasm_enter
1117+ mov.l r14,@-r15
1118+ sts.l pr,@-r15
1119+ mov r15,r14
1120+ nop
1121+ .endm
1122+
1123+ comment "subroutine epilogue"
1124+ .macro gdbasm_leave
1125+ mov r14,r15
1126+ lds.l @r15+,pr
1127+ mov.l @r15+,r14
1128+ rts
1129+ nop
1130+ nop
1131+ .endm
1132+
1133+ comment "subroutine end"
1134+ .purgem gdbasm_end
1135+ .macro gdbasm_end name
1136+ .size \name, .-_foo1
1137+ .align 1
1138+ .endm
1139+
1140+ comment "subroutine call"
1141+ .macro gdbasm_call subr
1142+ mov.l .Lconst\@,r1
1143+ bra .Lafterconst\@
1144+ nop
1145+ .align 2
1146+.Lconst\@:
1147+ .long \subr
1148+.Lafterconst\@:
1149+ jsr @r1
1150+ nop
1151+ .endm
1152+
1153+ .macro gdbasm_several_nops
1154+ nop
1155+ nop
1156+ nop
1157+ nop
1158+ .endm
1159+
1160+ comment "exit (0)"
1161+ .macro gdbasm_exit0
1162+ sleep
1163+ nop
1164+ .endm
1165+
1166+ comment "crt0 startup"
1167+ .macro gdbasm_startup
1168+ mov #0,r14
1169+ .endm
1170+
1171+ comment "Declare a data variable"
1172+ .purgem gdbasm_datavar
1173+ .macro gdbasm_datavar name value
1174+ .data
1175+ .align 2
1176+ .type \name, @object
1177+ .size \name, 4
1178+\name:
1179+ .long \value
1180+ .endm
1181Index: gdb-7.5/gdb/testsuite/gdb.asm/sh.inc
1182===================================================================
1183--- gdb-7.5.orig/gdb/testsuite/gdb.asm/sh.inc 2012-04-16 01:02:09.000000000 -0700
1184+++ gdb-7.5/gdb/testsuite/gdb.asm/sh.inc 2012-09-19 14:40:42.978609771 -0700
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.5/gdb/testsuite/gdb.asm/asm-source.exp
1197===================================================================
1198--- gdb-7.5.orig/gdb/testsuite/gdb.asm/asm-source.exp 2012-06-25 13:11:43.000000000 -0700
1199+++ gdb-7.5/gdb/testsuite/gdb.asm/asm-source.exp 2012-09-19 14:40:42.978609771 -0700
1200@@ -108,6 +108,11 @@
1201 append link-flags " -m elf32ppc"
1202 }
1203 }
1204+ "sh*-linux*" {
1205+ set asm-arch sh-linux
1206+ set asm-flags "-I${srcdir}/${subdir} -I${objdir}/${subdir}"
1207+ set debug-flags "-gdwarf-2"
1208+ }
1209 "sh*-*-*" {
1210 set asm-arch sh
1211 set debug-flags "-gdwarf-2"
1212Index: gdb-7.5/gdb/testsuite/gdb.base/sigall.c
1213===================================================================
1214--- gdb-7.5.orig/gdb/testsuite/gdb.base/sigall.c 2012-02-28 02:24:15.000000000 -0800
1215+++ gdb-7.5/gdb/testsuite/gdb.base/sigall.c 2012-09-19 14:42:02.202612808 -0700
1216@@ -5,6 +5,10 @@
1217 /* Signal handlers, we set breakpoints in them to make sure that the
1218 signals really get delivered. */
1219
1220+#ifdef __sh__
1221+#define signal(a,b) /* Signals not supported on this target - make them go away */
1222+#endif
1223+
1224 #ifdef PROTOTYPES
1225 void
1226 handle_ABRT (int sig)
1227Index: gdb-7.5/gdb/testsuite/gdb.base/signals.c
1228===================================================================
1229--- gdb-7.5.orig/gdb/testsuite/gdb.base/signals.c 2012-02-28 02:24:15.000000000 -0800
1230+++ gdb-7.5/gdb/testsuite/gdb.base/signals.c 2012-09-19 14:43:22.034615831 -0700
1231@@ -3,6 +3,10 @@
1232 #include <signal.h>
1233 #include <unistd.h>
1234
1235+#ifdef __sh__
1236+#define signal(a,b) /* Signals not supported on this target - make them go away */
1237+#define alarm(a) /* Ditto for alarm() */
1238+#endif
1239
1240 static int count = 0;
1241
1242Index: gdb-7.5/gdb/testsuite/gdb.base/annota1.c
1243===================================================================
1244--- gdb-7.5.orig/gdb/testsuite/gdb.base/annota1.c 2012-02-28 14:40:48.000000000 -0800
1245+++ gdb-7.5/gdb/testsuite/gdb.base/annota1.c 2012-09-19 14:42:42.074614308 -0700
1246@@ -1,6 +1,9 @@
1247 #include <stdio.h>
1248 #include <signal.h>
1249
1250+#ifdef __sh__
1251+#define signal(a,b) /* Signals not supported on this target - make them go away */
1252+#endif
1253
1254 #ifdef PROTOTYPES
1255 void
1256Index: gdb-7.5/gdb/testsuite/gdb.base/annota3.c
1257===================================================================
1258--- gdb-7.5.orig/gdb/testsuite/gdb.base/annota3.c 2012-02-28 14:40:48.000000000 -0800
1259+++ gdb-7.5/gdb/testsuite/gdb.base/annota3.c 2012-09-19 14:43:54.410617081 -0700
1260@@ -1,6 +1,10 @@
1261 #include <stdio.h>
1262 #include <signal.h>
1263
1264+#ifdef __sh__
1265+#define signal(a,b) /* Signals not supported on this target - make them go away */
1266+#endif
1267+
1268
1269 #ifdef PROTOTYPES
1270 void
1271Index: gdb-7.5/gdb/config/sh/xm-linux.h
1272===================================================================
1273--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1274+++ gdb-7.5/gdb/config/sh/xm-linux.h 2012-09-19 14:40:42.994609807 -0700
1275@@ -0,0 +1,32 @@
1276+/* Native support for GNU/Linux, for GDB, the GNU debugger.
1277+ Copyright (C) 2000 Free Software Foundation, Inc.
1278+
1279+This file is part of GDB.
1280+
1281+This program is free software; you can redistribute it and/or modify
1282+it under the terms of the GNU General Public License as published by
1283+the Free Software Foundation; either version 2 of the License, or
1284+(at your option) any later version.
1285+
1286+This program is distributed in the hope that it will be useful,
1287+but WITHOUT ANY WARRANTY; without even the implied warranty of
1288+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1289+GNU General Public License for more details.
1290+
1291+You should have received a copy of the GNU General Public License
1292+along with this program; if not, write to the Free Software
1293+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
1294+
1295+#ifndef XM_LINUX_H
1296+#define XM_LINUX_H
1297+
1298+#define HOST_BYTE_ORDER LITTLE_ENDIAN
1299+
1300+#define HAVE_TERMIOS
1301+
1302+#define NEED_POSIX_SETPGID
1303+
1304+/* Need R_OK etc, but USG isn't defined. */
1305+#include <unistd.h>
1306+
1307+#endif /* #ifndef XM_LINUX_H */
1308Index: gdb-7.5/gdb/config/sh/nm-linux.h
1309===================================================================
1310--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1311+++ gdb-7.5/gdb/config/sh/nm-linux.h 2012-09-19 14:40:42.994609807 -0700
1312@@ -0,0 +1,54 @@
1313+/* Native-dependent definitions for SuperH running Linux, for GDB.
1314+ Copyright 2004 Free Software Foundation, Inc.
1315+
1316+ This file is part of GDB.
1317+
1318+ This program is free software; you can redistribute it and/or modify
1319+ it under the terms of the GNU General Public License as published by
1320+ the Free Software Foundation; either version 2 of the License, or
1321+ (at your option) any later version.
1322+
1323+ This program is distributed in the hope that it will be useful,
1324+ but WITHOUT ANY WARRANTY; without even the implied warranty of
1325+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1326+ GNU General Public License for more details.
1327+
1328+ You should have received a copy of the GNU General Public License
1329+ along with this program; if not, write to the Free Software
1330+ Foundation, Inc., 59 Temple Place - Suite 330,
1331+ Boston, MA 02111-1307, USA. */
1332+
1333+#ifndef NM_LINUX_H
1334+#define NM_LINUX_H
1335+
1336+/* Get generic Linux native definitions. */
1337+#include "config/nm-linux.h"
1338+/* Support for the user area. */
1339+
1340+/* Return the size of the user struct. */
1341+extern int kernel_u_size (void);
1342+#define KERNEL_U_SIZE kernel_u_size()
1343+
1344+/* This is the amount to substract from u.u_ar0 to get the offset in
1345+ the core file of the register values. */
1346+#define KERNEL_U_ADDR 0
1347+
1348+#define U_REGS_OFFSET 0
1349+
1350+extern CORE_ADDR register_u_addr (CORE_ADDR blockend, int regnum);
1351+#define REGISTER_U_ADDR(addr, blockend, regnum) \
1352+ (addr) = register_u_addr (blockend, regnum)
1353+
1354+/* Override copies of {fetch,store}_inferior_registers in `infptrace.c'. */
1355+#define FETCH_INFERIOR_REGISTERS
1356+
1357+/* Nevertheless, define CANNOT_{FETCH,STORE}_REGISTER, because we
1358+ might fall back on the code `infptrace.c' (well a copy of that code
1359+ in `sh-linux-nat.c' for now) and we can access only the
1360+ general-purpose registers in that way. */
1361+extern int cannot_fetch_register (int regno);
1362+extern int cannot_store_register (int regno);
1363+#define CANNOT_FETCH_REGISTER(regno) cannot_fetch_register (regno)
1364+#define CANNOT_STORE_REGISTER(regno) cannot_store_register (regno)
1365+
1366+#endif /* NM_LINUX_H */
1367Index: gdb-7.5/gdb/config/sh/linux.mh
1368===================================================================
1369--- /dev/null 1970-01-01 00:00:00.000000000 +0000
1370+++ gdb-7.5/gdb/config/sh/linux.mh 2012-09-19 14:40:42.994609807 -0700
1371@@ -0,0 +1,8 @@
1372+# Host: Renesas Super-H running GNU/Linux
1373+NAT_FILE= config/sh/nm-linux.h
1374+NATDEPFILES= inf-ptrace.o fork-child.o corelow.o sh-linux-nat.o \
1375+ proc-service.o linux-thread-db.o gcore.o \
1376+ linux-nat.o linux-osdata.o linux-fork.o linux-procfs.o
1377+
1378+NAT_CDEPS = $(srcdir)/proc-service.list
1379+LOADLIBES= -ldl $(RDYNAMIC)
diff --git a/meta/recipes-devtools/gdb/gdb/run-ptest b/meta/recipes-devtools/gdb/gdb/run-ptest
new file mode 100755
index 0000000000..e8587e8961
--- /dev/null
+++ b/meta/recipes-devtools/gdb/gdb/run-ptest
@@ -0,0 +1,2 @@
1#!/bin/sh
2make -C testsuite check-single | sed -e 's/XFAIL/PASS/' -e 's/UNRESOLVED/SKIP/' -e 's/UNTESTED/SKIP/' -e 's/UNSUPPORTED/SKIP/'
diff --git a/meta/recipes-devtools/gdb/gdb/runtest-flags.patch b/meta/recipes-devtools/gdb/gdb/runtest-flags.patch
new file mode 100644
index 0000000000..054abc32d1
--- /dev/null
+++ b/meta/recipes-devtools/gdb/gdb/runtest-flags.patch
@@ -0,0 +1,30 @@
1Description: add -a to runtest
2 Pass "-a" to runtest so that everything is printed to output
3 (e.g. unsupported test cases)
4
5Author: "Gordon.Sun" <gordon.sun@enea.com>
6Date: Wed, 28 Nov 2012 03:39:58 +0100
7
8Upstream-Status: Inappropriate (other)
9
10Signed-off-by: Gordon.Sun <gordon.sun@enea.com>
11Signed-off-by: Ciprian Barbu <ciprian.barbu@enea.com>
12---
13 gdb/testsuite/Makefile.in | 2 +-
14 1 files changed, 1 insertions(+), 1 deletions(-)
15
16diff --git a/gdb/testsuite/Makefile.in b/gdb/testsuite/Makefile.in
17index fab124e..f5cddb2 100644
18--- a/gdb/testsuite/Makefile.in
19+++ b/gdb/testsuite/Makefile.in
20@@ -46,7 +46,7 @@ EXPECT = `if [ -f $${rootme}/../../expect/expect ] ; then \
21
22 RUNTEST = $(RUNTEST_FOR_TARGET)
23
24-RUNTESTFLAGS =
25+RUNTESTFLAGS = -a
26
27 FORCE_PARALLEL =
28
29--
301.7.5.4
diff --git a/meta/recipes-devtools/gdb/gdb/sim-install-6.6.patch b/meta/recipes-devtools/gdb/gdb/sim-install-6.6.patch
new file mode 100644
index 0000000000..f67c25d50e
--- /dev/null
+++ b/meta/recipes-devtools/gdb/gdb/sim-install-6.6.patch
@@ -0,0 +1,14 @@
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
new file mode 100644
index 0000000000..a663ba7b81
--- /dev/null
+++ b/meta/recipes-devtools/gdb/gdb/sim-install.patch
@@ -0,0 +1,36 @@
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
new file mode 100644
index 0000000000..f5fd518fcf
--- /dev/null
+++ b/meta/recipes-devtools/gdb/gdb/uclibc.patch
@@ -0,0 +1,196 @@
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 ;;
diff --git a/meta/recipes-devtools/gdb/gdb_7.6.2.bb b/meta/recipes-devtools/gdb/gdb_7.6.2.bb
new file mode 100644
index 0000000000..e86447121b
--- /dev/null
+++ b/meta/recipes-devtools/gdb/gdb_7.6.2.bb
@@ -0,0 +1,23 @@
1require gdb.inc
2require gdb-${PV}.inc
3
4inherit python-dir
5
6PACKAGECONFIG ??= ""
7PACKAGECONFIG[python] = "--with-python=${WORKDIR}/python,--without-python,python"
8
9do_configure_prepend() {
10 if [ -n "${@base_contains('PACKAGECONFIG', 'python', 'python', '', d)}" ]; then
11 cat > ${WORKDIR}/python << EOF
12#!/bin/sh
13case "\$2" in
14 --includes) echo "-I${STAGING_INCDIR}/${PYTHON_DIR}/" ;;
15 --ldflags) echo "-Wl,-rpath-link,${STAGING_LIBDIR}/.. -Wl,-rpath,${libdir}/.. -lpthread -ldl -lutil -lm -lpython${PYTHON_BASEVERSION}" ;;
16 --exec-prefix) echo "${exec_prefix}" ;;
17 *) exit 1 ;;
18esac
19exit 0
20EOF
21 chmod +x ${WORKDIR}/python
22 fi
23}