From d0a798aabf598335b4509a10866c228c20e5c9c0 Mon Sep 17 00:00:00 2001
From: Antonio Huete Jimenez <tuxillo@quantumachine.net>
Date: Tue, 22 Dec 2015 04:20:26 -0800
Subject: [PATCH] gdb - Local mods (compile)

---
 contrib/gdb-7/amd64dfly-nat.c                      | 336 +++++++++++++++++++++
 contrib/gdb-7/amd64dfly-tdep.c                     | 176 +++++++++++
 contrib/gdb-7/gdb/amd64dfly-nat.c                  |  22 +-
 contrib/gdb-7/gdb/amd64dfly-tdep.c                 |   1 -
 contrib/gdb-7/gdb/arch-utils.c                     |   3 +-
 contrib/gdb-7/gdb/common/common-defs.h             |   4 +-
 contrib/gdb-7/gdb/common/ptid.h                    |   2 +-
 contrib/gdb-7/gdb/defs.h                           |   1 +
 contrib/gdb-7/gdb/extension.c                      |   4 -
 contrib/gdb-7/gdb/fbsd-nat.c                       |   6 +-
 contrib/gdb-7/gdb/fbsd-nat.h                       |   3 +
 .../gdb-7/gdb/gnulib/import/canonicalize-lgpl.c    |   1 -
 contrib/gdb-7/gdb/gnulib/import/malloca.h          |   1 -
 contrib/gdb-7/gdb/inferior.c                       |   4 +-
 contrib/gdb-7/gdb/main.c                           |   3 -
 contrib/gdb-7/gdb/osabi.c                          |   1 +
 contrib/gdb-7/gdb/top.c                            |   4 +-
 contrib/gdb-7/i386dfly-nat.c                       | 223 ++++++++++++++
 contrib/gdb-7/i386dfly-tdep.c                      | 103 +++++++
 gnu/usr.bin/gdb/Makefile                           |   2 +-
 gnu/usr.bin/gdb/gdb/Makefile                       |   3 +-
 gnu/usr.bin/gdb/libbfd/Makefile.x86_64             |  16 +-
 gnu/usr.bin/gdb/libgdb/Makefile                    |  40 ++-
 gnu/usr.bin/gdb/libgdb/Makefile.x86_64             |   2 +-
 gnu/usr.bin/gdb/libiberty/Makefile                 |   3 +
 25 files changed, 908 insertions(+), 56 deletions(-)
 create mode 100644 contrib/gdb-7/amd64dfly-nat.c
 create mode 100644 contrib/gdb-7/amd64dfly-tdep.c
 create mode 100644 contrib/gdb-7/i386dfly-nat.c
 create mode 100644 contrib/gdb-7/i386dfly-tdep.c

