svn commit: r418566 - in head/devel/gdb: . files

John Baldwin jhb at FreeBSD.org
Fri Jul 15 01:10:17 UTC 2016


Author: jhb (src,doc committer)
Date: Fri Jul 15 01:10:15 2016
New Revision: 418566
URL: https://svnweb.freebsd.org/changeset/ports/418566

Log:
  Import several patches recently merged upstream.
  
  - Fix fork following to honor 'detach-on-fork'
  - Fix vfork following to post a fake vfork_done event to fix breakpoints
    in vfork parents (a real vfork_done event is pending but requires kernel
    changes currently in review).
  - Fix x86 debug registers to work with multiple threads (PR 157755)
  - Add support for 'info auxv' on both live processes and cores.
  - Add support for 'catch syscall'.  Note that catching system calls by
    names requires parsing an XML file mapping system call names to
    numbers.  The port now installs the XML syscall files to the data
    directory.  In addition, the EXPAT option is now enabled by default as
    expat is used to parse the XML files.
  - Bump PORTREVISION.
  
  PR:		157755, 210874
  Approved by:	luca.pizzamiglio at gmail.com (maintainer), bdrewery

Added:
  head/devel/gdb/files/commit-21002a6   (contents, props changed)
  head/devel/gdb/files/commit-2c5c2a3   (contents, props changed)
  head/devel/gdb/files/commit-2faa344   (contents, props changed)
  head/devel/gdb/files/commit-3350c5f   (contents, props changed)
  head/devel/gdb/files/commit-5077bff   (contents, props changed)
  head/devel/gdb/files/commit-7697fc9   (contents, props changed)
  head/devel/gdb/files/commit-82372b2   (contents, props changed)
  head/devel/gdb/files/commit-8607ea6   (contents, props changed)
  head/devel/gdb/files/commit-a3405d1   (contents, props changed)
  head/devel/gdb/files/commit-aa1ed4a   (contents, props changed)
  head/devel/gdb/files/commit-b00f86d   (contents, props changed)
  head/devel/gdb/files/commit-bb2a62e   (contents, props changed)
  head/devel/gdb/files/commit-e6cdd38   (contents, props changed)
  head/devel/gdb/files/commit-ee95032   (contents, props changed)
Modified:
  head/devel/gdb/Makefile
  head/devel/gdb/pkg-plist

Modified: head/devel/gdb/Makefile
==============================================================================
--- head/devel/gdb/Makefile	Thu Jul 14 22:50:05 2016	(r418565)
+++ head/devel/gdb/Makefile	Fri Jul 15 01:10:15 2016	(r418566)
@@ -3,7 +3,7 @@
 
 PORTNAME=	gdb
 PORTVERSION=	7.11.1
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	devel
 MASTER_SITES=	GNU
 
