pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
wip/gdb6: import gdb-6.2.1nb8
Module Name: pkgsrc-wip
Committed By: Kamil Rytarowski <n54%gmx.com@localhost>
Pushed By: kamil
Date: Fri Sep 29 15:16:28 2017 +0200
Changeset: 6853d2d06505eb065d47be49876ba80373e9a1b2
Added Files:
gdb6/DESCR
gdb6/Makefile
gdb6/PLIST.Linux
gdb6/PLIST.common
gdb6/distinfo
gdb6/files/nbsd-nat.c
gdb6/options.mk
gdb6/patches/patch-aa
gdb6/patches/patch-ab
gdb6/patches/patch-ac
gdb6/patches/patch-ad
gdb6/patches/patch-ae
gdb6/patches/patch-af
gdb6/patches/patch-ag
gdb6/patches/patch-ah
gdb6/patches/patch-ai
gdb6/patches/patch-aj
gdb6/patches/patch-ak
gdb6/patches/patch-al
gdb6/patches/patch-am
gdb6/patches/patch-an
gdb6/patches/patch-ao
gdb6/patches/patch-ap
gdb6/patches/patch-aq
gdb6/patches/patch-ar
gdb6/patches/patch-as
gdb6/patches/patch-at
gdb6/patches/patch-au
gdb6/patches/patch-av
gdb6/patches/patch-aw
gdb6/patches/patch-ax
gdb6/patches/patch-ay
gdb6/patches/patch-az
gdb6/patches/patch-ba
gdb6/patches/patch-bb
gdb6/patches/patch-bc
gdb6/patches/patch-bd
gdb6/patches/patch-be
gdb6/patches/patch-bf
gdb6/patches/patch-bg
gdb6/patches/patch-bh
gdb6/patches/patch-bi
gdb6/patches/patch-bj
gdb6/patches/patch-bk
gdb6/patches/patch-bl
gdb6/patches/patch-bm
gdb6/patches/patch-bn
gdb6/patches/patch-bo
gdb6/patches/patch-bp
gdb6/patches/patch-br
gdb6/patches/patch-gdb_dwarf2read.c
gdb6/patches/patch-gdb_dwarfread.c
Log Message:
wip/gdb6: import gdb-6.2.1nb8
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.
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=6853d2d06505eb065d47be49876ba80373e9a1b2
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
gdb6/DESCR | 3 ++
gdb6/Makefile | 41 ++++++++++++++++++++
gdb6/PLIST.Linux | 3 ++
gdb6/PLIST.common | 39 +++++++++++++++++++
gdb6/distinfo | 51 +++++++++++++++++++++++++
gdb6/files/nbsd-nat.c | 54 ++++++++++++++++++++++++++
gdb6/options.mk | 15 ++++++++
gdb6/patches/patch-aa | 68 +++++++++++++++++++++++++++++++++
gdb6/patches/patch-ab | 13 +++++++
gdb6/patches/patch-ac | 13 +++++++
gdb6/patches/patch-ad | 26 +++++++++++++
gdb6/patches/patch-ae | 13 +++++++
gdb6/patches/patch-af | 28 ++++++++++++++
gdb6/patches/patch-ag | 15 ++++++++
gdb6/patches/patch-ah | 13 +++++++
gdb6/patches/patch-ai | 21 +++++++++++
gdb6/patches/patch-aj | 10 +++++
gdb6/patches/patch-ak | 20 ++++++++++
gdb6/patches/patch-al | 21 +++++++++++
gdb6/patches/patch-am | 11 ++++++
gdb6/patches/patch-an | 21 +++++++++++
gdb6/patches/patch-ao | 12 ++++++
gdb6/patches/patch-ap | 12 ++++++
gdb6/patches/patch-aq | 16 ++++++++
gdb6/patches/patch-ar | 22 +++++++++++
gdb6/patches/patch-as | 21 +++++++++++
gdb6/patches/patch-at | 22 +++++++++++
gdb6/patches/patch-au | 13 +++++++
gdb6/patches/patch-av | 12 ++++++
gdb6/patches/patch-aw | 13 +++++++
gdb6/patches/patch-ax | 12 ++++++
gdb6/patches/patch-ay | 38 +++++++++++++++++++
gdb6/patches/patch-az | 12 ++++++
gdb6/patches/patch-ba | 19 ++++++++++
gdb6/patches/patch-bb | 14 +++++++
gdb6/patches/patch-bc | 37 ++++++++++++++++++
gdb6/patches/patch-bd | 13 +++++++
gdb6/patches/patch-be | 12 ++++++
gdb6/patches/patch-bf | 13 +++++++
gdb6/patches/patch-bg | 50 +++++++++++++++++++++++++
gdb6/patches/patch-bh | 12 ++++++
gdb6/patches/patch-bi | 13 +++++++
gdb6/patches/patch-bj | 67 +++++++++++++++++++++++++++++++++
gdb6/patches/patch-bk | 25 +++++++++++++
gdb6/patches/patch-bl | 13 +++++++
gdb6/patches/patch-bm | 9 +++++
gdb6/patches/patch-bn | 13 +++++++
gdb6/patches/patch-bo | 75 +++++++++++++++++++++++++++++++++++++
gdb6/patches/patch-bp | 15 ++++++++
gdb6/patches/patch-br | 28 ++++++++++++++
gdb6/patches/patch-gdb_dwarf2read.c | 42 +++++++++++++++++++++
gdb6/patches/patch-gdb_dwarfread.c | 43 +++++++++++++++++++++
52 files changed, 1217 insertions(+)
diffs:
diff --git a/gdb6/DESCR b/gdb6/DESCR
new file mode 100644
index 0000000000..e10b71287b
--- /dev/null
+++ b/gdb6/DESCR
@@ -0,0 +1,3 @@
+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.
diff --git a/gdb6/Makefile b/gdb6/Makefile
new file mode 100644
index 0000000000..95114002f6
--- /dev/null
+++ b/gdb6/Makefile
@@ -0,0 +1,41 @@
+# $NetBSD: Makefile,v 1.33 2015/08/18 07:31:04 wiz Exp $
+#
+
+DISTNAME= gdb-6.2.1
+PKGREVISION= 8
+CATEGORIES= devel
+MASTER_SITES= ftp://sources.redhat.com/pub/gdb/releases/
+EXTRACT_SUFX= .tar.bz2
+
+MAINTAINER= pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE= http://www.gnu.org/software/gdb/gdb.html
+COMMENT= The GNU Project Debugger
+
+# This (outdated) gdb does not understand mach-o (hence macos) and has
+# never heard of dragonfly either, and is not worth fixing.
+NOT_FOR_PLATFORM= Darwin-*-* DragonFly-*-*
+
+USE_TOOLS+= gmake makeinfo msgfmt
+USE_LIBTOOL= yes
+USE_PKGLOCALEDIR= yes
+REPLACE_LOCALEDIR_PATTERNS+= Make-in
+GNU_CONFIGURE= yes
+GNU_CONFIGURE_LIBSUBDIR=gdb6
+CONFIGURE_ARGS+= --includedir=${PREFIX}/include/gdb6
+CONFIGURE_ARGS+= --enable-libada
+INFO_FILES= yes
+
+.include "options.mk"
+
+pre-patch:
+ ${CP} ${FILESDIR}/nbsd-nat.c ${WRKSRC}/gdb
+
+do-test:
+ if ${PKG_INFO} -qe dejagnu; then \
+ (cd ${WRKSRC} && ${GMAKE} check); \
+ else \
+ ${ECHO} "dejagnu is required for the test target"; \
+ fi
+
+.include "../../devel/gettext-lib/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/gdb6/PLIST.Linux b/gdb6/PLIST.Linux
new file mode 100644
index 0000000000..f497dd9046
--- /dev/null
+++ b/gdb6/PLIST.Linux
@@ -0,0 +1,3 @@
+@comment $NetBSD: PLIST.Linux,v 1.1 2009/02/11 21:58:40 shattered Exp $
+bin/gdbserver
+man/man1/gdbserver.1
diff --git a/gdb6/PLIST.common b/gdb6/PLIST.common
new file mode 100644
index 0000000000..d8a4772d01
--- /dev/null
+++ b/gdb6/PLIST.common
@@ -0,0 +1,39 @@
+@comment $NetBSD: PLIST.common,v 1.4 2009/09/09 12:50:58 wiz Exp $
+bin/gdb
+${PLIST.tui}bin/gdbtui
+include/gdb6/ansidecl.h
+include/gdb6/bfd.h
+include/gdb6/bfdlink.h
+include/gdb6/dis-asm.h
+include/gdb6/symcat.h
+info/annotate.info
+info/bfd.info
+info/configure.info
+info/gdb.info
+info/gdbint.info
+info/mmalloc.info
+info/stabs.info
+lib/gdb6/libbfd.la
+lib/gdb6/libiberty.a
+lib/gdb6/libmmalloc.a
+lib/gdb6/libopcodes.la
+man/man1/gdb.1
+${PLIST.tui}man/man1/gdbtui.1
+share/locale/da/LC_MESSAGES/bfd.mo
+share/locale/da/LC_MESSAGES/opcodes.mo
+share/locale/de/LC_MESSAGES/opcodes.mo
+share/locale/es/LC_MESSAGES/bfd.mo
+share/locale/es/LC_MESSAGES/opcodes.mo
+share/locale/fr/LC_MESSAGES/bfd.mo
+share/locale/fr/LC_MESSAGES/opcodes.mo
+share/locale/id/LC_MESSAGES/opcodes.mo
+share/locale/ja/LC_MESSAGES/bfd.mo
+share/locale/nl/LC_MESSAGES/opcodes.mo
+share/locale/pt_BR/LC_MESSAGES/opcodes.mo
+share/locale/ro/LC_MESSAGES/bfd.mo
+share/locale/ro/LC_MESSAGES/opcodes.mo
+share/locale/sv/LC_MESSAGES/bfd.mo
+share/locale/sv/LC_MESSAGES/opcodes.mo
+share/locale/tr/LC_MESSAGES/bfd.mo
+share/locale/tr/LC_MESSAGES/opcodes.mo
+share/locale/zh_CN/LC_MESSAGES/bfd.mo
diff --git a/gdb6/distinfo b/gdb6/distinfo
new file mode 100644
index 0000000000..f14af9b8f9
--- /dev/null
+++ b/gdb6/distinfo
@@ -0,0 +1,51 @@
+$NetBSD: distinfo,v 1.16 2015/11/03 03:27:27 agc Exp $
+
+SHA1 (gdb-6.2.1.tar.bz2) = 50cee3887744c4140aafcc0e4eb579d94464dfd7
+RMD160 (gdb-6.2.1.tar.bz2) = 6fe9f3bbef076c55cbcdf05143e7d5f98f61f889
+SHA512 (gdb-6.2.1.tar.bz2) = dc253a48ae4480c38af726920ebcf9c44c3e4269d71283e60a6730298bfb4f368ec775b4ecca906c6a33dc9548ef05102ff6a8f088c4cca26f7e6279ef33a50c
+Size (gdb-6.2.1.tar.bz2) = 12820148 bytes
+SHA1 (patch-aa) = afb8d7805c2c01c131bc4a7949a532e5372817c0
+SHA1 (patch-ab) = b5c98fc990606e2f5c566864d02565d8fc9adeb4
+SHA1 (patch-ac) = bc9a4e5d77d571a6f06b88984fb2030beec37654
+SHA1 (patch-ad) = 7fddbe93dda4ddb659b050b0b511f5cb19e2777e
+SHA1 (patch-ae) = 19dbdb326643bf32a3d0c26cfea056cca19deb13
+SHA1 (patch-af) = 976cbe2b27c23a113c43cab791562a04d9e6d7e3
+SHA1 (patch-ag) = c53cc22ac5a2c5d5b2c1a7b0825558d8787b2bed
+SHA1 (patch-ah) = 048c03512a18f3234422a3afc00d6c45f2dea58d
+SHA1 (patch-ai) = 66e40920b5de734cbcf66c0b357e82a74f3c48c0
+SHA1 (patch-aj) = a54471bf7cdd42def5e78137df3674988ae3c04b
+SHA1 (patch-ak) = 6ae7afb646fe7464b8a3667913ac6681b1df34e6
+SHA1 (patch-al) = c883cc007cd43c478b1ba0f09ca084391552ba3b
+SHA1 (patch-am) = 3d9a9eb8dce8a8cb83f8e7afc504bf52cdec0b1d
+SHA1 (patch-an) = ba113183487cea58e71b932754d3b7b77f1c96f9
+SHA1 (patch-ao) = 6b977d1da6d94ff32bdf1e3627ee534333cc2a79
+SHA1 (patch-ap) = 3e41ee1623a52802268d5986559ce7ab742f36e7
+SHA1 (patch-aq) = bf4b1c62b003e65f5810a7d28f8464e936e8d190
+SHA1 (patch-ar) = d8b8e91f191837fd1b98e23733780ccfecd61b3b
+SHA1 (patch-as) = eef1bd1d5f00a6fc65d81c46063be9983dbe472b
+SHA1 (patch-at) = f60be4c062e0df4a31f1795b5d2708065ee368cb
+SHA1 (patch-au) = 0595fd12a2dd0f7ec4ec95b74537094ea7314273
+SHA1 (patch-av) = 0ec7cfe9b232caeb1d6fd20fb5fd64f045e68bbf
+SHA1 (patch-aw) = 272b4035d1bcde2fadc04a90ad471de681680c34
+SHA1 (patch-ax) = bacd2687675ccbb7cbc05359323c0bf32f75e9e5
+SHA1 (patch-ay) = edcb6662c891738a0582bbfed151bff3812a5f8d
+SHA1 (patch-az) = b3f7b9f8a3ad7762637fe9f60a45e50206b713ae
+SHA1 (patch-ba) = d85e155d88e17da9c316c69e6fea3a7ba2e470ee
+SHA1 (patch-bb) = 63dde49eaf61bf85ce6dae12ec9af33ae4addfb5
+SHA1 (patch-bc) = 9c8d886a5b412e64a9a8e6165110a5c336ff65ae
+SHA1 (patch-bd) = 840ce6ceb34afea4c8b789c70fb848ad9942ce39
+SHA1 (patch-be) = dd353978d62cc45aadf6259e8b5f7b2895317f9c
+SHA1 (patch-bf) = 1c56789841982089a32bdcca8465f6d2112503b0
+SHA1 (patch-bg) = 8a7c8e5d081d261b7493d633931d7003f49001ae
+SHA1 (patch-bh) = c62928b6b8c4857ddb373ab3ac7f111442672b9d
+SHA1 (patch-bi) = 96f44172271f9a45f9136bda159371ee709da59a
+SHA1 (patch-bj) = 43cf376dddf9f91dceee8d1eba853171fd873905
+SHA1 (patch-bk) = 98f836c7007a668b812d119be294842a957cb507
+SHA1 (patch-bl) = c125f2a1bed7c5b528e463ff619a77f84edd1f55
+SHA1 (patch-bm) = baf198e86cb5e9d8b9f6b0bd6d7ccd1ca61227b4
+SHA1 (patch-bn) = cfeee69148028782b9ab6580f0f619d5f3327325
+SHA1 (patch-bo) = 92221afaa93d9362057783c20100ce7ff1b5df9b
+SHA1 (patch-bp) = bff41b3fb0f5952cbcd37797ec4bb63f6f79da8d
+SHA1 (patch-br) = f1e1a0b16721cdc8b1379685a0598211e71cee49
+SHA1 (patch-gdb_dwarf2read.c) = 811455c31b004a35ba557244037cde55c0161777
+SHA1 (patch-gdb_dwarfread.c) = 56a2210a50e31d464eb4ca295b3021d010f738d2
diff --git a/gdb6/files/nbsd-nat.c b/gdb6/files/nbsd-nat.c
new file mode 100644
index 0000000000..a8dc399c1c
--- /dev/null
+++ b/gdb6/files/nbsd-nat.c
@@ -0,0 +1,54 @@
+/* Low level Unix child interface to ptrace, for GDB when running under Unix.
+ Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996,
+ 1998, 1999, 2000, 2001, 2002
+ Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 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., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include "defs.h"
+#include "frame.h"
+#include "inferior.h"
+#include "target.h"
+#include "gdb_string.h"
+#include "regcache.h"
+
+#include "gdb_wait.h"
+
+#include "command.h"
+
+#include <sys/types.h>
+#include "gdb_dirent.h"
+#include <sys/ptrace.h>
+#include <machine/reg.h>
+#include "i386-tdep.h"
+
+#define ATTACH_DETACH
+/* Start debugging the process whose number is PID. */
+int
+attach (int pid)
+{
+ errno = 0;
+ if (pid == getpid())
+ ptrace (PT_TRACE_ME, pid, (PTRACE_ARG3_TYPE) 0, 0);
+ else
+ ptrace (PT_ATTACH, pid, (PTRACE_ARG3_TYPE) 0, 0);
+ if (errno)
+ perror_with_name ("ptrace");
+ attach_flag = 1;
+ return pid;
+}
diff --git a/gdb6/options.mk b/gdb6/options.mk
new file mode 100644
index 0000000000..ef602d6ce5
--- /dev/null
+++ b/gdb6/options.mk
@@ -0,0 +1,15 @@
+# $NetBSD: options.mk,v 1.1 2009/04/04 13:49:17 wiz Exp $
+
+PKG_OPTIONS_VAR= PKG_OPTIONS.gdb6
+PKG_SUPPORTED_OPTIONS= gdb6-tui
+PKG_SUGGESTED_OPTIONS= gdb6-tui
+
+.include "../../mk/bsd.options.mk"
+
+PLIST_VARS+= tui
+.if !empty(PKG_OPTIONS:Mgdb6-tui)
+PLIST.tui= yes
+.include "../../mk/curses.buildlink3.mk"
+.else
+CONFIGURE_ARGS+= --disable-tui
+.endif
diff --git a/gdb6/patches/patch-aa b/gdb6/patches/patch-aa
new file mode 100644
index 0000000000..35c29f16e6
--- /dev/null
+++ b/gdb6/patches/patch-aa
@@ -0,0 +1,68 @@
+$NetBSD: patch-aa,v 1.2 2006/03/14 00:47:50 joerg Exp $
+
+--- gdb/i386bsd-nat.c.orig 2004-05-31 11:20:41.000000000 +0000
++++ gdb/i386bsd-nat.c
+@@ -33,6 +33,19 @@
+
+ #include "i386-tdep.h"
+ #include "i387-tdep.h"
++#ifdef HAVE_SYS_PROCFS_H
++#include <sys/procfs.h>
++#endif
++
++#ifndef HAVE_GREGSET_T
++typedef struct reg gregset_t;
++#endif
++
++#ifndef HAVE_FPREGSET_T
++typedef struct fpreg fpregset_t;
++#endif
++
++#include "gregset.h"
+
+
+ /* In older BSD versions we cannot get at some of the segment
+@@ -349,7 +362,7 @@ _initialize_i386bsd_nat (void)
+ system header files and sysctl(3) to get at the relevant
+ information. */
+
+-#if defined (__FreeBSD_version) && __FreeBSD_version >= 400011
++#if defined(__DragonFly__) || (defined (__FreeBSD_version) && __FreeBSD_version >= 400011)
+ #define SC_REG_OFFSET i386fbsd4_sc_reg_offset
+ #elif defined (__FreeBSD_version) && __FreeBSD_version >= 300005
+ #define SC_REG_OFFSET i386fbsd_sc_reg_offset
+@@ -373,7 +386,11 @@ _initialize_i386bsd_nat (void)
+
+ /* Override the default value for the offset of the program counter
+ in the sigcontext structure. */
+- offset = offsetof (struct sigcontext, sc_pc);
++#if defined(__DragonFly__)
++ offset = offsetof (ucontext_t, uc_mcontext.mc_eip);
++#else
++ offset = offsetof (ucontext_t, uc_mcontext.__gregs[_REG_EIP]);
++#endif
+
+ if (SC_PC_OFFSET != offset)
+ {
+@@ -386,7 +403,11 @@ Please report this to <bug-gdb%gnu.org@localhost>.
+ SC_PC_OFFSET = offset;
+
+ /* Likewise for the stack pointer. */
+- offset = offsetof (struct sigcontext, sc_sp);
++#if defined(__DragonFly__)
++ offset = offsetof (ucontext_t, uc_mcontext.mc_esp);
++#else
++ offset = offsetof (ucontext_t, uc_mcontext.__gregs[_REG_UESP]);
++#endif
+
+ if (SC_SP_OFFSET != offset)
+ {
+@@ -399,7 +420,7 @@ Please report this to <bug-gdb%gnu.org@localhost>.
+ SC_SP_OFFSET = offset;
+
+ /* And the frame pointer. */
+- offset = offsetof (struct sigcontext, sc_fp);
++ offset = offsetof (ucontext_t, uc_stack);
+
+ if (SC_FP_OFFSET != offset)
+ {
diff --git a/gdb6/patches/patch-ab b/gdb6/patches/patch-ab
new file mode 100644
index 0000000000..08b8c68a86
--- /dev/null
+++ b/gdb6/patches/patch-ab
@@ -0,0 +1,13 @@
+$NetBSD: patch-ab,v 1.1 2005/10/20 17:48:49 wiz Exp $
+
+--- Makefile.tpl.orig 2004-06-01 08:06:45.000000000 -0600
++++ Makefile.tpl
+@@ -1370,7 +1370,7 @@ configure-target-zlib: $(ALL_GCC_C)
+ configure-target-examples: $(ALL_GCC_C)
+ configure-target-libgloss: $(ALL_GCC)
+ all-target-libgloss: maybe-configure-target-newlib
+-configure-target-libiberty: $(ALL_GCC)
++maybe-configure-target-libiberty: $(ALL_GCC)
+ configure-target-libtermcap: $(ALL_GCC_C)
+ configure-target-newlib: $(ALL_GCC)
+ configure-target-rda: $(ALL_GCC_C)
diff --git a/gdb6/patches/patch-ac b/gdb6/patches/patch-ac
new file mode 100644
index 0000000000..7587d6a841
--- /dev/null
+++ b/gdb6/patches/patch-ac
@@ -0,0 +1,13 @@
+$NetBSD: patch-ac,v 1.1 2005/10/20 17:48:49 wiz Exp $
+
+--- gdb/ax-gdb.c.orig 2004-02-06 11:30:47.000000000 -0700
++++ gdb/ax-gdb.c
+@@ -743,6 +743,8 @@ gen_usual_unary (struct agent_expr *ax,
+ case TYPE_CODE_ENUM:
+ value->type = builtin_type_int;
+ break;
++ default:
++ ;
+ }
+
+ /* If the value is an lvalue, dereference it. */
diff --git a/gdb6/patches/patch-ad b/gdb6/patches/patch-ad
new file mode 100644
index 0000000000..0962741e37
--- /dev/null
+++ b/gdb6/patches/patch-ad
@@ -0,0 +1,26 @@
+$NetBSD: patch-ad,v 1.2 2006/03/14 00:47:50 joerg Exp $
+
+--- gdb/bsd-kvm.c.orig 2004-07-03 13:17:33.000000000 +0000
++++ gdb/bsd-kvm.c
+@@ -33,7 +33,9 @@
+ #include <nlist.h>
+ #include "readline/readline.h"
+ #include <sys/param.h>
++#if !defined(__DragonFly__)
+ #include <sys/proc.h>
++#endif
+ #include <sys/user.h>
+
+ #include "bsd-kvm.h"
+@@ -228,7 +230,11 @@ bsd_kvm_proc_cmd (char *arg, int fromtty
+ error ("No kernel memory image.");
+
+ addr = parse_and_eval_address (arg);
++#ifdef HAVE_STRUCT_LWP
++ addr += offsetof (struct lwp, l_addr);
++#else
+ addr += offsetof (struct proc, p_addr);
++#endif
+
+ if (kvm_read (core_kd, addr, &bsd_kvm_paddr, sizeof bsd_kvm_paddr) == -1)
+ error ("%s", kvm_geterr (core_kd));
diff --git a/gdb6/patches/patch-ae b/gdb6/patches/patch-ae
new file mode 100644
index 0000000000..2bf8d30353
--- /dev/null
+++ b/gdb6/patches/patch-ae
@@ -0,0 +1,13 @@
+$NetBSD: patch-ae,v 1.1 2005/10/20 17:48:49 wiz Exp $
+
+--- ./gdb/cli/cli-decode.c.orig 2004-02-10 12:08:15.000000000 -0700
++++ ./gdb/cli/cli-decode.c
+@@ -1207,8 +1207,6 @@ deprecated_cmd_warning (char **text)
+ struct cmd_list_element *alias = NULL;
+ struct cmd_list_element *prefix_cmd = NULL;
+ struct cmd_list_element *cmd = NULL;
+- struct cmd_list_element *c;
+- char *type;
+
+ if (!lookup_cmd_composition (*text, &alias, &prefix_cmd, &cmd))
+ /* return if text doesn't evaluate to a command */
diff --git a/gdb6/patches/patch-af b/gdb6/patches/patch-af
new file mode 100644
index 0000000000..eca5b18cc5
--- /dev/null
+++ b/gdb6/patches/patch-af
@@ -0,0 +1,28 @@
+$NetBSD: patch-af,v 1.1 2005/10/20 17:48:49 wiz Exp $
+
+--- gdb/cli/cli-dump.c.orig 2004-02-28 11:04:37.000000000 -0700
++++ gdb/cli/cli-dump.c
+@@ -72,7 +72,6 @@ scan_expression_with_cleanup (char **cmd
+ static void
+ do_fclose_cleanup (void *arg)
+ {
+- FILE *file = arg;
+ fclose (arg);
+ }
+
+@@ -233,7 +232,6 @@ dump_memory_to_file (char *cmd, char *mo
+ void *buf;
+ char *lo_exp;
+ char *hi_exp;
+- int len;
+
+ /* Open the file. */
+ filename = scan_filename_with_cleanup (&cmd, NULL);
+@@ -521,7 +519,6 @@ static void
+ restore_binary_file (char *filename, struct callback_data *data)
+ {
+ FILE *file = fopen_with_cleanup (filename, FOPEN_RB);
+- int status;
+ char *buf;
+ long len;
+
diff --git a/gdb6/patches/patch-ag b/gdb6/patches/patch-ag
new file mode 100644
index 0000000000..c564046bda
--- /dev/null
+++ b/gdb6/patches/patch-ag
@@ -0,0 +1,15 @@
+$NetBSD: patch-ag,v 1.1 2005/10/20 17:48:49 wiz Exp $
+
+--- gdb/cli/cli-script.c.orig 2004-02-25 08:57:42.000000000 -0700
++++ gdb/cli/cli-script.c
+@@ -1071,9 +1071,8 @@ define_command (char *comname, int from_
+ CMD_POST_HOOK
+ };
+ struct command_line *cmds;
+- struct cmd_list_element *c, *newc, *oldc, *hookc = 0;
++ struct cmd_list_element *c, *newc, *hookc = 0;
+ char *tem = comname;
+- char *tem2;
+ char tmpbuf[MAX_TMPBUF];
+ int hook_type = CMD_NO_HOOK;
+ int hook_name_size = 0;
diff --git a/gdb6/patches/patch-ah b/gdb6/patches/patch-ah
new file mode 100644
index 0000000000..215993191b
--- /dev/null
+++ b/gdb6/patches/patch-ah
@@ -0,0 +1,13 @@
+$NetBSD: patch-ah,v 1.1 2005/10/20 17:48:49 wiz Exp $
+
+--- gdb/cli/cli-setshow.c.orig 2004-02-28 11:04:37.000000000 -0700
++++ gdb/cli/cli-setshow.c
+@@ -276,8 +276,6 @@ do_setshow_command (char *arg, int from_
+ {
+ case var_string:
+ {
+- unsigned char *p;
+-
+ if (*(unsigned char **) c->var)
+ fputstr_filtered (*(unsigned char **) c->var, '"', stb->stream);
+ quote = 1;
diff --git a/gdb6/patches/patch-ai b/gdb6/patches/patch-ai
new file mode 100644
index 0000000000..e39f842d2b
--- /dev/null
+++ b/gdb6/patches/patch-ai
@@ -0,0 +1,21 @@
+$NetBSD: patch-ai,v 1.1 2005/10/20 17:48:49 wiz Exp $
+
+--- gdb/cli/cli-cmds.c.orig 2004-02-28 11:04:37.000000000 -0700
++++ gdb/cli/cli-cmds.c
+@@ -225,7 +225,6 @@ compare_strings (const void *arg1, const
+ static void
+ complete_command (char *arg, int from_tty)
+ {
+- int i;
+ int argpoint;
+ char **completions, *point, *arg_prefix;
+
+@@ -836,7 +835,7 @@ disassemble_command (char *arg, int from
+ {
+ CORE_ADDR low, high;
+ char *name;
+- CORE_ADDR pc, pc_masked;
++ CORE_ADDR pc;
+ char *space_index;
+ #if 0
+ asection *section;
diff --git a/gdb6/patches/patch-aj b/gdb6/patches/patch-aj
new file mode 100644
index 0000000000..633e725b2e
--- /dev/null
+++ b/gdb6/patches/patch-aj
@@ -0,0 +1,10 @@
+$NetBSD: patch-aj,v 1.1 2005/10/20 17:48:49 wiz Exp $
+
+--- gdb/config/xm-nbsd.h.orig 2001-12-01 19:57:13.000000000 -0700
++++ gdb/config/xm-nbsd.h
+@@ -24,3 +24,5 @@
+
+ /* NetBSD has termios facilities. */
+ #define HAVE_TERMIOS
++
++#define PT_IO 1
diff --git a/gdb6/patches/patch-ak b/gdb6/patches/patch-ak
new file mode 100644
index 0000000000..d9a0cc6dd4
--- /dev/null
+++ b/gdb6/patches/patch-ak
@@ -0,0 +1,20 @@
+$NetBSD: patch-ak,v 1.1 2005/10/20 17:48:49 wiz Exp $
+
+--- gdb/corelow.c.orig 2004-02-28 11:04:36.000000000 -0700
++++ gdb/corelow.c
+@@ -493,7 +493,6 @@ get_core_register_section (char *name,
+ static void
+ get_core_registers (int regno)
+ {
+- int status;
+
+ if (!(core_gdbarch && gdbarch_regset_from_core_section_p (core_gdbarch))
+ && (core_vec == NULL || core_vec->core_read_registers == NULL))
+@@ -540,7 +539,6 @@ core_xfer_partial (struct target_ops *op
+
+ struct bfd_section *section;
+ bfd_size_type size;
+- char *contents;
+
+ section = bfd_get_section_by_name (core_bfd, ".auxv");
+ if (section == NULL)
diff --git a/gdb6/patches/patch-al b/gdb6/patches/patch-al
new file mode 100644
index 0000000000..395b8d45e9
--- /dev/null
+++ b/gdb6/patches/patch-al
@@ -0,0 +1,21 @@
+$NetBSD: patch-al,v 1.1 2005/10/20 17:48:49 wiz Exp $
+
+--- gdb/configure.in.orig 2004-07-17 05:29:08.000000000 -0600
++++ gdb/configure.in
+@@ -504,6 +504,16 @@ if test $gdb_cv_struct_thread_td_pcb = y
+ [Define to 1 if your system has td_pcb in struct thread.])
+ fi
+
++# See if <sys/lwp.h> defines `struct lwp`.
++AC_CACHE_CHECK([for struct lwp], gdb_cv_struct_lwp,
++[AC_TRY_COMPILE([#include <sys/param.h>
++#include <sys/lwp.h>], [struct lwp l;],
++gdb_cv_struct_lwp=yes, gdb_cv_struct_lwp=no)])
++if test $gdb_cv_struct_lwp = yes; then
++ AC_DEFINE(HAVE_STRUCT_LWP, 1,
++ [Define to 1 if your system has struct lwp.])
++fi
++
+ # See if <machine/reg.h> degines `struct reg'.
+ AC_CACHE_CHECK([for struct reg in machine/reg.h], gdb_cv_struct_reg,
+ [AC_TRY_COMPILE([#include <sys/types.h>
diff --git a/gdb6/patches/patch-am b/gdb6/patches/patch-am
new file mode 100644
index 0000000000..62f20ef07f
--- /dev/null
+++ b/gdb6/patches/patch-am
@@ -0,0 +1,11 @@
+$NetBSD: patch-am,v 1.1 2005/10/20 17:48:49 wiz Exp $
+
+--- gdb/config/i386/nbsdelf.mh.orig 2004-06-27 10:22:43.000000000 -0600
++++ gdb/config/i386/nbsdelf.mh
+@@ -1,5 +1,5 @@
+ # Host: NetBSD/i386 ELF
+-NATDEPFILES= fork-child.o infptrace.o inftarg.o \
++NATDEPFILES= fork-child.o nbsd-nat.o infptrace.o inftarg.o \
+ i386bsd-nat.o i386nbsd-nat.o bsd-kvm.o
+ NAT_FILE= nm-nbsd.h
+ XM_FILE= xm-nbsd.h
diff --git a/gdb6/patches/patch-an b/gdb6/patches/patch-an
new file mode 100644
index 0000000000..9ba937362c
--- /dev/null
+++ b/gdb6/patches/patch-an
@@ -0,0 +1,21 @@
+$NetBSD: patch-an,v 1.2 2008/01/06 19:54:46 rillig Exp $
+
+--- gdb/config/i386/nm-nbsd.h.orig 2004-02-22 16:20:22.000000000 +0000
++++ gdb/config/i386/nm-nbsd.h 2008-01-06 20:43:25.000000000 +0000
+@@ -23,7 +23,16 @@
+ #ifndef NM_NBSD_H
+ #define NM_NBSD_H
+
++#include <sys/param.h>
++
+ /* Get generic NetBSD native definitions. */
+ #include "config/nm-nbsd.h"
+
++#include <sys/lock.h>
++#if __NetBSD_Version__ >= 499000900
++#include <sys/mutex.h>
++#endif
++#include <machine/vmparam.h>
++#define KERNEL_U_ADDR USRSTACK
++
+ #endif /* nm-nbsd.h */
diff --git a/gdb6/patches/patch-ao b/gdb6/patches/patch-ao
new file mode 100644
index 0000000000..b395a7a33d
--- /dev/null
+++ b/gdb6/patches/patch-ao
@@ -0,0 +1,12 @@
+$NetBSD: patch-ao,v 1.1 2005/10/20 17:48:49 wiz Exp $
+
+--- gdb/i386nbsd-tdep.c.orig 2004-02-22 09:20:22.000000000 -0700
++++ gdb/i386nbsd-tdep.c
+@@ -137,7 +137,6 @@ i386nbsd_sigtramp_offset (CORE_ADDR pc)
+ {
+ unsigned char ret[sizeof(sigtramp_retcode)], insn;
+ LONGEST off;
+- int i;
+
+ if (read_memory_nobpt (pc, &insn, 1) != 0)
+ return -1;
diff --git a/gdb6/patches/patch-ap b/gdb6/patches/patch-ap
new file mode 100644
index 0000000000..d56038036c
--- /dev/null
+++ b/gdb6/patches/patch-ap
@@ -0,0 +1,12 @@
+$NetBSD: patch-ap,v 1.1 2005/10/20 17:48:49 wiz Exp $
+
+--- gdb/i387-tdep.c.orig 2004-02-28 13:43:51.000000000 -0700
++++ gdb/i387-tdep.c
+@@ -206,7 +206,6 @@ i387_print_float_info (struct gdbarch *g
+ struct frame_info *frame, const char *args)
+ {
+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (frame));
+- char buf[4];
+ ULONGEST fctrl;
+ ULONGEST fstat;
+ ULONGEST ftag;
diff --git a/gdb6/patches/patch-aq b/gdb6/patches/patch-aq
new file mode 100644
index 0000000000..87cb5eb2a3
--- /dev/null
+++ b/gdb6/patches/patch-aq
@@ -0,0 +1,16 @@
+$NetBSD: patch-aq,v 1.1 2005/10/20 17:48:49 wiz Exp $
+
+--- gdb/inftarg.c.orig 2004-02-04 14:49:55.000000000 -0700
++++ gdb/inftarg.c
+@@ -106,11 +106,7 @@ child_wait (ptid_t ptid, struct target_w
+ {
+ int save_errno;
+ int status;
+- char *execd_pathname = NULL;
+ int exit_status;
+- int related_pid;
+- int syscall_id;
+- enum target_waitkind kind;
+ int pid;
+
+ do
diff --git a/gdb6/patches/patch-ar b/gdb6/patches/patch-ar
new file mode 100644
index 0000000000..424a3b6bee
--- /dev/null
+++ b/gdb6/patches/patch-ar
@@ -0,0 +1,22 @@
+$NetBSD: patch-ar,v 1.1 2005/10/20 17:48:49 wiz Exp $
+
+--- gdb/mi/mi-cmd-break.c.orig 2002-03-18 19:51:08.000000000 -0700
++++ gdb/mi/mi-cmd-break.c
+@@ -90,7 +90,7 @@ mi_cmd_break_insert (char *command, char
+ {"c", CONDITION_OPT, 1},
+ {"i", IGNORE_COUNT_OPT, 1},
+ {"p", THREAD_OPT, 1},
+- 0
++ {0}
+ };
+
+ /* Parse arguments. It could be -r or -h or -t, <location> or ``--''
+@@ -194,7 +194,7 @@ mi_cmd_break_watch (char *command, char
+ {
+ {"r", READ_OPT, 0},
+ {"a", ACCESS_OPT, 0},
+- 0
++ {0}
+ };
+
+ /* Parse arguments. */
diff --git a/gdb6/patches/patch-as b/gdb6/patches/patch-as
new file mode 100644
index 0000000000..2dd9c2c80e
--- /dev/null
+++ b/gdb6/patches/patch-as
@@ -0,0 +1,21 @@
+$NetBSD: patch-as,v 1.1 2005/10/20 17:48:49 wiz Exp $
+
+--- gdb/mi/mi-cmd-disas.c.orig 2002-09-30 09:57:26.000000000 -0600
++++ gdb/mi/mi-cmd-disas.c
+@@ -51,7 +51,6 @@
+ enum mi_cmd_result
+ mi_cmd_disassemble (char *command, char **argv, int argc)
+ {
+- enum mi_cmd_result retval;
+ CORE_ADDR start;
+
+ int mixed_source_and_assembly;
+@@ -84,7 +83,7 @@ mi_cmd_disassemble (char *command, char
+ {"n", NUM_OPT, 1},
+ {"s", START_OPT, 1},
+ {"e", END_OPT, 1},
+- 0
++ {0}
+ };
+
+ /* Get the options with their arguments. Keep track of what we
diff --git a/gdb6/patches/patch-at b/gdb6/patches/patch-at
new file mode 100644
index 0000000000..b5249f3903
--- /dev/null
+++ b/gdb6/patches/patch-at
@@ -0,0 +1,22 @@
+$NetBSD: patch-at,v 1.1 2005/10/20 17:48:49 wiz Exp $
+
+--- gdb/mi/mi-cmd-env.c.orig 2004-01-18 18:20:12.000000000 -0700
++++ gdb/mi/mi-cmd-env.c
+@@ -126,7 +126,7 @@ mi_cmd_env_path (char *command, char **a
+ static struct mi_opt opts[] =
+ {
+ {"r", RESET_OPT, 0},
+- 0
++ {0}
+ };
+
+ dont_repeat ();
+@@ -198,7 +198,7 @@ mi_cmd_env_dir (char *command, char **ar
+ static struct mi_opt opts[] =
+ {
+ {"r", RESET_OPT, 0},
+- 0
++ {0}
+ };
+
+ dont_repeat ();
diff --git a/gdb6/patches/patch-au b/gdb6/patches/patch-au
new file mode 100644
index 0000000000..a2ca39496a
--- /dev/null
+++ b/gdb6/patches/patch-au
@@ -0,0 +1,13 @@
+$NetBSD: patch-au,v 1.1 2005/10/20 17:48:49 wiz Exp $
+
+--- gdb/mi/mi-cmd-file.c.orig 2003-04-02 15:10:35.000000000 -0700
++++ gdb/mi/mi-cmd-file.c
+@@ -33,8 +33,6 @@ enum mi_cmd_result
+ mi_cmd_file_list_exec_source_file(char *command, char **argv, int argc)
+ {
+ struct symtab_and_line st;
+- int optind = 0;
+- char *optarg;
+
+ if ( !mi_valid_noargs("mi_cmd_file_list_exec_source_file", argc, argv) )
+ error ("mi_cmd_file_list_exec_source_file: Usage: No args");
diff --git a/gdb6/patches/patch-av b/gdb6/patches/patch-av
new file mode 100644
index 0000000000..942b75aeb0
--- /dev/null
+++ b/gdb6/patches/patch-av
@@ -0,0 +1,12 @@
+$NetBSD: patch-av,v 1.1 2005/10/20 17:48:49 wiz Exp $
+
+--- gdb/mi/mi-cmd-stack.c.orig 2004-01-23 21:21:55.000000000 -0700
++++ gdb/mi/mi-cmd-stack.c
+@@ -232,7 +232,6 @@ list_args_or_locals (int locals, int val
+ struct block *block;
+ struct symbol *sym;
+ struct dict_iterator iter;
+- int nsyms;
+ struct cleanup *cleanup_list;
+ static struct ui_stream *stb = NULL;
+ struct type *type;
diff --git a/gdb6/patches/patch-aw b/gdb6/patches/patch-aw
new file mode 100644
index 0000000000..bc0141cf91
--- /dev/null
+++ b/gdb6/patches/patch-aw
@@ -0,0 +1,13 @@
+$NetBSD: patch-aw,v 1.1 2005/10/20 17:48:49 wiz Exp $
+
+--- gdb/mi/mi-getopt.c.orig 2003-04-02 15:10:35.000000000 -0700
++++ gdb/mi/mi-getopt.c
+@@ -82,7 +82,7 @@ mi_valid_noargs (const char *prefix, int
+ char *optarg;
+ static struct mi_opt opts[] =
+ {
+- 0
++ {0}
+ };
+
+ if (mi_getopt (prefix, argc, argv, opts, &optind, &optarg) == -1)
diff --git a/gdb6/patches/patch-ax b/gdb6/patches/patch-ax
new file mode 100644
index 0000000000..273bb06635
--- /dev/null
+++ b/gdb6/patches/patch-ax
@@ -0,0 +1,12 @@
+$NetBSD: patch-ax,v 1.1 2005/10/20 17:48:49 wiz Exp $
+
+--- gdb/mi/mi-interp.c.orig 2004-01-18 18:20:12.000000000 -0700
++++ gdb/mi/mi-interp.c
+@@ -190,7 +190,6 @@ mi_cmd_interpreter_exec (char *command,
+ struct interp *interp_to_use;
+ enum mi_cmd_result result = MI_CMD_DONE;
+ int i;
+- struct interp_procs *procs;
+
+ if (argc < 2)
+ {
diff --git a/gdb6/patches/patch-ay b/gdb6/patches/patch-ay
new file mode 100644
index 0000000000..b91f526d7a
--- /dev/null
+++ b/gdb6/patches/patch-ay
@@ -0,0 +1,38 @@
+$NetBSD: patch-ay,v 1.1 2005/10/20 17:48:49 wiz Exp $
+
+--- gdb/mi/mi-main.c.orig 2004-02-15 08:22:06.000000000 -0700
++++ gdb/mi/mi-main.c
+@@ -817,7 +817,7 @@ mi_cmd_data_read_memory (char *command,
+ static struct mi_opt opts[] =
+ {
+ {"o", OFFSET_OPT, 1},
+- 0
++ {0}
+ };
+
+ while (1)
+@@ -1027,7 +1027,7 @@ mi_cmd_data_write_memory (char *command,
+ static struct mi_opt opts[] =
+ {
+ {"o", OFFSET_OPT, 1},
+- 0
++ {0}
+ };
+
+ while (1)
+@@ -1192,7 +1192,6 @@ mi_execute_command (char *cmd, int from_
+ {
+ struct mi_parse *command;
+ struct captured_mi_execute_command_args args;
+- struct ui_out *saved_uiout = uiout;
+ int result;
+
+ /* This is to handle EOF (^D). We just quit gdb. */
+@@ -1220,7 +1219,6 @@ mi_execute_command (char *cmd, int from_
+ if (args.action == EXECUTE_COMMAND_DISPLAY_ERROR || result < 0)
+ {
+ char *msg = error_last_message ();
+- struct cleanup *cleanup = make_cleanup (xfree, msg);
+ /* The command execution failed and error() was called
+ somewhere */
+ fputs_unfiltered (command->token, raw_stdout);
diff --git a/gdb6/patches/patch-az b/gdb6/patches/patch-az
new file mode 100644
index 0000000000..eaf9affef2
--- /dev/null
+++ b/gdb6/patches/patch-az
@@ -0,0 +1,12 @@
+$NetBSD: patch-az,v 1.1 2005/10/20 17:48:49 wiz Exp $
+
+--- gdb/mi/mi-out.c.orig 2004-01-18 18:20:12.000000000 -0700
++++ gdb/mi/mi-out.c
+@@ -106,7 +106,6 @@ mi_table_begin (struct ui_out *uiout,
+ int nr_rows,
+ const char *tblid)
+ {
+- mi_out_data *data = ui_out_data (uiout);
+ mi_open (uiout, tblid, ui_out_type_tuple);
+ mi_field_int (uiout, -1/*fldno*/, -1/*width*/, -1/*alin*/,
+ "nr_rows", nr_rows);
diff --git a/gdb6/patches/patch-ba b/gdb6/patches/patch-ba
new file mode 100644
index 0000000000..da425b1979
--- /dev/null
+++ b/gdb6/patches/patch-ba
@@ -0,0 +1,19 @@
+$NetBSD: patch-ba,v 1.1 2005/10/20 17:48:49 wiz Exp $
+
+--- gdb/config/nm-nbsd.h.orig 2004-10-04 08:11:51.000000000 -0600
++++ gdb/config/nm-nbsd.h
+@@ -18,8 +18,13 @@
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+-#define PTRACE_ARG3_TYPE char*
++#define PTRACE_ARG3_TYPE caddr_t
+
+ #define FETCH_INFERIOR_REGISTERS
+
+ #include "solib.h" /* Support for shared libraries. */
++#include <signal.h>
++#ifdef SIGRTMIN
++#define REALTIME_LO SIGRTMIN
++#define REALTIME_HI SIGRTMAX
++#endif
diff --git a/gdb6/patches/patch-bb b/gdb6/patches/patch-bb
new file mode 100644
index 0000000000..9ce70bdc5c
--- /dev/null
+++ b/gdb6/patches/patch-bb
@@ -0,0 +1,14 @@
+$NetBSD: patch-bb,v 1.1 2005/10/20 17:48:49 wiz Exp $
+
+--- readline/rltty.c.orig 2004-06-01 09:01:39.000000000 -0600
++++ readline/rltty.c
+@@ -619,6 +619,9 @@ prepare_terminal_settings (meta_flag, ol
+ just to be sure. This includes ^Y and ^V. This should not really
+ be necessary. */
+ #if defined (TERMIOS_TTY_DRIVER) && defined (_POSIX_VDISABLE)
++#if defined (VDISCARD)
++ tiop->c_cc[VDISCARD] = _POSIX_VDISABLE;
++#endif
+
+ #if defined (VLNEXT)
+ tiop->c_cc[VLNEXT] = _POSIX_VDISABLE;
diff --git a/gdb6/patches/patch-bc b/gdb6/patches/patch-bc
new file mode 100644
index 0000000000..1162fd8c5b
--- /dev/null
+++ b/gdb6/patches/patch-bc
@@ -0,0 +1,37 @@
+$NetBSD: patch-bc,v 1.1 2005/10/20 17:48:49 wiz Exp $
+
+--- gdb/remote-fileio.c.orig 2004-01-27 16:19:51.000000000 -0700
++++ gdb/remote-fileio.c
+@@ -1279,19 +1279,19 @@ static struct {
+ char *name;
+ void (*func)(char *);
+ } remote_fio_func_map[] = {
+- "open", remote_fileio_func_open,
+- "close", remote_fileio_func_close,
+- "read", remote_fileio_func_read,
+- "write", remote_fileio_func_write,
+- "lseek", remote_fileio_func_lseek,
+- "rename", remote_fileio_func_rename,
+- "unlink", remote_fileio_func_unlink,
+- "stat", remote_fileio_func_stat,
+- "fstat", remote_fileio_func_fstat,
+- "gettimeofday", remote_fileio_func_gettimeofday,
+- "isatty", remote_fileio_func_isatty,
+- "system", remote_fileio_func_system,
+- NULL, NULL
++ {"open", remote_fileio_func_open},
++ {"close", remote_fileio_func_close},
++ {"read", remote_fileio_func_read},
++ {"write", remote_fileio_func_write},
++ {"lseek", remote_fileio_func_lseek},
++ {"rename", remote_fileio_func_rename},
++ {"unlink", remote_fileio_func_unlink},
++ {"stat", remote_fileio_func_stat},
++ {"fstat", remote_fileio_func_fstat},
++ {"gettimeofday", remote_fileio_func_gettimeofday},
++ {"isatty", remote_fileio_func_isatty},
++ {"system", remote_fileio_func_system},
++ {NULL, NULL}
+ };
+
+ static int
diff --git a/gdb6/patches/patch-bd b/gdb6/patches/patch-bd
new file mode 100644
index 0000000000..65a572f5e1
--- /dev/null
+++ b/gdb6/patches/patch-bd
@@ -0,0 +1,13 @@
+$NetBSD: patch-bd,v 1.1 2005/10/20 17:48:49 wiz Exp $
+
+--- gdb/ser-pipe.c.orig 2004-01-22 15:20:39.000000000 -0700
++++ gdb/ser-pipe.c
+@@ -132,8 +132,6 @@ pipe_close (struct serial *scb)
+ }
+ }
+
+-static struct serial_ops pipe_ops;
+-
+ void
+ _initialize_ser_pipe (void)
+ {
diff --git a/gdb6/patches/patch-be b/gdb6/patches/patch-be
new file mode 100644
index 0000000000..8193af2eef
--- /dev/null
+++ b/gdb6/patches/patch-be
@@ -0,0 +1,12 @@
+$NetBSD: patch-be,v 1.1 2005/10/20 17:48:49 wiz Exp $
+
+--- gdb/tui/tui-interp.c.orig 2004-02-06 21:40:36.000000000 -0700
++++ gdb/tui/tui-interp.c
+@@ -194,7 +194,6 @@ _initialize_tui_interp (void)
+ tui_display_prompt_p,
+ tui_command_loop,
+ };
+- struct interp *tui_interp;
+
+ /* Create a default uiout builder for the TUI. */
+ tui_out = tui_out_new (gdb_stdout);
diff --git a/gdb6/patches/patch-bf b/gdb6/patches/patch-bf
new file mode 100644
index 0000000000..7002df26ac
--- /dev/null
+++ b/gdb6/patches/patch-bf
@@ -0,0 +1,13 @@
+$NetBSD: patch-bf,v 1.1 2006/03/14 00:47:50 joerg Exp $
+
+--- bfd/config.bfd.orig 2006-03-01 00:39:22.000000000 +0000
++++ bfd/config.bfd
+@@ -470,7 +470,7 @@ case "${targ}" in
+ targ_selvecs=i386bsd_vec
+ targ_underscore=yes
+ ;;
+- i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu)
++ i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu | i[3-7]86-*-dragonfly*)
+ targ_defvec=bfd_elf32_i386_freebsd_vec
+ targ_selvecs=i386coff_vec
+ # FreeBSD <= 4.0 supports only the old nonstandard way of ABI labelling.
diff --git a/gdb6/patches/patch-bg b/gdb6/patches/patch-bg
new file mode 100644
index 0000000000..6073a8a1ad
--- /dev/null
+++ b/gdb6/patches/patch-bg
@@ -0,0 +1,50 @@
+$NetBSD: patch-bg,v 1.1 2006/03/14 00:47:50 joerg Exp $
+
+--- bfd/configure.orig 2006-03-01 00:38:13.000000000 +0000
++++ bfd/configure
+@@ -3923,9 +3923,12 @@ echo "configure:3923: checking for gette
+ if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
++ ac_save_LIBS="$LIBS"
++LIBS="-lintl $LIBS"
+ cat > conftest.$ac_ext <<EOF
+ #line 3928 "configure"
+ #include "confdefs.h"
++#include <libintl.h>
+
+ int main() {
+ return (int) gettext ("")
+@@ -3941,6 +3944,7 @@ else
+ gt_cv_func_gettext_libintl=no
+ fi
+ rm -f conftest*
++LIBS="$ac_save_LIBS"
+ fi
+
+ echo "$ac_t""$gt_cv_func_gettext_libintl" 1>&6
+@@ -5306,7 +5310,7 @@ if test "${target}" = "${host}"; then
+ COREFILE=trad-core.lo
+ TRAD_HEADER='"hosts/i386bsd.h"'
+ ;;
+- i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu)
++ i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu| i[3-7]86-*-dragonfly*)
+ COREFILE=''
+ TRAD_HEADER='"hosts/i386bsd.h"'
+ ;;
+@@ -6292,6 +6296,7 @@ do
+ bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
+ bfd_elf32_i370_vec) tb="$tb elf32-i370.lo elf32.lo $elf" ;;
+ bfd_elf32_i386_freebsd_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;;
++ bfd_elf32_i386_dragonfly_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;;
+ bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;;
+ bfd_elf32_i860_little_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
+ bfd_elf32_i860_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
+@@ -6402,6 +6407,7 @@ do
+ i386coff_vec) tb="$tb coff-i386.lo cofflink.lo" ;;
+ i386dynix_vec) tb="$tb i386dynix.lo aout32.lo" ;;
+ i386freebsd_vec) tb="$tb i386freebsd.lo aout32.lo" ;;
++ i386dragonfly_vec) tb="$tb i386freebsd.lo aout32.lo" ;;
+ i386linux_vec) tb="$tb i386linux.lo aout32.lo" ;;
+ i386lynx_aout_vec) tb="$tb i386lynx.lo lynx-core.lo aout32.lo" ;;
+ i386lynx_coff_vec) tb="$tb cf-i386lynx.lo cofflink.lo lynx-core.lo" ;;
diff --git a/gdb6/patches/patch-bh b/gdb6/patches/patch-bh
new file mode 100644
index 0000000000..dd7d23f533
--- /dev/null
+++ b/gdb6/patches/patch-bh
@@ -0,0 +1,12 @@
+$NetBSD: patch-bh,v 1.1 2006/03/14 00:47:50 joerg Exp $
+
+--- gdb/configure.tgt.orig 2006-03-01 00:40:30.000000000 +0000
++++ gdb/configure.tgt
+@@ -40,6 +40,7 @@ case "${target}" in
+
+ x86_64-*-freebsd*) gdb_target=fbsd64 ;;
+ *-*-freebsd*) gdb_target=fbsd ;;
++*-*-dragonfly*) gdb_target=fbsd ;;
+
+ alpha*-*-osf*) gdb_target=alpha-osf1 ;;
+ alpha*-*-linux*) gdb_target=alpha-linux ;;
diff --git a/gdb6/patches/patch-bi b/gdb6/patches/patch-bi
new file mode 100644
index 0000000000..955521539c
--- /dev/null
+++ b/gdb6/patches/patch-bi
@@ -0,0 +1,13 @@
+$NetBSD: patch-bi,v 1.1 2006/03/14 00:47:50 joerg Exp $
+
+--- gdb/configure.host.orig 2006-03-01 00:41:02.000000000 +0000
++++ gdb/configure.host
+@@ -54,7 +54,7 @@ hppa*-*-openbsd*) gdb_host=obsd ;;
+
+ i[34567]86-ncr-*) gdb_host=ncr3000 ;;
+ i[34567]86-*-dgux*) gdb_host=i386v4 ;;
+-i[34567]86-*-freebsd* | i[34567]86-*-kfreebsd*-gnu)
++i[34567]86-*-freebsd* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-dragonfly*)
+ gdb_host=fbsd ;;
+ i[34567]86-*-netbsdelf* | i[34567]86-*-knetbsd*-gnu)
+ gdb_host=nbsdelf ;;
diff --git a/gdb6/patches/patch-bj b/gdb6/patches/patch-bj
new file mode 100644
index 0000000000..271f715819
--- /dev/null
+++ b/gdb6/patches/patch-bj
@@ -0,0 +1,67 @@
+$NetBSD: patch-bj,v 1.1 2006/03/14 00:47:50 joerg Exp $
+
+--- gdb/configure.orig 2004-07-17 11:29:05.000000000 +0000
++++ gdb/configure
+@@ -2405,9 +2405,12 @@ echo "configure:2405: checking for gette
+ if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
++ ac_save_LIBS="$LIBS"
++LIBS="-lintl $LIBS"
+ cat > conftest.$ac_ext <<EOF
+ #line 2410 "configure"
+ #include "confdefs.h"
++#include <libintl.h>
+
+ int main() {
+ return (int) gettext ("")
+@@ -2423,6 +2426,7 @@ else
+ gt_cv_func_gettext_libintl=no
+ fi
+ rm -f conftest*
++LIBS="$ac_save_LIBS"
+ fi
+
+ echo "$ac_t""$gt_cv_func_gettext_libintl" 1>&6
+@@ -7323,6 +7327,41 @@ EOF
+
+ fi
+
++# See if <sys/lwp.h> defines `struct lwp`.
++echo $ac_n "checking for struct lwp""... $ac_c" 1>&6
++echo "configure:7318: checking for struct lwp" >&5
++if eval "test \"`echo '$''{'gdb_cv_struct_lwp'+set}'`\" = set"; then
++ echo $ac_n "(cached) $ac_c" 1>&6
++else
++ cat > conftest.$ac_ext <<EOF
++#line 7323 "configure"
++#include "confdefs.h"
++#include <sys/param.h>
++#include <sys/lwp.h>
++int main() {
++struct lwp l;
++; return 0; }
++EOF
++if { (eval echo configure:7331: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
++ rm -rf conftest*
++ gdb_cv_struct_lwp=yes
++else
++ echo "configure: failed program was:" >&5
++ cat conftest.$ac_ext >&5
++ rm -rf conftest*
++ gdb_cv_struct_lwp=no
++fi
++rm -f conftest*
++fi
++
++echo "$ac_t""$gdb_cv_struct_lwp" 1>&6
++if test $gdb_cv_struct_lwp = yes; then
++ cat >> confdefs.h <<\EOF
++#define HAVE_STRUCT_LWP 1
++EOF
++
++fi
++
+ # See if <machine/reg.h> degines `struct reg'.
+ echo $ac_n "checking for struct reg in machine/reg.h""... $ac_c" 1>&6
+ echo "configure:7329: checking for struct reg in machine/reg.h" >&5
diff --git a/gdb6/patches/patch-bk b/gdb6/patches/patch-bk
new file mode 100644
index 0000000000..f4c2821408
--- /dev/null
+++ b/gdb6/patches/patch-bk
@@ -0,0 +1,25 @@
+$NetBSD: patch-bk,v 1.1 2006/03/14 00:47:50 joerg Exp $
+
+--- opcodes/configure.orig 2006-03-13 22:59:10.000000000 +0000
++++ opcodes/configure
+@@ -3900,9 +3900,12 @@ echo "configure:3900: checking for gette
+ if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
++ ac_save_LIBS="$LIBS"
++LIBS="-lintl $LIBS"
+ cat > conftest.$ac_ext <<EOF
+ #line 3905 "configure"
+ #include "confdefs.h"
++#include <libintl.h>
+
+ int main() {
+ return (int) gettext ("")
+@@ -3918,6 +3921,7 @@ else
+ gt_cv_func_gettext_libintl=no
+ fi
+ rm -f conftest*
++LIBS="$ac_save_LIBS"
+ fi
+
+ echo "$ac_t""$gt_cv_func_gettext_libintl" 1>&6
diff --git a/gdb6/patches/patch-bl b/gdb6/patches/patch-bl
new file mode 100644
index 0000000000..7ca30f213b
--- /dev/null
+++ b/gdb6/patches/patch-bl
@@ -0,0 +1,13 @@
+$NetBSD: patch-bl,v 1.2 2013/10/20 18:17:19 joerg Exp $
+
+--- gdb/Makefile.in.orig 2006-03-13 23:43:10.000000000 +0000
++++ gdb/Makefile.in
+@@ -125,7 +125,7 @@ GDB_WERROR_CFLAGS = $(WERROR_CFLAGS)
+
+ # Where is the INTL library? Typically in ../intl.
+ INTL_DIR = ../intl
+-INTL = @INTLLIBS@
++INTL = -L${PREFIX}/lib ${COMPILER_RPATH_FLAG}${PREFIX}/lib -lintl
+ INTL_DEPS = @INTLDEPS@
+ INTL_SRC = $(srcdir)/$(INTL_DIR)
+ INTL_CFLAGS = -I$(INTL_DIR) -I$(INTL_SRC)
diff --git a/gdb6/patches/patch-bm b/gdb6/patches/patch-bm
new file mode 100644
index 0000000000..ead356421e
--- /dev/null
+++ b/gdb6/patches/patch-bm
@@ -0,0 +1,9 @@
+$NetBSD: patch-bm,v 1.1 2006/03/17 13:57:38 joerg Exp $
+
+--- gdb/config.in.orig 2006-03-17 14:49:47.000000000 +0100
++++ gdb/config.in
+@@ -552,3 +552,4 @@
+ /* Define as const if the declaration of iconv() needs const. */
+ #undef ICONV_CONST
+
++#undef HAVE_STRUCT_LWP
diff --git a/gdb6/patches/patch-bn b/gdb6/patches/patch-bn
new file mode 100644
index 0000000000..348a564dd6
--- /dev/null
+++ b/gdb6/patches/patch-bn
@@ -0,0 +1,13 @@
+$NetBSD: patch-bn,v 1.1 2006/10/22 08:06:42 rillig Exp $
+
+--- gdb/config/djgpp/djconfig.sh.orig 2003-12-29 08:35:35.000000000 +0100
++++ gdb/config/djgpp/djconfig.sh 2006-10-22 09:56:02.000000000 +0200
+@@ -89,7 +89,7 @@ TMPFILE="${TMPDIR-.}/cfg.tmp"
+
+ # We need to skip the build directory if it is a subdirectory of $srcdir,
+ # otherwise we will have an infinite recursion on our hands...
+-if test "`pwd`" == "${srcdir}" ; then
++if test "`pwd`" = "${srcdir}" ; then
+ SKIPDIR=""
+ SKIPFILES=""
+ else
diff --git a/gdb6/patches/patch-bo b/gdb6/patches/patch-bo
new file mode 100644
index 0000000000..6dc9ba9c52
--- /dev/null
+++ b/gdb6/patches/patch-bo
@@ -0,0 +1,75 @@
+$NetBSD: patch-bo,v 1.1 2007/07/03 12:32:28 lkundrak Exp $
+
+Patch for CVE-2005-1704 sucked from upstream.
+* elfcode.h (elf_object_p): Add more sanity checks on elf header.
+
+--- bfd/elfcode.h.orig 2004-06-24 06:46:22.000000000 +0200
++++ bfd/elfcode.h
+@@ -613,8 +613,13 @@ elf_object_p (bfd *abfd)
+
+ if (i_ehdrp->e_shoff != 0)
+ {
++ bfd_signed_vma where = i_ehdrp->e_shoff;
++
++ if (where != (file_ptr) where)
++ goto got_wrong_format_error;
++
+ /* Seek to the section header table in the file. */
+- if (bfd_seek (abfd, (file_ptr) i_ehdrp->e_shoff, SEEK_SET) != 0)
++ if (bfd_seek (abfd, (file_ptr) where, SEEK_SET) != 0)
+ goto got_no_match;
+
+ /* Read the first section header at index 0, and convert to internal
+@@ -626,13 +631,50 @@ elf_object_p (bfd *abfd)
+ /* If the section count is zero, the actual count is in the first
+ section header. */
+ if (i_ehdrp->e_shnum == SHN_UNDEF)
+- i_ehdrp->e_shnum = i_shdr.sh_size;
++ {
++ i_ehdrp->e_shnum = i_shdr.sh_size;
++ if (i_ehdrp->e_shnum != i_shdr.sh_size)
++ goto got_wrong_format_error;
++ }
+
+ /* And similarly for the string table index. */
+ if (i_ehdrp->e_shstrndx == SHN_XINDEX)
+- i_ehdrp->e_shstrndx = i_shdr.sh_link;
++ {
++ i_ehdrp->e_shstrndx = i_shdr.sh_link;
++ if (i_ehdrp->e_shstrndx != i_shdr.sh_link)
++ goto got_wrong_format_error;
++ }
++
++ /* Sanity check that we can read all of the section headers.
++ It ought to be good enough to just read the last one. */
++ if (i_ehdrp->e_shnum != 1)
++ {
++ /* Check that we don't have a totally silly number of sections. */
++ if (i_ehdrp->e_shnum > (unsigned int) -1 / sizeof (x_shdr))
++ goto got_wrong_format_error;
++
++ where += (i_ehdrp->e_shnum - 1) * sizeof (x_shdr);
++ if (where != (file_ptr) where)
++ goto got_wrong_format_error;
++ if ((bfd_size_type) where <= i_ehdrp->e_shoff)
++ goto got_wrong_format_error;
++
++ if (bfd_seek (abfd, (file_ptr) where, SEEK_SET) != 0)
++ goto got_no_match;
++ if (bfd_bread (&x_shdr, sizeof x_shdr, abfd) != sizeof (x_shdr))
++ goto got_no_match;
++
++ /* Back to where we were. */
++ where = i_ehdrp->e_shoff + sizeof (x_shdr);
++ if (bfd_seek (abfd, (file_ptr) where, SEEK_SET) != 0)
++ goto got_no_match;
++ }
+ }
+
++ /* A further sanity check. */
++ if (i_ehdrp->e_shstrndx >= i_ehdrp->e_shnum)
++ goto got_wrong_format_error;
++
+ /* Allocate space for a copy of the section header table in
+ internal form. */
+ if (i_ehdrp->e_shnum != 0)
diff --git a/gdb6/patches/patch-bp b/gdb6/patches/patch-bp
new file mode 100644
index 0000000000..4a2898fb28
--- /dev/null
+++ b/gdb6/patches/patch-bp
@@ -0,0 +1,15 @@
+$NetBSD: patch-bp,v 1.1 2007/07/03 12:32:28 lkundrak Exp $
+
+Patch for CVE-2005-1705 from Gentoo #88398.
+
+--- gdb/main.c.orig 2004-07-26 21:01:36.000000000 +0200
++++ gdb/main.c
+@@ -696,7 +696,7 @@ extern int gdbtk_test (char *);
+
+ if (!homedir
+ || memcmp ((char *) &homebuf, (char *) &cwdbuf, sizeof (struct stat)))
+- if (!inhibit_gdbinit)
++ if (!inhibit_gdbinit && (cwdbuf.st_uid == getuid()) && (!cwdbuf.st_mode & (S_IWOTH)))
+ {
+ catch_command_errors (source_command, gdbinit, 0, RETURN_MASK_ALL);
+ }
diff --git a/gdb6/patches/patch-br b/gdb6/patches/patch-br
new file mode 100644
index 0000000000..f66e465c29
--- /dev/null
+++ b/gdb6/patches/patch-br
@@ -0,0 +1,28 @@
+$NetBSD: patch-br,v 1.1 2009/09/09 12:50:58 wiz Exp $
+
+--- etc/Makefile.in.orig 2003-01-02 20:51:02.000000000 +0000
++++ etc/Makefile.in
+@@ -48,8 +48,8 @@ TEXIDIR = $(srcdir)/../texinfo
+ #### Host, target, and site specific Makefile fragments come in here.
+ ###
+
+-INFOFILES = standards.info configure.info
+-DVIFILES = standards.dvi configure.dvi
++INFOFILES = configure.info
++DVIFILES = configure.dvi
+
+ all:
+
+@@ -71,12 +71,6 @@ info:
+
+ install-info: info
+ $(SHELL) $(srcdir)/../mkinstalldirs $(DESTDIR)$(infodir)
+- if test ! -f standards.info; then cd $(srcdir); fi; \
+- if test -f standards.info; then \
+- for i in standards.info*; do \
+- $(INSTALL_DATA) $$i $(DESTDIR)$(infodir)/$$i; \
+- done; \
+- fi
+ if test ! -f configure.info; then cd $(srcdir); fi; \
+ if test -f configure.info; then \
+ for i in configure.info*; do \
diff --git a/gdb6/patches/patch-gdb_dwarf2read.c b/gdb6/patches/patch-gdb_dwarf2read.c
new file mode 100644
index 0000000000..6041854b68
--- /dev/null
+++ b/gdb6/patches/patch-gdb_dwarf2read.c
@@ -0,0 +1,42 @@
+$NetBSD: patch-gdb_dwarf2read.c,v 1.1 2012/11/20 23:13:04 tez Exp $
+
+Patch for CVE-2006-4146 from https://bugzilla.redhat.com/show_bug.cgi?id=204841
+
+--- gdb/dwarf2read.c.orig 2004-07-06 19:29:30.000000000 +0000
++++ gdb/dwarf2read.c
+@@ -8027,8 +8027,7 @@ dwarf2_fundamental_type (struct objfile
+ When the result is a register number, the global isreg flag is set,
+ otherwise it is cleared.
+
+- Note that stack[0] is unused except as a default error return.
+- Note that stack overflow is not yet handled. */
++ Note that stack[0] is unused except as a default error return. */
+
+ static CORE_ADDR
+ decode_locdesc (struct dwarf_block *blk, struct dwarf2_cu *cu)
+@@ -8045,7 +8044,7 @@ decode_locdesc (struct dwarf_block *blk,
+
+ i = 0;
+ stacki = 0;
+- stack[stacki] = 0;
++ stack[++stacki] = 0;
+ isreg = 0;
+
+ while (i < size)
+@@ -8227,6 +8226,16 @@ decode_locdesc (struct dwarf_block *blk,
+ dwarf_stack_op_name (op));
+ return (stack[stacki]);
+ }
++ /* Enforce maximum stack depth of size-1 to avoid ++stacki writing
++ outside of the allocated space. Also enforce minimum > 0.
++ -- wad%google.com@localhost 14 Aug 2006 */
++ if (stacki >= sizeof (stack) / sizeof (*stack) - 1)
++ internal_error (__FILE__, __LINE__,
++ _("location description stack too deep: %d"),
++ stacki);
++ if (stacki <= 0)
++ internal_error (__FILE__, __LINE__,
++ _("location description stack too shallow"));
+ }
+ return (stack[stacki]);
+ }
diff --git a/gdb6/patches/patch-gdb_dwarfread.c b/gdb6/patches/patch-gdb_dwarfread.c
new file mode 100644
index 0000000000..7fa276b02b
--- /dev/null
+++ b/gdb6/patches/patch-gdb_dwarfread.c
@@ -0,0 +1,43 @@
+$NetBSD: patch-gdb_dwarfread.c,v 1.1 2012/11/20 23:13:04 tez Exp $
+
+Patch for CVE-2006-4146 from https://bugzilla.redhat.com/show_bug.cgi?id=204841
+
+--- gdb/dwarfread.c.orig 2004-07-17 14:16:14.000000000 +0000
++++ gdb/dwarfread.c
+@@ -2137,9 +2137,7 @@ decode_line_numbers (char *linetable)
+
+ NOTES
+
+- Note that stack[0] is unused except as a default error return.
+- Note that stack overflow is not yet handled.
+- */
++ Note that stack[0] is unused except as a default error return. */
+
+ static int
+ locval (struct dieinfo *dip)
+@@ -2159,7 +2157,7 @@ locval (struct dieinfo *dip)
+ loc += nbytes;
+ end = loc + locsize;
+ stacki = 0;
+- stack[stacki] = 0;
++ stack[++stacki] = 0;
+ dip->isreg = 0;
+ dip->offreg = 0;
+ dip->optimized_out = 1;
+@@ -2223,6 +2221,16 @@ locval (struct dieinfo *dip)
+ stacki--;
+ break;
+ }
++ /* Enforce maximum stack depth of size-1 to avoid ++stacki writing
++ outside of the allocated space. Also enforce minimum > 0.
++ -- wad%google.com@localhost 14 Aug 2006 */
++ if (stacki >= sizeof (stack) / sizeof (*stack) - 1)
++ internal_error (__FILE__, __LINE__,
++ _("location description stack too deep: %d"),
++ stacki);
++ if (stacki <= 0)
++ internal_error (__FILE__, __LINE__,
++ _("location description stack too shallow"));
+ }
+ return (stack[stacki]);
+ }
Home |
Main Index |
Thread Index |
Old Index