diff --git a/contrib/gdb-7/amd64dfly-nat.c b/contrib/gdb-7/amd64dfly-nat.c
new file mode 100644
index 0000000..7ff041d
--- /dev/null
+++ b/contrib/gdb-7/amd64dfly-nat.c
@@ -0,0 +1,336 @@
+/* Native-dependent code for DragonFly/amd64.
+
+   Copyright (C) 2003-2013 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 3 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, see <http://www.gnu.org/licenses/>.  */
+
+#include "defs.h"
+#include "inferior.h"
+#include "regcache.h"
+#include "target.h"
+#include "gregset.h"
+
+#include "gdb_assert.h"
+#include <signal.h>
+#include <stddef.h>
+#include <sys/types.h>
+#include <sys/procfs.h>
+#include <sys/ptrace.h>
+#include <sys/sysctl.h>
+#include <machine/reg.h>
+
+#include "fbsd-nat.h"
+#include "amd64-tdep.h"
+#include "amd64-nat.h"
+#include "amd64bsd-nat.h"
+#include "i386-nat.h"
+
+
+/* Offset in `struct reg' where MEMBER is stored.  */
+#define REG_OFFSET(member) offsetof (struct reg, member)
+
+/* At amd64dfly64_r_reg_offset[REGNUM] you'll find the offset in
+   `struct reg' location where the GDB register REGNUM is stored.
+   Unsupported registers are marked with `-1'.  */
+static int amd64dfly64_r_reg_offset[] =
+{
+  REG_OFFSET (r_rax),
+  REG_OFFSET (r_rbx),
+  REG_OFFSET (r_rcx),
+  REG_OFFSET (r_rdx),
+  REG_OFFSET (r_rsi),
+  REG_OFFSET (r_rdi),
+  REG_OFFSET (r_rbp),
+  REG_OFFSET (r_rsp),
+  REG_OFFSET (r_r8),
+  REG_OFFSET (r_r9),
+  REG_OFFSET (r_r10),
+  REG_OFFSET (r_r11),
+  REG_OFFSET (r_r12),
+  REG_OFFSET (r_r13),
+  REG_OFFSET (r_r14),
+  REG_OFFSET (r_r15),
+  REG_OFFSET (r_rip),
+  REG_OFFSET (r_rflags),
+  REG_OFFSET (r_cs),
+  REG_OFFSET (r_ss),
+  -1,
+  -1,
+  -1,
+  -1
+};
+
+
+/* Mapping between the general-purpose registers in DragonFly/amd64
+   `struct reg' format and GDB's register cache layout for
+   DragonFly/i386.
+
+   Note that most DragonFly/amd64 registers are 64-bit, while the
+   DragonFly/i386 registers are all 32-bit, but since we're
+   little-endian we get away with that.  */
+
+/* From <machine/reg.h>.  */
+static int amd64dfly32_r_reg_offset[I386_NUM_GREGS] =
+{
+  14 * 8, 13 * 8,		/* %eax, %ecx */
+  12 * 8, 11 * 8,		/* %edx, %ebx */
+  20 * 8, 10 * 8,		/* %esp, %ebp */
+  9 * 8, 8 * 8,			/* %esi, %edi */
+  17 * 8, 19 * 8,		/* %eip, %eflags */
+  18 * 8, 21 * 8,		/* %cs, %ss */
+  -1, -1, -1, -1		/* %ds, %es, %fs, %gs */
+};
+
+
+#ifdef DFLY_PCB_SUPPLY
+/* Transfering the registers between GDB, inferiors and core files.  */
+
+/* Fill GDB's register array with the general-purpose register values
+   in *GREGSETP.  */
+
+void
+supply_gregset (struct regcache *regcache, const gregset_t *gregsetp)
+{
+  amd64_supply_native_gregset (regcache, gregsetp, -1);
+}
+
+/* Fill register REGNUM (if it is a general-purpose register) in
+   *GREGSETPS with the value in GDB's register array.  If REGNUM is -1,
+   do this for all registers.  */
+
+void
+fill_gregset (const struct regcache *regcache, gdb_gregset_t *gregsetp, int regnum)
+{
+  amd64_collect_native_gregset (regcache, gregsetp, regnum);
+}
+
+/* Fill GDB's register array with the floating-point register values
+   in *FPREGSETP.  */
+
+void
+supply_fpregset (struct regcache *regcache, const fpregset_t *fpregsetp)
+{
+  amd64_supply_fxsave (regcache, -1, fpregsetp);
+}
+
+/* Fill register REGNUM (if it is a floating-point register) in
+   *FPREGSETP with the value in GDB's register array.  If REGNUM is -1,
+   do this for all registers.  */
+
+void
+fill_fpregset (const struct regcache *regcache, gdb_fpregset_t *fpregsetp, int regnum)
+{
+  amd64_collect_fxsave (regcache, regnum, fpregsetp);
+}
+
+/* Support for debugging kernel virtual memory images.  */
+
+#include <sys/types.h>
+#include <machine/pcb.h>
+#include <osreldate.h>
+
+#include "bsd-kvm.h"
+
+static int
+amd64dfly_supply_pcb (struct regcache *regcache, struct pcb *pcb)
+{
+  /* The following is true for FreeBSD 5.2:
+
+     The pcb contains %rip, %rbx, %rsp, %rbp, %r12, %r13, %r14, %r15,
+     %ds, %es, %fs and %gs.  This accounts for all callee-saved
+     registers specified by the psABI and then some.  Here %esp
+     contains the stack pointer at the point just after the call to
+     cpu_switch().  From this information we reconstruct the register
+     state as it would like when we just returned from cpu_switch().  */
+
+  /* The stack pointer shouldn't be zero.  */
+  if (pcb->pcb_rsp == 0)
+    return 0;
+
+  pcb->pcb_rsp += 8;
+  regcache_raw_supply (regcache, AMD64_RIP_REGNUM, &pcb->pcb_rip);
+  regcache_raw_supply (regcache, AMD64_RBX_REGNUM, &pcb->pcb_rbx);
+  regcache_raw_supply (regcache, AMD64_RSP_REGNUM, &pcb->pcb_rsp);
+  regcache_raw_supply (regcache, AMD64_RBP_REGNUM, &pcb->pcb_rbp);
+  regcache_raw_supply (regcache, 12, &pcb->pcb_r12);
+  regcache_raw_supply (regcache, 13, &pcb->pcb_r13);
+  regcache_raw_supply (regcache, 14, &pcb->pcb_r14);
+  regcache_raw_supply (regcache, 15, &pcb->pcb_r15);
+#if (__FreeBSD_version < 800075) && (__FreeBSD_kernel_version < 800075)
+  /* struct pcb provides the pcb_ds/pcb_es/pcb_fs/pcb_gs fields only
+     up until __FreeBSD_version 800074: The removal of these fields
+     occurred on 2009-04-01 while the __FreeBSD_version number was
+     bumped to 800075 on 2009-04-06.  So 800075 is the closest version
+     number where we should not try to access these fields.  */
+  regcache_raw_supply (regcache, AMD64_DS_REGNUM, &pcb->pcb_ds);
+  regcache_raw_supply (regcache, AMD64_ES_REGNUM, &pcb->pcb_es);
+  regcache_raw_supply (regcache, AMD64_FS_REGNUM, &pcb->pcb_fs);
+  regcache_raw_supply (regcache, AMD64_GS_REGNUM, &pcb->pcb_gs);
+#endif
+
+  return 1;
+}
+#endif /* DFLY_PCB_SUPPLY */
+
+
+static void (*super_mourn_inferior) (struct target_ops *ops);
+
+/* Work around vkernels not having PT_{GET,SET}DBREGS via ptrace(2) support. */
+static int
+is_vkernel(void)
+{
+	size_t len;
+	char buf[64];
+
+	len = sizeof(buf);
+	if (sysctlbyname("kern.vmm_guest", buf, &len, NULL, 0) < 0)
+		return 0;
+	if (strncmp("vkernel", buf, len) == 0)
+		return 1;
+	else
+		return 0;
+}
+
+static void
+amd64dfly_mourn_inferior (struct target_ops *ops)
+{
+#ifdef HAVE_PT_GETDBREGS
+  if (!is_vkernel())
+  i386_cleanup_dregs ();
+#endif
+  super_mourn_inferior (ops);
+}
+
+/* Provide a prototype to silence -Wmissing-prototypes.  */
+void _initialize_amd64dfly_nat (void);
+
+void
+_initialize_amd64dfly_nat (void)
+{
+  struct target_ops *t;
+  int offset;
+
+  amd64_native_gregset32_reg_offset = amd64dfly32_r_reg_offset;
+  amd64_native_gregset64_reg_offset = amd64dfly64_r_reg_offset;
+
+  /* Add some extra features to the common *BSD/i386 target.  */
+  t = amd64bsd_target ();
+
+#ifdef HAVE_PT_GETDBREGS
+
+  if (!is_vkernel()) {
+  i386_use_watchpoints (t);
+
+  i386_dr_low.set_control = amd64bsd_dr_set_control;
+  i386_dr_low.set_addr = amd64bsd_dr_set_addr;
+  i386_dr_low.get_addr = amd64bsd_dr_get_addr;
+  i386_dr_low.get_status = amd64bsd_dr_get_status;
+  i386_dr_low.get_control = amd64bsd_dr_get_control;
+  i386_set_debug_register_length (8);
+  }
+
+#endif /* HAVE_PT_GETDBREGS */
+
+  super_mourn_inferior = t->to_mourn_inferior;
+  t->to_mourn_inferior = amd64dfly_mourn_inferior;
+
+  t->to_pid_to_exec_file = fbsd_pid_to_exec_file;
+  t->to_find_memory_regions = fbsd_find_memory_regions;
+  t->to_make_corefile_notes = fbsd_make_corefile_notes;
+  add_target (t);
+
+#ifdef DFLY_PCB_SUPPLY
+  /* Support debugging kernel virtual memory images.  */
+  bsd_kvm_add_target (amd64dfly_supply_pcb);
+#endif
+
+  /* To support the recognition of signal handlers, i386bsd-tdep.c
+     hardcodes some constants.  Inclusion of this file means that we
+     are compiling a native debugger, which means that we can use the
+     system header files and sysctl(3) to get at the relevant
+     information.  */
+
+#define SC_REG_OFFSET amd64dfly_sc_reg_offset
+
+  /* We only check the program counter, stack pointer and frame
+     pointer since these members of `struct sigcontext' are essential
+     for providing backtraces.  */
+
+#define SC_RIP_OFFSET SC_REG_OFFSET[AMD64_RIP_REGNUM]
+#define SC_RSP_OFFSET SC_REG_OFFSET[AMD64_RSP_REGNUM]
+#define SC_RBP_OFFSET SC_REG_OFFSET[AMD64_RBP_REGNUM]
+
+  /* Override the default value for the offset of the program counter
+     in the sigcontext structure.  */
+  offset = offsetof (struct sigcontext, sc_rip);
+
+  if (SC_RIP_OFFSET != offset)
+    {
+      warning (_("\
+offsetof (struct sigcontext, sc_rip) yields %d instead of %d.\n\
+Please report this to <bug-gdb@gnu.org>."),
+	       offset, SC_RIP_OFFSET);
+    }
+
+  SC_RIP_OFFSET = offset;
+
+  /* Likewise for the stack pointer.  */
+  offset = offsetof (struct sigcontext, sc_rsp);
+
+  if (SC_RSP_OFFSET != offset)
+    {
+      warning (_("\
+offsetof (struct sigcontext, sc_rsp) yields %d instead of %d.\n\
+Please report this to <bug-gdb@gnu.org>."),
+	       offset, SC_RSP_OFFSET);
+    }
+
+  SC_RSP_OFFSET = offset;
+
+  /* And the frame pointer.  */
+  offset = offsetof (struct sigcontext, sc_rbp);
+
+  if (SC_RBP_OFFSET != offset)
+    {
+      warning (_("\
+offsetof (struct sigcontext, sc_rbp) yields %d instead of %d.\n\
+Please report this to <bug-gdb@gnu.org>."),
+	       offset, SC_RBP_OFFSET);
+    }
+
+  SC_RBP_OFFSET = offset;
+
+  /* DragonFly provides a kern.ps_strings sysctl that we can use to
+     locate the sigtramp.  That way we can still recognize a sigtramp
+     if its location is changed in a new kernel.  Of course this is
+     still based on the assumption that the sigtramp is placed
+     directly under the location where the program arguments and
+     environment can be found.  */
+  {
+    int mib[2];
+    long ps_strings;
+    size_t len;
+
+    mib[0] = CTL_KERN;
+    mib[1] = KERN_PS_STRINGS;
+    len = sizeof (ps_strings);
+    if (sysctl (mib, 2, &ps_strings, &len, NULL, 0) == 0)
+      {
+	amd64dfly_sigtramp_start_addr = ps_strings - 32;
+	amd64dfly_sigtramp_end_addr = ps_strings;
+      }
+  }
+}
diff --git a/contrib/gdb-7/amd64dfly-tdep.c b/contrib/gdb-7/amd64dfly-tdep.c
new file mode 100644
index 0000000..1f59876
--- /dev/null
+++ b/contrib/gdb-7/amd64dfly-tdep.c
@@ -0,0 +1,176 @@
+/* Target-dependent code for DragonFly/amd64.
+
+   Copyright (C) 2003-2013 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 3 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, see <http://www.gnu.org/licenses/>.  */
+
+#include "defs.h"
+#include "arch-utils.h"
+#include "frame.h"
+#include "gdbcore.h"
+#include "regcache.h"
+#include "osabi.h"
+
+#include "gdb_assert.h"
+#include "gdb_string.h"
+
+#include "amd64-tdep.h"
+#include "solib-svr4.h"
+
+/* Support for signal handlers.  */
+
+/* Assuming THIS_FRAME is for a BSD sigtramp routine, return the
+   address of the associated sigcontext structure.  */
+
+static CORE_ADDR
+amd64dfly_sigcontext_addr (struct frame_info *this_frame)
+{
+  struct gdbarch *gdbarch = get_frame_arch (this_frame);
+  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+  CORE_ADDR sp;
+  gdb_byte buf[8];
+
+  /* The `struct sigcontext' (which really is an `ucontext_t' on
+     DragonFly/amd64) lives at a fixed offset in the signal frame.  See
+     <machine/sigframe.h>.  */
+  get_frame_register (this_frame, AMD64_RSP_REGNUM, buf);
+  sp = extract_unsigned_integer (buf, 8, byte_order);
+  return sp + 16;
+}
+
+/* Mapping between the general-purpose registers in `struct reg'
+   format and GDB's register cache layout.
+
+   Note that some registers are 32-bit, but since we're little-endian
+   we get away with that.  */
+
+/* From <machine/reg.h>.  */
+static int amd64dfly_r_reg_offset[] =
+{
+  6 * 8,			/* %rax */
+  7 * 8,			/* %rbx */
+  3 * 8,			/* %rcx */
+  2 * 8,			/* %rdx */
+  1 * 8,			/* %rsi */
+  0 * 8,			/* %rdi */
+  8 * 8,			/* %rbp */
+  23 * 8,			/* %rsp */
+  4 * 8,			/* %r8 ... */
+  5 * 8,
+  9 * 8,
+  10 * 8,
+  11 * 8,
+  12 * 8,
+  13 * 8,
+  14 * 8,			/* ... %r15 */
+  20 * 8,			/* %rip */
+  22 * 8,			/* %eflags */
+  21 * 8,			/* %cs */
+  24 * 8,			/* %ss */
+  -1,				/* %ds */
+  -1,				/* %es */
+  -1,				/* %fs */
+  -1				/* %gs */
+};
+
+/* Location of the signal trampoline.  */
+CORE_ADDR amd64dfly_sigtramp_start_addr = 0x7fffffffffc0ULL;
+CORE_ADDR amd64dfly_sigtramp_end_addr = 0x7fffffffffe0ULL;
+
+/* From <machine/signal.h>.  */
+int amd64dfly_sc_reg_offset[] =
+{
+  24 + 6 * 8,			/* %rax */
+  24 + 7 * 8,			/* %rbx */
+  24 + 3 * 8,			/* %rcx */
+  24 + 2 * 8,			/* %rdx */
+  24 + 1 * 8,			/* %rsi */
+  24 + 0 * 8,			/* %rdi */
+  24 + 8 * 8,			/* %rbp */
+  24 + 23 * 8,			/* %rsp */
+  24 + 4 * 8,			/* %r8 ... */
+  24 + 5 * 8,
+  24 + 9 * 8,
+  24 + 10 * 8,
+  24 + 11 * 8,
+  24 + 12 * 8,
+  24 + 13 * 8,
+  24 + 14 * 8,			/* ... %r15 */
+  24 + 20 * 8,			/* %rip */
+  24 + 22 * 8,			/* %eflags */
+  24 + 21 * 8,			/* %cs */
+  24 + 24 * 8,			/* %ss */
+  -1,				/* %ds */
+  -1,				/* %es */
+  -1,				/* %fs */
+  -1				/* %gs */
+};
+
+/* From /usr/src/lib/libc/amd64/gen/_setjmp.S.  */
+static int amd64dfly_jmp_buf_reg_offset[] =
+{
+  -1,				/* %rax */
+  1 * 8,			/* %rbx */
+  -1,				/* %rcx */
+  -1,				/* %rdx */
+  -1,				/* %rsi */
+  -1,				/* %rdi */
+  3 * 8,			/* %rbp */
+  2 * 8,			/* %rsp */
+  -1,				/* %r8 ... */
+  -1,
+  -1,
+  -1,				/* ... %r11 */
+  4 * 8,			/* %r12 ... */
+  5 * 8,
+  6 * 8,
+  7 * 8,			/* ... %r15 */
+  0 * 8				/* %rip */
+};
+
+static void
+amd64dfly_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+  i386bsd_init_abi (info, gdbarch);
+
+  tdep->gregset_reg_offset = amd64dfly_r_reg_offset;
+  tdep->gregset_num_regs = ARRAY_SIZE (amd64dfly_r_reg_offset);
+  tdep->sizeof_gregset = 25 * 8;
+
+  amd64_init_abi (info, gdbarch);
+
+  tdep->sigtramp_start = amd64dfly_sigtramp_start_addr;
+  tdep->sigtramp_end = amd64dfly_sigtramp_end_addr;
+  tdep->sigcontext_addr = amd64dfly_sigcontext_addr;
+  tdep->sc_reg_offset = amd64dfly_sc_reg_offset;
+  tdep->sc_num_regs = ARRAY_SIZE (amd64dfly_sc_reg_offset);
+
+  set_solib_svr4_fetch_link_map_offsets
+    (gdbarch, svr4_lp64_fetch_link_map_offsets);
+}
+
+
+/* Provide a prototype to silence -Wmissing-prototypes.  */
+void _initialize_amd64dfly_tdep (void);
+
+void
+_initialize_amd64dfly_tdep (void)
+{
+  gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
+			  GDB_OSABI_DRAGONFLY, amd64dfly_init_abi);
+}
diff --git a/contrib/gdb-7/gdb/amd64dfly-nat.c b/contrib/gdb-7/gdb/amd64dfly-nat.c
index 7ff041d..c44f242 100644
--- a/contrib/gdb-7/gdb/amd64dfly-nat.c
+++ b/contrib/gdb-7/gdb/amd64dfly-nat.c
@@ -36,7 +36,7 @@
 #include "amd64-tdep.h"
 #include "amd64-nat.h"
 #include "amd64bsd-nat.h"
