summaryrefslogtreecommitdiffstats
path: root/package/gdb
diff options
context:
space:
mode:
authorThomas Petazzoni <thomas.petazzoni@free-electrons.com>2013-04-07 00:04:33 +0000
committerPeter Korsgaard <jacmet@sunsite.dk>2013-04-11 21:46:32 +0200
commita0b6faaab4dcb7e372fe16ffb335e39b9e06a8fb (patch)
tree091873326b66084289ab13f10de84ec13bb6e491 /package/gdb
parent15ada1c1846a243893f5e734fbb5039aa8e4b1a4 (diff)
downloadbuildroot-novena-a0b6faaab4dcb7e372fe16ffb335e39b9e06a8fb.tar.gz
buildroot-novena-a0b6faaab4dcb7e372fe16ffb335e39b9e06a8fb.zip
gdb: convert to the package infrastructure
This commit converts gdb to the package infrastructure, and therefore moves it from toolchain/gdb to package/gdb. The target package is now visible in "Package selection for the target" => "Debugging, profiling and benchmark". The main option, "gdb", forcefully selects the "gdbserver" sub-option by default. Another sub-option, "full debugger" allows to install the complete gdb on the target. When this option is enabled, then "gdbserver" is no longer forcefully selected. This ensures that at least gdbserver or the full debugger gets built/installed, so that the package is not a no-op. The host debugger is still enabled through a configuration option in "Toolchain". It is now visible regardless of the toolchain type (it used to be hidden for External Toolchains). The configuration options relative to the host debugger are now in package/gdb/Config.in.host, similar to how we have package/binutils/Config.in.host. Since gdb is now a proper package, it is no longer allowed to 'select BR2_PTHREADS_DEBUG' to ensure thread debugging is available when needed. Instead, it now 'depends on BR2_TOOLCHAIN_HAS_THREADS_DEBUG'. This option, in turn, is selected by the different toolchain backends when appropriate. The 'BR2_TOOLCHAIN_HAS_THREADS_DEBUG_IF_NEEDED' option is removed, since we no longer need to know when it is allowed to 'select BR2_PTHREADS_DEBUG'. Also, the 'BR2_PTHREADS_DEBUG' option is moved to appear right below the thread implementation selection (in the case of the Buildroot toolchain backend). Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Diffstat (limited to 'package/gdb')
-rw-r--r--package/gdb/6.6a/100-uclibc-conf.patch82
-rw-r--r--package/gdb/6.6a/600-fix-compile-flag-mismatch.patch69
-rw-r--r--package/gdb/6.6a/gdb-6.6-bfin-gdbserver.patch238
-rw-r--r--package/gdb/7.4.1/00_all_ptrace_setsiginfo.patch314
-rw-r--r--package/gdb/7.4.1/05_all_readline-headers.patch42
-rw-r--r--package/gdb/7.4.1/xtensa-asm-ptrace-h.patch22
-rw-r--r--package/gdb/7.4.1/xtensa-gdb-regsize.patch19
-rw-r--r--package/gdb/Config.in41
-rw-r--r--package/gdb/Config.in.host56
-rw-r--r--package/gdb/gdb.mk101
10 files changed, 984 insertions, 0 deletions
diff --git a/package/gdb/6.6a/100-uclibc-conf.patch b/package/gdb/6.6a/100-uclibc-conf.patch
new file mode 100644
index 000000000..a790b6f0f
--- /dev/null
+++ b/package/gdb/6.6a/100-uclibc-conf.patch
@@ -0,0 +1,82 @@
+diff -rNdup gdb-6.6.orig/bfd/configure gdb-6.6/bfd/configure
+--- gdb-6.6.orig/bfd/configure 2006-10-25 08:49:20.000000000 +0200
++++ gdb-6.6/bfd/configure 2007-05-14 10:35:50.000000000 +0200
+@@ -3579,6 +3579,11 @@ linux-gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd* | knetbsd*-gnu)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+diff -rNdup gdb-6.6.orig/libtool.m4 gdb-6.6/libtool.m4
+--- gdb-6.6.orig/libtool.m4 2005-12-27 17:37:57.000000000 +0100
++++ gdb-6.6/libtool.m4 2007-05-14 10:35:50.000000000 +0200
+@@ -751,6 +751,11 @@ netbsd* | knetbsd*-gnu)
+ fi
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ newsos6)
+ [lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)']
+ lt_cv_file_magic_cmd=/usr/bin/file
+diff -rNdup gdb-6.6.orig/ltconfig gdb-6.6/ltconfig
+--- gdb-6.6.orig/ltconfig 2006-07-04 22:31:03.000000000 +0200
++++ gdb-6.6/ltconfig 2007-05-14 10:35:50.000000000 +0200
+@@ -602,7 +602,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-
+
+ # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+ case $host_os in
+-linux-gnu*) ;;
++linux-gnu*|linux-uclibc*) ;;
+ linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+ esac
+
+@@ -1270,6 +1270,24 @@ linux-gnu*)
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
++linux-uclibc*)
++ version_type=linux
++ need_lib_prefix=no
++ need_version=no
++ library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so'
++ soname_spec='${libname}${release}.so$major'
++ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
++ shlibpath_var=LD_LIBRARY_PATH
++ shlibpath_overrides_runpath=no
++ # This implies no fast_install, which is unacceptable.
++ # Some rework will be needed to allow for fast_install
++ # before this can be enabled.
++ # Note: copied from linux-gnu, and may not be appropriate.
++ hardcode_into_libs=yes
++ # Assume using the uClibc dynamic linker.
++ dynamic_linker="uClibc ld.so"
++ ;;
++
+ netbsd*)
+ need_lib_prefix=no
+ need_version=no
+diff -rNdup gdb-6.6.orig/opcodes/configure gdb-6.6/opcodes/configure
+--- gdb-6.6.orig/opcodes/configure 2006-10-25 08:49:20.000000000 +0200
++++ gdb-6.6/opcodes/configure 2007-05-14 10:35:50.000000000 +0200
+@@ -3590,6 +3590,11 @@ netbsd* | knetbsd*-gnu)
+ fi
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ newsos6)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+ lt_cv_file_magic_cmd=/usr/bin/file
diff --git a/package/gdb/6.6a/600-fix-compile-flag-mismatch.patch b/package/gdb/6.6a/600-fix-compile-flag-mismatch.patch
new file mode 100644
index 000000000..60f0ace65
--- /dev/null
+++ b/package/gdb/6.6a/600-fix-compile-flag-mismatch.patch
@@ -0,0 +1,69 @@
+diff -rduNp gdb-6.6-100/Makefile.in gdb-6.6/Makefile.in
+--- gdb-6.6-100/Makefile.in 2006-12-18 08:21:19.000000000 +0100
++++ gdb-6.6/Makefile.in 2007-05-14 10:54:29.000000000 +0200
+@@ -331,7 +331,7 @@ COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_
+ # CFLAGS will be just -g. We want to ensure that TARGET libraries
+ # (which we know are built with gcc) are built with optimizations so
+ # prepend -O2 when setting CFLAGS_FOR_TARGET.
+-CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
++CFLAGS_FOR_TARGET = $(strip $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET))
+ SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
+ CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
+ LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
+diff -rduNp gdb-6.6-100/Makefile.tpl gdb-6.6/Makefile.tpl
+--- gdb-6.6-100/Makefile.tpl 2006-11-15 00:26:39.000000000 +0100
++++ gdb-6.6/Makefile.tpl 2007-05-14 10:54:29.000000000 +0200
+@@ -334,7 +334,7 @@ COMPILER_NM_FOR_TARGET=@COMPILER_NM_FOR_
+ # CFLAGS will be just -g. We want to ensure that TARGET libraries
+ # (which we know are built with gcc) are built with optimizations so
+ # prepend -O2 when setting CFLAGS_FOR_TARGET.
+-CFLAGS_FOR_TARGET = -O2 $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
++CFLAGS_FOR_TARGET = $(strip $(CFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET))
+ SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
+ CXXFLAGS_FOR_TARGET = $(CXXFLAGS) $(SYSROOT_CFLAGS_FOR_TARGET)
+ LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
+diff -rduNp gdb-6.6-100/gdb/configure gdb-6.6/gdb/configure
+--- gdb-6.6-100/gdb/configure 2006-12-17 16:38:59.000000000 +0100
++++ gdb-6.6/gdb/configure 2007-05-14 10:55:41.000000000 +0200
+@@ -272,7 +272,7 @@ PACKAGE_STRING=
+ PACKAGE_BUGREPORT=
+
+ ac_unique_file="main.c"
+-ac_subdirs_all="$ac_subdirs_all doc testsuite"
++ac_subdirs_all="$ac_subdirs_all doc"
+ # Factoring default headers for most tests.
+ ac_includes_default="\
+ #include <stdio.h>
+@@ -3055,7 +3055,7 @@ _ACEOF
+
+
+
+-subdirs="$subdirs doc testsuite"
++subdirs="$subdirs doc"
+
+
+ # Provide defaults for some variables set by the per-host and per-target
+diff -rduNp gdb-6.6-100/gdb/gdbserver/configure gdb-6.6/gdb/gdbserver/configure
+--- gdb-6.6-100/gdb/gdbserver/configure 2006-11-22 01:10:19.000000000 +0100
++++ gdb-6.6/gdb/gdbserver/configure 2007-05-14 10:54:29.000000000 +0200
+@@ -1239,7 +1239,7 @@ echo "$as_me: error: \`$ac_var' was not
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+- if test "x$ac_old_val" != "x$ac_new_val"; then
++ if test "`echo $ac_old_val`" != "`echo $ac_new_val`"; then
+ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+ echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
+diff -rduNp gdb-6.6-100/gdb/testsuite/configure gdb-6.6/gdb/testsuite/configure
+--- gdb-6.6-100/gdb/testsuite/configure 2006-06-21 15:57:21.000000000 +0200
++++ gdb-6.6/gdb/testsuite/configure 2007-05-14 10:54:29.000000000 +0200
+@@ -1248,7 +1248,7 @@ echo "$as_me: error: \`$ac_var' was not
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+- if test "x$ac_old_val" != "x$ac_new_val"; then
++ if test "`echo $ac_old_val" != "`echo $ac_new_val"; then
+ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+ echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
diff --git a/package/gdb/6.6a/gdb-6.6-bfin-gdbserver.patch b/package/gdb/6.6a/gdb-6.6-bfin-gdbserver.patch
new file mode 100644
index 000000000..65c4b908d
--- /dev/null
+++ b/package/gdb/6.6a/gdb-6.6-bfin-gdbserver.patch
@@ -0,0 +1,238 @@
+--- gdb-6.6/gdb/gdbserver/configure.srv
++++ gdb-6.6/gdb/gdbserver/configure.srv
+@@ -23,6 +23,11 @@ case "${target}" in
+ srv_linux_usrregs=yes
+ srv_linux_thread_db=yes
+ ;;
++ bfin-*-*) srv_regobj=reg-bfin.o
++ srv_tgtobj="linux-low.o linux-bfin-low.o"
++ srv_linux_usrregs=yes
++ srv_linux_thread_db=yes
++ ;;
+ crisv32-*-linux*) srv_regobj=reg-crisv32.o
+ srv_tgtobj="linux-low.o linux-crisv32-low.o"
+ srv_linux_regsets=yes
+--- gdb-6.6/gdb/gdbserver/linux-bfin-low.c
++++ gdb-6.6/gdb/gdbserver/linux-bfin-low.c
+@@ -0,0 +1,101 @@
++/* GNU/Linux/BFIN specific low level interface, for the remote server for GDB.
++
++ Copyright (C) 2005 Free Software Foundation, Inc.
++ Contributed by Analog Devices.
++
++ This file is part of GDB.
++
++ This program is free software; you can redistribute it and/or modify
++ it under the terms of the GNU General Public License as published by
++ the Free Software Foundation; either version 2 of the License, or
++ (at your option) any later version.
++
++ This program is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ GNU General Public License for more details.
++
++ You should have received a copy of the GNU General Public License
++ along with this program; if not, write to the Free Software
++ Foundation, Inc., 51 Franklin Street, Fifth Floor,
++ Boston, MA 02110-1301, USA. */
++
++#include "server.h"
++#include "linux-low.h"
++#include <asm/ptrace.h>
++
++static int bfin_regmap[] =
++{
++ PT_R0, PT_R1, PT_R2, PT_R3, PT_R4, PT_R5, PT_R6, PT_R7,
++ PT_P0, PT_P1, PT_P2, PT_P3, PT_P4, PT_P5, PT_USP, PT_FP,
++ PT_I0, PT_I1, PT_I2, PT_I3, PT_M0, PT_M1, PT_M2, PT_M3,
++ PT_B0, PT_B1, PT_B2, PT_B3, PT_L0, PT_L1, PT_L2, PT_L3,
++ PT_A0X, PT_A0W, PT_A1X, PT_A1W, PT_ASTAT, PT_RETS,
++ PT_LC0, PT_LT0, PT_LB0, PT_LC1, PT_LT1, PT_LB1,
++ -1 /* PT_CYCLES */, -1 /* PT_CYCLES2 */,
++ -1 /* PT_USP */, PT_SEQSTAT, PT_SYSCFG, PT_PC, PT_RETX, PT_RETN, PT_RETE,
++ PT_PC, -1 /* PT_CC */, PT_TEXT_ADDR, PT_TEXT_END_ADDR, PT_DATA_ADDR,
++ PT_FDPIC_EXEC, PT_FDPIC_INTERP,
++ PT_IPEND
++};
++
++#define bfin_num_regs (sizeof(bfin_regmap) / sizeof(bfin_regmap[0]))
++
++static int
++bfin_cannot_store_register (int regno)
++{
++ return (regno >= bfin_num_regs);
++}
++
++static int
++bfin_cannot_fetch_register (int regno)
++{
++ return (regno >= bfin_num_regs);
++}
++
++static CORE_ADDR
++bfin_get_pc ()
++{
++ unsigned long pc;
++ collect_register_by_name ("pc", &pc);
++ return pc;
++}
++
++static void
++bfin_set_pc (CORE_ADDR pc)
++{
++ unsigned long newpc = pc;
++ supply_register_by_name ("pc", &newpc);
++}
++
++#define bfin_breakpoint_len 2
++static const unsigned char bfin_breakpoint[bfin_breakpoint_len]={0xa1, 0x00};
++
++static int
++bfin_breakpoint_at (CORE_ADDR where)
++{
++ unsigned char insn[bfin_breakpoint_len];
++
++ read_inferior_memory(where, insn, bfin_breakpoint_len);
++ if (insn[0] == bfin_breakpoint[0]
++ && insn[1] == bfin_breakpoint[1])
++ return 1;
++
++ /* If necessary, recognize more trap instructions here. GDB only uses the
++ one. */
++ return 0;
++}
++
++struct linux_target_ops the_low_target = {
++ bfin_num_regs,
++ bfin_regmap,
++ bfin_cannot_fetch_register,
++ bfin_cannot_store_register,
++ bfin_get_pc,
++ bfin_set_pc,
++ bfin_breakpoint,
++ bfin_breakpoint_len,
++ 0,
++ 2,
++ bfin_breakpoint_at,
++};
+--- gdb-6.6/gdb/gdbserver/linux-low.c
++++ gdb-6.6/gdb/gdbserver/linux-low.c
+@@ -1592,6 +1592,10 @@ linux_stopped_data_address (void)
+ #define PT_TEXT_ADDR 49*4
+ #define PT_DATA_ADDR 50*4
+ #define PT_TEXT_END_ADDR 51*4
++#elif defined(BFIN)
++#define PT_TEXT_ADDR 220
++#define PT_TEXT_END_ADDR 224
++#define PT_DATA_ADDR 228
+ #endif
+
+ /* Under uClinux, programs are loaded at non-zero offsets, which we need
+--- gdb-6.6/gdb/gdbserver/Makefile.in
++++ gdb-6.6/gdb/gdbserver/Makefile.in
+@@ -119,9 +119,9 @@ SFILES= $(srcdir)/gdbreplay.c $(srcdir)/
+ $(srcdir)/mem-break.c $(srcdir)/proc-service.c $(srcdir)/regcache.c \
+ $(srcdir)/remote-utils.c $(srcdir)/server.c $(srcdir)/target.c \
+ $(srcdir)/thread-db.c $(srcdir)/utils.c \
+- $(srcdir)/linux-arm-low.c $(srcdir)/linux-cris-low.c \
+- $(srcdir)/linux-crisv32-low.c $(srcdir)/linux-i386-low.c \
+- $(srcdir)/i387-fp.c \
++ $(srcdir)/linux-arm-low.c $(srcdir)/linux-bfin-low.c \
++ $(srcdir)/linux-cris-low.c $(srcdir)/linux-crisv32-low.c \
++ $(srcdir)/linux-i386-low.c $(srcdir)/i387-fp.c \
+ $(srcdir)/linux-ia64-low.c $(srcdir)/linux-low.c \
+ $(srcdir)/linux-m32r-low.c \
+ $(srcdir)/linux-m68k-low.c $(srcdir)/linux-mips-low.c \
+@@ -207,6 +207,7 @@ clean:
+ rm -f reg-arm.c reg-i386.c reg-ia64.c reg-m32r.c reg-m68k.c reg-mips.c
+ rm -f reg-ppc.c reg-sh.c reg-spu.c reg-x86-64.c reg-i386-linux.c
+ rm -f reg-cris.c reg-crisv32.c reg-x86-64-linux.c
++ rm -f reg-bfin.c
+
+ maintainer-clean realclean distclean: clean
+ rm -f nm.h tm.h xm.h config.status config.h stamp-h config.log
+@@ -272,6 +273,7 @@ linux-low.o: linux-low.c $(linux_low_h)
+
+ linux-arm-low.o: linux-arm-low.c $(linux_low_h) $(server_h) \
+ $(gdb_proc_service_h)
++linux-bfin-low.o: linux-bfin-low.c $(linux_low_h) $(server_h)
+ linux-cris-low.o: linux-cris-low.c $(linux_low_h) $(server_h)
+ linux-crisv32-low.o: linux-crisv32-low.c $(linux_low_h) $(server_h)
+ linux-i386-low.o: linux-i386-low.c $(linux_low_h) $(server_h) \
+@@ -294,6 +297,9 @@ spu-low.o: spu-low.c $(server_h)
+ reg-arm.o : reg-arm.c $(regdef_h)
+ reg-arm.c : $(srcdir)/../regformats/reg-arm.dat $(regdat_sh)
+ sh $(regdat_sh) $(srcdir)/../regformats/reg-arm.dat reg-arm.c
++reg-bfin.o : reg-bfin.c $(regdef_h)
++reg-bfin.c : $(srcdir)/../regformats/reg-bfin.dat $(regdat_sh)
++ sh $(regdat_sh) $(srcdir)/../regformats/reg-bfin.dat reg-bfin.c
+ reg-cris.o : reg-cris.c $(regdef_h)
+ reg-cris.c : $(srcdir)/../regformats/reg-cris.dat $(regdat_sh)
+ sh $(regdat_sh) $(srcdir)/../regformats/reg-cris.dat reg-cris.c
+--- gdb-6.6/gdb/regformats/reg-bfin.dat
++++ gdb-6.6/gdb/regformats/reg-bfin.dat
+@@ -0,0 +1,63 @@
++name:bfin
++expedite:pc,sp,fp
++32:r0
++32:r1
++32:r2
++32:r3
++32:r4
++32:r5
++32:r6
++32:r7
++32:p0
++32:p1
++32:p2
++32:p3
++32:p4
++32:p5
++32:sp
++32:fp
++32:i0
++32:i1
++32:i2
++32:i3
++32:m0
++32:m1
++32:m2
++32:m3
++32:b0
++32:b1
++32:b2
++32:b3
++32:l0
++32:l1
++32:l2
++32:l3
++32:a0x
++32:a0w
++32:a1x
++32:a1w
++32:astat
++32:rets
++32:lc0
++32:lt0
++32:lb0
++32:lc1
++32:lt1
++32:lb1
++32:cycles
++32:cycles2
++32:usp
++32:seqstat
++32:syscfg
++32:reti
++32:retx
++32:retn
++32:rete
++32:pc
++32:cc
++32:text_addr
++32:text_end_addr
++32:data_addr
++32:fdpic_exec
++32:fdpic_interp
++32:ipend
diff --git a/package/gdb/7.4.1/00_all_ptrace_setsiginfo.patch b/package/gdb/7.4.1/00_all_ptrace_setsiginfo.patch
new file mode 100644
index 000000000..81a92db9a
--- /dev/null
+++ b/package/gdb/7.4.1/00_all_ptrace_setsiginfo.patch
@@ -0,0 +1,314 @@
+fix from upstream for building with newer kernel headers
+
+From a7f9ca9cb797d653dc7919538e1dfa0c26010331 Mon Sep 17 00:00:00 2001
+From: tschwinge <tschwinge>
+Date: Wed, 21 Mar 2012 13:43:50 +0000
+Subject: [PATCH] struct siginfo vs. siginfo_t
+
+gdb/
+ * amd64-linux-nat.c (amd64_linux_siginfo_fixup): Use siginfo_t instead
+ of struct siginfo.
+ * arm-linux-nat.c (arm_linux_stopped_data_address): Likewise.
+ * ia64-linux-nat.c (ia64_linux_stopped_data_address): Likewise.
+ * linux-nat.c (linux_nat_siginfo_fixup, siginfo_fixup)
+ (linux_xfer_siginfo, linux_nat_set_siginfo_fixup)
+ (linux_nat_get_siginfo): Likewise.
+ * linux-nat.h (struct lwp_info, linux_nat_set_siginfo_fixup)
+ (linux_nat_get_siginfo): Likewise.
+ * linux-tdep.c (linux_get_siginfo_type): Likewise.
+ * ppc-linux-nat.c (ppc_linux_stopped_data_address): Likewise.
+ * procfs.c (gdb_siginfo_t): Likewise.
+
+gdbserver/
+ * linux-arm-low.c (arm_stopped_by_watchpoint): Use siginfo_t instead of
+ struct siginfo.
+ * linux-low.c (siginfo_fixup, linux_xfer_siginfo): Likewise.
+ * linux-x86-low.c (x86_siginfo_fixup): Likewise.
+ * linux-low.h: Include <signal.h>.
+ (struct siginfo): Remove forward declaration.
+ (struct linux_target_ops) <siginfo_fixup>: Use siginfo_t instead of
+ struct siginfo.
+---
+ gdb/ChangeLog | 15 +++++++++++++++
+ gdb/amd64-linux-nat.c | 4 ++--
+ gdb/arm-linux-nat.c | 2 +-
+ gdb/gdbserver/ChangeLog | 11 +++++++++++
+ gdb/gdbserver/linux-arm-low.c | 2 +-
+ gdb/gdbserver/linux-low.c | 10 +++++-----
+ gdb/gdbserver/linux-low.h | 5 ++---
+ gdb/gdbserver/linux-x86-low.c | 4 ++--
+ gdb/ia64-linux-nat.c | 2 +-
+ gdb/linux-nat.c | 16 ++++++++--------
+ gdb/linux-nat.h | 6 +++---
+ gdb/ppc-linux-nat.c | 2 +-
+ gdb/procfs.c | 2 +-
+ 13 files changed, 53 insertions(+), 28 deletions(-)
+
+diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
+index f954483..5ebba3a 100644
+--- a/gdb/amd64-linux-nat.c
++++ b/gdb/amd64-linux-nat.c
+@@ -731,13 +731,13 @@ siginfo_from_compat_siginfo (siginfo_t *to, compat_siginfo_t *from)
+ INF. */
+
+ static int
+-amd64_linux_siginfo_fixup (struct siginfo *native, gdb_byte *inf, int direction)
++amd64_linux_siginfo_fixup (siginfo_t *native, gdb_byte *inf, int direction)
+ {
+ /* Is the inferior 32-bit? If so, then do fixup the siginfo
+ object. */
+ if (gdbarch_addr_bit (get_frame_arch (get_current_frame ())) == 32)
+ {
+- gdb_assert (sizeof (struct siginfo) == sizeof (compat_siginfo_t));
++ gdb_assert (sizeof (siginfo_t) == sizeof (compat_siginfo_t));
+
+ if (direction == 0)
+ compat_siginfo_from_siginfo ((struct compat_siginfo *) inf, native);
+diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
+index c5ce21c..f9f6ba5 100644
+--- a/gdb/arm-linux-nat.c
++++ b/gdb/arm-linux-nat.c
+@@ -1137,7 +1137,7 @@ arm_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw,
+ static int
+ arm_linux_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
+ {
+- struct siginfo *siginfo_p = linux_nat_get_siginfo (inferior_ptid);
++ siginfo_t *siginfo_p = linux_nat_get_siginfo (inferior_ptid);
+ int slot = siginfo_p->si_errno;
+
+ /* This must be a hardware breakpoint. */
+diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c
+index ff2437d..01208ef 100644
+--- a/gdb/gdbserver/linux-arm-low.c
++++ b/gdb/gdbserver/linux-arm-low.c
+@@ -631,7 +631,7 @@ static int
+ arm_stopped_by_watchpoint (void)
+ {
+ struct lwp_info *lwp = get_thread_lwp (current_inferior);
+- struct siginfo siginfo;
++ siginfo_t siginfo;
+
+ /* We must be able to set hardware watchpoints. */
+ if (arm_linux_get_hw_watchpoint_count () == 0)
+diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
+index d2d4c1d..4734f15 100644
+--- a/gdb/gdbserver/linux-low.c
++++ b/gdb/gdbserver/linux-low.c
+@@ -4779,7 +4779,7 @@ linux_qxfer_osdata (const char *annex,
+ layout of the inferiors' architecture. */
+
+ static void
+-siginfo_fixup (struct siginfo *siginfo, void *inf_siginfo, int direction)
++siginfo_fixup (siginfo_t *siginfo, void *inf_siginfo, int direction)
+ {
+ int done = 0;
+
+@@ -4791,9 +4791,9 @@ siginfo_fixup (struct siginfo *siginfo, void *inf_siginfo, int direction)
+ if (!done)
+ {
+ if (direction == 1)
+- memcpy (siginfo, inf_siginfo, sizeof (struct siginfo));
++ memcpy (siginfo, inf_siginfo, sizeof (siginfo_t));
+ else
+- memcpy (inf_siginfo, siginfo, sizeof (struct siginfo));
++ memcpy (inf_siginfo, siginfo, sizeof (siginfo_t));
+ }
+ }
+
+@@ -4802,8 +4802,8 @@ linux_xfer_siginfo (const char *annex, unsigned char *readbuf,
+ unsigned const char *writebuf, CORE_ADDR offset, int len)
+ {
+ int pid;
+- struct siginfo siginfo;
+- char inf_siginfo[sizeof (struct siginfo)];
++ siginfo_t siginfo;
++ char inf_siginfo[sizeof (siginfo_t)];
+
+ if (current_inferior == NULL)
+ return -1;
+diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h
+index 677d261..3aeae70 100644
+--- a/gdb/gdbserver/linux-low.h
++++ b/gdb/gdbserver/linux-low.h
+@@ -20,6 +20,7 @@
+ #ifdef HAVE_THREAD_DB_H
+ #include <thread_db.h>
+ #endif
++#include <signal.h>
+
+ #include "gdb_proc_service.h"
+
+@@ -46,8 +47,6 @@ struct regset_info
+ extern struct regset_info target_regsets[];
+ #endif
+
+-struct siginfo;
+-
+ struct process_info_private
+ {
+ /* Arch-specific additions. */
+@@ -109,7 +108,7 @@ struct linux_target_ops
+ Returns true if any conversion was done; false otherwise.
+ If DIRECTION is 1, then copy from INF to NATIVE.
+ If DIRECTION is 0, copy from NATIVE to INF. */
+- int (*siginfo_fixup) (struct siginfo *native, void *inf, int direction);
++ int (*siginfo_fixup) (siginfo_t *native, void *inf, int direction);
+
+ /* Hook to call when a new process is created or attached to.
+ If extra per-process architecture-specific data is needed,
+diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
+index ed1f8a8..b466b5d 100644
+--- a/gdb/gdbserver/linux-x86-low.c
++++ b/gdb/gdbserver/linux-x86-low.c
+@@ -918,13 +918,13 @@ siginfo_from_compat_siginfo (siginfo_t *to, compat_siginfo_t *from)
+ INF. */
+
+ static int
+-x86_siginfo_fixup (struct siginfo *native, void *inf, int direction)
++x86_siginfo_fixup (siginfo_t *native, void *inf, int direction)
+ {
+ #ifdef __x86_64__
+ /* Is the inferior 32-bit? If so, then fixup the siginfo object. */
+ if (register_size (0) == 4)
+ {
+- if (sizeof (struct siginfo) != sizeof (compat_siginfo_t))
++ if (sizeof (siginfo_t) != sizeof (compat_siginfo_t))
+ fatal ("unexpected difference in siginfo");
+
+ if (direction == 0)
+diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c
+index 8773195..19b827f 100644
+--- a/gdb/ia64-linux-nat.c
++++ b/gdb/ia64-linux-nat.c
+@@ -637,7 +637,7 @@ static int
+ ia64_linux_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
+ {
+ CORE_ADDR psr;
+- struct siginfo *siginfo_p;
++ siginfo_t *siginfo_p;
+ struct regcache *regcache = get_current_regcache ();
+
+ siginfo_p = linux_nat_get_siginfo (inferior_ptid);
+diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
+index f80c0c1..d81d55e 100644
+--- a/gdb/linux-nat.c
++++ b/gdb/linux-nat.c
+@@ -188,7 +188,7 @@ static void (*linux_nat_prepare_to_resume) (struct lwp_info *);
+ /* The method to call, if any, when the siginfo object needs to be
+ converted between the layout returned by ptrace, and the layout in
+ the architecture of the inferior. */
+-static int (*linux_nat_siginfo_fixup) (struct siginfo *,
++static int (*linux_nat_siginfo_fixup) (siginfo_t *,
+ gdb_byte *,
+ int);
+
+@@ -4232,7 +4232,7 @@ linux_nat_mourn_inferior (struct target_ops *ops)
+ layout of the inferiors' architecture. */
+
+ static void
+-siginfo_fixup (struct siginfo *siginfo, gdb_byte *inf_siginfo, int direction)
++siginfo_fixup (siginfo_t *siginfo, gdb_byte *inf_siginfo, int direction)
+ {
+ int done = 0;
+
+@@ -4244,9 +4244,9 @@ siginfo_fixup (struct siginfo *siginfo, gdb_byte *inf_siginfo, int direction)
+ if (!done)
+ {
+ if (direction == 1)
+- memcpy (siginfo, inf_siginfo, sizeof (struct siginfo));
++ memcpy (siginfo, inf_siginfo, sizeof (siginfo_t));
+ else
+- memcpy (inf_siginfo, siginfo, sizeof (struct siginfo));
++ memcpy (inf_siginfo, siginfo, sizeof (siginfo_t));
+ }
+ }
+
+@@ -4256,8 +4256,8 @@ linux_xfer_siginfo (struct target_ops *ops, enum target_object object,
+ const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
+ {
+ int pid;
+- struct siginfo siginfo;
+- gdb_byte inf_siginfo[sizeof (struct siginfo)];
++ siginfo_t siginfo;
++ gdb_byte inf_siginfo[sizeof (siginfo_t)];
+
+ gdb_assert (object == TARGET_OBJECT_SIGNAL_INFO);
+ gdb_assert (readbuf || writebuf);
+@@ -5266,7 +5266,7 @@ linux_nat_set_new_thread (struct target_ops *t,
+ inferior. */
+ void
+ linux_nat_set_siginfo_fixup (struct target_ops *t,
+- int (*siginfo_fixup) (struct siginfo *,
++ int (*siginfo_fixup) (siginfo_t *,
+ gdb_byte *,
+ int))
+ {
+@@ -5285,7 +5285,7 @@ linux_nat_set_prepare_to_resume (struct target_ops *t,
+ }
+
+ /* Return the saved siginfo associated with PTID. */
+-struct siginfo *
++siginfo_t *
+ linux_nat_get_siginfo (ptid_t ptid)
+ {
+ struct lwp_info *lp = find_lwp_pid (ptid);
+diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h
+index c9878d9..d87f0cf 100644
+--- a/gdb/linux-nat.h
++++ b/gdb/linux-nat.h
+@@ -78,7 +78,7 @@ struct lwp_info
+
+ /* Non-zero si_signo if this LWP stopped with a trap. si_addr may
+ be the address of a hardware watchpoint. */
+- struct siginfo siginfo;
++ siginfo_t siginfo;
+
+ /* STOPPED_BY_WATCHPOINT is non-zero if this LWP stopped with a data
+ watchpoint trap. */
+@@ -184,7 +184,7 @@ void linux_nat_set_new_thread (struct target_ops *, void (*) (struct lwp_info *)
+ that ptrace returns, and the layout in the architecture of the
+ inferior. */
+ void linux_nat_set_siginfo_fixup (struct target_ops *,
+- int (*) (struct siginfo *,
++ int (*) (siginfo_t *,
+ gdb_byte *,
+ int));
+
+@@ -198,7 +198,7 @@ void linux_nat_set_prepare_to_resume (struct target_ops *,
+ void linux_nat_switch_fork (ptid_t new_ptid);
+
+ /* Return the saved siginfo associated with PTID. */
+-struct siginfo *linux_nat_get_siginfo (ptid_t ptid);
++siginfo_t *linux_nat_get_siginfo (ptid_t ptid);
+
+ /* Compute and return the processor core of a given thread. */
+ int linux_nat_core_of_thread_1 (ptid_t ptid);
+diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
+index 1bd157b..9bd11fd 100644
+--- a/gdb/ppc-linux-nat.c
++++ b/gdb/ppc-linux-nat.c
+@@ -2218,7 +2218,7 @@ ppc_linux_thread_exit (struct thread_info *tp, int silent)
+ static int
+ ppc_linux_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
+ {
+- struct siginfo *siginfo_p;
++ siginfo_t *siginfo_p;
+
+ siginfo_p = linux_nat_get_siginfo (inferior_ptid);
+
+diff --git a/gdb/procfs.c b/gdb/procfs.c
+index 903621d..cb4bc7c 100644
+--- a/gdb/procfs.c
++++ b/gdb/procfs.c
+@@ -266,7 +266,7 @@ typedef struct sigaction gdb_sigaction_t;
+ #ifdef HAVE_PR_SIGINFO64_T
+ typedef pr_siginfo64_t gdb_siginfo_t;
+ #else
+-typedef struct siginfo gdb_siginfo_t;
++typedef siginfo_t gdb_siginfo_t;
+ #endif
+
+ /* On mips-irix, praddset and prdelset are defined in such a way that
+--
+1.7.9.7
+
diff --git a/package/gdb/7.4.1/05_all_readline-headers.patch b/package/gdb/7.4.1/05_all_readline-headers.patch
new file mode 100644
index 000000000..e65adf6e6
--- /dev/null
+++ b/package/gdb/7.4.1/05_all_readline-headers.patch
@@ -0,0 +1,42 @@
+--- a/readline/complete.c
++++ b/readline/complete.c
+@@ -25,6 +25,11 @@
+ # include <config.h>
+ #endif
+
++#ifdef HAVE_WCHAR_H /* wcwidth() */
++# define _GNU_SOURCE
++# include <wchar.h>
++#endif
++
+ #include <sys/types.h>
+ #include <fcntl.h>
+ #if defined (HAVE_SYS_FILE_H)
+--- a/readline/display.c
++++ b/readline/display.c
+@@ -25,6 +25,11 @@
+ # include <config.h>
+ #endif
+
++#ifdef HAVE_WCHAR_H /* wcwidth() */
++# define _GNU_SOURCE
++# include <wchar.h>
++#endif
++
+ #include <sys/types.h>
+
+ #if defined (HAVE_UNISTD_H)
+--- a/readline/mbutil.c
++++ b/readline/mbutil.c
+@@ -25,6 +25,11 @@
+ # include <config.h>
+ #endif
+
++#ifdef HAVE_WCHAR_H /* wcwidth() */
++# define _GNU_SOURCE
++# include <wchar.h>
++#endif
++
+ #include <sys/types.h>
+ #include <fcntl.h>
+ #include "posixjmp.h"
diff --git a/package/gdb/7.4.1/xtensa-asm-ptrace-h.patch b/package/gdb/7.4.1/xtensa-asm-ptrace-h.patch
new file mode 100644
index 000000000..3d1b07c99
--- /dev/null
+++ b/package/gdb/7.4.1/xtensa-asm-ptrace-h.patch
@@ -0,0 +1,22 @@
+--- gdb-7.4.1/gdb/xtensa-linux-nat.c.orig 2012-10-19 16:23:06.908165323 -0700
++++ gdb-7.4.1/gdb/xtensa-linux-nat.c 2012-10-19 16:35:30.792134876 -0700
+@@ -36,7 +36,7 @@
+ #include "gdb_wait.h"
+ #include <fcntl.h>
+ #include <sys/procfs.h>
+-#include <sys/ptrace.h>
++#include <asm/ptrace.h>
+
+ #include "gregset.h"
+ #include "xtensa-tdep.h"
+--- gdb-7.4.1/gdb/gdbserver/linux-xtensa-low.c.orig 2012-10-19 16:24:06.260162894 -0700
++++ gdb-7.4.1/gdb/gdbserver/linux-xtensa-low.c 2012-10-19 16:36:07.920133357 -0700
+@@ -23,7 +23,7 @@
+ /* Defined in auto-generated file reg-xtensa.c. */
+ void init_registers_xtensa (void);
+
+-#include <sys/ptrace.h>
++#include <asm/ptrace.h>
+ #include <xtensa-config.h>
+
+ #include "xtensa-xtregs.c"
diff --git a/package/gdb/7.4.1/xtensa-gdb-regsize.patch b/package/gdb/7.4.1/xtensa-gdb-regsize.patch
new file mode 100644
index 000000000..e10bb8f3e
--- /dev/null
+++ b/package/gdb/7.4.1/xtensa-gdb-regsize.patch
@@ -0,0 +1,19 @@
+--- gdb-7.4.1/gdb/xtensa-tdep.h.orig 2012-10-30 11:40:23.546448594 -0700
++++ gdb-7.4.1/gdb/xtensa-tdep.h 2012-10-30 11:41:43.078445337 -0700
+@@ -17,6 +17,7 @@
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
++#include <stdint.h>
+
+ /* XTENSA_TDEP_VERSION can/should be changed along with XTENSA_CONFIG_VERSION
+ whenever the "tdep" structure changes in an incompatible way. */
+@@ -84,7 +85,7 @@
+ /* Xtensa ELF core file register set representation ('.reg' section).
+ Copied from target-side ELF header <xtensa/elf.h>. */
+
+-typedef unsigned long xtensa_elf_greg_t;
++typedef uint32_t xtensa_elf_greg_t;
+
+ typedef struct
+ {
diff --git a/package/gdb/Config.in b/package/gdb/Config.in
new file mode 100644
index 000000000..6eb29d5bd
--- /dev/null
+++ b/package/gdb/Config.in
@@ -0,0 +1,41 @@
+comment "gdb/gdbserver require a toolchain with thread and thread debug support"
+ depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_TOOLCHAIN_HAS_THREADS_DEBUG
+
+config BR2_PACKAGE_GDB
+ bool "gdb"
+ select BR2_PACKAGE_GDB_SERVER if !BR2_PACKAGE_GDB_DEBUGGER
+ depends on BR2_TOOLCHAIN_HAS_THREADS && BR2_TOOLCHAIN_HAS_THREADS_DEBUG
+ help
+ GDB, the GNU Project debugger, allows you to see what is
+ going on `inside' another program while it executes -- or
+ what another program was doing at the moment it crashed.
+
+ This option allows to build gdbserver and/or the gdb
+ debugger for the target.
+
+ For embedded development, the most common solution is to
+ build only 'gdbserver' for the target, and use a cross-gdb
+ on the host. See BR2_PACKAGE_HOST_GDB in the Toolchain menu
+ to enable one. Notice that external toolchains often provide
+ their own pre-built cross-gdb and gdbserver binaries.
+
+ http://www.gnu.org/software/gdb/
+
+if BR2_PACKAGE_GDB
+
+config BR2_PACKAGE_GDB_SERVER
+ bool "gdbserver"
+ help
+ Build the gdbserver stub to run on the target.
+ A full gdb is needed to debug the progam.
+
+config BR2_PACKAGE_GDB_DEBUGGER
+ bool "full debugger"
+ select BR2_PACKAGE_NCURSES
+ depends on BR2_USE_WCHAR
+ depends on !BR2_sh && !BR2_sh64 && !BR2_avr32 && !BR2_microblaze && !BR2_bfin && !BR2_aarch64
+
+comment "full gdb on target needs WCHAR support in toolchain"
+ depends on !BR2_USE_WCHAR
+
+endif
diff --git a/package/gdb/Config.in.host b/package/gdb/Config.in.host
new file mode 100644
index 000000000..223c4268c
--- /dev/null
+++ b/package/gdb/Config.in.host
@@ -0,0 +1,56 @@
+config BR2_PACKAGE_HOST_GDB
+ bool "Build cross gdb for the host"
+ help
+ Build a cross gdb that runs on the host machine and debugs
+ programs running on the target. It requires 'gdbserver'
+ installed on the target, see BR2_PACKAGE_GDB_SERVER to
+ enable it.
+
+if BR2_PACKAGE_HOST_GDB
+
+choice
+ prompt "GDB debugger Version"
+ default BR2_GDB_VERSION_6_6 if BR2_bfin
+ default BR2_GDB_VERSION_6_7_1_AVR32_2_1_5 if BR2_avr32
+ default BR2_GDB_VERSION_7_5
+ help
+ Select the version of gdb you wish to use.
+
+ config BR2_GDB_VERSION_6_6
+ bool "gdb 6.6"
+ depends on BR2_bfin
+
+ config BR2_GDB_VERSION_6_7_1_AVR32_2_1_5
+ depends on BR2_avr32
+ bool "gdb 6.7.1-avr32-2.1.5"
+
+ config BR2_GDB_VERSION_7_2
+ bool "gdb 7.2.x"
+ depends on !BR2_bfin
+ depends on BR2_DEPRECATED
+
+ config BR2_GDB_VERSION_7_3
+ bool "gdb 7.3.x"
+ depends on !BR2_bfin
+ depends on BR2_DEPRECATED
+
+ config BR2_GDB_VERSION_7_4
+ bool "gdb 7.4.x"
+ depends on !BR2_bfin
+
+ config BR2_GDB_VERSION_7_5
+ bool "gdb 7.5.x"
+ depends on !BR2_bfin
+
+endchoice
+
+config BR2_GDB_VERSION
+ string
+ default "6.6a" if BR2_GDB_VERSION_6_6
+ default "6.7.1-avr32-2.1.5" if BR2_GDB_VERSION_6_7_1_AVR32_2_1_5
+ default "7.2a" if BR2_GDB_VERSION_7_2
+ default "7.3.1" if BR2_GDB_VERSION_7_3
+ default "7.4.1" if BR2_GDB_VERSION_7_4
+ default "7.5.1" if BR2_GDB_VERSION_7_5
+
+endif
diff --git a/package/gdb/gdb.mk b/package/gdb/gdb.mk
new file mode 100644
index 000000000..24ce9bf21
--- /dev/null
+++ b/package/gdb/gdb.mk
@@ -0,0 +1,101 @@
+#############################################################
+#
+# gdb
+#
+#############################################################
+
+GDB_VERSION = $(call qstrip,$(BR2_GDB_VERSION))
+GDB_SITE = $(BR2_GNU_MIRROR)/gdb
+
+# When no version is defined, it means that cross-gdb for the host has
+# not been enabled, and we will only build gdbserver or gdb for the
+# target. In this case, use the latest available version
+# automatically.
+ifeq ($(GDB_VERSION),)
+ifeq ($(BR2_bfin),y)
+GDB_VERSION = 6.6a
+else ifeq ($(BR2_avr32),y)
+GDB_VERSION = 6.7.1-avr32-2.1.5
+GDB_SITE = ftp://www.at91.com/pub/buildroot/
+else
+GDB_VERSION = 7.5.1
+endif
+endif
+
+GDB_SOURCE = gdb-$(GDB_VERSION).tar.bz2
+GDB_LICENSE = GPLv2+ LGPLv2+ GPLv3+ LGPLv3+
+GDB_LICENSE_FILES = COPYING COPYING.LIB COPYING3 COPYING3.LIB
+
+# We only want gdbserver and not the entire debugger.
+ifeq ($(BR2_PACKAGE_GDB_DEBUGGER),)
+GDB_SUBDIR = gdb/gdbserver
+HOST_GDB_SUBDIR = .
+else
+GDB_DEPENDENCIES = ncurses
+endif
+
+# For the host variant, we really want to build with XML support,
+# which is needed to read XML descriptions of target architectures.
+HOST_GDB_DEPENDENCIES = host-expat
+
+# Apply the Xtensa specific patches
+XTENSA_CORE_NAME = $(call qstrip, $(BR2_XTENSA_CORE_NAME))
+ifneq ($(XTENSA_CORE_NAME),)
+define GDB_XTENSA_PRE_PATCH
+ tar xf $(BR2_XTENSA_OVERLAY_DIR)/xtensa_$(XTENSA_CORE_NAME).tar \
+ -C $(@D) --strip-components=1 gdb
+endef
+HOST_GDB_PRE_PATCH_HOOKS += GDB_XTENSA_PRE_PATCH
+endif
+
+GDB_CONF_ENV = \
+ ac_cv_type_uintptr_t=yes \
+ gt_cv_func_gettext_libintl=yes \
+ ac_cv_func_dcgettext=yes \
+ gdb_cv_func_sigsetjmp=yes \
+ bash_cv_func_strcoll_broken=no \
+ bash_cv_must_reinstall_sighandlers=no \
+ bash_cv_func_sigsetjmp=present \
+ bash_cv_have_mbstate_t=yes \
+ gdb_cv_func_sigsetjmp=yes
+
+GDB_CONF_OPT = \
+ --without-uiout \
+ --disable-tui \
+ --disable-gdbtk \
+ --without-x \
+ --disable-sim \
+ $(if $(BR2_PACKAGE_GDB_SERVER),--enable-gdbserver) \
+ --with-curses \
+ --without-included-gettext \
+ --disable-werror
+
+# This removes some unneeded Python scripts and XML target description
+# files that are not useful for a normal usage of the debugger.
+define GDB_REMOVE_UNNEEDED_FILES
+ $(RM) -rf $(TARGET_DIR)/usr/share/gdb
+endef
+
+GDB_POST_INSTALL_TARGET_HOOKS += GDB_REMOVE_UNNEEDED_FILES
+
+# A few notes:
+# * --target, because we're doing a cross build rather than a real
+# host build.
+# * --enable-static because gdb really wants to use libbfd.a
+# * --disable-shared, otherwise the old 6.7 version specific to AVR32
+# doesn't build because it wants to link a shared libbfd.so against
+# non-PIC liberty.a.
+HOST_GDB_CONF_OPT = \
+ --target=$(GNU_TARGET_NAME) \
+ --enable-static --disable-shared \
+ --without-uiout \
+ --disable-tui \
+ --disable-gdbtk \
+ --without-x \
+ --enable-threads \
+ --disable-werror \
+ --without-included-gettext \
+ --disable-sim
+
+$(eval $(autotools-package))
+$(eval $(host-autotools-package))