@@ -30,6 +30,20 @@ CFLAGS:=	${CFLAGS:C/ +$//}	# blanks at E
 CFLAGS+=	-DRL_NO_COMPAT -Wno-unused-function -Wno-unused-variable
 EXCLUDE=	dejagnu expect sim texinfo intl
 EXTRACT_AFTER_ARGS=	${EXCLUDE:S/^/--exclude /}
+EXTRA_PATCHES=	${FILESDIR}/commit-21002a6 \
+		${FILESDIR}/commit-b00f86d \
+		${FILESDIR}/commit-aa1ed4a \
+		${FILESDIR}/commit-7697fc9 \
+		${FILESDIR}/commit-3350c5f \
+		${FILESDIR}/commit-2faa344 \
+		${FILESDIR}/commit-82372b2 \
+		${FILESDIR}/commit-e6cdd38 \
+		${FILESDIR}/commit-a3405d1 \
+		${FILESDIR}/commit-5077bff \
+		${FILESDIR}/commit-bb2a62e \
+		${FILESDIR}/commit-8607ea6 \
+		${FILESDIR}/commit-2c5c2a3 \
+		${FILESDIR}/commit-ee95032
 
 VER=		${PORTVERSION:S/.//g}
 PLIST_SUB=	VER=${VER}
@@ -38,7 +52,7 @@ ONLY_FOR_ARCHS=	i386 amd64 powerpc power
 
 OPTIONS_DEFINE=	DEBUG EXPAT GDB_LINK GUILE KGDB PYTHON TUI
 
-OPTIONS_DEFAULT=	GDB_LINK KGDB PYTHON TUI PORT_READLINE
+OPTIONS_DEFAULT=	EXPAT GDB_LINK KGDB PYTHON TUI PORT_READLINE
 
 OPTIONS_SINGLE=	READLINE
 OPTIONS_SINGLE_READLINE=	BASE_READLINE BUNDLED_READLINE PORT_READLINE
@@ -99,6 +113,10 @@ do-install-KGDB-on:
 do-install-TUI-on:
 	${LN} -sf gdb${VER} ${STAGEDIR}${PREFIX}/bin/gdbtui${VER}
 
+do-install-EXPAT-on:
+	(cd ${WRKSRC}/gdb/data-directory ; \
+		${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install-syscalls )
+
 do-install-GDB_LINK-on:
 	${LN} -sf gdb${VER} ${STAGEDIR}${PREFIX}/bin/gdb
 .if ${PORT_OPTIONS:MKGDB}

Added: head/devel/gdb/files/commit-21002a6
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/gdb/files/commit-21002a6	Fri Jul 15 01:10:15 2016	(r418566)
@@ -0,0 +1,102 @@
+commit 21002a635bf3da33367592e3a3ab3cce24fe5299
+Author: John Baldwin <jhb at FreeBSD.org>
+Date:   Tue Jan 19 11:02:09 2016 -0800
+
+    Handle void * conversions in FreeBSD/x86 native code to fix C++ build.
+    
+    gdb/ChangeLog:
+    
+    	* amd64bsd-nat.c (amd64bsd_fetch_inferior_registers): Change xstateregs
+    	to void *.
+    	(amd64bsd_store_inferior_registers): Likewise.
+    	* fbsd-nat.c (resume_one_thread_cb): Explicitly cast data to ptid_t *.
+    	(resume_all_threads_cb): Likewise.
+    	* i386bsd-nat.c (i386bsd_supply_gregset): Cast gregs to char *.
+    	(i386bsd_collect_gregset): Likewise.
+    	(i386bsd_fetch_inferior_registers): Change xstateregs to void *.
+    	(i386bsd_store_inferior_registers): Likewise.
+
+diff --git gdb/amd64bsd-nat.c gdb/amd64bsd-nat.c
+index fb7e4fa..e278a91 100644
+--- gdb/amd64bsd-nat.c
++++ gdb/amd64bsd-nat.c
+@@ -65,7 +65,7 @@ amd64bsd_fetch_inferior_registers (struct target_ops *ops,
+     {
+       struct fpreg fpregs;
+ #ifdef PT_GETXSTATE_INFO
+-      char *xstateregs;
++      void *xstateregs;
+ 
+       if (amd64bsd_xsave_len != 0)
+ 	{
+@@ -118,7 +118,7 @@ amd64bsd_store_inferior_registers (struct target_ops *ops,
+     {
+       struct fpreg fpregs;
+ #ifdef PT_GETXSTATE_INFO
+-      char *xstateregs;
++      void *xstateregs;
+ 
+       if (amd64bsd_xsave_len != 0)
+ 	{
+diff --git gdb/fbsd-nat.c gdb/fbsd-nat.c
+index bdf078e..b582abe 100644
+--- gdb/fbsd-nat.c
++++ gdb/fbsd-nat.c
+@@ -428,7 +428,7 @@ static void (*super_resume) (struct target_ops *,
+ static int
+ resume_one_thread_cb (struct thread_info *tp, void *data)
+ {
+-  ptid_t *ptid = data;
++  ptid_t *ptid = (ptid_t *) data;
+   int request;
+ 
+   if (ptid_get_pid (tp->ptid) != ptid_get_pid (*ptid))
+@@ -447,7 +447,7 @@ resume_one_thread_cb (struct thread_info *tp, void *data)
+ static int
+ resume_all_threads_cb (struct thread_info *tp, void *data)
+ {
+-  ptid_t *filter = data;
++  ptid_t *filter = (ptid_t *) data;
+ 
+   if (!ptid_match (tp->ptid, *filter))
+     return 0;
+diff --git gdb/i386bsd-nat.c gdb/i386bsd-nat.c
+index 5d45c33..f5f4a0f 100644
+--- gdb/i386bsd-nat.c
++++ gdb/i386bsd-nat.c
+@@ -92,7 +92,7 @@ size_t i386bsd_xsave_len;
+ static void
+ i386bsd_supply_gregset (struct regcache *regcache, const void *gregs)
+ {
+-  const char *regs = gregs;
++  const char *regs = (const char *) gregs;
+   int regnum;
+ 
+   for (regnum = 0; regnum < ARRAY_SIZE (i386bsd_r_reg_offset); regnum++)
+@@ -112,7 +112,7 @@ static void
+ i386bsd_collect_gregset (const struct regcache *regcache,
+ 			 void *gregs, int regnum)
+ {
+-  char *regs = gregs;
++  char *regs = (char *) gregs;
+   int i;
+ 
+   for (i = 0; i < ARRAY_SIZE (i386bsd_r_reg_offset); i++)
+@@ -157,7 +157,7 @@ i386bsd_fetch_inferior_registers (struct target_ops *ops,
+ #ifdef PT_GETXSTATE_INFO
+       if (i386bsd_xsave_len != 0)
+ 	{
+-	  char *xstateregs;
++	  void *xstateregs;
+ 
+ 	  xstateregs = alloca (i386bsd_xsave_len);
+ 	  if (ptrace (PT_GETXSTATE, get_ptrace_pid (inferior_ptid),
+@@ -227,7 +227,7 @@ i386bsd_store_inferior_registers (struct target_ops *ops,
+ #ifdef PT_GETXSTATE_INFO
+       if (i386bsd_xsave_len != 0)
+ 	{
+-	  char *xstateregs;
++	  void *xstateregs;
+ 
+ 	  xstateregs = alloca (i386bsd_xsave_len);
+ 	  if (ptrace (PT_GETXSTATE, get_ptrace_pid (inferior_ptid),

Added: head/devel/gdb/files/commit-2c5c2a3
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/gdb/files/commit-2c5c2a3	Fri Jul 15 01:10:15 2016	(r418566)
@@ -0,0 +1,214 @@
+commit 2c5c2a3321706c28cbf1b85a970a2e32912eb0c8
+Author: John Baldwin <jhb at FreeBSD.org>
+Date:   Fri Jun 24 21:00:04 2016 -0700
+
+    Fake VFORK_DONE events when following only the parent after a vfork.
+    
+    FreeBSD does not currently report a ptrace event for a parent process
+    after it resumes due to the child exiting the shared memory region after
+    a vfork.  Take the same approach used in linux-nat.c in this case of
+    sleeping for a while and then reporting a fake VFORK_DONE event.
+    
+    gdb/ChangeLog:
+    
+    	* fbsd-nat.c (struct fbsd_fork_child_info): Rename to ...
+    	(struct fbsd_fork_info): ... this.
+    	(struct fbsd_fork_info) <child>: Rename to ...
+    	(struct fbsd_fork_info) <ptid>: ... this.
+    	(fbsd_pending_children): Update type.
+    	(fbsd_remember_child): Update type and field name.
+    	(fbsd_is_child_pending): Likewise.
+    	(fbsd_pending_vfork_done): New variable.
+    	(fbsd_is_vfork_done_pending): New function.
+    	(fbsd_next_vfork_done): New function.
+    	(fbsd_resume): Don't resume processes with a pending vfork done
+    	event.
+    	(fbsd_wait): Report pending vfork done events.
+    	(fbsd_follow_fork): Delay and record a pending vfork done event
+    	for a vfork parent when detaching the child.
+
+diff --git gdb/fbsd-nat.c gdb/fbsd-nat.c
+index daf4580..fcb7ff5 100644
+--- gdb/fbsd-nat.c
++++ gdb/fbsd-nat.c
+@@ -530,13 +530,13 @@ fbsd_update_thread_list (struct target_ops *ops)
+   sake.  FreeBSD versions newer than 9.1 contain both fixes.
+ */
+ 
+-struct fbsd_fork_child_info
++struct fbsd_fork_info
+ {
+-  struct fbsd_fork_child_info *next;
+-  ptid_t child;			/* Pid of new child.  */
++  struct fbsd_fork_info *next;
++  ptid_t ptid;
+ };
+ 
+-static struct fbsd_fork_child_info *fbsd_pending_children;
++static struct fbsd_fork_info *fbsd_pending_children;
+ 
+ /* Record a new child process event that is reported before the
+    corresponding fork event in the parent.  */
+@@ -544,9 +544,9 @@ static struct fbsd_fork_child_info *fbsd_pending_children;
+ static void
+ fbsd_remember_child (ptid_t pid)
+ {
+-  struct fbsd_fork_child_info *info = XCNEW (struct fbsd_fork_child_info);
++  struct fbsd_fork_info *info = XCNEW (struct fbsd_fork_info);
+ 
+-  info->child = pid;
++  info->ptid = pid;
+   info->next = fbsd_pending_children;
+   fbsd_pending_children = info;
+ }
+@@ -557,25 +557,74 @@ fbsd_remember_child (ptid_t pid)
+ static ptid_t
+ fbsd_is_child_pending (pid_t pid)
+ {
+-  struct fbsd_fork_child_info *info, *prev;
++  struct fbsd_fork_info *info, *prev;
+   ptid_t ptid;
+ 
+   prev = NULL;
+   for (info = fbsd_pending_children; info; prev = info, info = info->next)
+     {
+-      if (ptid_get_pid (info->child) == pid)
++      if (ptid_get_pid (info->ptid) == pid)
+ 	{
+ 	  if (prev == NULL)
+ 	    fbsd_pending_children = info->next;
+ 	  else
+ 	    prev->next = info->next;
+-	  ptid = info->child;
++	  ptid = info->ptid;
+ 	  xfree (info);
+ 	  return ptid;
+ 	}
+     }
+   return null_ptid;
+ }
++
++static struct fbsd_fork_info *fbsd_pending_vfork_done;
++
++/* Record a pending vfork done event.  */
++
++static void
++fbsd_add_vfork_done (ptid_t pid)
++{
++  struct fbsd_fork_info *info = XCNEW (struct fbsd_fork_info);
++
++  info->ptid = pid;
++  info->next = fbsd_pending_vfork_done;
++  fbsd_pending_vfork_done = info;
++}
++
++/* Check for a pending vfork done event for a specific PID.  */
++
++static int
++fbsd_is_vfork_done_pending (pid_t pid)
++{
++  struct fbsd_fork_info *info;
++
++  for (info = fbsd_pending_vfork_done; info != NULL; info = info->next)
++    {
++      if (ptid_get_pid (info->ptid) == pid)
++	return 1;
++    }
++  return 0;
++}
++
++/* Check for a pending vfork done event.  If one is found, remove it
++   from the list and return the PTID.  */
++
++static ptid
++fbsd_next_vfork_done (void)
++{
++  struct fbsd_fork_info *info;
++  ptid_t ptid;
++
++  if (fbsd_pending_vfork_done != NULL)
++    {
++      info = fbsd_pending_vfork_done;
++      fbsd_pending_vfork_done = info->next;
++      ptid = info->ptid;
++      xfree (info);
++      return ptid;
++    }
++  return null_ptid;
++}
+ #endif
+ 
+ static int
+@@ -616,6 +665,17 @@ static void
+ fbsd_resume (struct target_ops *ops,
+ 	     ptid_t ptid, int step, enum gdb_signal signo)
+ {
++#ifdef TDP_RFPPWAIT
++  pid_t pid;
++
++  /* Don't PT_CONTINUE a process which has a pending vfork done event.  */
++  if (ptid_equal (minus_one_ptid, ptid))
++    pid = ptid_get_pid (inferior_ptid);
++  else
++    pid = ptid_get_pid (ptid);
++  if (fbsd_is_vfork_done_pending (pid))
++    return;
++#endif
+ 
+   if (debug_fbsd_lwp)
+     fprintf_unfiltered (gdb_stdlog,
+@@ -650,6 +710,12 @@ fbsd_wait (struct target_ops *ops,
+ 
+   while (1)
+     {
++      wptid = fbsd_next_vfork_done ();
++      if (!ptid_equal (wptid, null_ptid))
++	{
++	  ourstatus->kind = TARGET_WAITKIND_VFORK_DONE;
++	  return wptid;
++	}
+       wptid = super_wait (ops, ptid, ourstatus, target_options);
+       if (ourstatus->kind == TARGET_WAITKIND_STOPPED)
+ 	{
+@@ -828,6 +894,7 @@ fbsd_follow_fork (struct target_ops *ops, int follow_child,
+   if (!follow_child && detach_fork)
+     {
+       struct thread_info *tp = inferior_thread ();
++      int has_vforked = tp->pending_follow.kind == TARGET_WAITKIND_VFORKED;
+       pid_t child_pid = ptid_get_pid (tp->pending_follow.value.related_pid);
+ 
+       /* Breakpoints have already been detached from the child by
+@@ -835,6 +902,33 @@ fbsd_follow_fork (struct target_ops *ops, int follow_child,
+ 
+       if (ptrace (PT_DETACH, child_pid, (PTRACE_TYPE_ARG3)1, 0) == -1)
+ 	perror_with_name (("ptrace"));
++
++      if (has_vforked)
++	{
++	  /* We can't insert breakpoints until the child process has
++	     finished with the shared memory region.  The parent
++	     process doesn't wait for the child process to exit or
++	     exec until after it has been resumed from the ptrace stop
++	     to report the fork.  Once it has been resumed it doesn't
++	     stop again before returning to userland, so there is no
++	     reliable way to wait on the parent.
++
++	     We can't stay attached to the child to wait for an exec
++	     or exit because it may invoke ptrace(PT_TRACE_ME)
++	     (e.g. if the parent process is a debugger forking a new
++	     child process).
++
++	     In the end, the best we can do is to make sure it runs
++	     for a little while.  Hopefully it will be out of range of
++	     any breakpoints we reinsert.  Usually this is only the
++	     single-step breakpoint at vfork's return point.  */
++
++	  usleep (10000);
++
++	  /* Schedule a fake VFORK_DONE event to report on the next
++	     wait.  */
++	  fbsd_add_vfork_done (inferior_ptid);
++	}
+     }
+ 
+   return 0;

Added: head/devel/gdb/files/commit-2faa344
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/gdb/files/commit-2faa344	Fri Jul 15 01:10:15 2016	(r418566)
@@ -0,0 +1,397 @@
+commit 2faa34476d9e6120eaf389b7f91b7227183fa2ce
+Author: John Baldwin <jhb at FreeBSD.org>
+Date:   Sat Jun 11 15:51:38 2016 -0700
+
+    Add a new gdbarch method to print a single AUXV entry.
+    
+    Different platforms have different meanings for auxiliary vector
+    entries.  The 'print_auxv_entry' gdbarch method allows an architecture
+    to output a suitable description for platform-specific entries.
+    
+    A fprint_auxv_entry function is split out of fprint_target_auxv.
+    This function outputs the description of a single auxiliary vector
+    entry to the specified file using caller-supplied formatting and
+    strings to describe the vector type.
+    
+    The existing switch on auxiliary vector types is moved out of
+    fprint_target_auxv into a new default_print_auxv_entry function.
+    default_print_auxv_entry chooses an appropriate format and description
+    and calls fprint_single_auxv to describe a single vector entry.
+    This function is used as the default 'print_auxv_entry' gdbarch method.
+    
+    fprint_target_auxv now invokes the gdbarch 'print_auxv_entry' method
+    on each vector entry.
+    
+    gdb/ChangeLog:
+    
+    	* auxv.c (fprint_auxv_entry): New function.
+    	(default_print_auxv_entry): New function.
+    	(fprint_target_auxv): Use gdbarch_print_auxv_entry.
+    	* auxv.h (enum auxv_format): New enum.
+    	(fprint_auxv_entry): Declare.
+    	(default_print_auxv_entry): Declare.
+    	* gdbarch.sh (print_auxv_entry): New.
+    	* gdbarch.c, gdbarch.h: Re-generated.
+
+diff --git gdb/auxv.c gdb/auxv.c
+index 396862e..de9205d 100644
+--- gdb/auxv.c
++++ gdb/auxv.c
+@@ -407,10 +407,126 @@ target_auxv_search (struct target_ops *ops, CORE_ADDR match, CORE_ADDR *valp)
+ }
+ 
+ 
++/* Print the description of a single AUXV entry on the specified file.  */
++
++void
++fprint_auxv_entry (struct ui_file *file, const char *name,
++		   const char *description, enum auxv_format format,
++		   CORE_ADDR type, CORE_ADDR val)
++{
++  fprintf_filtered (file, ("%-4s %-20s %-30s "),
++		    plongest (type), name, description);
++  switch (format)
++    {
++    case AUXV_FORMAT_DEC:
++      fprintf_filtered (file, ("%s\n"), plongest (val));
++      break;
++    case AUXV_FORMAT_HEX:
++      fprintf_filtered (file, ("%s\n"), paddress (target_gdbarch (), val));
++      break;
++    case AUXV_FORMAT_STR:
++      {
++	struct value_print_options opts;
++
++	get_user_print_options (&opts);
++	if (opts.addressprint)
++	  fprintf_filtered (file, ("%s "), paddress (target_gdbarch (), val));
++	val_print_string (builtin_type (target_gdbarch ())->builtin_char,
++			  NULL, val, -1, file, &opts);
++	fprintf_filtered (file, ("\n"));
++      }
++      break;
++    }
++}
++
++/* The default implementation of gdbarch_print_auxv_entry.  */
++
++void
++default_print_auxv_entry (struct gdbarch *gdbarch, struct ui_file *file,
++			  CORE_ADDR type, CORE_ADDR val)
++{
++  const char *name = "???";
++  const char *description = "";
++  enum auxv_format format = AUXV_FORMAT_HEX;
++
++  switch (type)
++    {
++#define TAG(tag, text, kind) \
++      case tag: name = #tag; description = text; format = kind; break
++      TAG (AT_NULL, _("End of vector"), AUXV_FORMAT_HEX);
++      TAG (AT_IGNORE, _("Entry should be ignored"), AUXV_FORMAT_HEX);
++      TAG (AT_EXECFD, _("File descriptor of program"), AUXV_FORMAT_DEC);
++      TAG (AT_PHDR, _("Program headers for program"), AUXV_FORMAT_HEX);
++      TAG (AT_PHENT, _("Size of program header entry"), AUXV_FORMAT_DEC);
++      TAG (AT_PHNUM, _("Number of program headers"), AUXV_FORMAT_DEC);
++      TAG (AT_PAGESZ, _("System page size"), AUXV_FORMAT_DEC);
++      TAG (AT_BASE, _("Base address of interpreter"), AUXV_FORMAT_HEX);
++      TAG (AT_FLAGS, _("Flags"), AUXV_FORMAT_HEX);
++      TAG (AT_ENTRY, _("Entry point of program"), AUXV_FORMAT_HEX);
++      TAG (AT_NOTELF, _("Program is not ELF"), AUXV_FORMAT_DEC);
++      TAG (AT_UID, _("Real user ID"), AUXV_FORMAT_DEC);
++      TAG (AT_EUID, _("Effective user ID"), AUXV_FORMAT_DEC);
++      TAG (AT_GID, _("Real group ID"), AUXV_FORMAT_DEC);
++      TAG (AT_EGID, _("Effective group ID"), AUXV_FORMAT_DEC);
++      TAG (AT_CLKTCK, _("Frequency of times()"), AUXV_FORMAT_DEC);
++      TAG (AT_PLATFORM, _("String identifying platform"), AUXV_FORMAT_STR);
++      TAG (AT_HWCAP, _("Machine-dependent CPU capability hints"),
++	   AUXV_FORMAT_HEX);
++      TAG (AT_FPUCW, _("Used FPU control word"), AUXV_FORMAT_DEC);
++      TAG (AT_DCACHEBSIZE, _("Data cache block size"), AUXV_FORMAT_DEC);
++      TAG (AT_ICACHEBSIZE, _("Instruction cache block size"), AUXV_FORMAT_DEC);
++      TAG (AT_UCACHEBSIZE, _("Unified cache block size"), AUXV_FORMAT_DEC);
++      TAG (AT_IGNOREPPC, _("Entry should be ignored"), AUXV_FORMAT_DEC);
++      TAG (AT_BASE_PLATFORM, _("String identifying base platform"),
++	   AUXV_FORMAT_STR);
++      TAG (AT_RANDOM, _("Address of 16 random bytes"), AUXV_FORMAT_HEX);
++      TAG (AT_HWCAP2, _("Extension of AT_HWCAP"), AUXV_FORMAT_HEX);
++      TAG (AT_EXECFN, _("File name of executable"), AUXV_FORMAT_STR);
++      TAG (AT_SECURE, _("Boolean, was exec setuid-like?"), AUXV_FORMAT_DEC);
++      TAG (AT_SYSINFO, _("Special system info/entry points"), AUXV_FORMAT_HEX);
++      TAG (AT_SYSINFO_EHDR, _("System-supplied DSO's ELF header"),
++	   AUXV_FORMAT_HEX);
++      TAG (AT_L1I_CACHESHAPE, _("L1 Instruction cache information"),
++	   AUXV_FORMAT_HEX);
++      TAG (AT_L1D_CACHESHAPE, _("L1 Data cache information"), AUXV_FORMAT_HEX);
++      TAG (AT_L2_CACHESHAPE, _("L2 cache information"), AUXV_FORMAT_HEX);
++      TAG (AT_L3_CACHESHAPE, _("L3 cache information"), AUXV_FORMAT_HEX);
++      TAG (AT_SUN_UID, _("Effective user ID"), AUXV_FORMAT_DEC);
++      TAG (AT_SUN_RUID, _("Real user ID"), AUXV_FORMAT_DEC);
++      TAG (AT_SUN_GID, _("Effective group ID"), AUXV_FORMAT_DEC);
++      TAG (AT_SUN_RGID, _("Real group ID"), AUXV_FORMAT_DEC);
++      TAG (AT_SUN_LDELF, _("Dynamic linker's ELF header"), AUXV_FORMAT_HEX);
++      TAG (AT_SUN_LDSHDR, _("Dynamic linker's section headers"),
++	   AUXV_FORMAT_HEX);
++      TAG (AT_SUN_LDNAME, _("String giving name of dynamic linker"),
++	   AUXV_FORMAT_STR);
++      TAG (AT_SUN_LPAGESZ, _("Large pagesize"), AUXV_FORMAT_DEC);
++      TAG (AT_SUN_PLATFORM, _("Platform name string"), AUXV_FORMAT_STR);
++      TAG (AT_SUN_HWCAP, _("Machine-dependent CPU capability hints"),
++	   AUXV_FORMAT_HEX);
++      TAG (AT_SUN_IFLUSH, _("Should flush icache?"), AUXV_FORMAT_DEC);
++      TAG (AT_SUN_CPU, _("CPU name string"), AUXV_FORMAT_STR);
++      TAG (AT_SUN_EMUL_ENTRY, _("COFF entry point address"), AUXV_FORMAT_HEX);
++      TAG (AT_SUN_EMUL_EXECFD, _("COFF executable file descriptor"),
++	   AUXV_FORMAT_DEC);
++      TAG (AT_SUN_EXECNAME,
++	   _("Canonicalized file name given to execve"), AUXV_FORMAT_STR);
++      TAG (AT_SUN_MMU, _("String for name of MMU module"), AUXV_FORMAT_STR);
++      TAG (AT_SUN_LDDATA, _("Dynamic linker's data segment address"),
++	   AUXV_FORMAT_HEX);
++      TAG (AT_SUN_AUXFLAGS,
++	   _("AF_SUN_ flags passed from the kernel"), AUXV_FORMAT_HEX);
++    }
++
++  fprint_auxv_entry (file, name, description, format, type, val);
++}
++
+ /* Print the contents of the target's AUXV on the specified file.  */
++
+ int
+ fprint_target_auxv (struct ui_file *file, struct target_ops *ops)
+ {
++  struct gdbarch *gdbarch = target_gdbarch ();
+   CORE_ADDR type, val;
+   gdb_byte *data;
+   gdb_byte *ptr;
+@@ -426,93 +542,7 @@ fprint_target_auxv (struct ui_file *file, struct target_ops *ops)
+ 
+   while (target_auxv_parse (ops, &ptr, data + info->length, &type, &val) > 0)
+     {
+-      const char *name = "???";
+-      const char *description = "";
+-      enum { dec, hex, str } flavor = hex;
+-
+-      switch (type)
+-	{
+-#define TAG(tag, text, kind) \
+-	case tag: name = #tag; description = text; flavor = kind; break
+-	  TAG (AT_NULL, _("End of vector"), hex);
+-	  TAG (AT_IGNORE, _("Entry should be ignored"), hex);
+-	  TAG (AT_EXECFD, _("File descriptor of program"), dec);
+-	  TAG (AT_PHDR, _("Program headers for program"), hex);
+-	  TAG (AT_PHENT, _("Size of program header entry"), dec);
+-	  TAG (AT_PHNUM, _("Number of program headers"), dec);
+-	  TAG (AT_PAGESZ, _("System page size"), dec);
+-	  TAG (AT_BASE, _("Base address of interpreter"), hex);
+-	  TAG (AT_FLAGS, _("Flags"), hex);
+-	  TAG (AT_ENTRY, _("Entry point of program"), hex);
+-	  TAG (AT_NOTELF, _("Program is not ELF"), dec);
+-	  TAG (AT_UID, _("Real user ID"), dec);
+-	  TAG (AT_EUID, _("Effective user ID"), dec);
+-	  TAG (AT_GID, _("Real group ID"), dec);
+-	  TAG (AT_EGID, _("Effective group ID"), dec);
+-	  TAG (AT_CLKTCK, _("Frequency of times()"), dec);
+-	  TAG (AT_PLATFORM, _("String identifying platform"), str);
+-	  TAG (AT_HWCAP, _("Machine-dependent CPU capability hints"), hex);
+-	  TAG (AT_FPUCW, _("Used FPU control word"), dec);
+-	  TAG (AT_DCACHEBSIZE, _("Data cache block size"), dec);
+-	  TAG (AT_ICACHEBSIZE, _("Instruction cache block size"), dec);
+-	  TAG (AT_UCACHEBSIZE, _("Unified cache block size"), dec);
+-	  TAG (AT_IGNOREPPC, _("Entry should be ignored"), dec);
+-	  TAG (AT_BASE_PLATFORM, _("String identifying base platform"), str);
+-	  TAG (AT_RANDOM, _("Address of 16 random bytes"), hex);
+-	  TAG (AT_HWCAP2, _("Extension of AT_HWCAP"), hex);
+-	  TAG (AT_EXECFN, _("File name of executable"), str);
+-	  TAG (AT_SECURE, _("Boolean, was exec setuid-like?"), dec);
+-	  TAG (AT_SYSINFO, _("Special system info/entry points"), hex);
+-	  TAG (AT_SYSINFO_EHDR, _("System-supplied DSO's ELF header"), hex);
+-	  TAG (AT_L1I_CACHESHAPE, _("L1 Instruction cache information"), hex);
+-	  TAG (AT_L1D_CACHESHAPE, _("L1 Data cache information"), hex);
+-	  TAG (AT_L2_CACHESHAPE, _("L2 cache information"), hex);
+-	  TAG (AT_L3_CACHESHAPE, _("L3 cache information"), hex);
+-	  TAG (AT_SUN_UID, _("Effective user ID"), dec);
+-	  TAG (AT_SUN_RUID, _("Real user ID"), dec);
+-	  TAG (AT_SUN_GID, _("Effective group ID"), dec);
+-	  TAG (AT_SUN_RGID, _("Real group ID"), dec);
+-	  TAG (AT_SUN_LDELF, _("Dynamic linker's ELF header"), hex);
+-	  TAG (AT_SUN_LDSHDR, _("Dynamic linker's section headers"), hex);
+-	  TAG (AT_SUN_LDNAME, _("String giving name of dynamic linker"), str);
+-	  TAG (AT_SUN_LPAGESZ, _("Large pagesize"), dec);
+-	  TAG (AT_SUN_PLATFORM, _("Platform name string"), str);
+-	  TAG (AT_SUN_HWCAP, _("Machine-dependent CPU capability hints"), hex);
+-	  TAG (AT_SUN_IFLUSH, _("Should flush icache?"), dec);
+-	  TAG (AT_SUN_CPU, _("CPU name string"), str);
+-	  TAG (AT_SUN_EMUL_ENTRY, _("COFF entry point address"), hex);
+-	  TAG (AT_SUN_EMUL_EXECFD, _("COFF executable file descriptor"), dec);
+-	  TAG (AT_SUN_EXECNAME,
+-	       _("Canonicalized file name given to execve"), str);
+-	  TAG (AT_SUN_MMU, _("String for name of MMU module"), str);
+-	  TAG (AT_SUN_LDDATA, _("Dynamic linker's data segment address"), hex);
+-	  TAG (AT_SUN_AUXFLAGS,
+-	       _("AF_SUN_ flags passed from the kernel"), hex);
+-	}
+-
+-      fprintf_filtered (file, "%-4s %-20s %-30s ",
+-			plongest (type), name, description);
+-      switch (flavor)
+-	{
+-	case dec:
+-	  fprintf_filtered (file, "%s\n", plongest (val));
+-	  break;
+-	case hex:
+-	  fprintf_filtered (file, "%s\n", paddress (target_gdbarch (), val));
+-	  break;
+-	case str:
+-	  {
+-	    struct value_print_options opts;
+-
+-	    get_user_print_options (&opts);
+-	    if (opts.addressprint)
+-	      fprintf_filtered (file, "%s ", paddress (target_gdbarch (), val));
+-	    val_print_string (builtin_type (target_gdbarch ())->builtin_char,
+-			      NULL, val, -1, file, &opts);
+-	    fprintf_filtered (file, "\n");
+-	  }
+-	  break;
+-	}
++      gdbarch_print_auxv_entry (gdbarch, file, type, val);
+       ++ents;
+       if (type == AT_NULL)
+ 	break;
+diff --git gdb/auxv.h gdb/auxv.h
+index 9efe604..916f674 100644
+--- gdb/auxv.h
++++ gdb/auxv.h
+@@ -46,6 +46,20 @@ extern int target_auxv_parse (struct target_ops *ops,
+ extern int target_auxv_search (struct target_ops *ops,
+ 			       CORE_ADDR match, CORE_ADDR *valp);
+ 
++/* Print a description of a single AUXV entry on the specified file.  */
++enum auxv_format { AUXV_FORMAT_DEC, AUXV_FORMAT_HEX, AUXV_FORMAT_STR };
++
++extern void fprint_auxv_entry (struct ui_file *file, const char *name,
++			       const char *description,
++			       enum auxv_format format, CORE_ADDR type,
++			       CORE_ADDR val);
++
++/* The default implementation of gdbarch_print_auxv_entry.  */
++
++extern void default_print_auxv_entry (struct gdbarch *gdbarch,
++				      struct ui_file *file, CORE_ADDR type,
++				      CORE_ADDR val);
++
+ /* Print the contents of the target's AUXV on the specified file.  */
+ extern int fprint_target_auxv (struct ui_file *file, struct target_ops *ops);
+ 
+diff --git gdb/gdbarch.c gdb/gdbarch.c
+index 313502b..af7359e 100644
+--- gdb/gdbarch.c
++++ gdb/gdbarch.c
+@@ -47,6 +47,7 @@
+ #include "observer.h"
+ #include "regcache.h"
+ #include "objfiles.h"
++#include "auxv.h"
+ 
+ /* Static function declarations */
+ 
+@@ -328,6 +329,7 @@ struct gdbarch
+   gdbarch_insn_is_ret_ftype *insn_is_ret;
+   gdbarch_insn_is_jump_ftype *insn_is_jump;
+   gdbarch_auxv_parse_ftype *auxv_parse;
++  gdbarch_print_auxv_entry_ftype *print_auxv_entry;
+   gdbarch_vsyscall_range_ftype *vsyscall_range;
+   gdbarch_infcall_mmap_ftype *infcall_mmap;
+   gdbarch_infcall_munmap_ftype *infcall_munmap;
+@@ -432,6 +434,7 @@ gdbarch_alloc (const struct gdbarch_info *info,
+   gdbarch->insn_is_call = default_insn_is_call;
+   gdbarch->insn_is_ret = default_insn_is_ret;
+   gdbarch->insn_is_jump = default_insn_is_jump;
++  gdbarch->print_auxv_entry = default_print_auxv_entry;
+   gdbarch->vsyscall_range = default_vsyscall_range;
+   gdbarch->infcall_mmap = default_infcall_mmap;
+   gdbarch->infcall_munmap = default_infcall_munmap;
+@@ -678,6 +681,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
+   /* Skip verify of insn_is_ret, invalid_p == 0 */
+   /* Skip verify of insn_is_jump, invalid_p == 0 */
+   /* Skip verify of auxv_parse, has predicate.  */
++  /* Skip verify of print_auxv_entry, invalid_p == 0 */
+   /* Skip verify of vsyscall_range, invalid_p == 0 */
+   /* Skip verify of infcall_mmap, invalid_p == 0 */
+   /* Skip verify of infcall_munmap, invalid_p == 0 */
+@@ -1167,6 +1171,9 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
+                       "gdbarch_dump: pointer_to_address = <%s>\n",
+                       host_address_to_string (gdbarch->pointer_to_address));
+   fprintf_unfiltered (file,
++                      "gdbarch_dump: print_auxv_entry = <%s>\n",
++                      host_address_to_string (gdbarch->print_auxv_entry));
++  fprintf_unfiltered (file,
+                       "gdbarch_dump: print_float_info = <%s>\n",
+                       host_address_to_string (gdbarch->print_float_info));
+   fprintf_unfiltered (file,
+@@ -4769,6 +4776,23 @@ set_gdbarch_auxv_parse (struct gdbarch *gdbarch,
+   gdbarch->auxv_parse = auxv_parse;
+ }
+ 
++void
++gdbarch_print_auxv_entry (struct gdbarch *gdbarch, struct ui_file *file, CORE_ADDR type, CORE_ADDR val)
++{
++  gdb_assert (gdbarch != NULL);
++  gdb_assert (gdbarch->print_auxv_entry != NULL);
++  if (gdbarch_debug >= 2)
++    fprintf_unfiltered (gdb_stdlog, "gdbarch_print_auxv_entry called\n");
++  gdbarch->print_auxv_entry (gdbarch, file, type, val);
++}
++
++void
++set_gdbarch_print_auxv_entry (struct gdbarch *gdbarch,
++                              gdbarch_print_auxv_entry_ftype print_auxv_entry)
++{
++  gdbarch->print_auxv_entry = print_auxv_entry;
++}
++
+ int
+ gdbarch_vsyscall_range (struct gdbarch *gdbarch, struct mem_range *range)
+ {
+diff --git gdb/gdbarch.h gdb/gdbarch.h
+index a6366fc..bc0f692 100644
+--- gdb/gdbarch.h
++++ gdb/gdbarch.h
+@@ -1464,6 +1464,13 @@ typedef int (gdbarch_auxv_parse_ftype) (struct gdbarch *gdbarch, gdb_byte **read
+ extern int gdbarch_auxv_parse (struct gdbarch *gdbarch, gdb_byte **readptr, gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp);
+ extern void set_gdbarch_auxv_parse (struct gdbarch *gdbarch, gdbarch_auxv_parse_ftype *auxv_parse);
+ 
++/* Print the description of a single auxv entry described by TYPE and VAL
++   to FILE. */
++
++typedef void (gdbarch_print_auxv_entry_ftype) (struct gdbarch *gdbarch, struct ui_file *file, CORE_ADDR type, CORE_ADDR val);
++extern void gdbarch_print_auxv_entry (struct gdbarch *gdbarch, struct ui_file *file, CORE_ADDR type, CORE_ADDR val);
++extern void set_gdbarch_print_auxv_entry (struct gdbarch *gdbarch, gdbarch_print_auxv_entry_ftype *print_auxv_entry);
++
+ /* Find the address range of the current inferior's vsyscall/vDSO, and
+    write it to *RANGE.  If the vsyscall's length can't be determined, a
+    range with zero length is returned.  Returns true if the vsyscall is
+diff --git gdb/gdbarch.sh gdb/gdbarch.sh
+index f170c10..d8e0eeb 100755
+--- gdb/gdbarch.sh
++++ gdb/gdbarch.sh
+@@ -1110,6 +1110,10 @@ m:int:insn_is_jump:CORE_ADDR addr:addr::default_insn_is_jump::0
+ # Return 1 if an entry was read into *TYPEP and *VALP.
+ M:int:auxv_parse:gdb_byte **readptr, gdb_byte *endptr, CORE_ADDR *typep, CORE_ADDR *valp:readptr, endptr, typep, valp
+ 
++# Print the description of a single auxv entry described by TYPE and VAL
++# to FILE.
++m:void:print_auxv_entry:struct ui_file *file, CORE_ADDR type, CORE_ADDR val:file, type, val::default_print_auxv_entry::0
++
+ # Find the address range of the current inferior's vsyscall/vDSO, and
+ # write it to *RANGE.  If the vsyscall's length can't be determined, a
+ # range with zero length is returned.  Returns true if the vsyscall is
+@@ -1616,6 +1620,7 @@ cat <<EOF
+ #include "observer.h"
+ #include "regcache.h"
+ #include "objfiles.h"
++#include "auxv.h"
+ 
+ /* Static function declarations */
+ 

Added: head/devel/gdb/files/commit-3350c5f
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/gdb/files/commit-3350c5f	Fri Jul 15 01:10:15 2016	(r418566)
@@ -0,0 +1,39 @@
+commit 3350c5f5de3d2e62dd9de2a76cf2d5d8728d2600
+Author: John Baldwin <jhb at FreeBSD.org>
+Date:   Sun Jun 12 12:34:51 2016 -0700
+
+    Create a pseudo section for the ELF AUXV core dump note on FreeBSD.
+    
+    The procstat AUXV core dump note in FreeBSD consists of 32-bit integer
+    followed by an array of auxiliary vector entries.
+    
+    bfd/ChangeLog:
+    
+    	* elf.c (elfcore_grok_freebsd_note): Handle NT_FREEBSD_PROCSTAT_AUXV
+    	notes.
+
+diff --git bfd/elf.c bfd/elf.c
+index cfcafaa..cb4de50 100644
+--- bfd/elf.c
++++ bfd/elf.c
+@@ -9663,6 +9663,20 @@ elfcore_grok_freebsd_note (bfd *abfd, Elf_Internal_Note *note)
+       else
+ 	return TRUE;
+ 
++    case NT_FREEBSD_PROCSTAT_AUXV:
++      {
++	asection *sect = bfd_make_section_anyway_with_flags (abfd, ".auxv",
++							     SEC_HAS_CONTENTS);
++
++	if (sect == NULL)
++	  return FALSE;
++	sect->size = note->descsz - 4;
++	sect->filepos = note->descpos + 4;
++	sect->alignment_power = 1 + bfd_get_arch_size (abfd) / 32;
++
++	return TRUE;
++      }
++
+     case NT_X86_XSTATE:
+       if (note->namesz == 8)
+ 	return elfcore_grok_xstatereg (abfd, note);

Added: head/devel/gdb/files/commit-5077bff
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/gdb/files/commit-5077bff	Fri Jul 15 01:10:15 2016	(r418566)
@@ -0,0 +1,49 @@
+commit 5077bfff905136e9d9a8fdf0886f6217887622ad
+Author: John Baldwin <jhb at FreeBSD.org>
+Date:   Mon Jun 27 17:44:58 2016 -0700
+
+    Set debug registers on all threads belonging to the current inferior.
+    
+    gdb/ChangeLog:
+    
+    	* x86bsd-nat.c: Include 'gdbthread.h'.
+    	(x86bsd_dr_set): Set debug registers on all threads belonging to
+    	the current inferior.
+
+diff --git gdb/x86bsd-nat.c gdb/x86bsd-nat.c
+index 0c56848..bde25ab 100644
+--- gdb/x86bsd-nat.c
++++ gdb/x86bsd-nat.c
+@@ -19,6 +19,7 @@
+ 
+ #include "defs.h"
+ #include "inferior.h"
++#include "gdbthread.h"
+ 
+ /* We include <signal.h> to make sure `struct fxsave64' is defined on
+    NetBSD, since NetBSD's <machine/reg.h> needs it.  */
+@@ -71,6 +72,7 @@ x86bsd_dr_get (ptid_t ptid, int regnum)
+ static void
+ x86bsd_dr_set (int regnum, unsigned long value)
+ {
++  struct thread_info *thread;
+   struct dbreg dbregs;
+ 
+   if (ptrace (PT_GETDBREGS, get_ptrace_pid (inferior_ptid),
+@@ -84,9 +86,13 @@ x86bsd_dr_set (int regnum, unsigned long value)
+ 
+   DBREG_DRX ((&dbregs), regnum) = value;
+ 
+-  if (ptrace (PT_SETDBREGS, get_ptrace_pid (inferior_ptid),
+-              (PTRACE_TYPE_ARG3) &dbregs, 0) == -1)
+-    perror_with_name (_("Couldn't write debug registers"));
++  ALL_NON_EXITED_THREADS (thread)
++    if (thread->inf == current_inferior ())
++      {
++	if (ptrace (PT_SETDBREGS, get_ptrace_pid (thread->ptid),
++		    (PTRACE_TYPE_ARG3) &dbregs, 0) == -1)
++	  perror_with_name (_("Couldn't write debug registers"));
++      }
+ }
+ 
+ static void

Added: head/devel/gdb/files/commit-7697fc9
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/gdb/files/commit-7697fc9	Fri Jul 15 01:10:15 2016	(r418566)
@@ -0,0 +1,110 @@
+commit 7697fc9ec3a970f05abb836107653c46ada466ad
+Author: John Baldwin <jhb at FreeBSD.org>
+Date:   Sat Jun 11 15:07:38 2016 -0700
+
+    Fetch the ELF auxiliary vector from live processes on FreeBSD.
+    
+    Use the kern.proc.auxv.<pid> sysctl to fetch the ELF auxiliary vector for
+    a live process.
+    
+    gdb/ChangeLog:
+    
+    	* fbsd-nat.c [KERN_PROC_AUXV] New variable super_xfer_partial.
+    	(fbsd_xfer_partial): New function.
+    	(fbsd_nat_add_target) [KERN_PROC_AUXV] Set "to_xfer_partial" to
+    	"fbsd_xfer_partial".
+
+diff --git gdb/fbsd-nat.c gdb/fbsd-nat.c
+index b582abe..dc65e29 100644
+--- gdb/fbsd-nat.c
++++ gdb/fbsd-nat.c
+@@ -206,6 +206,78 @@ fbsd_find_memory_regions (struct target_ops *self,
+ }
+ #endif
+ 
++#ifdef KERN_PROC_AUXV
++static enum target_xfer_status (*super_xfer_partial) (struct target_ops *ops,
++						      enum target_object object,
++						      const char *annex,
++						      gdb_byte *readbuf,
++						      const gdb_byte *writebuf,
++						      ULONGEST offset,
++						      ULONGEST len,
++						      ULONGEST *xfered_len);
++
++/* Implement the "to_xfer_partial target_ops" method.  */
++
++static enum target_xfer_status
++fbsd_xfer_partial (struct target_ops *ops, enum target_object object,
++		   const char *annex, gdb_byte *readbuf,
++		   const gdb_byte *writebuf,
++		   ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
++{
++  pid_t pid = ptid_get_pid (inferior_ptid);
++
++  switch (object)
++    {
++    case TARGET_OBJECT_AUXV:
++      {
++	struct cleanup *cleanup = make_cleanup (null_cleanup, NULL);
++	unsigned char *buf;
++	size_t buflen;
++	int mib[4];
++
++	if (writebuf != NULL)
++	  return TARGET_XFER_E_IO;
++	mib[0] = CTL_KERN;
++	mib[1] = KERN_PROC;
++	mib[2] = KERN_PROC_AUXV;
++	mib[3] = pid;
++	if (offset == 0)
++	  {
++	    buf = readbuf;
++	    buflen = len;
++	  }
++	else
++	  {
++	    buflen = offset + len;
++	    buf = XCNEWVEC (unsigned char, buflen);
++	    cleanup = make_cleanup (xfree, buf);
++	  }
++	if (sysctl (mib, 4, buf, &buflen, NULL, 0) == 0)
++	  {
++	    if (offset != 0)
++	      {
++		if (buflen > offset)
++		  {
++		    buflen -= offset;
++		    memcpy (readbuf, buf + offset, buflen);
++		  }
++		else
++		  buflen = 0;
++	      }
++	    do_cleanups (cleanup);
++	    *xfered_len = buflen;
++	    return (buflen == 0) ? TARGET_XFER_EOF : TARGET_XFER_OK;
++	  }
++	do_cleanups (cleanup);
++	return TARGET_XFER_E_IO;
++      }
++    default:
++      return super_xfer_partial (ops, object, annex, readbuf, writebuf, offset,
++				 len, xfered_len);
++    }
++}
++#endif
++
+ #ifdef PT_LWPINFO
+ static int debug_fbsd_lwp;
+ 
+@@ -824,6 +896,10 @@ fbsd_nat_add_target (struct target_ops *t)
+ {
+   t->to_pid_to_exec_file = fbsd_pid_to_exec_file;
+   t->to_find_memory_regions = fbsd_find_memory_regions;
++#ifdef KERN_PROC_AUXV
++  super_xfer_partial = t->to_xfer_partial;
++  t->to_xfer_partial = fbsd_xfer_partial;
++#endif
+ #ifdef PT_LWPINFO
+   t->to_thread_alive = fbsd_thread_alive;
+   t->to_pid_to_str = fbsd_pid_to_str;

Added: head/devel/gdb/files/commit-82372b2
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/gdb/files/commit-82372b2	Fri Jul 15 01:10:15 2016	(r418566)
@@ -0,0 +1,74 @@
+commit 82372b2f2747d347e24bb10ddc7bc7e828222a42
+Author: John Baldwin <jhb at FreeBSD.org>
+Date:   Wed Jun 15 21:33:42 2016 -0700
+
+    Add a gdbarch 'print_auxv_entry' method for FreeBSD ABIs.
+    
+    Add a 'print_auxv_entry' method for FreeBSD ABIs that parses
+    FreeBSD-specific auxiliary vector entries and outputs a suitable
+    description using fprint_auxv_entry.
+    
+    gdb/ChangeLog:
+    
+    	* fbsd-tdep.c: Include "auxv.h".
+    	(fbsd_print_auxv_entry): New function.
+    	(fbsd_init_abi): Install gdbarch "print_auxv_entry" method.
+

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-ports-head mailing list