-#include "i386-nat.h"
+#include "x86-nat.h"
 
 
 /* Offset in `struct reg' where MEMBER is stored.  */
@@ -209,7 +209,7 @@ amd64dfly_mourn_inferior (struct target_ops *ops)
 {
 #ifdef HAVE_PT_GETDBREGS
   if (!is_vkernel())
-  i386_cleanup_dregs ();
+  x86_cleanup_dregs ();
 #endif
   super_mourn_inferior (ops);
 }
@@ -232,14 +232,14 @@ _initialize_amd64dfly_nat (void)
 #ifdef HAVE_PT_GETDBREGS
 
   if (!is_vkernel()) {
-  i386_use_watchpoints (t);
-
-  i386_dr_low.set_control = amd64bsd_dr_set_control;
-  i386_dr_low.set_addr = amd64bsd_dr_set_addr;
-  i386_dr_low.get_addr = amd64bsd_dr_get_addr;
-  i386_dr_low.get_status = amd64bsd_dr_get_status;
-  i386_dr_low.get_control = amd64bsd_dr_get_control;
-  i386_set_debug_register_length (8);
+  x86_use_watchpoints (t);
+
+  x86_dr_low.set_control = amd64bsd_dr_set_control;
+  x86_dr_low.set_addr = amd64bsd_dr_set_addr;
+  x86_dr_low.get_addr = amd64bsd_dr_get_addr;
+  x86_dr_low.get_status = amd64bsd_dr_get_status;
+  x86_dr_low.get_control = amd64bsd_dr_get_control;
+  x86_set_debug_register_length (8);
   }
 
 #endif /* HAVE_PT_GETDBREGS */
