summaryrefslogtreecommitdiff
path: root/openwrt/toolchain/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'openwrt/toolchain/gdb')
-rw-r--r--openwrt/toolchain/gdb/5.3/050-debian-subset.patch633
-rw-r--r--openwrt/toolchain/gdb/5.3/100-uclibc.patch154
-rw-r--r--openwrt/toolchain/gdb/6.1.1/100-uclibc-conf.patch290
-rw-r--r--openwrt/toolchain/gdb/6.1.1/200-uclibc-readline-conf.patch15
-rw-r--r--openwrt/toolchain/gdb/6.2.1/100-uclibc-conf.patch290
-rw-r--r--openwrt/toolchain/gdb/6.2.1/200-uclibc-readline-conf.patch15
-rw-r--r--openwrt/toolchain/gdb/6.2.1/400-mips-coredump.patch28
-rw-r--r--openwrt/toolchain/gdb/6.2/100-uclibc-conf.patch290
-rw-r--r--openwrt/toolchain/gdb/6.2/200-uclibc-readline-conf.patch15
-rw-r--r--openwrt/toolchain/gdb/Config.in49
-rw-r--r--openwrt/toolchain/gdb/Makefile.in10
-rw-r--r--openwrt/toolchain/gdb/gdb.mk189
12 files changed, 1978 insertions, 0 deletions
diff --git a/openwrt/toolchain/gdb/5.3/050-debian-subset.patch b/openwrt/toolchain/gdb/5.3/050-debian-subset.patch
new file mode 100644
index 0000000..e44b15c
--- /dev/null
+++ b/openwrt/toolchain/gdb/5.3/050-debian-subset.patch
@@ -0,0 +1,633 @@
+Patch pending upstream, probably acceptable.
+--------------------------------------------
+
+
+
+Daniel Jacobowitz <drow@mvista.com> writes:
+> I like this. The way func_frame_chain_valid should really be used is
+> by something like:
+>
+> /* NOTE: tm-i386nw.h and tm-i386v4.h override this. */
+> set_gdbarch_frame_chain_valid (gdbarch, file_frame_chain_valid);
+>
+> (copied from i386-tdep.c).
+>
+> Does this patch work for you?
+
+Yes, thanks. I've included a revised version of my patch below.
+
+> I'm curious as to why we can't just set this universally, or at least a
+> little more globally. Most things that have a main () use it as a
+> normal main (). I'd propose that we set it as the default frame chain,
+> and provide/document an option to ignore inside_main_func.
+
+Well, gdbarch is never supposed to change the default behavior of
+macros; this helps us convert pre-gdbarch targets incrementally.
+Simply turning on gdbarch for one's target ideally wouldn't change its
+behavior at all.
+
+
+[Patch revised for Debian snapshot]
+--- snap/gdb/i386-linux-tdep.c.orig 2002-08-18 19:53:57.000000000 -0400
++++ snap/gdb/i386-linux-tdep.c 2002-08-18 19:54:31.000000000 -0400
+@@ -452,6 +452,9 @@
+
+ set_solib_svr4_fetch_link_map_offsets (gdbarch,
+ i386_linux_svr4_fetch_link_map_offsets);
++
++ set_gdbarch_frame_chain_valid (gdbarch,
++ generic_func_frame_chain_valid);
+ }
+
+ /* Provide a prototype to silence -Wmissing-prototypes. */
+[Hurd needs 6. Take 8, since it does no real harm.]
+
+
+Package: gdb
+Severity: normal
+Tags: patch, sid
+
+Hello,
+
+GDB will crash on the Hurd after issuing the 'show' and hitting enter
+a few times:
+
+../../gdb/ui-out.c:130: gdb-internal-error: push_level: Assertion +`uiout->level >= 0 && uiout->level < MAX_UI_OUT_LEVELS' failed.
+
+the problem is that MAX_UI_OUT_LEVELS is not high enough for the extra
+option we have on the Hurd, it should be rised to 6 then, which works
+fine:
+
+--- gdb-5.2.cvs20020401/gdb/ui-out.c~ Fri May 3 02:19:20 2002
++++ gdb-5.2.cvs20020401/gdb/ui-out.c Fri May 3 02:19:32 2002
+@@ -45,7 +45,7 @@
+ is always available. Stack/nested level 0 is reserved for the
+ top-level result. */
+
+-enum { MAX_UI_OUT_LEVELS = 5 };
++enum { MAX_UI_OUT_LEVELS = 8 };
+
+ struct ui_out_level
+ {
+
+--
+Robert Millan
+
+"5 years from now everyone will be running
+free GNU on their 200 MIPS, 64M SPARCstation-5"
+
+ Andrew S. Tanenbaum, 30 Jan 1992
+
+
+Submitted upstream, not liked very much. It's a hack, but it will do for
+now.
+
+2002-07-31 Daniel Jacobowitz <drow@mvista.com>
+
+ Fix PR gdb/568
+ * thread-db.c (lwp_from_thread): Only warn if unable to find
+ the thread.
+
+Index: thread-db.c
+===================================================================
+RCS file: /cvs/src/src/gdb/thread-db.c,v
+retrieving revision 1.22
+diff -u -p -r1.22 thread-db.c
+--- gdb/gdb/thread-db.c 23 Mar 2002 17:38:13 -0000 1.22
++++ gdb/gdb/thread-db.c 31 Jul 2002 16:29:52 -0000
+@@ -260,6 +260,12 @@ lwp_from_thread (ptid_t ptid)
+ return ptid;
+
+ err = td_ta_map_id2thr_p (thread_agent, GET_THREAD (ptid), &th);
++ if (err == TD_ERR)
++ {
++ warning ("Cannot find thread %ld: %s",
++ (long) GET_THREAD (ptid), thread_db_err_str (err));
++ return ptid;
++ }
+ if (err != TD_OK)
+ error ("Cannot find thread %ld: %s",
+ (long) GET_THREAD (ptid), thread_db_err_str (err));
+From Michael Fedrowitz <michaelf@debian.org>. Not submitted to FSF yet.
+
+ Hi,
+
+gdb fails to build from source on m68k because some definitions have
+been removed from tm-m68k.h. The patch below readds them.
+
+-Michael
+
+
+diff -urN gdb-5.2.cvs20020818.orig/gdb/config/m68k/tm-m68k.h gdb-5.2.cvs20020818/gdb/config/m68k/tm-m68k.h
+--- gdb-5.2.cvs20020818.orig/gdb/config/m68k/tm-m68k.h 2002-07-10 19:01:38.000000000 +0200
++++ gdb-5.2.cvs20020818/gdb/config/m68k/tm-m68k.h 2002-10-06 18:01:59.000000000 +0200
+@@ -26,8 +26,11 @@
+ /* Generic 68000 stuff, to be included by other tm-*.h files. */
+
+ /* D0_REGNM and A0_REGNUM must be defined here because they are
+- used by the monitor. */
++ used by the monitor. FPC_REGNUM, FPS_REGNUM and FPI_REGNUM are
++ defined here because they are used by m68klinux-nat.c. */
+
+ #define D0_REGNUM 0
+ #define A0_REGNUM 8
+-
++#define FPC_REGNUM 26
++#define FPS_REGNUM 27
++#define FPI_REGNUM 28
+
+
+2002-11-24 Daniel Jacobowitz <drow@mvista.com>
+
+ * doublest.c (convert_floatformat_to_doublest): Cast exp_bias to int.
+ * config/alpha/alpha-linux.mh (MH_CFLAGS): Add -mieee.
+
+--- gdb-5.2.debian90.cvs20021120/gdb/doublest.c.orig 2002-11-24 17:48:16.000000000 -0500
++++ gdb-5.2.debian90.cvs20021120/gdb/doublest.c 2002-11-24 17:48:25.000000000 -0500
+@@ -177,7 +177,7 @@
+ if (!special_exponent)
+ exponent -= fmt->exp_bias;
+ else if (exponent == 0)
+- exponent = 1 - fmt->exp_bias;
++ exponent = 1 - (int)fmt->exp_bias;
+
+ /* Build the result algebraically. Might go infinite, underflow, etc;
+ who cares. */
+--- gdb-5.2.debian90.cvs20021120/gdb/config/alpha/alpha-linux.mh.orig 2002-11-24 17:50:30.000000000 -0500
++++ gdb-5.2.debian90.cvs20021120/gdb/config/alpha/alpha-linux.mh 2002-11-24 17:50:41.000000000 -0500
+@@ -8,3 +8,5 @@
+
+ MMALLOC =
+ MMALLOC_CFLAGS = -DNO_MMALLOC
++
++MH_CFLAGS = -mieee
+In CVS but not in 5.3 branch...
+
+2002-10-23 Daniel Jacobowitz <drow@mvista.com>
+
+ * lin-lwp.c (lin_lwp_resume): Remove resume_all test for !step.
+
+Index: lin-lwp.c
+===================================================================
+RCS file: /cvs/src/src/gdb/lin-lwp.c,v
+retrieving revision 1.35
+diff -u -p -r1.35 lin-lwp.c
+--- gdb-5.2.90/gdb/lin-lwp.c 27 Aug 2002 22:37:06 -0000 1.35
++++ gdb-5.2.90/gdb/lin-lwp.c 23 Oct 2002 04:23:13 -0000
+@@ -579,11 +579,8 @@ lin_lwp_resume (ptid_t ptid, int step, e
+ struct lwp_info *lp;
+ int resume_all;
+
+- /* Apparently the interpretation of PID is dependent on STEP: If
+- STEP is non-zero, a specific PID means `step only this process
+- id'. But if STEP is zero, then PID means `continue *all*
+- processes, but give the signal only to this one'. */
+- resume_all = (PIDGET (ptid) == -1) || !step;
++ /* A specific PTID means `step only this process id'. */
++ resume_all = (PIDGET (ptid) == -1);
+
+ if (resume_all)
+ iterate_over_lwps (resume_set_callback, NULL);
+
+Not submitted yet, testing.
+
+--- gdb-5.2.90/gdb/alpha-tdep.c.orig Sun Nov 24 21:42:53 2002
++++ gdb-5.2.90/gdb/alpha-tdep.c Sun Nov 24 21:48:26 2002
+@@ -99,10 +99,12 @@
+
+ static alpha_extra_func_info_t heuristic_proc_desc (CORE_ADDR,
+ CORE_ADDR,
+- struct frame_info *);
++ struct frame_info *,
++ int);
+
+ static alpha_extra_func_info_t find_proc_desc (CORE_ADDR,
+- struct frame_info *);
++ struct frame_info *,
++ int);
+
+ #if 0
+ static int alpha_in_lenient_prologue (CORE_ADDR, CORE_ADDR);
+@@ -512,7 +514,7 @@
+ if (tmp != 0)
+ pc = tmp;
+
+- proc_desc = find_proc_desc (pc, frame->next);
++ proc_desc = find_proc_desc (pc, frame->next, 1);
+ pcreg = proc_desc ? PROC_PC_REG (proc_desc) : ALPHA_RA_REGNUM;
+
+ if (frame->signal_handler_caller)
+@@ -596,10 +598,10 @@
+
+ static alpha_extra_func_info_t
+ heuristic_proc_desc (CORE_ADDR start_pc, CORE_ADDR limit_pc,
+- struct frame_info *next_frame)
++ struct frame_info *next_frame, int read_sp_p)
+ {
+- CORE_ADDR sp = read_next_frame_reg (next_frame, SP_REGNUM);
+- CORE_ADDR vfp = sp;
++ CORE_ADDR sp;
++ CORE_ADDR vfp;
+ CORE_ADDR cur_pc;
+ int frame_size;
+ int has_frame_reg = 0;
+@@ -607,6 +609,11 @@
+ int pcreg = -1;
+ int regno;
+
++ if (read_sp_p)
++ vfp = sp = read_next_frame_reg (next_frame, SP_REGNUM);
++ else
++ vfp = sp = 0;
++
+ if (start_pc == 0)
+ return NULL;
+ memset (&temp_proc_desc, '\0', sizeof (temp_proc_desc));
+@@ -761,7 +768,7 @@
+ CORE_ADDR func_addr, func_end;
+
+ if (!proc_desc)
+- proc_desc = find_proc_desc (pc, NULL);
++ proc_desc = find_proc_desc (pc, NULL, 0);
+
+ if (proc_desc)
+ {
+@@ -807,7 +814,7 @@
+ }
+
+ static alpha_extra_func_info_t
+-find_proc_desc (CORE_ADDR pc, struct frame_info *next_frame)
++find_proc_desc (CORE_ADDR pc, struct frame_info *next_frame, int read_sp_p)
+ {
+ alpha_extra_func_info_t proc_desc;
+ struct block *b;
+@@ -879,7 +886,7 @@
+ {
+ alpha_extra_func_info_t found_heuristic =
+ heuristic_proc_desc (PROC_LOW_ADDR (proc_desc),
+- pc, next_frame);
++ pc, next_frame, read_sp_p);
+ if (found_heuristic)
+ {
+ PROC_LOCALOFF (found_heuristic) =
+@@ -921,7 +928,7 @@
+ startaddr = heuristic_proc_start (pc);
+
+ proc_desc =
+- heuristic_proc_desc (startaddr, pc, next_frame);
++ heuristic_proc_desc (startaddr, pc, next_frame, read_sp_p);
+ }
+ return proc_desc;
+ }
+@@ -937,7 +944,7 @@
+ if (saved_pc == 0 || inside_entry_file (saved_pc))
+ return 0;
+
+- proc_desc = find_proc_desc (saved_pc, frame);
++ proc_desc = find_proc_desc (saved_pc, frame, 1);
+ if (!proc_desc)
+ return 0;
+
+@@ -979,7 +986,7 @@
+ {
+ /* Use proc_desc calculated in frame_chain */
+ alpha_extra_func_info_t proc_desc =
+- frame->next ? cached_proc_desc : find_proc_desc (frame->pc, frame->next);
++ frame->next ? cached_proc_desc : find_proc_desc (frame->pc, frame->next, 1);
+
+ frame->extra_info = (struct frame_extra_info *)
+ frame_obstack_alloc (sizeof (struct frame_extra_info));
+@@ -1291,7 +1298,7 @@
+ /* we need proc_desc to know how to restore the registers;
+ if it is NULL, construct (a temporary) one */
+ if (proc_desc == NULL)
+- proc_desc = find_proc_desc (frame->pc, frame->next);
++ proc_desc = find_proc_desc (frame->pc, frame->next, 1);
+
+ /* Question: should we copy this proc_desc and save it in
+ frame->proc_desc? If we do, who will free it?
+Not yet submitted upstream. This requires some serious thinking about.
+If the target stack worked in any logical way, this wouldn't be necessary...
+ending up with roughly:
+ thread_stratum: thread-db (silent reference to lin-lwp)
+ core_stratum: corelow
+ exec_stratum: exec
+ dummy_stratum: dummy
+just makes no sense.
+
+This patch fixes debugging threaded applications which are statically linked
+without breaking debugging threaded core files. It also fixes the PIDs in
+generate-core-file'd corefiles. Mostly.
+
+diff -x '*~' -ur o/gdb-5.2.debian90.cvs20021120/gdb/corelow.c gdb-5.2.debian90.cvs20021120/gdb/corelow.c
+--- o/gdb-5.2.debian90.cvs20021120/gdb/corelow.c 2002-09-18 13:23:15.000000000 -0400
++++ gdb-5.2.debian90.cvs20021120/gdb/corelow.c 2002-12-03 14:03:32.000000000 -0500
+@@ -350,7 +350,7 @@
+ bfd_map_over_sections (core_bfd, add_to_thread_list,
+ bfd_get_section_by_name (core_bfd, ".reg"));
+
+- if (ontop)
++ if (ontop || 1)
+ {
+ /* Fetch all registers from core file. */
+ target_fetch_registers (-1);
+diff -x '*~' -ur o/gdb-5.2.debian90.cvs20021120/gdb/linux-proc.c gdb-5.2.debian90.cvs20021120/gdb/linux-proc.c
+--- o/gdb-5.2.debian90.cvs20021120/gdb/linux-proc.c 2002-12-03 14:13:52.000000000 -0500
++++ gdb-5.2.debian90.cvs20021120/gdb/linux-proc.c 2002-12-03 13:56:34.000000000 -0500
+@@ -177,7 +177,7 @@
+ #ifdef FILL_FPXREGSET
+ gdb_fpxregset_t fpxregs;
+ #endif
+- unsigned long merged_pid = ptid_get_tid (ptid) << 16 | ptid_get_pid (ptid);
++ unsigned long merged_pid = ptid_get_tid (ptid) << 16; /* | ptid_get_pid (ptid); */
+
+ fill_gregset (&gregs, -1);
+ note_data = (char *) elfcore_write_prstatus (obfd,
+diff -x '*~' -ur o/gdb-5.2.debian90.cvs20021120/gdb/target.c gdb-5.2.debian90.cvs20021120/gdb/target.c
+--- o/gdb-5.2.debian90.cvs20021120/gdb/target.c 2002-09-18 13:23:22.000000000 -0400
++++ gdb-5.2.debian90.cvs20021120/gdb/target.c 2002-12-03 14:06:07.000000000 -0500
+@@ -1589,6 +1589,7 @@
+ dummy_target.to_find_memory_regions = dummy_find_memory_regions;
+ dummy_target.to_make_corefile_notes = dummy_make_corefile_notes;
+ dummy_target.to_magic = OPS_MAGIC;
++ cleanup_target (&dummy_target);
+ }
+
+
+diff -x '*~' -ur o/gdb-5.2.debian90.cvs20021120/gdb/thread-db.c gdb-5.2.debian90.cvs20021120/gdb/thread-db.c
+--- o/gdb-5.2.debian90.cvs20021120/gdb/thread-db.c 2002-12-03 14:13:50.000000000 -0500
++++ gdb-5.2.debian90.cvs20021120/gdb/thread-db.c 2002-12-03 13:39:54.000000000 -0500
+@@ -57,6 +57,31 @@
+ /* Non-zero if we're using this module's target vector. */
+ static int using_thread_db;
+
++/* Macros to pass an event to the next target if we should not be handling it
++ here in the thread_stratum. */
++#define FIND_NEXT_TARGET(METHOD_NAME) \
++ struct target_ops *next_target = &thread_db_ops; \
++ while (1) \
++ { \
++ next_target = find_target_beneath (next_target); \
++ if (next_target->METHOD_NAME != NULL) \
++ break; \
++ }
++
++#define MAYBE_HAND_DOWN(METHOD_NAME,ARGS) \
++ if (proc_handle.pid == 0) \
++ { \
++ FIND_NEXT_TARGET (METHOD_NAME); \
++ (*next_target->METHOD_NAME) ARGS; \
++ return; \
++ }
++#define MAYBE_HAND_DOWN_RETURN(METHOD_NAME,ARGS) \
++ if (proc_handle.pid == 0) \
++ { \
++ FIND_NEXT_TARGET (METHOD_NAME); \
++ return (*next_target->METHOD_NAME) ARGS; \
++ }
++
+ /* Non-zero if we have to keep this module's target vector active
+ across re-runs. */
+ static int keep_thread_db;
+@@ -489,9 +514,7 @@
+ {
+ td_err_e err;
+
+- /* Don't attempt to use thread_db on targets which can not run
+- (core files). */
+- if (objfile == NULL || !target_has_execution)
++ if (objfile == NULL)
+ {
+ /* All symbols have been discarded. If the thread_db target is
+ active, deactivate it now. */
+@@ -515,7 +538,10 @@
+ /* Initialize the structure that identifies the child process. Note
+ that at this point there is no guarantee that we actually have a
+ child process. */
+- proc_handle.pid = GET_PID (inferior_ptid);
++ if (target_has_execution)
++ proc_handle.pid = GET_PID (inferior_ptid);
++ else
++ proc_handle.pid = 0;
+
+ /* Now attempt to open a connection to the thread library. */
+ err = td_ta_new_p (&proc_handle, &thread_agent);
+@@ -758,6 +784,9 @@
+ struct cleanup *old_chain = save_inferior_ptid ();
+ int xfer;
+
++ MAYBE_HAND_DOWN_RETURN (to_xfer_memory, (memaddr, myaddr, len, write,
++ attrib, target));
++
+ if (is_thread (inferior_ptid))
+ {
+ /* FIXME: This seems to be necessary to make sure breakpoints
+@@ -782,6 +811,8 @@
+ gdb_prfpregset_t fpregset;
+ td_err_e err;
+
++ MAYBE_HAND_DOWN (to_fetch_registers, (regno));
++
+ if (!is_thread (inferior_ptid))
+ {
+ /* Pass the request to the target beneath us. */
+@@ -819,6 +850,8 @@
+ gdb_prfpregset_t fpregset;
+ td_err_e err;
+
++ MAYBE_HAND_DOWN (to_store_registers, (regno));
++
+ if (!is_thread (inferior_ptid))
+ {
+ /* Pass the request to the target beneath us. */
+@@ -908,6 +941,8 @@
+ td_thrinfo_t ti;
+ td_err_e err;
+
++ MAYBE_HAND_DOWN_RETURN (to_thread_alive, (ptid));
++
+ if (is_thread (ptid))
+ {
+ err = td_ta_map_id2thr_p (thread_agent, GET_THREAD (ptid), &th);
+@@ -961,6 +996,8 @@
+ {
+ td_err_e err;
+
++ MAYBE_HAND_DOWN (to_find_new_threads, ());
++
+ /* Iterate over all user-space threads to discover new threads. */
+ err = td_ta_thr_iter_p (thread_agent, find_new_threads_callback, NULL,
+ TD_THR_ANY_STATE, TD_THR_LOWEST_PRIORITY,
+@@ -972,6 +1009,8 @@
+ static char *
+ thread_db_pid_to_str (ptid_t ptid)
+ {
++ MAYBE_HAND_DOWN_RETURN (to_pid_to_str, (ptid));
++
+ if (is_thread (ptid))
+ {
+ static char buf[64];
+Trivial. Need to submit this.
+
+--- gdb-5.2.debian90.cvs20021120/gdb/tracepoint.c.orig 2002-12-03 14:35:44.000000000 -0500
++++ gdb-5.2.debian90.cvs20021120/gdb/tracepoint.c 2002-12-03 14:43:02.000000000 -0500
+@@ -861,6 +861,8 @@
+ else
+ line = gdb_readline (0);
+
++ if (line == NULL || *line == EOF)
++ break;
+ linetype = validate_actionline (&line, t);
+ if (linetype == BADLINE)
+ continue; /* already warned -- collect another line */
+Fix build on Sparc.
+
+--- gdb-5.3/gdb/sparc-nat.c.orig 2003-01-04 00:11:28.000000000 -0500
++++ gdb-5.3/gdb/sparc-nat.c 2003-01-04 00:12:42.000000000 -0500
+@@ -33,6 +33,13 @@
+ #include <sys/ptrace.h>
+ #include <sys/wait.h>
+ #ifdef __linux__
++/* Sadly, <sys/ucontext.h> conflicts with <asm/reg.h> on Linux. And
++ -D_GNU_SOURCE brings in <sys/ucontext.h> implicitly with <signal.h>.
++ Hack around this. */
++#undef FPU_REGS_TYPE
++#define fpu asm_reg_fpu
++#define fq asm_reg_fq
++#define fpq asm_reg_fpq
+ #include <asm/reg.h>
+ #else
+ #include <machine/reg.h>
+diff -urN gdb-5.3/gdb/gdbserver.orig/gdbreplay.c gdb-5.3/gdb/gdbserver/gdbreplay.c
+--- gdb-5.3/gdb/gdbserver.orig/gdbreplay.c 2002-07-09 11:38:58.000000000 -0600
++++ gdb-5.3/gdb/gdbserver/gdbreplay.c 2003-08-20 08:44:20.000000000 -0600
+@@ -54,14 +54,15 @@
+ perror_with_name (char *string)
+ {
+ #ifndef STDC_HEADERS
+- extern int sys_nerr;
+ extern char *sys_errlist[];
+ extern int errno;
+ #endif
+ const char *err;
+ char *combined;
+
+- err = (errno < sys_nerr) ? sys_errlist[errno] : "unknown error";
++ err = strerror (errno);
++ if (err == NULL)
++ err = "unknown error";
+ combined = (char *) alloca (strlen (err) + strlen (string) + 3);
+ strcpy (combined, string);
+ strcat (combined, ": ");
+diff -urN gdb-5.3/gdb/gdbserver.orig/low-hppabsd.c gdb-5.3/gdb/gdbserver/low-hppabsd.c
+--- gdb-5.3/gdb/gdbserver.orig/low-hppabsd.c 2002-01-17 14:13:49.000000000 -0700
++++ gdb-5.3/gdb/gdbserver/low-hppabsd.c 2003-08-20 08:46:04.000000000 -0600
+@@ -61,7 +61,7 @@
+ execv (program, allargs);
+
+ fprintf (stderr, "Cannot exec %s: %s.\n", program,
+- errno < sys_nerr ? sys_errlist[errno] : "unknown error");
++ strerror (errno));
+ fflush (stderr);
+ _exit (0177);
+ }
+diff -urN gdb-5.3/gdb/gdbserver.orig/low-lynx.c gdb-5.3/gdb/gdbserver/low-lynx.c
+--- gdb-5.3/gdb/gdbserver.orig/low-lynx.c 2002-01-17 14:13:49.000000000 -0700
++++ gdb-5.3/gdb/gdbserver/low-lynx.c 2003-08-20 08:46:18.000000000 -0600
+@@ -79,7 +79,7 @@
+
+ fprintf (stderr, "GDBserver (process %d): Cannot exec %s: %s.\n",
+ getpid (), program,
+- errno < sys_nerr ? sys_errlist[errno] : "unknown error");
++ strerror (errno));
+ fflush (stderr);
+ _exit (0177);
+ }
+diff -urN gdb-5.3/gdb/gdbserver.orig/low-nbsd.c gdb-5.3/gdb/gdbserver/low-nbsd.c
+--- gdb-5.3/gdb/gdbserver.orig/low-nbsd.c 2002-01-17 14:13:49.000000000 -0700
++++ gdb-5.3/gdb/gdbserver/low-nbsd.c 2003-08-20 08:46:27.000000000 -0600
+@@ -137,7 +137,7 @@
+ execv (program, allargs);
+
+ fprintf (stderr, "Cannot exec %s: %s.\n", program,
+- errno < sys_nerr ? sys_errlist[errno] : "unknown error");
++ strerror (errno));
+ fflush (stderr);
+ _exit (0177);
+ }
+diff -urN gdb-5.3/gdb/gdbserver.orig/low-sparc.c gdb-5.3/gdb/gdbserver/low-sparc.c
+--- gdb-5.3/gdb/gdbserver.orig/low-sparc.c 2002-01-17 14:13:50.000000000 -0700
++++ gdb-5.3/gdb/gdbserver/low-sparc.c 2003-08-20 08:46:38.000000000 -0600
+@@ -44,7 +44,6 @@
+ #include <sys/ptrace.h>
+ #include <sys/reg.h>
+
+-extern int sys_nerr;
+ extern char **sys_errlist;
+ extern int errno;
+
+@@ -67,7 +66,7 @@
+ execv (program, allargs);
+
+ fprintf (stderr, "Cannot exec %s: %s.\n", program,
+- errno < sys_nerr ? sys_errlist[errno] : "unknown error");
++ strerror (errno));
+ fflush (stderr);
+ _exit (0177);
+ }
+diff -urN gdb-5.3/gdb/gdbserver.orig/low-sun3.c gdb-5.3/gdb/gdbserver/low-sun3.c
+--- gdb-5.3/gdb/gdbserver.orig/low-sun3.c 2002-01-17 14:13:50.000000000 -0700
++++ gdb-5.3/gdb/gdbserver/low-sun3.c 2003-08-20 08:46:51.000000000 -0600
+@@ -41,7 +41,6 @@
+ #include <sys/ptrace.h>
+ #include <machine/reg.h>
+
+-extern int sys_nerr;
+ extern char **sys_errlist;
+ extern int errno;
+
+@@ -64,7 +63,7 @@
+ execv (program, allargs);
+
+ fprintf (stderr, "Cannot exec %s: %s.\n", program,
+- errno < sys_nerr ? sys_errlist[errno] : "unknown error");
++ strerror (errno));
+ fflush (stderr);
+ _exit (0177);
+ }
+diff -urN gdb-5.3/gdb/gdbserver.orig/utils.c gdb-5.3/gdb/gdbserver/utils.c
+--- gdb-5.3/gdb/gdbserver.orig/utils.c 2003-08-20 08:47:56.000000000 -0600
++++ gdb-5.3/gdb/gdbserver/utils.c 2003-08-20 08:48:15.000000000 -0600
+@@ -33,16 +33,13 @@
+ perror_with_name (char *string)
+ {
+ #ifndef STDC_HEADERS
+- extern int sys_nerr;
+- extern char *sys_errlist[];
+ extern int errno;
+ #endif
+ const char *err;
+ char *combined;
+
+- if (errno < sys_nerr)
+- err = sys_errlist[errno];
+- else
++ err = strerror (errno);
++ if (err == NULL)
+ err = "unknown error";
+
+ combined = (char *) alloca (strlen (err) + strlen (string) + 3);
+diff -urN gdb-5.3/gdb/gdbserver.orig/linux-low.c.orig gdb-5.3/gdb/gdbserver/linux-low.c.orig
+--- gdb-5.3/gdb/gdbserver.orig/linux-low.c 2003-08-20 08:40:27.000000000 -0600
++++ gdb-5.3/gdb/gdbserver/linux-low.c 2003-08-20 08:44:54.000000000 -0600
+@@ -175,8 +175,7 @@
+ if (ptrace (PTRACE_ATTACH, pid, 0, 0) != 0)
+ {
+ fprintf (stderr, "Cannot attach to process %d: %s (%d)\n", pid,
+- errno < sys_nerr ? sys_errlist[errno] : "unknown error",
+- errno);
++ strerror (errno), errno);
+ fflush (stderr);
+
+ /* If we fail to attach to an LWP, just return. */
+
diff --git a/openwrt/toolchain/gdb/5.3/100-uclibc.patch b/openwrt/toolchain/gdb/5.3/100-uclibc.patch
new file mode 100644
index 0000000..f985303
--- /dev/null
+++ b/openwrt/toolchain/gdb/5.3/100-uclibc.patch
@@ -0,0 +1,154 @@
+diff -urN gdb-5.3/bfd/config.bfd gdb-5.3-new/bfd/config.bfd
+--- gdb-5.3/bfd/config.bfd 2002-09-05 15:34:35.000000000 -0500
++++ gdb-5.3-new/bfd/config.bfd 2004-01-11 06:25:31.000000000 -0600
+@@ -83,7 +83,7 @@
+ targ_defvec=ecoffalpha_little_vec
+ targ_selvecs=bfd_elf64_alpha_vec
+ ;;
+- alpha*-*-linux-gnu* | alpha*-*-elf*)
++ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc* | alpha*-*-elf*)
+ targ_defvec=bfd_elf64_alpha_vec
+ targ_selvecs=ecoffalpha_little_vec
+ ;;
+@@ -97,7 +97,8 @@
+ targ_defvec=bfd_elf64_ia64_aix_little_vec
+ targ_selvecs="bfd_elf64_ia64_aix_big_vec bfd_efi_app_ia64_vec"
+ ;;
+- ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-elf*)
++ ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | \
++ ia64*-*-linux-uclibc* | ia64*-*-elf*)
+ targ_defvec=bfd_elf64_ia64_little_vec
+ targ_selvecs="bfd_elf64_ia64_big_vec bfd_efi_app_ia64_vec"
+ ;;
+@@ -176,11 +177,12 @@
+ targ_defvec=bfd_elf32_littlearm_vec
+ targ_selvecs=bfd_elf32_bigarm_vec
+ ;;
+- armeb-*-elf | arm*b-*-linux-gnu*)
++ armeb-*-elf | arm*b-*-linux-gnu* | arm*b-*-linux-uclibc*)
+ targ_defvec=bfd_elf32_bigarm_vec
+ targ_selvecs=bfd_elf32_littlearm_vec
+ ;;
+- arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-conix* | arm*-*-uclinux*)
++ arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-linux-uclibc* | \
++ arm*-*-conix* | arm*-*-uclinux*)
+ targ_defvec=bfd_elf32_littlearm_vec
+ targ_selvecs=bfd_elf32_bigarm_vec
+ ;;
+@@ -313,7 +315,7 @@
+ ;;
+
+ #ifdef BFD64
+- hppa*64*-*-linux-gnu*)
++ hppa*64*-*-linux-gnu* | hppa*64*-*-linux-uclibc*)
+ targ_defvec=bfd_elf64_hppa_linux_vec
+ targ_selvecs=bfd_elf64_hppa_vec
+ ;;
+@@ -324,7 +326,7 @@
+ ;;
+ #endif
+
+- hppa*-*-linux-gnu*)
++ hppa*-*-linux-gnu* | hppa*-*-linux-uclibc*)
+ targ_defvec=bfd_elf32_hppa_linux_vec
+ targ_selvecs=bfd_elf32_hppa_vec
+ ;;
+@@ -424,7 +426,7 @@
+ targ_selvecs=bfd_elf32_i386_vec
+ targ_underscore=yes
+ ;;
+- i[3456]86-*-linux-gnu*)
++ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*)
+ targ_defvec=bfd_elf32_i386_vec
+ targ_selvecs="i386linux_vec bfd_efi_app_ia32_vec"
+ targ64_selvecs=bfd_elf64_x86_64_vec
+@@ -438,7 +440,7 @@
+ targ_defvec=bfd_elf64_x86_64_vec
+ targ_selvecs="bfd_elf32_i386_vec i386netbsd_vec i386coff_vec bfd_efi_app_ia32_vec"
+ ;;
+- x86_64-*-linux-gnu*)
++ x86_64-*-linux-gnu* | x86_64-*-linux-uclibc*)
+ targ_defvec=bfd_elf64_x86_64_vec
+ targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec"
+ ;;
+@@ -589,7 +591,7 @@
+ targ_defvec=hp300hpux_vec
+ targ_underscore=yes
+ ;;
+- m68*-*-linux*aout*)
++ m68*-*-linux-gnu* | m68*-*-linux-uclibc*)
+ targ_defvec=m68klinux_vec
+ targ_selvecs=bfd_elf32_m68k_vec
+ targ_underscore=yes
+@@ -865,7 +867,8 @@
+ ;;
+ #endif
+ powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \
+- powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-rtems* | \
++ powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-linux-uclibc* | \
++ powerpc-*-rtems* | \
+ powerpc-*-chorus* | powerpc-*-vxworks* | powerpc-*-windiss*)
+ targ_defvec=bfd_elf32_powerpc_vec
+ targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec"
+@@ -887,8 +890,8 @@
+ targ_selvecs="rs6000coff_vec bfd_elf32_powerpcqnx_vec ppcboot_vec"
+ ;;
+ powerpcle-*-elf* | powerpcle-*-sysv4* | powerpcle-*-eabi* | \
+- powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-vxworks* |\
+- powerpcle-*-rtems*)
++ powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-linux-uclibc* |\
++ powerpcle-*-vxworks* | powerpcle-*-rtems*)
+ targ_defvec=bfd_elf32_powerpcle_vec
+ targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec"
+ targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec"
+@@ -1038,7 +1041,7 @@
+ targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec"
+ targ_underscore=yes
+ ;;
+- sparc-*-linux-gnu*)
++ sparc-*-linux-gnu* | sparc-*-linux-uclibc*)
+ targ_defvec=bfd_elf32_sparc_vec
+ targ_selvecs="sparclinux_vec bfd_elf64_sparc_vec sunos_big_vec"
+ ;;
+@@ -1081,7 +1084,7 @@
+ targ_defvec=sunos_big_vec
+ targ_underscore=yes
+ ;;
+- sparc64-*-linux-gnu*)
++ sparc64-*-linux-gnu* | sparc64-*-linux-uclibc*)
+ targ_defvec=bfd_elf64_sparc_vec
+ targ_selvecs="bfd_elf32_sparc_vec sparclinux_vec sunos_big_vec"
+ ;;
+diff -urN gdb-5.3/bfd/configure gdb-5.3-new/bfd/configure
+--- gdb-5.3/bfd/configure 2002-08-28 05:38:44.000000000 -0500
++++ gdb-5.3-new/bfd/configure 2004-01-11 06:27:15.000000000 -0600
+@@ -1677,6 +1677,11 @@
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+@@ -5067,7 +5072,7 @@
+ alpha*-*-freebsd*)
+ COREFILE=''
+ ;;
+- alpha*-*-linux-gnu*)
++ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc*)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/alphalinux.h"'
+ ;;
+@@ -5126,7 +5131,7 @@
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/i386mach3.h"'
+ ;;
+- i[3456]86-*-linux-gnu*)
++ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/i386linux.h"'
+ ;;
diff --git a/openwrt/toolchain/gdb/6.1.1/100-uclibc-conf.patch b/openwrt/toolchain/gdb/6.1.1/100-uclibc-conf.patch
new file mode 100644
index 0000000..8dbd347
--- /dev/null
+++ b/openwrt/toolchain/gdb/6.1.1/100-uclibc-conf.patch
@@ -0,0 +1,290 @@
+diff -urN gdb-6.1.1-dist/bfd/config.bfd gdb-6.1.1/bfd/config.bfd
+--- gdb-6.1.1-dist/bfd/config.bfd 2004-03-13 06:37:09.000000000 -0600
++++ gdb-6.1.1/bfd/config.bfd 2004-08-08 05:01:47.000000000 -0500
+@@ -121,7 +121,7 @@
+ targ_defvec=ecoffalpha_little_vec
+ targ_selvecs=bfd_elf64_alpha_vec
+ ;;
+- alpha*-*-linux-gnu* | alpha*-*-elf*)
++ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc* | alpha*-*-elf*)
+ targ_defvec=bfd_elf64_alpha_vec
+ targ_selvecs=ecoffalpha_little_vec
+ ;;
+@@ -131,7 +131,7 @@
+ alpha*-*-*)
+ targ_defvec=ecoffalpha_little_vec
+ ;;
+- ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu)
++ ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu | ia64*-*-linux-uclibc*)
+ targ_defvec=bfd_elf64_ia64_little_vec
+ targ_selvecs="bfd_elf64_ia64_big_vec bfd_efi_app_ia64_vec"
+ ;;
+@@ -208,7 +208,7 @@
+ targ_defvec=bfd_elf32_littlearm_vec
+ targ_selvecs=bfd_elf32_bigarm_vec
+ ;;
+- armeb-*-elf | arm*b-*-linux-gnu*)
++ armeb-*-elf | arm*b-*-linux-gnu* | arm*b-*-linux-uclibc*)
+ targ_defvec=bfd_elf32_bigarm_vec
+ targ_selvecs=bfd_elf32_littlearm_vec
+ ;;
+@@ -216,7 +216,7 @@
+ targ_defvec=bfd_elf32_littlearm_vec
+ targ_selvecs=bfd_elf32_bigarm_vec
+ ;;
+- arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-conix* | \
++ arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-linux-uclibc* | arm*-*-conix* | \
+ arm*-*-uclinux* | arm-*-kfreebsd*-gnu | arm-*-vxworks)
+ targ_defvec=bfd_elf32_littlearm_vec
+ targ_selvecs=bfd_elf32_bigarm_vec
+@@ -350,7 +350,7 @@
+ ;;
+
+ #ifdef BFD64
+- hppa*64*-*-linux-gnu*)
++ hppa*64*-*-linux-gnu* | hppa*64*-*-linux-uclibc*)
+ targ_defvec=bfd_elf64_hppa_linux_vec
+ targ_selvecs=bfd_elf64_hppa_vec
+ ;;
+@@ -361,7 +361,7 @@
+ ;;
+ #endif
+
+- hppa*-*-linux-gnu* | hppa*-*-netbsd*)
++ hppa*-*-linux-gnu* | hppa*-*-netbsd* | hppa*-*-linux-uclibc*)
+ targ_defvec=bfd_elf32_hppa_linux_vec
+ targ_selvecs=bfd_elf32_hppa_vec
+ ;;
+@@ -483,7 +483,7 @@
+ targ_selvecs=bfd_elf32_i386_vec
+ targ_underscore=yes
+ ;;
+- i[3-7]86-*-linux-gnu*)
++ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*)
+ targ_defvec=bfd_elf32_i386_vec
+ targ_selvecs="i386linux_vec bfd_efi_app_ia32_vec"
+ targ64_selvecs=bfd_elf64_x86_64_vec
+@@ -497,7 +497,7 @@
+ targ_defvec=bfd_elf64_x86_64_vec
+ targ_selvecs="bfd_elf32_i386_vec i386netbsd_vec i386coff_vec bfd_efi_app_ia32_vec"
+ ;;
+- x86_64-*-linux-gnu*)
++ x86_64-*-linux-gnu* | x86_64-*-linux-uclibc*)
+ targ_defvec=bfd_elf64_x86_64_vec
+ targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec"
+ ;;
+@@ -667,7 +667,7 @@
+ targ_defvec=hp300hpux_vec
+ targ_underscore=yes
+ ;;
+- m68*-*-linux*aout*)
++ m68*-*-linux*aout* | m68*-*-linux-uclibc*)
+ targ_defvec=m68klinux_vec
+ targ_selvecs=bfd_elf32_m68k_vec
+ targ_underscore=yes
+@@ -952,8 +952,8 @@
+ ;;
+ #endif
+ powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \
+- powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-rtems* | \
+- powerpc-*-chorus* | powerpc-*-vxworks* | powerpc-*-windiss*)
++ powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-linux-uclibc* | powerpc-*-rtems* | \
++ powerpc-*-chorus* | powerpc-*-vxworks* | powerpc-*-windiss* )
+ targ_defvec=bfd_elf32_powerpc_vec
+ targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec"
+ targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec"
+@@ -984,8 +984,8 @@
+ targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec"
+ ;;
+ powerpcle-*-elf* | powerpcle-*-sysv4* | powerpcle-*-eabi* | \
+- powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-vxworks* |\
+- powerpcle-*-rtems*)
++ powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-linux-uclibc* | \
++ powerpcle-*-vxworks* | powerpcle-*-rtems*)
+ targ_defvec=bfd_elf32_powerpcle_vec
+ targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec"
+ targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec"
+@@ -1141,7 +1141,7 @@
+ targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec"
+ targ_underscore=yes
+ ;;
+- sparc-*-linux-gnu*)
++ sparc-*-linux-gnu* | sparc-*-linux-uclibc*)
+ targ_defvec=bfd_elf32_sparc_vec
+ targ_selvecs="sparclinux_vec bfd_elf64_sparc_vec sunos_big_vec"
+ ;;
+@@ -1188,7 +1188,7 @@
+ targ_defvec=sunos_big_vec
+ targ_underscore=yes
+ ;;
+- sparc64-*-linux-gnu*)
++ sparc64-*-linux-gnu* | sparc64-*-linux-uclibc*)
+ targ_defvec=bfd_elf64_sparc_vec
+ targ_selvecs="bfd_elf32_sparc_vec sparclinux_vec sunos_big_vec"
+ ;;
+@@ -1257,7 +1257,7 @@
+ targ_underscore=yes
+ ;;
+
+- vax-*-linux-gnu*)
++ vax-*-linux-gnu* | vax-*-linux-uclibc*)
+ targ_defvec=bfd_elf32_vax_vec
+ ;;
+
+diff -urN gdb-6.1.1-dist/bfd/configure gdb-6.1.1/bfd/configure
+--- gdb-6.1.1-dist/bfd/configure 2004-03-13 06:37:09.000000000 -0600
++++ gdb-6.1.1/bfd/configure 2004-08-08 05:01:47.000000000 -0500
+@@ -1710,6 +1710,11 @@
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+@@ -5276,7 +5281,7 @@
+ alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
+ COREFILE=''
+ ;;
+- alpha*-*-linux-gnu*)
++ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc*)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/alphalinux.h"'
+ ;;
+@@ -5336,7 +5341,7 @@
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/i386mach3.h"'
+ ;;
+- i[3-7]86-*-linux-gnu*)
++ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/i386linux.h"'
+ ;;
+@@ -5386,7 +5391,7 @@
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/hp300bsd.h"'
+ ;;
+- m68*-*-linux-gnu*)
++ m68*-*-linux-gnu* | m68*-*-linux-uclibc)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/m68klinux.h"'
+ ;;
+@@ -5487,7 +5492,7 @@
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/vaxult2.h"'
+ ;;
+- vax-*-linux-gnu*)
++ vax-*-linux-gnu* | vax-*-linux-uclibc*)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/vaxlinux.h"'
+ ;;
+diff -urN gdb-6.1.1-dist/bfd/configure.in gdb-6.1.1/bfd/configure.in
+--- gdb-6.1.1-dist/bfd/configure.in 2004-03-13 06:37:09.000000000 -0600
++++ gdb-6.1.1/bfd/configure.in 2004-08-08 05:01:47.000000000 -0500
+@@ -178,7 +178,7 @@
+ alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
+ COREFILE=''
+ ;;
+- alpha*-*-linux-gnu*)
++ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc*)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/alphalinux.h"'
+ ;;
+@@ -259,7 +259,7 @@
+ TRAD_HEADER='"hosts/i386mach3.h"'
+ ;;
+ changequote(,)dnl
+- i[3-7]86-*-linux-gnu*)
++ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*)
+ changequote([,])dnl
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/i386linux.h"'
+@@ -312,7 +312,7 @@
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/hp300bsd.h"'
+ ;;
+- m68*-*-linux-gnu*)
++ m68*-*-linux-gnu* | m68*-*-linux-uclibc*)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/m68klinux.h"'
+ ;;
+@@ -397,7 +397,7 @@
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/vaxult2.h"'
+ ;;
+- vax-*-linux-gnu*)
++ vax-*-linux-gnu* | vax-*-linux-uclibc*)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/vaxlinux.h"'
+ ;;
+diff -urN gdb-6.1.1-dist/libtool.m4 gdb-6.1.1/libtool.m4
+--- gdb-6.1.1-dist/libtool.m4 2003-04-10 22:58:39.000000000 -0500
++++ gdb-6.1.1/libtool.m4 2004-08-08 05:01:47.000000000 -0500
+@@ -645,6 +645,11 @@
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$']
+diff -urN gdb-6.1.1-dist/ltconfig gdb-6.1.1/ltconfig
+--- gdb-6.1.1-dist/ltconfig 2003-10-03 23:54:47.000000000 -0500
++++ gdb-6.1.1/ltconfig 2004-08-08 05:01:47.000000000 -0500
+@@ -602,7 +602,7 @@
+
+ # 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
+
+@@ -1259,6 +1259,24 @@
+ 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 -urN gdb-6.1.1-dist/opcodes/configure gdb-6.1.1/opcodes/configure
+--- gdb-6.1.1-dist/opcodes/configure 2003-08-05 04:39:31.000000000 -0500
++++ gdb-6.1.1/opcodes/configure 2004-08-08 05:01:47.000000000 -0500
+@@ -1700,6 +1700,11 @@
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
diff --git a/openwrt/toolchain/gdb/6.1.1/200-uclibc-readline-conf.patch b/openwrt/toolchain/gdb/6.1.1/200-uclibc-readline-conf.patch
new file mode 100644
index 0000000..ffe792d
--- /dev/null
+++ b/openwrt/toolchain/gdb/6.1.1/200-uclibc-readline-conf.patch
@@ -0,0 +1,15 @@
+--- gdb-6.1.1-dist/readline/configure 2003-05-27 18:29:47.000000000 -0500
++++ gdb-6.1.1/readline/configure 2004-08-09 14:20:23.000000000 -0500
+@@ -6249,7 +6249,12 @@
+
+
+ echo "$as_me:$LINENO: checking for mbstate_t" >&5
++echo $ECHO_N "bash_cv_have_mbstate_t=$bash_cv_have_mbstate_t" >&6
+ echo $ECHO_N "checking for mbstate_t... $ECHO_C" >&6
++if test "${bash_cv_have_mbstate_t+set}" != set; then
++ bash_cv_have_mbstate_t=yes
++ echo $ECHO_N "WARNING!! forcing to yes!!! $ECHO_C" >&6
++fi
+ if test "${bash_cv_have_mbstate_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
diff --git a/openwrt/toolchain/gdb/6.2.1/100-uclibc-conf.patch b/openwrt/toolchain/gdb/6.2.1/100-uclibc-conf.patch
new file mode 100644
index 0000000..d3645bf
--- /dev/null
+++ b/openwrt/toolchain/gdb/6.2.1/100-uclibc-conf.patch
@@ -0,0 +1,290 @@
+diff -urN gdb-6.2-dist/bfd/config.bfd gdb-6.2/bfd/config.bfd
+--- gdb-6.2-dist/bfd/config.bfd 2004-07-09 07:32:35.000000000 -0500
++++ gdb-6.2/bfd/config.bfd 2004-08-08 04:23:19.000000000 -0500
+@@ -129,7 +129,7 @@
+ targ_defvec=ecoffalpha_little_vec
+ targ_selvecs=bfd_elf64_alpha_vec
+ ;;
+- alpha*-*-linux-gnu* | alpha*-*-elf*)
++ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc* | alpha*-*-elf*)
+ targ_defvec=bfd_elf64_alpha_vec
+ targ_selvecs=ecoffalpha_little_vec
+ ;;
+@@ -139,7 +139,7 @@
+ alpha*-*-*)
+ targ_defvec=ecoffalpha_little_vec
+ ;;
+- ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu)
++ ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu | ia64*-*-linux-uclibc*)
+ targ_defvec=bfd_elf64_ia64_little_vec
+ targ_selvecs="bfd_elf64_ia64_big_vec bfd_efi_app_ia64_vec"
+ ;;
+@@ -216,7 +216,7 @@
+ targ_defvec=bfd_elf32_littlearm_vec
+ targ_selvecs=bfd_elf32_bigarm_vec
+ ;;
+- armeb-*-elf | arm*b-*-linux-gnu*)
++ armeb-*-elf | arm*b-*-linux-gnu* | arm*b-*-linux-uclibc*)
+ targ_defvec=bfd_elf32_bigarm_vec
+ targ_selvecs=bfd_elf32_littlearm_vec
+ ;;
+@@ -224,7 +224,7 @@
+ targ_defvec=bfd_elf32_littlearm_vec
+ targ_selvecs=bfd_elf32_bigarm_vec
+ ;;
+- arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-conix* | \
++ arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-linux-uclibc* | arm*-*-conix* | \
+ arm*-*-uclinux* | arm-*-kfreebsd*-gnu | arm-*-vxworks)
+ targ_defvec=bfd_elf32_littlearm_vec
+ targ_selvecs=bfd_elf32_bigarm_vec
+@@ -373,7 +373,7 @@
+ ;;
+
+ #ifdef BFD64
+- hppa*64*-*-linux-gnu*)
++ hppa*64*-*-linux-gnu* | hppa*64*-*-linux-uclibc*)
+ targ_defvec=bfd_elf64_hppa_linux_vec
+ targ_selvecs=bfd_elf64_hppa_vec
+ ;;
+@@ -384,7 +384,7 @@
+ ;;
+ #endif
+
+- hppa*-*-linux-gnu* | hppa*-*-netbsd*)
++ hppa*-*-linux-gnu* | hppa*-*-netbsd* | hppa*-*-linux-uclibc*)
+ targ_defvec=bfd_elf32_hppa_linux_vec
+ targ_selvecs=bfd_elf32_hppa_vec
+ ;;
+@@ -507,7 +507,7 @@
+ targ_selvecs=bfd_elf32_i386_vec
+ targ_underscore=yes
+ ;;
+- i[3-7]86-*-linux-gnu*)
++ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*)
+ targ_defvec=bfd_elf32_i386_vec
+ targ_selvecs="i386linux_vec bfd_efi_app_ia32_vec"
+ targ64_selvecs=bfd_elf64_x86_64_vec
+@@ -521,7 +521,7 @@
+ targ_defvec=bfd_elf64_x86_64_vec
+ targ_selvecs="bfd_elf32_i386_vec i386netbsd_vec i386coff_vec bfd_efi_app_ia32_vec"
+ ;;
+- x86_64-*-linux-gnu*)
++ x86_64-*-linux-gnu* | x86_64-*-linux-uclibc*)
+ targ_defvec=bfd_elf64_x86_64_vec
+ targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec"
+ ;;
+@@ -691,7 +691,7 @@
+ targ_defvec=hp300hpux_vec
+ targ_underscore=yes
+ ;;
+- m68*-*-linux*aout*)
++ m68*-*-linux*aout* | m68*-*-linux-uclibc*)
+ targ_defvec=m68klinux_vec
+ targ_selvecs=bfd_elf32_m68k_vec
+ targ_underscore=yes
+@@ -972,8 +972,8 @@
+ ;;
+ #endif
+ powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \
+- powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-rtems* | \
+- powerpc-*-chorus* | powerpc-*-vxworks* | powerpc-*-windiss*)
++ powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-linux-uclibc* | powerpc-*-rtems* | \
++ powerpc-*-chorus* | powerpc-*-vxworks* | powerpc-*-windiss* )
+ targ_defvec=bfd_elf32_powerpc_vec
+ targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec"
+ targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec"
+@@ -1009,8 +1009,8 @@
+ targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec"
+ ;;
+ powerpcle-*-elf* | powerpcle-*-sysv4* | powerpcle-*-eabi* | \
+- powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-vxworks* |\
+- powerpcle-*-rtems*)
++ powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-linux-uclibc* | \
++ powerpcle-*-vxworks* | powerpcle-*-rtems*)
+ targ_defvec=bfd_elf32_powerpcle_vec
+ targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec"
+ targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec"
+@@ -1177,7 +1177,7 @@
+ targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec"
+ targ_underscore=yes
+ ;;
+- sparc-*-linux-gnu*)
++ sparc-*-linux-gnu* | sparc-*-linux-uclibc*)
+ targ_defvec=bfd_elf32_sparc_vec
+ targ_selvecs="sparclinux_vec bfd_elf64_sparc_vec sunos_big_vec"
+ ;;
+@@ -1224,7 +1224,7 @@
+ targ_defvec=sunos_big_vec
+ targ_underscore=yes
+ ;;
+- sparc64-*-linux-gnu*)
++ sparc64-*-linux-gnu* | sparc64-*-linux-uclibc*)
+ targ_defvec=bfd_elf64_sparc_vec
+ targ_selvecs="bfd_elf32_sparc_vec sparclinux_vec sunos_big_vec"
+ ;;
+@@ -1293,7 +1293,7 @@
+ targ_underscore=yes
+ ;;
+
+- vax-*-linux-gnu*)
++ vax-*-linux-gnu* | vax-*-linux-uclibc*)
+ targ_defvec=bfd_elf32_vax_vec
+ ;;
+
+diff -urN gdb-6.2-dist/bfd/configure gdb-6.2/bfd/configure
+--- gdb-6.2-dist/bfd/configure 2004-07-07 12:28:45.000000000 -0500
++++ gdb-6.2/bfd/configure 2004-08-08 04:27:01.000000000 -0500
+@@ -1698,6 +1698,11 @@
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+@@ -5264,7 +5269,7 @@
+ alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
+ COREFILE=''
+ ;;
+- alpha*-*-linux-gnu*)
++ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc*)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/alphalinux.h"'
+ ;;
+@@ -5328,7 +5333,7 @@
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/i386mach3.h"'
+ ;;
+- i[3-7]86-*-linux-gnu*)
++ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/i386linux.h"'
+ ;;
+@@ -5366,7 +5371,7 @@
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/hp300bsd.h"'
+ ;;
+- m68*-*-linux-gnu*)
++ m68*-*-linux-gnu* | m68*-*-linux-uclibc)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/m68klinux.h"'
+ ;;
+@@ -5470,7 +5475,7 @@
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/vaxult2.h"'
+ ;;
+- vax-*-linux-gnu*)
++ vax-*-linux-gnu* | vax-*-linux-uclibc*)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/vaxlinux.h"'
+ ;;
+diff -urN gdb-6.2-dist/bfd/configure.in gdb-6.2/bfd/configure.in
+--- gdb-6.2-dist/bfd/configure.in 2004-07-07 12:28:45.000000000 -0500
++++ gdb-6.2/bfd/configure.in 2004-08-08 04:28:07.000000000 -0500
+@@ -164,7 +164,7 @@
+ alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
+ COREFILE=''
+ ;;
+- alpha*-*-linux-gnu*)
++ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc*)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/alphalinux.h"'
+ ;;
+@@ -249,7 +249,7 @@
+ TRAD_HEADER='"hosts/i386mach3.h"'
+ ;;
+ changequote(,)dnl
+- i[3-7]86-*-linux-gnu*)
++ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*)
+ changequote([,])dnl
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/i386linux.h"'
+@@ -290,7 +290,7 @@
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/hp300bsd.h"'
+ ;;
+- m68*-*-linux-gnu*)
++ m68*-*-linux-gnu* | m68*-*-linux-uclibc*)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/m68klinux.h"'
+ ;;
+@@ -378,7 +378,7 @@
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/vaxult2.h"'
+ ;;
+- vax-*-linux-gnu*)
++ vax-*-linux-gnu* | vax-*-linux-uclibc*)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/vaxlinux.h"'
+ ;;
+diff -urN gdb-6.2-dist/libtool.m4 gdb-6.2/libtool.m4
+--- gdb-6.2-dist/libtool.m4 2003-04-10 22:58:39.000000000 -0500
++++ gdb-6.2/libtool.m4 2004-08-08 03:48:33.000000000 -0500
+@@ -645,6 +645,11 @@
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$']
+diff -urN gdb-6.2-dist/ltconfig gdb-6.2/ltconfig
+--- gdb-6.2-dist/ltconfig 2003-10-03 23:54:47.000000000 -0500
++++ gdb-6.2/ltconfig 2004-08-08 03:48:33.000000000 -0500
+@@ -602,7 +602,7 @@
+
+ # 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
+
+@@ -1259,6 +1259,24 @@
+ 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 -urN gdb-6.2-dist/opcodes/configure gdb-6.2/opcodes/configure
+--- gdb-6.2-dist/opcodes/configure 2004-07-07 12:28:53.000000000 -0500
++++ gdb-6.2/opcodes/configure 2004-08-08 04:53:55.000000000 -0500
+@@ -1701,6 +1701,11 @@
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
diff --git a/openwrt/toolchain/gdb/6.2.1/200-uclibc-readline-conf.patch b/openwrt/toolchain/gdb/6.2.1/200-uclibc-readline-conf.patch
new file mode 100644
index 0000000..ffe792d
--- /dev/null
+++ b/openwrt/toolchain/gdb/6.2.1/200-uclibc-readline-conf.patch
@@ -0,0 +1,15 @@
+--- gdb-6.1.1-dist/readline/configure 2003-05-27 18:29:47.000000000 -0500
++++ gdb-6.1.1/readline/configure 2004-08-09 14:20:23.000000000 -0500
+@@ -6249,7 +6249,12 @@
+
+
+ echo "$as_me:$LINENO: checking for mbstate_t" >&5
++echo $ECHO_N "bash_cv_have_mbstate_t=$bash_cv_have_mbstate_t" >&6
+ echo $ECHO_N "checking for mbstate_t... $ECHO_C" >&6
++if test "${bash_cv_have_mbstate_t+set}" != set; then
++ bash_cv_have_mbstate_t=yes
++ echo $ECHO_N "WARNING!! forcing to yes!!! $ECHO_C" >&6
++fi
+ if test "${bash_cv_have_mbstate_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
diff --git a/openwrt/toolchain/gdb/6.2.1/400-mips-coredump.patch b/openwrt/toolchain/gdb/6.2.1/400-mips-coredump.patch
new file mode 100644
index 0000000..4e17ba7
--- /dev/null
+++ b/openwrt/toolchain/gdb/6.2.1/400-mips-coredump.patch
@@ -0,0 +1,28 @@
+Sometime around 2.4.22-23, the mips pt_regs.h fields were reordered, breaking
+coredump handling by gdb for current kernels. Update the hardcoded constants
+to reflect the change.
+--- gdb-6.2.1/gdb/mips-linux-tdep.c-orig 2004-10-29 14:23:55.000000000 -0500
++++ gdb-6.2.1/gdb/mips-linux-tdep.c 2004-10-29 14:26:44.000000000 -0500
+@@ -53,12 +53,22 @@
+
+ #define EF_REG0 6
+ #define EF_REG31 37
++
++#if 0
+ #define EF_LO 38
+ #define EF_HI 39
+ #define EF_CP0_EPC 40
+ #define EF_CP0_BADVADDR 41
+ #define EF_CP0_STATUS 42
+ #define EF_CP0_CAUSE 43
++#else
++#define EF_CP0_STATUS 38
++#define EF_LO 39
++#define EF_HI 40
++#define EF_CP0_BADVADDR 41
++#define EF_CP0_CAUSE 42
++#define EF_CP0_EPC 43
++#endif
+
+ #define EF_SIZE 180
+
diff --git a/openwrt/toolchain/gdb/6.2/100-uclibc-conf.patch b/openwrt/toolchain/gdb/6.2/100-uclibc-conf.patch
new file mode 100644
index 0000000..d3645bf
--- /dev/null
+++ b/openwrt/toolchain/gdb/6.2/100-uclibc-conf.patch
@@ -0,0 +1,290 @@
+diff -urN gdb-6.2-dist/bfd/config.bfd gdb-6.2/bfd/config.bfd
+--- gdb-6.2-dist/bfd/config.bfd 2004-07-09 07:32:35.000000000 -0500
++++ gdb-6.2/bfd/config.bfd 2004-08-08 04:23:19.000000000 -0500
+@@ -129,7 +129,7 @@
+ targ_defvec=ecoffalpha_little_vec
+ targ_selvecs=bfd_elf64_alpha_vec
+ ;;
+- alpha*-*-linux-gnu* | alpha*-*-elf*)
++ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc* | alpha*-*-elf*)
+ targ_defvec=bfd_elf64_alpha_vec
+ targ_selvecs=ecoffalpha_little_vec
+ ;;
+@@ -139,7 +139,7 @@
+ alpha*-*-*)
+ targ_defvec=ecoffalpha_little_vec
+ ;;
+- ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu)
++ ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-gnu* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu | ia64*-*-linux-uclibc*)
+ targ_defvec=bfd_elf64_ia64_little_vec
+ targ_selvecs="bfd_elf64_ia64_big_vec bfd_efi_app_ia64_vec"
+ ;;
+@@ -216,7 +216,7 @@
+ targ_defvec=bfd_elf32_littlearm_vec
+ targ_selvecs=bfd_elf32_bigarm_vec
+ ;;
+- armeb-*-elf | arm*b-*-linux-gnu*)
++ armeb-*-elf | arm*b-*-linux-gnu* | arm*b-*-linux-uclibc*)
+ targ_defvec=bfd_elf32_bigarm_vec
+ targ_selvecs=bfd_elf32_littlearm_vec
+ ;;
+@@ -224,7 +224,7 @@
+ targ_defvec=bfd_elf32_littlearm_vec
+ targ_selvecs=bfd_elf32_bigarm_vec
+ ;;
+- arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-conix* | \
++ arm-*-elf | arm-*-freebsd* | arm*-*-linux-gnu* | arm*-*-linux-uclibc* | arm*-*-conix* | \
+ arm*-*-uclinux* | arm-*-kfreebsd*-gnu | arm-*-vxworks)
+ targ_defvec=bfd_elf32_littlearm_vec
+ targ_selvecs=bfd_elf32_bigarm_vec
+@@ -373,7 +373,7 @@
+ ;;
+
+ #ifdef BFD64
+- hppa*64*-*-linux-gnu*)
++ hppa*64*-*-linux-gnu* | hppa*64*-*-linux-uclibc*)
+ targ_defvec=bfd_elf64_hppa_linux_vec
+ targ_selvecs=bfd_elf64_hppa_vec
+ ;;
+@@ -384,7 +384,7 @@
+ ;;
+ #endif
+
+- hppa*-*-linux-gnu* | hppa*-*-netbsd*)
++ hppa*-*-linux-gnu* | hppa*-*-netbsd* | hppa*-*-linux-uclibc*)
+ targ_defvec=bfd_elf32_hppa_linux_vec
+ targ_selvecs=bfd_elf32_hppa_vec
+ ;;
+@@ -507,7 +507,7 @@
+ targ_selvecs=bfd_elf32_i386_vec
+ targ_underscore=yes
+ ;;
+- i[3-7]86-*-linux-gnu*)
++ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*)
+ targ_defvec=bfd_elf32_i386_vec
+ targ_selvecs="i386linux_vec bfd_efi_app_ia32_vec"
+ targ64_selvecs=bfd_elf64_x86_64_vec
+@@ -521,7 +521,7 @@
+ targ_defvec=bfd_elf64_x86_64_vec
+ targ_selvecs="bfd_elf32_i386_vec i386netbsd_vec i386coff_vec bfd_efi_app_ia32_vec"
+ ;;
+- x86_64-*-linux-gnu*)
++ x86_64-*-linux-gnu* | x86_64-*-linux-uclibc*)
+ targ_defvec=bfd_elf64_x86_64_vec
+ targ_selvecs="bfd_elf32_i386_vec i386linux_vec bfd_efi_app_ia32_vec"
+ ;;
+@@ -691,7 +691,7 @@
+ targ_defvec=hp300hpux_vec
+ targ_underscore=yes
+ ;;
+- m68*-*-linux*aout*)
++ m68*-*-linux*aout* | m68*-*-linux-uclibc*)
+ targ_defvec=m68klinux_vec
+ targ_selvecs=bfd_elf32_m68k_vec
+ targ_underscore=yes
+@@ -972,8 +972,8 @@
+ ;;
+ #endif
+ powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \
+- powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-rtems* | \
+- powerpc-*-chorus* | powerpc-*-vxworks* | powerpc-*-windiss*)
++ powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-linux-uclibc* | powerpc-*-rtems* | \
++ powerpc-*-chorus* | powerpc-*-vxworks* | powerpc-*-windiss* )
+ targ_defvec=bfd_elf32_powerpc_vec
+ targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec"
+ targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec"
+@@ -1009,8 +1009,8 @@
+ targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec"
+ ;;
+ powerpcle-*-elf* | powerpcle-*-sysv4* | powerpcle-*-eabi* | \
+- powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-vxworks* |\
+- powerpcle-*-rtems*)
++ powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-linux-uclibc* | \
++ powerpcle-*-vxworks* | powerpcle-*-rtems*)
+ targ_defvec=bfd_elf32_powerpcle_vec
+ targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec"
+ targ64_selvecs="bfd_elf64_powerpc_vec bfd_elf64_powerpcle_vec"
+@@ -1177,7 +1177,7 @@
+ targ_selvecs="bfd_elf32_sparc_vec sunos_big_vec"
+ targ_underscore=yes
+ ;;
+- sparc-*-linux-gnu*)
++ sparc-*-linux-gnu* | sparc-*-linux-uclibc*)
+ targ_defvec=bfd_elf32_sparc_vec
+ targ_selvecs="sparclinux_vec bfd_elf64_sparc_vec sunos_big_vec"
+ ;;
+@@ -1224,7 +1224,7 @@
+ targ_defvec=sunos_big_vec
+ targ_underscore=yes
+ ;;
+- sparc64-*-linux-gnu*)
++ sparc64-*-linux-gnu* | sparc64-*-linux-uclibc*)
+ targ_defvec=bfd_elf64_sparc_vec
+ targ_selvecs="bfd_elf32_sparc_vec sparclinux_vec sunos_big_vec"
+ ;;
+@@ -1293,7 +1293,7 @@
+ targ_underscore=yes
+ ;;
+
+- vax-*-linux-gnu*)
++ vax-*-linux-gnu* | vax-*-linux-uclibc*)
+ targ_defvec=bfd_elf32_vax_vec
+ ;;
+
+diff -urN gdb-6.2-dist/bfd/configure gdb-6.2/bfd/configure
+--- gdb-6.2-dist/bfd/configure 2004-07-07 12:28:45.000000000 -0500
++++ gdb-6.2/bfd/configure 2004-08-08 04:27:01.000000000 -0500
+@@ -1698,6 +1698,11 @@
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
+@@ -5264,7 +5269,7 @@
+ alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
+ COREFILE=''
+ ;;
+- alpha*-*-linux-gnu*)
++ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc*)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/alphalinux.h"'
+ ;;
+@@ -5328,7 +5333,7 @@
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/i386mach3.h"'
+ ;;
+- i[3-7]86-*-linux-gnu*)
++ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/i386linux.h"'
+ ;;
+@@ -5366,7 +5371,7 @@
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/hp300bsd.h"'
+ ;;
+- m68*-*-linux-gnu*)
++ m68*-*-linux-gnu* | m68*-*-linux-uclibc)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/m68klinux.h"'
+ ;;
+@@ -5470,7 +5475,7 @@
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/vaxult2.h"'
+ ;;
+- vax-*-linux-gnu*)
++ vax-*-linux-gnu* | vax-*-linux-uclibc*)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/vaxlinux.h"'
+ ;;
+diff -urN gdb-6.2-dist/bfd/configure.in gdb-6.2/bfd/configure.in
+--- gdb-6.2-dist/bfd/configure.in 2004-07-07 12:28:45.000000000 -0500
++++ gdb-6.2/bfd/configure.in 2004-08-08 04:28:07.000000000 -0500
+@@ -164,7 +164,7 @@
+ alpha*-*-freebsd* | alpha*-*-kfreebsd*-gnu)
+ COREFILE=''
+ ;;
+- alpha*-*-linux-gnu*)
++ alpha*-*-linux-gnu* | alpha*-*-linux-uclibc*)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/alphalinux.h"'
+ ;;
+@@ -249,7 +249,7 @@
+ TRAD_HEADER='"hosts/i386mach3.h"'
+ ;;
+ changequote(,)dnl
+- i[3-7]86-*-linux-gnu*)
++ i[3-7]86-*-linux-gnu* | i[3-7]86-*-linux-uclibc*)
+ changequote([,])dnl
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/i386linux.h"'
+@@ -290,7 +290,7 @@
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/hp300bsd.h"'
+ ;;
+- m68*-*-linux-gnu*)
++ m68*-*-linux-gnu* | m68*-*-linux-uclibc*)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/m68klinux.h"'
+ ;;
+@@ -378,7 +378,7 @@
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/vaxult2.h"'
+ ;;
+- vax-*-linux-gnu*)
++ vax-*-linux-gnu* | vax-*-linux-uclibc*)
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/vaxlinux.h"'
+ ;;
+diff -urN gdb-6.2-dist/libtool.m4 gdb-6.2/libtool.m4
+--- gdb-6.2-dist/libtool.m4 2003-04-10 22:58:39.000000000 -0500
++++ gdb-6.2/libtool.m4 2004-08-08 03:48:33.000000000 -0500
+@@ -645,6 +645,11 @@
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ [lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$']
+diff -urN gdb-6.2-dist/ltconfig gdb-6.2/ltconfig
+--- gdb-6.2-dist/ltconfig 2003-10-03 23:54:47.000000000 -0500
++++ gdb-6.2/ltconfig 2004-08-08 03:48:33.000000000 -0500
+@@ -602,7 +602,7 @@
+
+ # 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
+
+@@ -1259,6 +1259,24 @@
+ 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 -urN gdb-6.2-dist/opcodes/configure gdb-6.2/opcodes/configure
+--- gdb-6.2-dist/opcodes/configure 2004-07-07 12:28:53.000000000 -0500
++++ gdb-6.2/opcodes/configure 2004-08-08 04:53:55.000000000 -0500
+@@ -1701,6 +1701,11 @@
+ lt_cv_file_magic_test_file=`echo /lib/libc.so* /lib/libc-*.so`
+ ;;
+
++linux-uclibc*)
++ lt_cv_deplibs_check_method=pass_all
++ lt_cv_file_magic_test_file=`echo /lib/libuClibc-*.so`
++ ;;
++
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/\.]+\.so\.[0-9]+\.[0-9]+$'
diff --git a/openwrt/toolchain/gdb/6.2/200-uclibc-readline-conf.patch b/openwrt/toolchain/gdb/6.2/200-uclibc-readline-conf.patch
new file mode 100644
index 0000000..ffe792d
--- /dev/null
+++ b/openwrt/toolchain/gdb/6.2/200-uclibc-readline-conf.patch
@@ -0,0 +1,15 @@
+--- gdb-6.1.1-dist/readline/configure 2003-05-27 18:29:47.000000000 -0500
++++ gdb-6.1.1/readline/configure 2004-08-09 14:20:23.000000000 -0500
+@@ -6249,7 +6249,12 @@
+
+
+ echo "$as_me:$LINENO: checking for mbstate_t" >&5
++echo $ECHO_N "bash_cv_have_mbstate_t=$bash_cv_have_mbstate_t" >&6
+ echo $ECHO_N "checking for mbstate_t... $ECHO_C" >&6
++if test "${bash_cv_have_mbstate_t+set}" != set; then
++ bash_cv_have_mbstate_t=yes
++ echo $ECHO_N "WARNING!! forcing to yes!!! $ECHO_C" >&6
++fi
+ if test "${bash_cv_have_mbstate_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+ else
diff --git a/openwrt/toolchain/gdb/Config.in b/openwrt/toolchain/gdb/Config.in
new file mode 100644
index 0000000..a17b736
--- /dev/null
+++ b/openwrt/toolchain/gdb/Config.in
@@ -0,0 +1,49 @@
+# Choose gcc version.
+# WARNING -- 2.95 currently only builds for i386, arm, mips*, and powerpc.
+# WARNING -- 2.95 does not currently build natively for the target.
+
+comment "Gdb Options"
+
+config BR2_PACKAGE_GDB
+ bool "Build gdb debugger for the Target"
+ default n
+ select BR2_PACKAGE_NCURSES
+ help
+ Enable the gdb debugger.
+
+config BR2_PACKAGE_GDB_SERVER
+ bool "Build gdb server for the Target"
+ default n
+ select BR2_PACKAGE_NCURSES
+ help
+ Enable the gdb debugger.
+
+choice
+ prompt "GDB debuger Version"
+ default BR2_GDB_VERSION_5_3
+ depends on BR2_PACKAGE_GDB || BR2_PACKAGE_GDB_SERVER || BR2_HOST_GDB
+ help
+ Select the version of gcc you wish to use.
+
+ config BR2_GDB_VERSION_5.3
+ bool "gdb 5.3"
+
+ config BR2_GDB_VERSION_6_1_1
+ bool "gdb 6.1.1"
+
+ config BR2_GDB_VERSION_6_2
+ bool "gdb 6.2"
+
+ config BR2_GDB_VERSION_6_2_1
+ bool "gdb 6.2.1"
+
+endchoice
+
+config BR2_GDB_VERSION
+ string
+ default "5.3" if BR2_GDB_VERSION_5.3
+ default "6.1.1" if BR2_GDB_VERSION_6_1_1
+ default "6.2" if BR2_GDB_VERSION_6_2
+ default "6.2.1" if BR2_GDB_VERSION_6_2_1
+
+
diff --git a/openwrt/toolchain/gdb/Makefile.in b/openwrt/toolchain/gdb/Makefile.in
new file mode 100644
index 0000000..51a2ddb
--- /dev/null
+++ b/openwrt/toolchain/gdb/Makefile.in
@@ -0,0 +1,10 @@
+GDB_VERSION:=$(strip $(subst ",, $(BR2_GDB_VERSION)))
+#"
+
+ifeq ($(strip $(BR2_PACKAGE_GDB)),y)
+TARGETS+=gdb_target
+endif
+
+ifeq ($(strip $(BR2_PACKAGE_GDB_SERVER)),y)
+TARGETS+=gdbserver gdbclient
+endif
diff --git a/openwrt/toolchain/gdb/gdb.mk b/openwrt/toolchain/gdb/gdb.mk
new file mode 100644
index 0000000..862f84d
--- /dev/null
+++ b/openwrt/toolchain/gdb/gdb.mk
@@ -0,0 +1,189 @@
+######################################################################
+#
+# gdb
+#
+######################################################################
+GDB_VERSION:=$(strip $(GDB_VERSION))
+
+GDB_SITE:=http://ftp.gnu.org/gnu/gdb
+
+ifeq ($(GDB_VERSION),5.3)
+GDB_SOURCE:=gdb-$(GDB_VERSION).tar.gz
+GDB_CAT:=zcat
+else
+GDB_SOURCE:=gdb-$(GDB_VERSION).tar.bz2
+GDB_CAT:=bzcat
+endif
+
+GDB_DIR:=$(TOOL_BUILD_DIR)/gdb-$(GDB_VERSION)
+
+$(DL_DIR)/$(GDB_SOURCE):
+ $(WGET) -P $(DL_DIR) $(GDB_SITE)/$(GDB_SOURCE)
+
+$(GDB_DIR)/.unpacked: $(DL_DIR)/$(GDB_SOURCE)
+ $(GDB_CAT) $(DL_DIR)/$(GDB_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
+ toolchain/patch-kernel.sh $(GDB_DIR) toolchain/gdb/$(GDB_VERSION) \*.patch
+ # Copy a config.sub from gcc. This is only necessary until
+ # gdb's config.sub supports <arch>-linux-uclibc tuples.
+ # Should probably integrate this into the patch.
+ifeq ($(GDB_VERSION),5.3)
+ chmod u+x $(GDB_DIR)/gdb/gdbserver/configure
+ cp $(GCC_DIR)/config.sub $(GDB_DIR)
+ cp $(GCC_DIR)/config.sub $(GDB_DIR)/readline/support/
+endif
+ touch $(GDB_DIR)/.unpacked
+
+######################################################################
+#
+# gdb target
+#
+######################################################################
+
+GDB_TARGET_DIR:=$(BUILD_DIR)/gdb-$(GDB_VERSION)-target
+
+GDB_TARGET_CONFIGURE_VARS:= \
+ 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_TARGET_DIR)/.configured: $(GDB_DIR)/.unpacked
+ mkdir -p $(GDB_TARGET_DIR)
+ (cd $(GDB_TARGET_DIR); \
+ gdb_cv_func_sigsetjmp=yes \
+ $(TARGET_CONFIGURE_OPTS) \
+ CFLAGS_FOR_TARGET="$(TARGET_CFLAGS)" \
+ $(GDB_TARGET_CONFIGURE_VARS) \
+ $(GDB_DIR)/configure \
+ --build=$(GNU_HOST_NAME) \
+ --host=$(REAL_GNU_TARGET_NAME) \
+ --target=$(REAL_GNU_TARGET_NAME) \
+ --prefix=/usr \
+ $(DISABLE_NLS) \
+ --without-uiout --disable-gdbmi \
+ --disable-tui --disable-gdbtk --without-x \
+ --disable-sim --enable-gdbserver \
+ --without-included-gettext \
+ );
+ifeq ($(ENABLE_LOCALE),true)
+ -$(SED) "s,^INTL *=.*,INTL = -lintl,g;" $(GDB_DIR)/gdb/Makefile
+endif
+ touch $(GDB_TARGET_DIR)/.configured
+
+$(GDB_TARGET_DIR)/gdb/gdb: $(GDB_TARGET_DIR)/.configured
+ $(MAKE) CC=$(TARGET_CC) MT_CFLAGS="$(TARGET_CFLAGS)" \
+ -C $(GDB_TARGET_DIR)
+ $(STRIP) $(GDB_TARGET_DIR)/gdb/gdb
+
+$(TARGET_DIR)/usr/bin/gdb: $(GDB_TARGET_DIR)/gdb/gdb
+ install -c $(GDB_TARGET_DIR)/gdb/gdb $(TARGET_DIR)/usr/bin/gdb
+
+gdb_target: ncurses-headers $(TARGET_DIR)/usr/bin/gdb
+
+gdb_target-source: $(DL_DIR)/$(GDB_SOURCE)
+
+gdb_target-clean:
+ $(MAKE) -C $(GDB_DIR) clean
+
+gdb_target-dirclean:
+ rm -rf $(GDB_DIR)
+
+######################################################################
+#
+# gdbserver
+#
+######################################################################
+
+GDB_SERVER_DIR:=$(BUILD_DIR)/gdbserver-$(GDB_VERSION)
+
+$(GDB_SERVER_DIR)/.configured: $(GDB_DIR)/.unpacked
+ mkdir -p $(GDB_SERVER_DIR)
+ (cd $(GDB_SERVER_DIR); \
+ $(TARGET_CONFIGURE_OPTS) \
+ gdb_cv_func_sigsetjmp=yes \
+ $(GDB_DIR)/gdb/gdbserver/configure \
+ --build=$(GNU_HOST_NAME) \
+ --host=$(REAL_GNU_TARGET_NAME) \
+ --target=$(REAL_GNU_TARGET_NAME) \
+ --prefix=/usr \
+ --exec-prefix=/usr \
+ --bindir=/usr/bin \
+ --sbindir=/usr/sbin \
+ --libexecdir=/usr/lib \
+ --sysconfdir=/etc \
+ --datadir=/usr/share \
+ --localstatedir=/var \
+ --mandir=/usr/man \
+ --infodir=/usr/info \
+ --includedir=$(STAGING_DIR)/include \
+ $(DISABLE_NLS) \
+ --without-uiout --disable-gdbmi \
+ --disable-tui --disable-gdbtk --without-x \
+ --without-included-gettext \
+ );
+ touch $(GDB_SERVER_DIR)/.configured
+
+$(GDB_SERVER_DIR)/gdbserver: $(GDB_SERVER_DIR)/.configured
+ $(MAKE) CC=$(TARGET_CC) MT_CFLAGS="$(TARGET_CFLAGS)" \
+ -C $(GDB_SERVER_DIR)
+ $(STRIP) $(GDB_SERVER_DIR)/gdbserver
+
+$(TARGET_DIR)/usr/bin/gdbserver: $(GDB_SERVER_DIR)/gdbserver
+ install -c $(GDB_SERVER_DIR)/gdbserver $(TARGET_DIR)/usr/bin/gdbserver
+
+gdbserver: ncurses-headers $(TARGET_DIR)/usr/bin/gdbserver
+
+gdbserver-clean:
+ $(MAKE) -C $(GDB_SERVER_DIR) clean
+
+gdbserver-dirclean:
+ rm -rf $(GDB_SERVER_DIR)
+
+######################################################################
+#
+# gdb client
+#
+######################################################################
+
+GDB_CLIENT_DIR:=$(TOOL_BUILD_DIR)/gdbclient-$(GDB_VERSION)
+
+$(GDB_CLIENT_DIR)/.configured: $(GDB_DIR)/.unpacked
+ mkdir -p $(GDB_CLIENT_DIR)
+ (cd $(GDB_CLIENT_DIR); \
+ gdb_cv_func_sigsetjmp=yes \
+ $(GDB_DIR)/configure \
+ --prefix=$(STAGING_DIR) \
+ --build=$(GNU_HOST_NAME) \
+ --host=$(GNU_HOST_NAME) \
+ --target=$(REAL_GNU_TARGET_NAME) \
+ $(DISABLE_NLS) \
+ --without-uiout --disable-gdbmi \
+ --disable-tui --disable-gdbtk --without-x \
+ --without-included-gettext \
+ --enable-threads \
+ );
+ touch $(GDB_CLIENT_DIR)/.configured
+
+$(GDB_CLIENT_DIR)/gdb/gdb: $(GDB_CLIENT_DIR)/.configured
+ $(MAKE) -C $(GDB_CLIENT_DIR)
+ strip $(GDB_CLIENT_DIR)/gdb/gdb
+
+$(TARGET_CROSS)gdb: $(GDB_CLIENT_DIR)/gdb/gdb
+ install -c $(GDB_CLIENT_DIR)/gdb/gdb $(TARGET_CROSS)gdb
+ ln -s ../../bin/$(REAL_GNU_TARGET_NAME)-gdb \
+ $(STAGING_DIR)/$(REAL_GNU_TARGET_NAME)/bin/gdb
+
+gdbclient: $(TARGET_CROSS)gdb
+
+gdbclient-clean:
+ $(MAKE) -C $(GDB_CLIENT_DIR) clean
+
+gdbclient-dirclean:
+ rm -rf $(GDB_CLIENT_DIR)
+
+
+