@@ -249,7 +249,7 @@ _initialize_amd64dfly_nat (void)
 
   t->to_pid_to_exec_file = fbsd_pid_to_exec_file;
   t->to_find_memory_regions = fbsd_find_memory_regions;
-  t->to_make_corefile_notes = fbsd_make_corefile_notes;
+  //t->to_make_corefile_notes = fbsd_make_corefile_notes;
   add_target (t);
 
 #ifdef DFLY_PCB_SUPPLY
diff --git a/contrib/gdb-7/gdb/amd64dfly-tdep.c b/contrib/gdb-7/gdb/amd64dfly-tdep.c
index 1f59876..f3a57e8 100644
--- a/contrib/gdb-7/gdb/amd64dfly-tdep.c
+++ b/contrib/gdb-7/gdb/amd64dfly-tdep.c
@@ -25,7 +25,6 @@
 #include "osabi.h"
 
 #include "gdb_assert.h"
-#include "gdb_string.h"
 
 #include "amd64-tdep.h"
 #include "solib-svr4.h"
diff --git a/contrib/gdb-7/gdb/arch-utils.c b/contrib/gdb-7/gdb/arch-utils.c
index e9c622d..f5b7163 100644
--- a/contrib/gdb-7/gdb/arch-utils.c
+++ b/contrib/gdb-7/gdb/arch-utils.c
@@ -33,11 +33,10 @@
 #include "language.h"
 #include "symtab.h"
 
-#include "version.h"
+#include "common/version.h"
 
 #include "floatformat.h"
 
-
 struct displaced_step_closure *
 simple_displaced_step_copy_insn (struct gdbarch *gdbarch,
                                  CORE_ADDR from, CORE_ADDR to,
diff --git a/contrib/gdb-7/gdb/common/common-defs.h b/contrib/gdb-7/gdb/common/common-defs.h
index 2be0d7d..4860e27 100644
--- a/contrib/gdb-7/gdb/common/common-defs.h
+++ b/contrib/gdb-7/gdb/common/common-defs.h
@@ -24,7 +24,7 @@
 #ifdef GDBSERVER
 #include "build-gnulib-gdbserver/config.h"
 #else
-#include "build-gnulib/config.h"
+#include "libgnu/config.h"
 #endif
 
 #include <stdarg.h>
@@ -34,10 +34,8 @@
 #include <stdint.h>
 #include <string.h>
 #include <errno.h>
-#include <alloca.h>
 #include "ansidecl.h"
 #include "libiberty.h"
-#include "pathmax.h"
 #include "gdb/signals.h"
 #include "gdb_locale.h"
 #include "ptid.h"
diff --git a/contrib/gdb-7/gdb/common/ptid.h b/contrib/gdb-7/gdb/common/ptid.h
index a21d2d4..2b9ebae 100644
--- a/contrib/gdb-7/gdb/common/ptid.h
+++ b/contrib/gdb-7/gdb/common/ptid.h
@@ -41,7 +41,7 @@ struct ptid
   long lwp;
 
   /* Thread id.  */
-  long tid;
+  unsigned long tid;
 };
 
 typedef struct ptid ptid_t;
diff --git a/contrib/gdb-7/gdb/defs.h b/contrib/gdb-7/gdb/defs.h
index 0bd8304..21a676b 100644
--- a/contrib/gdb-7/gdb/defs.h
+++ b/contrib/gdb-7/gdb/defs.h
@@ -25,6 +25,7 @@
 #  error gdbserver should not include gdb/defs.h
 #endif
 
+#include "config.h"            /* Generated by configure.  */
 #include "common-defs.h"
 
 #include <sys/types.h>
diff --git a/contrib/gdb-7/gdb/extension.c b/contrib/gdb-7/gdb/extension.c
index dac203b..f476b8c 100644
--- a/contrib/gdb-7/gdb/extension.c
+++ b/contrib/gdb-7/gdb/extension.c
@@ -29,8 +29,6 @@
 #include "extension-priv.h"
 #include "observer.h"
 #include "cli/cli-script.h"
-#include "python/python.h"
-#include "guile/guile.h"
 
 /* Iterate over all external extension languages, regardless of whether the
    support has been compiled in or not.
@@ -101,8 +99,6 @@ const struct extension_language_defn extension_language_gdb =
 static const struct extension_language_defn * const extension_languages[] =
 {
   /* To preserve existing behaviour, python should always appear first.  */
-  &extension_language_python,
-  &extension_language_guile,
   NULL
 };
 
diff --git a/contrib/gdb-7/gdb/fbsd-nat.c b/contrib/gdb-7/gdb/fbsd-nat.c
index 9705d45..5754793 100644
--- a/contrib/gdb-7/gdb/fbsd-nat.c
+++ b/contrib/gdb-7/gdb/fbsd-nat.c
@@ -39,7 +39,7 @@
 /* Return the name of a file that can be opened to get the symbols for
    the child process identified by PID.  */
 
-static char *
+char *
 fbsd_pid_to_exec_file (struct target_ops *self, int pid)
 {
   ssize_t len = PATH_MAX;
@@ -73,7 +73,7 @@ fbsd_pid_to_exec_file (struct target_ops *self, int pid)
    calling FUNC for each memory region.  OBFD is passed as the last
    argument to FUNC.  */
 
-static int
+int
 fbsd_find_memory_regions (struct target_ops *self,
 			  find_memory_region_ftype func, void *obfd)
 {
@@ -151,7 +151,7 @@ fbsd_read_mapping (FILE *mapfile, unsigned long *start, unsigned long *end,
    calling FUNC for each memory region.  OBFD is passed as the last
    argument to FUNC.  */
 
-static int
+int
 fbsd_find_memory_regions (struct target_ops *self,
 			  find_memory_region_ftype func, void *obfd)
 {
diff --git a/contrib/gdb-7/gdb/fbsd-nat.h b/contrib/gdb-7/gdb/fbsd-nat.h
index 03f6bb1..f25a6ed 100644
--- a/contrib/gdb-7/gdb/fbsd-nat.h
+++ b/contrib/gdb-7/gdb/fbsd-nat.h
@@ -23,5 +23,8 @@
 /* Register the customized FreeBSD target.  This should be used
    instead of calling add_target directly.  */
 extern void fbsd_nat_add_target (struct target_ops *);
+extern char *fbsd_pid_to_exec_file (struct target_ops *, int);
+extern int fbsd_find_memory_regions (struct target_ops *,
+    find_memory_region_ftype, void *);
 
 #endif /* fbsd-nat.h */
diff --git a/contrib/gdb-7/gdb/gnulib/import/canonicalize-lgpl.c b/contrib/gdb-7/gdb/gnulib/import/canonicalize-lgpl.c
index 6d26fa6..70e73a1 100644
--- a/contrib/gdb-7/gdb/gnulib/import/canonicalize-lgpl.c
+++ b/contrib/gdb-7/gdb/gnulib/import/canonicalize-lgpl.c
@@ -29,7 +29,6 @@
 /* Specification.  */
 #include <stdlib.h>
 
-#include <alloca.h>
 #include <string.h>
 #include <unistd.h>
 #include <limits.h>
diff --git a/contrib/gdb-7/gdb/gnulib/import/malloca.h b/contrib/gdb-7/gdb/gnulib/import/malloca.h
index f06e9e7..fea61ce 100644
--- a/contrib/gdb-7/gdb/gnulib/import/malloca.h
+++ b/contrib/gdb-7/gdb/gnulib/import/malloca.h
@@ -18,7 +18,6 @@
 #ifndef _MALLOCA_H
 #define _MALLOCA_H
 
-#include <alloca.h>
 #include <stddef.h>
 #include <stdlib.h>
 
diff --git a/contrib/gdb-7/gdb/inferior.c b/contrib/gdb-7/gdb/inferior.c
index a808664..525036e 100644
--- a/contrib/gdb-7/gdb/inferior.c
+++ b/contrib/gdb-7/gdb/inferior.c
@@ -358,8 +358,6 @@ find_inferior_pid (int pid)
   /* Looking for inferior pid == 0 is always wrong, and indicative of
      a bug somewhere else.  There may be more than one with pid == 0,
      for instance.  */
-  gdb_assert (kernel_debugger || pid != 0);
-
   for (inf = inferior_list; inf; inf = inf->next)
     if (inf->pid == pid)
       return inf;
@@ -536,7 +534,7 @@ number_of_inferiors (void)
 static char *
 inferior_pid_to_str (int pid)
 {
-  if (kernel_debugger || pid != 0)
+  if (pid != 0)
     return target_pid_to_str (pid_to_ptid (pid));
   else
     return _("<null>");
diff --git a/contrib/gdb-7/gdb/main.c b/contrib/gdb-7/gdb/main.c
index 5fec25c..ca8923a 100644
--- a/contrib/gdb-7/gdb/main.c
+++ b/contrib/gdb-7/gdb/main.c
@@ -711,9 +711,6 @@ captured_main (void *data)
 	    error (_("%s: TUI mode is not supported"), gdb_program_name);
 #endif
 	    break;
-	  case OPT_KGDB:
-	    kernel_debugger = 1;
-	    break;
 	  case OPT_WINDOWS:
 	    /* FIXME: cagney/2003-03-01: Not sure if this option is
                actually useful, and if it is, what it should do.  */
diff --git a/contrib/gdb-7/gdb/osabi.c b/contrib/gdb-7/gdb/osabi.c
index 731ade8..09978ea 100644
--- a/contrib/gdb-7/gdb/osabi.c
+++ b/contrib/gdb-7/gdb/osabi.c
@@ -69,6 +69,7 @@ static const struct osabi_names gdb_osabi_names[] =
   { "NetBSD a.out", NULL },
   { "NetBSD ELF", NULL },
   { "OpenBSD ELF", NULL },
+  { "DragonFly", NULL },
   { "Windows CE", NULL },
   { "DJGPP", NULL },
   { "Irix", NULL },
diff --git a/contrib/gdb-7/gdb/top.c b/contrib/gdb-7/gdb/top.c
index 01fddd2..7a00222 100644
--- a/contrib/gdb-7/gdb/top.c
+++ b/contrib/gdb-7/gdb/top.c
@@ -38,7 +38,7 @@
 #include "annotate.h"
 #include "completer.h"
 #include "top.h"
-#include "version.h"
+#include "common/version.h"
 #include "serial.h"
 #include "doublest.h"
 #include "main.h"
@@ -81,7 +81,7 @@ extern void initialize_all_files (void);
 
 /* Initialization file name for gdb.  This is host-dependent.  */
 
-const char gdbinit[] = GDBINIT;
+const char gdbinit[] = ".gdbinit";
 
 int inhibit_gdbinit = 0;
 
diff --git a/contrib/gdb-7/i386dfly-nat.c b/contrib/gdb-7/i386dfly-nat.c
new file mode 100644
index 0000000..cd12d1d
--- /dev/null
+++ b/contrib/gdb-7/i386dfly-nat.c
@@ -0,0 +1,223 @@
+/* Native-dependent code for DragonFly/i386.
+
+   Copyright (C) 2001-2013 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 3 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, see <http://www.gnu.org/licenses/>.  */
+
+#include "defs.h"
+#include "inferior.h"
+#include "regcache.h"
+#include "target.h"
+#include "gregset.h"
+
+#include <sys/types.h>
+#include <sys/procfs.h>
+#include <sys/ptrace.h>
+#include <sys/sysctl.h>
+
+#include "fbsd-nat.h"
+#include "i386-tdep.h"
+#include "i386-nat.h"
+#include "i386bsd-nat.h"
+
+#ifdef DFLY_PCB_SUPPLY
+/* Resume execution of the inferior process.  If STEP is nonzero,
+   single-step it.  If SIGNAL is nonzero, give it that signal.  */
+
+static void
+i386dfly_resume (struct target_ops *ops,
+		 ptid_t ptid, int step, enum gdb_signal signal)
+{
+  pid_t pid = ptid_get_pid (ptid);
+  int request = PT_STEP;
+
+  if (pid == -1)
+    /* Resume all threads.  This only gets used in the non-threaded
+       case, where "resume all threads" and "resume inferior_ptid" are
+       the same.  */
+    pid = ptid_get_pid (inferior_ptid);
+
+  if (!step)
+    {
+      struct regcache *regcache = get_current_regcache ();
+      ULONGEST eflags;
+
+      /* Workaround for a bug in FreeBSD.  Make sure that the trace
+ 	 flag is off when doing a continue.  There is a code path
+ 	 through the kernel which leaves the flag set when it should
+ 	 have been cleared.  If a process has a signal pending (such
+ 	 as SIGALRM) and we do a PT_STEP, the process never really has
+ 	 a chance to run because the kernel needs to notify the
+ 	 debugger that a signal is being sent.  Therefore, the process
+ 	 never goes through the kernel's trap() function which would
+ 	 normally clear it.  */
+
+      regcache_cooked_read_unsigned (regcache, I386_EFLAGS_REGNUM,
+				     &eflags);
+      if (eflags & 0x0100)
+	regcache_cooked_write_unsigned (regcache, I386_EFLAGS_REGNUM,
+					eflags & ~0x0100);
+
+      request = PT_CONTINUE;
+    }
+
+  /* An addres of (caddr_t) 1 tells ptrace to continue from where it
+     was.  (If GDB wanted it to start some other way, we have already
+     written a new PC value to the child.)  */
+  if (ptrace (request, pid, (caddr_t) 1,
+	      gdb_signal_to_host (signal)) == -1)
+    perror_with_name (("ptrace"));
+}
+
+
+/* Transfering the registers between GDB, inferiors and core files.  */
+
+/* Fill GDB's register array with the general-purpose register values
+   in *GREGSETP.  */
+
+void
+supply_gregset (struct regcache *regcache, const gregset_t *gregsetp)
+{
+  i386bsd_supply_gregset (regcache, gregsetp);
+}
+
+/* Fill register REGNUM (if it is a general-purpose register) in
+   *GREGSETPS with the value in GDB's register array.  If REGNUM is -1,
+   do this for all registers.  */
+
+void
+fill_gregset (const struct regcache *regcache, gdb_gregset_t *gregsetp, int regnum)
+{
+  i386bsd_collect_gregset (regcache, gregsetp, regnum);
+}
+
+#include "i387-tdep.h"
+
+/* Fill GDB's register array with the floating-point register values
+   in *FPREGSETP.  */
+
+void
+supply_fpregset (struct regcache *regcache, const fpregset_t *fpregsetp)
+{
+  i387_supply_fsave (regcache, -1, fpregsetp);
+}
+
+/* Fill register REGNUM (if it is a floating-point register) in
+   *FPREGSETP with the value in GDB's register array.  If REGNUM is -1,
+   do this for all registers.  */
+
+void
+fill_fpregset (const struct regcache *regcache, gdb_fpregset_t *fpregsetp, int regnum)
+{
+  i387_collect_fsave (regcache, regnum, fpregsetp);
+}
+
+
+/* Support for debugging kernel virtual memory images.  */
+
+#include <sys/types.h>
+#include <machine/pcb.h>
+
+#include "bsd-kvm.h"
+
+static int
+i386dfly_supply_pcb (struct regcache *regcache, struct pcb *pcb)
+{
+  /* The following is true for FreeBSD 4.7:
+
+     The pcb contains %eip, %ebx, %esp, %ebp, %esi, %edi and %gs.
+     This accounts for all callee-saved registers specified by the
+     psABI and then some.  Here %esp contains the stack pointer at the
+     point just after the call to cpu_switch().  From this information
+     we reconstruct the register state as it would look when we just
+     returned from cpu_switch().  */
+
+  /* The stack pointer shouldn't be zero.  */
+  if (pcb->pcb_esp == 0)
+    return 0;
+
+  pcb->pcb_esp += 4;
+  regcache_raw_supply (regcache, I386_EDI_REGNUM, &pcb->pcb_edi);
+  regcache_raw_supply (regcache, I386_ESI_REGNUM, &pcb->pcb_esi);
+  regcache_raw_supply (regcache, I386_EBP_REGNUM, &pcb->pcb_ebp);
+  regcache_raw_supply (regcache, I386_ESP_REGNUM, &pcb->pcb_esp);
+  regcache_raw_supply (regcache, I386_EBX_REGNUM, &pcb->pcb_ebx);
+  regcache_raw_supply (regcache, I386_EIP_REGNUM, &pcb->pcb_eip);
+  regcache_raw_supply (regcache, I386_GS_REGNUM, &pcb->pcb_gs);
+
+  return 1;
+}
+#endif /* DFLY_PCB_SUPPLY */
+
+
+/* Prevent warning from -Wmissing-prototypes.  */
+void _initialize_i386dfly_nat (void);
+
+void
+_initialize_i386dfly_nat (void)
+{
+  struct target_ops *t;
+
+  /* Add some extra features to the common *BSD/i386 target.  */
+  t = i386bsd_target ();
+
+#ifdef HAVE_PT_GETDBREGS
+
+  i386_use_watchpoints (t);
+
+  i386_dr_low.set_control = i386bsd_dr_set_control;
+  i386_dr_low.set_addr = i386bsd_dr_set_addr;
+  i386_dr_low.get_addr = i386bsd_dr_get_addr;
+  i386_dr_low.get_status = i386bsd_dr_get_status;
+  i386_dr_low.get_control = i386bsd_dr_get_control;
+  i386_set_debug_register_length (4);
+
+#endif /* HAVE_PT_GETDBREGS */
+
+
+  t->to_pid_to_exec_file = fbsd_pid_to_exec_file;
+  t->to_find_memory_regions = fbsd_find_memory_regions;
+  t->to_make_corefile_notes = fbsd_make_corefile_notes;
+  add_target (t);
+
+#ifdef DFLY_PCB_SUPPLY
+  /* Support debugging kernel virtual memory images.  */
+  bsd_kvm_add_target (i386dfly_supply_pcb);
+#endif
+
+  /* DragonFly provides a kern.ps_strings sysctl that we can use to
+     locate the sigtramp.  That way we can still recognize a sigtramp
+     if its location is changed in a new kernel.  Of course this is
+     still based on the assumption that the sigtramp is placed
+     directly under the location where the program arguments and
+     environment can be found.  */
+#ifdef KERN_PS_STRINGS
+  {
+    int mib[2];
+    u_long ps_strings;
+    size_t len;
+
+    mib[0] = CTL_KERN;
+    mib[1] = KERN_PS_STRINGS;
+    len = sizeof (ps_strings);
+    if (sysctl (mib, 2, &ps_strings, &len, NULL, 0) == 0)
+      {
+	i386dfly_sigtramp_start_addr = ps_strings - 128;
+	i386dfly_sigtramp_end_addr = ps_strings;
+      }
+  }
+#endif
+}
diff --git a/contrib/gdb-7/i386dfly-tdep.c b/contrib/gdb-7/i386dfly-tdep.c
new file mode 100644
index 0000000..0830c60
--- /dev/null
+++ b/contrib/gdb-7/i386dfly-tdep.c
@@ -0,0 +1,103 @@
+/* Target-dependent code for DragonFly/i386.
+
+   Copyright (C) 2003-2013 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 3 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, see <http://www.gnu.org/licenses/>.  */
+
+#include "defs.h"
+#include "arch-utils.h"
+#include "gdbcore.h"
+#include "osabi.h"
+#include "regcache.h"
+
+#include "gdb_assert.h"
+
+#include "i386-tdep.h"
+#include "i387-tdep.h"
+#include "solib-svr4.h"
+
+static int i386dfly_r_reg_offset[] =
+{
+  44, /* %eax */
+  40, /* %ecx */
+  36, /* %edx */
+  32, /* %ebx */
+  72, /* %esp */
+  24, /* %ebp */
+  20, /* %esi */
+  16, /* %edi */
+  60, /* %eip */
+  68, /* %eflags */
+  64, /* %cs */
+  76, /* %ss */
+  12, /* %ds */
+  8, /* %es */
+  4, /* %fs */
+  0  /* %gs */
+};
+
+/* Sigtramp routine location.  */
+CORE_ADDR i386dfly_sigtramp_start_addr = 0xbfbfdf20;
+CORE_ADDR i386dfly_sigtramp_end_addr = 0xbfbfdff0;
+
+int i386dfly_sc_reg_offset[] =
+{
+  64, /* %eax */
+  60, /* %ecx */
+  56, /* %edx */
+  52, /* %ebx */
+  92, /* %esp */
+  44, /* %ebp */
+  40, /* %esi */
+  36, /* %edi */
+  80, /* %eip */
+  88, /* %eflags */
+  84, /* %cs */
+  96, /* %ss */
+  32, /* %ds */
+  28, /* %es */
+  24, /* %fs */
+  20  /* %gs */
+};
+
+static void
+i386dfly_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
+
+  i386_elf_init_abi(info, gdbarch);
+
+  tdep->gregset_reg_offset = i386dfly_r_reg_offset;
+  tdep->gregset_num_regs = ARRAY_SIZE (i386dfly_r_reg_offset);
+  tdep->sizeof_gregset = 80;
+
+  tdep->sc_reg_offset = i386dfly_sc_reg_offset;
+  tdep->sc_num_regs = ARRAY_SIZE (i386dfly_sc_reg_offset);
+
+  set_solib_svr4_fetch_link_map_offsets
+    (gdbarch, svr4_ilp32_fetch_link_map_offsets);
+}
+
+
+/* Provide a prototype to silence -Wmissing-prototypes.  */
+void _initialize_i386dfly_tdep (void);
+
+void
+_initialize_i386dfly_tdep (void)
+{
+  gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_DRAGONFLY,
+			  i386dfly_init_abi);
+}
diff --git a/gnu/usr.bin/gdb/Makefile b/gnu/usr.bin/gdb/Makefile
index da5c840..f40b2b9 100644
--- a/gnu/usr.bin/gdb/Makefile
+++ b/gnu/usr.bin/gdb/Makefile
@@ -1,4 +1,4 @@
 SUBDIR= 	libbfd libiberty libgnu libopcodes libdecnumber libreadline
-SUBDIR+=	libgdb gdb kgdb gdbtui
+SUBDIR+=	libgdb gdb gdbtui
 
 .include <bsd.subdir.mk>
diff --git a/gnu/usr.bin/gdb/gdb/Makefile b/gnu/usr.bin/gdb/gdb/Makefile
index 3b55377..2aa26ec 100644
--- a/gnu/usr.bin/gdb/gdb/Makefile
+++ b/gnu/usr.bin/gdb/gdb/Makefile
@@ -2,6 +2,7 @@ PROG=	gdb
 SRCS=	gdb.c
 MAN=	gdb.1 gdbint.7 stabs.7
 
+CONTRIBDIR=     ${BASEDIR}/gdb
 CFLAGS+= -I${.OBJDIR}/../libgdb -I${.CURDIR}/../libgdb -I${.CURDIR}/..
 CFLAGS+= -I${BASEDIR}/include
 CFLAGS+= -I${BASEDIR}/bfd -I${BASEDIR}/gdb
@@ -21,4 +22,4 @@ LDADD+= -lncurses -lm -lz -lkvm -llzma
 
 .include <bsd.prog.mk>
 
-.PATH:	${BASEDIR}/gdb
+.PATH:	${BASEDIR}/gdb ${CONTRIBDIR}/doc
diff --git a/gnu/usr.bin/gdb/libbfd/Makefile.x86_64 b/gnu/usr.bin/gdb/libbfd/Makefile.x86_64
index 0116283..68d1a43 100644
--- a/gnu/usr.bin/gdb/libbfd/Makefile.x86_64
+++ b/gnu/usr.bin/gdb/libbfd/Makefile.x86_64
@@ -7,15 +7,15 @@ SRCS+=	cpu-i386.c cpu-l1om.c
 # BFD64_LIBS
 SRCS+=	archive64.c
 
-VECTORS=	bfd_elf64_x86_64_vec \
-		bfd_elf32_i386_vec \
-		bfd_elf64_l1om_vec \
-		bfd_elf64_little_generic_vec \
-		bfd_elf64_big_generic_vec \
-		bfd_elf32_little_generic_vec \
-		bfd_elf32_big_generic_vec
+VECTORS=	x86_64_elf64_vec \
+		i386_elf32_vec \
+		l1om_elf64_vec \
+		elf64_le_vec \
+		elf64_be_vec \
+		elf32_le_vec \
+		elf32_be_vec
 
-DEFAULT_VECTOR=	bfd_elf64_x86_64_vec
+DEFAULT_VECTOR=	x86_64_elf64_vec
 
 ARCHITECTURES=	bfd_i386_arch bfd_l1om_arch
 
diff --git a/gnu/usr.bin/gdb/libgdb/Makefile b/gnu/usr.bin/gdb/libgdb/Makefile
index cd51583..1d804e7 100644
--- a/gnu/usr.bin/gdb/libgdb/Makefile
+++ b/gnu/usr.bin/gdb/libgdb/Makefile
@@ -7,8 +7,9 @@ INTERNALLIB=	yes
 
 CONTRIBDIR=	${BASEDIR}/gdb
 .PATH:	${CONTRIBDIR} ${CONTRIBDIR}/cli ${CONTRIBDIR}/mi
-.PATH:	${CONTRIBDIR}/common ${CONTRIBDIR}/python ${CONTRIBDIR}/features
-.PATH:	${CONTRIBDIR}/tui
+.PATH:	${CONTRIBDIR}/common ${CONTRIBDIR}/nat ${CONTRIBDIR}/features
+.PATH:	${CONTRIBDIR}/tui ${CONTRIBDIR}/target ${CONTRIBDIR}/gnulib/import
+.PATH:	${CONTRIBDIR}/compile
 
 VERSION!= cat ${CONTRIBDIR}/version.in
 
@@ -16,8 +17,9 @@ CFLAGS+= -I${.OBJDIR} -I${.CURDIR} -I${.CURDIR}/..
 CFLAGS+= -I${BASEDIR}/include -I${BASEDIR}/bfd
 CFLAGS+= -I${CONTRIBDIR} -I${CONTRIBDIR}/common
 CFLAGS+= -I${BASEDIR}/libdecnumber
+CFLAGS+= -I${BASEDIR}/import
 CFLAGS+= -I${.CURDIR}/../libbfd -I${.OBJDIR}/../libbfd
-CFLAGS+= -I${BASEDIR} 
+CFLAGS+= -I${BASEDIR}
 CFLAGS+= -DMACHINE_ARCH='"${MACHINE_ARCH}"'
 CFLAGS+= -DTARGET_ARCH='"${TARGET_ARCH}"'
 CFLAGS+= -DVERSION_STRING='"${VERSION}"'
@@ -85,7 +87,7 @@ SRCS+=	\
 	inline-frame.c \
 	gnu-v2-abi.c gnu-v3-abi.c cp-abi.c cp-support.c \
 	cp-namespace.c \
-	reggroups.c regset.c \
+	reggroups.c \
 	trad-frame.c \
 	tramp-frame.c \
 	solib.c solib-target.c \
@@ -95,7 +97,11 @@ SRCS+=	\
 	inferior.c osdata.c gdb_usleep.c record.c record-full.c gcore.c \
 	gdb_vecs.c jit.c progspace.c skip.c probe.c \
 	common-utils.c buffer.c ptid.c gdb-dlfcn.c common-agent.c \
-	format.c registry.c btrace.c record-btrace.c
+	format.c registry.c btrace.c btrace-common.c record-btrace.c utils.c \
+	errors.c common-exceptions.c filestuff.c extension.c print-utils.c \
+	posix-strerror.c break-catch-syscall.c rsp-low.c target-dcache.c \
+	symfile-debug.c debug.c c-varobj.c jv-varobj.c build-id.c tracefile.c \
+	ctf.c tracefile-tfile.c fileio.c common-debug.c
 
 # TSOBS
 SRCS+=	inflow.c
@@ -121,11 +127,24 @@ SRCS+=	mi-out.c mi-console.c \
 	mi-cmd-target.c mi-cmd-info.c mi-interp.c \
 	mi-main.c mi-parse.c mi-getopt.c
 
-# PYTHON OBJS
-SRCS+=	python.c \
-	py-auto-load.c \
-	py-value.c \
-	py-prettyprint.c 
+# SUBDIR_NAT_OBS
+SRCS+=	x86-dregs.c
+
+# SUBDIR_TARGET_OBS
+SRCS+=	waitstatus.c
+
+# SUBDIR_IMPORT_OBS
+SRCS+=	canonicalize-lgpl.c malloca.c
+
+# SUBDIR_COMPILE_OBS
+SRCS+=	compile.c compile-c-support.c \
+	compile-c-types.c compile-c-symbols.c \
+	compile-loc2c.c
+
+#SRCS+=	python.c \
+#	py-auto-load.c \
+#	py-value.c \
+#	py-prettyprint.c
 
 # CONFIG_OBS
 SRCS+=	elfread.c posix-hdep.c stap-probe.c
@@ -151,6 +170,7 @@ SRCS+=	tui-command.c \
 
 # YYOBJ
 SRCS+=	c-exp.y \
+	d-exp.y \
 	cp-name-parser.y \
 	ada-exp.y \
 	jv-exp.y \
diff --git a/gnu/usr.bin/gdb/libgdb/Makefile.x86_64 b/gnu/usr.bin/gdb/libgdb/Makefile.x86_64
index 26d7196..30a9794 100644
--- a/gnu/usr.bin/gdb/libgdb/Makefile.x86_64
+++ b/gnu/usr.bin/gdb/libgdb/Makefile.x86_64
@@ -6,5 +6,5 @@ SRCS+=	amd64-tdep.c amd64dfly-tdep.c i386-tdep.c i387-tdep.c i386bsd-tdep.c \
 # NATDEPFILES
 SRCS+=	fork-child.c inf-ptrace.c \
 	fbsd-nat.c amd64-nat.c amd64bsd-nat.c amd64dfly-nat.c \
-	i386-nat.c gcore.c
+	x86-nat.c gcore.c fbsd-tdep.c
 .endif
diff --git a/gnu/usr.bin/gdb/libiberty/Makefile b/gnu/usr.bin/gdb/libiberty/Makefile
index c743737..9dc17ef 100644
--- a/gnu/usr.bin/gdb/libiberty/Makefile
+++ b/gnu/usr.bin/gdb/libiberty/Makefile
@@ -13,6 +13,8 @@ SRCS+=	./argv.c \
 	./cp-demint.c \
 	./cplus-dem.c \
 	./concat.c \
+	./d-demangle.c \
+	./crc32.c \
 	./dwarfnames.c \
 	./dyn-string.c \
 	./filename_cmp.c \
@@ -40,6 +42,7 @@ SRCS+=	./argv.c \
 	./unlink-if-ordinary.c \
 	./xexit.c \
 	./xstrdup.c \
+	./xstrndup.c \
 	./xstrerror.c
 
 .include <bsd.lib.mk>
-- 
2.6.3

