diff options
-rw-r--r-- | devel/gdb/Makefile | 22 | ||||
-rw-r--r-- | devel/gdb/files/commit-21002a6 | 102 | ||||
-rw-r--r-- | devel/gdb/files/commit-2c5c2a3 | 214 | ||||
-rw-r--r-- | devel/gdb/files/commit-2faa344 | 397 | ||||
-rw-r--r-- | devel/gdb/files/commit-3350c5f | 39 | ||||
-rw-r--r-- | devel/gdb/files/commit-5077bff | 49 | ||||
-rw-r--r-- | devel/gdb/files/commit-7697fc9 | 110 | ||||
-rw-r--r-- | devel/gdb/files/commit-82372b2 | 74 | ||||
-rw-r--r-- | devel/gdb/files/commit-8607ea6 | 165 | ||||
-rw-r--r-- | devel/gdb/files/commit-a3405d1 | 827 | ||||
-rw-r--r-- | devel/gdb/files/commit-aa1ed4a | 191 | ||||
-rw-r--r-- | devel/gdb/files/commit-b00f86d | 34 | ||||
-rw-r--r-- | devel/gdb/files/commit-bb2a62e | 27 | ||||
-rw-r--r-- | devel/gdb/files/commit-e6cdd38 | 644 | ||||
-rw-r--r-- | devel/gdb/files/commit-ee95032 | 24 | ||||
-rw-r--r-- | devel/gdb/pkg-plist | 15 |
16 files changed, 2932 insertions, 2 deletions
diff --git a/devel/gdb/Makefile b/devel/gdb/Makefile index d3190ba0129d..409fb9b66277 100644 --- a/devel/gdb/Makefile +++ b/devel/gdb/Makefile @@ -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 EOL creep in sometimes 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 powerpc64 armv6 # untested elsewhere, might w 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} diff --git a/devel/gdb/files/commit-21002a6 b/devel/gdb/files/commit-21002a6 new file mode 100644 index 000000000000..2307041c7599 --- /dev/null +++ b/devel/gdb/files/commit-21002a6 @@ -0,0 +1,102 @@ +commit 21002a635bf3da33367592e3a3ab3cce24fe5299 +Author: John Baldwin <jhb@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), diff --git a/devel/gdb/files/commit-2c5c2a3 b/devel/gdb/files/commit-2c5c2a3 new file mode 100644 index 000000000000..35bdb0354dca --- /dev/null +++ b/devel/gdb/files/commit-2c5c2a3 @@ -0,0 +1,214 @@ +commit 2c5c2a3321706c28cbf1b85a970a2e32912eb0c8 +Author: John Baldwin <jhb@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; diff --git a/devel/gdb/files/commit-2faa344 b/devel/gdb/files/commit-2faa344 new file mode 100644 index 000000000000..0d83a6a14813 --- /dev/null +++ b/devel/gdb/files/commit-2faa344 @@ -0,0 +1,397 @@ +commit 2faa34476d9e6120eaf389b7f91b7227183fa2ce +Author: John Baldwin <jhb@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 */ + diff --git a/devel/gdb/files/commit-3350c5f b/devel/gdb/files/commit-3350c5f new file mode 100644 index 000000000000..2e3526305c4b --- /dev/null +++ b/devel/gdb/files/commit-3350c5f @@ -0,0 +1,39 @@ +commit 3350c5f5de3d2e62dd9de2a76cf2d5d8728d2600 +Author: John Baldwin <jhb@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); diff --git a/devel/gdb/files/commit-5077bff b/devel/gdb/files/commit-5077bff new file mode 100644 index 000000000000..4b4f59d67cbf --- /dev/null +++ b/devel/gdb/files/commit-5077bff @@ -0,0 +1,49 @@ +commit 5077bfff905136e9d9a8fdf0886f6217887622ad +Author: John Baldwin <jhb@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 diff --git a/devel/gdb/files/commit-7697fc9 b/devel/gdb/files/commit-7697fc9 new file mode 100644 index 000000000000..2989d18b0c39 --- /dev/null +++ b/devel/gdb/files/commit-7697fc9 @@ -0,0 +1,110 @@ +commit 7697fc9ec3a970f05abb836107653c46ada466ad +Author: John Baldwin <jhb@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; diff --git a/devel/gdb/files/commit-82372b2 b/devel/gdb/files/commit-82372b2 new file mode 100644 index 000000000000..11b368140c3d --- /dev/null +++ b/devel/gdb/files/commit-82372b2 @@ -0,0 +1,74 @@ +commit 82372b2f2747d347e24bb10ddc7bc7e828222a42 +Author: John Baldwin <jhb@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 --git gdb/fbsd-tdep.c gdb/fbsd-tdep.c +index 7310ea0..e8f8605 100644 +--- gdb/fbsd-tdep.c ++++ gdb/fbsd-tdep.c +@@ -18,6 +18,7 @@ + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + + #include "defs.h" ++#include "auxv.h" + #include "gdbcore.h" + #include "inferior.h" + #include "regcache.h" +@@ -283,6 +284,39 @@ fbsd_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size) + return note_data; + } + ++/* Print descriptions of FreeBSD-specific AUXV entries to FILE. */ ++ ++static void ++fbsd_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; ++ ++ switch (type) ++ { ++#define _TAGNAME(tag) #tag ++#define TAGNAME(tag) _TAGNAME(AT_##tag) ++#define TAG(tag, text, kind) \ ++ case AT_FREEBSD_##tag: name = TAGNAME(tag); description = text; format = kind; break ++ TAG (EXECPATH, _("Executable path"), AUXV_FORMAT_STR); ++ TAG (CANARY, _("Canary for SSP"), AUXV_FORMAT_HEX); ++ TAG (CANARYLEN, ("Length of the SSP canary"), AUXV_FORMAT_DEC); ++ TAG (OSRELDATE, _("OSRELDATE"), AUXV_FORMAT_DEC); ++ TAG (NCPUS, _("Number of CPUs"), AUXV_FORMAT_DEC); ++ TAG (PAGESIZES, _("Pagesizes"), AUXV_FORMAT_HEX); ++ TAG (PAGESIZESLEN, _("Number of pagesizes"), AUXV_FORMAT_DEC); ++ TAG (TIMEKEEP, _("Pointer to timehands"), AUXV_FORMAT_HEX); ++ TAG (STACKPROT, _("Initial stack protection"), AUXV_FORMAT_HEX); ++ default: ++ default_print_auxv_entry (gdbarch, file, type, val); ++ return; ++ } ++ ++ fprint_auxv_entry (file, name, description, format, type, val); ++} ++ + /* To be called from GDB_OSABI_FREEBSD_ELF handlers. */ + + void +@@ -291,4 +325,5 @@ fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) + set_gdbarch_core_pid_to_str (gdbarch, fbsd_core_pid_to_str); + set_gdbarch_core_thread_name (gdbarch, fbsd_core_thread_name); + set_gdbarch_make_corefile_notes (gdbarch, fbsd_make_corefile_notes); ++ set_gdbarch_print_auxv_entry (gdbarch, fbsd_print_auxv_entry); + } diff --git a/devel/gdb/files/commit-8607ea6 b/devel/gdb/files/commit-8607ea6 new file mode 100644 index 000000000000..e392208169ad --- /dev/null +++ b/devel/gdb/files/commit-8607ea6 @@ -0,0 +1,165 @@ +commit 8607ea632c806235554aa2336cf01bf3758c1264 +Author: John Baldwin <jhb@FreeBSD.org> +Date: Fri Jun 24 21:06:36 2016 -0700 + + Move fbsd_resume and related functions below fork following helper code. + + gdb/ChangeLog: + + * fbsd-nat.c (super_resume): Move earlier next to "super_wait". + (resume_one_thread_cb): Move below fork following helper code. + (resume_all_threads_cb): Likewise. + (fbsd_resume): Likewise. + +diff --git gdb/fbsd-nat.c gdb/fbsd-nat.c +index 0999712..daf4580 100644 +--- gdb/fbsd-nat.c ++++ gdb/fbsd-nat.c +@@ -281,6 +281,10 @@ fbsd_xfer_partial (struct target_ops *ops, enum target_object object, + #ifdef PT_LWPINFO + static int debug_fbsd_lwp; + ++static void (*super_resume) (struct target_ops *, ++ ptid_t, ++ int, ++ enum gdb_signal); + static ptid_t (*super_wait) (struct target_ops *, + ptid_t, + struct target_waitstatus *, +@@ -492,70 +496,6 @@ fbsd_update_thread_list (struct target_ops *ops) + #endif + } + +-static void (*super_resume) (struct target_ops *, +- ptid_t, +- int, +- enum gdb_signal); +- +-static int +-resume_one_thread_cb (struct thread_info *tp, void *data) +-{ +- ptid_t *ptid = (ptid_t *) data; +- int request; +- +- if (ptid_get_pid (tp->ptid) != ptid_get_pid (*ptid)) +- return 0; +- +- if (ptid_get_lwp (tp->ptid) == ptid_get_lwp (*ptid)) +- request = PT_RESUME; +- else +- request = PT_SUSPEND; +- +- if (ptrace (request, ptid_get_lwp (tp->ptid), NULL, 0) == -1) +- perror_with_name (("ptrace")); +- return 0; +-} +- +-static int +-resume_all_threads_cb (struct thread_info *tp, void *data) +-{ +- ptid_t *filter = (ptid_t *) data; +- +- if (!ptid_match (tp->ptid, *filter)) +- return 0; +- +- if (ptrace (PT_RESUME, ptid_get_lwp (tp->ptid), NULL, 0) == -1) +- perror_with_name (("ptrace")); +- return 0; +-} +- +-/* Implement the "to_resume" target_ops method. */ +- +-static void +-fbsd_resume (struct target_ops *ops, +- ptid_t ptid, int step, enum gdb_signal signo) +-{ +- +- if (debug_fbsd_lwp) +- fprintf_unfiltered (gdb_stdlog, +- "FLWP: fbsd_resume for ptid (%d, %ld, %ld)\n", +- ptid_get_pid (ptid), ptid_get_lwp (ptid), +- ptid_get_tid (ptid)); +- if (ptid_lwp_p (ptid)) +- { +- /* If ptid is a specific LWP, suspend all other LWPs in the process. */ +- iterate_over_threads (resume_one_thread_cb, &ptid); +- } +- else +- { +- /* If ptid is a wildcard, resume all matching threads (they won't run +- until the process is continued however). */ +- iterate_over_threads (resume_all_threads_cb, &ptid); +- ptid = inferior_ptid; +- } +- super_resume (ops, ptid, step, signo); +-} +- + #ifdef TDP_RFPPWAIT + /* + To catch fork events, PT_FOLLOW_FORK is set on every traced process +@@ -638,6 +578,65 @@ fbsd_is_child_pending (pid_t pid) + } + #endif + ++static int ++resume_one_thread_cb (struct thread_info *tp, void *data) ++{ ++ ptid_t *ptid = (ptid_t *) data; ++ int request; ++ ++ if (ptid_get_pid (tp->ptid) != ptid_get_pid (*ptid)) ++ return 0; ++ ++ if (ptid_get_lwp (tp->ptid) == ptid_get_lwp (*ptid)) ++ request = PT_RESUME; ++ else ++ request = PT_SUSPEND; ++ ++ if (ptrace (request, ptid_get_lwp (tp->ptid), NULL, 0) == -1) ++ perror_with_name (("ptrace")); ++ return 0; ++} ++ ++static int ++resume_all_threads_cb (struct thread_info *tp, void *data) ++{ ++ ptid_t *filter = (ptid_t *) data; ++ ++ if (!ptid_match (tp->ptid, *filter)) ++ return 0; ++ ++ if (ptrace (PT_RESUME, ptid_get_lwp (tp->ptid), NULL, 0) == -1) ++ perror_with_name (("ptrace")); ++ return 0; ++} ++ ++/* Implement the "to_resume" target_ops method. */ ++ ++static void ++fbsd_resume (struct target_ops *ops, ++ ptid_t ptid, int step, enum gdb_signal signo) ++{ ++ ++ if (debug_fbsd_lwp) ++ fprintf_unfiltered (gdb_stdlog, ++ "FLWP: fbsd_resume for ptid (%d, %ld, %ld)\n", ++ ptid_get_pid (ptid), ptid_get_lwp (ptid), ++ ptid_get_tid (ptid)); ++ if (ptid_lwp_p (ptid)) ++ { ++ /* If ptid is a specific LWP, suspend all other LWPs in the process. */ ++ iterate_over_threads (resume_one_thread_cb, &ptid); ++ } ++ else ++ { ++ /* If ptid is a wildcard, resume all matching threads (they won't run ++ until the process is continued however). */ ++ iterate_over_threads (resume_all_threads_cb, &ptid); ++ ptid = inferior_ptid; ++ } ++ super_resume (ops, ptid, step, signo); ++} ++ + /* Wait for the child specified by PTID to do something. Return the + process ID of the child, or MINUS_ONE_PTID in case of error; store + the status in *OURSTATUS. */ diff --git a/devel/gdb/files/commit-a3405d1 b/devel/gdb/files/commit-a3405d1 new file mode 100644 index 000000000000..ae966365f8c8 --- /dev/null +++ b/devel/gdb/files/commit-a3405d1 @@ -0,0 +1,827 @@ +commit a3405d124e1388b613a35af49f19f0cc1b8d959d +Author: John Baldwin <jhb@FreeBSD.org> +Date: Mon Jun 27 13:19:09 2016 -0700 + + Consolidate x86 debug register code for BSD native targets. + + Move the debug register support code from amd64bsd-nat.c and + i386bsd-nat.c into a shared x86bsd-nat.c. + + Instead of setting up x86_dr_low in amd64fbsd-nat.c and + i386fbsd-nat.c, add a x86bsd_target function that creates a new target + that inherits from inf_ptrace and sets up x86 debug registers if + supported. In addition to initializing x86_dr_low, the x86bsd target + installs a custom mourn_inferior target operation to clean up the + x86 debug register state. Previously this was only done on amd64. + Now it will be done for both i386 and amd64. The i386bsd_target and + amd64bsd_target functions create targets that inherit from x86bsd + rather than inf_ptrace. + + gdb/ChangeLog: + + * Makefile.in [HFILES_NO_SRCDIR]: Replace 'amd64bsd-nat.h' with + 'x86bsd-nat.h'. + * amd64bsd-nat.c: Include 'x86bsd-nat.h' instead of + 'amd64bsd-nat.h'. + (amd64bsd_xsave_len): Rename and move to x86bsd-nat.c. + (amd64bsd_fetch_inferior_registers): Replace 'amd64bsd_xsave_len' + with 'x86bsd_xsave_len'. + (amd64bsd_store_inferior_registers): Likewise. + (amd64bsd_target): Inherit from x86bsd_target. + (amd64bsd_dr_get): Rename and move to x86bsd-nat.c. + (amd64bsd_dr_set): Likewise. + (amd64bsd_dr_set_control): Likewise. + (amd64bsd_dr_set_addr): Likewise. + (amd64bsd_dr_get_addr): Likewise. + (amd64bsd_dr_get_status): Likewise. + (amd64bsd_dr_get_control): Likewise. + * amd64fbsd-nat.c: Include 'x86bsd-nat.h' instead of + 'amd64bsd-nat.h'. + (super_mourn_inferior): Move to x86bsd-nat.c. + (amd64fbsd_mourn_inferior): Rename and move to x86bsd-nat.c. + (amd64fbsd_read_description): Replace 'amd64bsd_xsave_len' with + 'x86bsd_xsave_len'. + (_initialize_amd64fbsd_nat): Remove x86 watchpoint setup and + mourn_inferior' target op. + * config/i386/fbsd.mh (NATDEPFILES): Add x86bsd-nat.o. + * config/i386/fbsd64.mh: Likewise. + * config/i386/nbsd64.mh: Likewise. + * config/i386/nbsdelf.mh: Likewise. + * config/i386/obsd.mh: Likewise. + * config/i386/obsd64.mh: Likewise. + * i386bsd-nat.c: Include 'x86bsd-nat.h'. + (i386bsd_xsave_len): Rename and move to x86bsd-nat.c. + (i386bsd_fetch_inferior_registers): Replace 'i386bsd_xsave_len' + with 'x86bsd_xsave_len'. + (i386bsd_store_inferior_registers): Likewise. + (i386bsd_target): Inherit from x86bsd_target. + (i386bsd_dr_get): Rename and move to x86bsd-nat.c. + (i386bsd_dr_set): Likewise. + (i386bsd_dr_set_control): Likewise. + (i386bsd_dr_set_addr): Likewise. + (i386bsd_dr_get_addr): Likewise. + (i386bsd_dr_get_status): Likewise. + (i386bsd_dr_get_control): Likewise. + * i386bsd-nat.h (i386bsd_xsave_len): Remove. + (i386bsd_dr_set_control): Remove. + (i386bsd_dr_set_addr): Remove. + (i386bsd_dr_get_addr): Remove. + (i386bsd_dr_get_status): Remove. + (i386bsd_dr_get_control): Remove. + * i386fbsd-nat.c: Include 'x86bsd-nat.h'. + (i386fbsd_read_description): Replace 'i386bsd_xsave_len' with + 'x86bsd_xsave_len'. + (_initialize_i386fbsd_nat): Remove x86 watchpoint setup and + mourn_inferior' target op. + * x86bsd-nat.c: New file. + * x86bsd-nat.h: New file. + +diff --git gdb/Makefile.in gdb/Makefile.in +index 16d5f27..5af6103 100644 +--- gdb/Makefile.in ++++ gdb/Makefile.in +@@ -912,7 +912,7 @@ common/gdb_signals.h nat/gdb_thread_db.h common/gdb_vecs.h \ + common/x86-xstate.h nat/linux-ptrace.h nat/mips-linux-watch.h \ + proc-utils.h aarch64-tdep.h arm-tdep.h ax-gdb.h ppcfbsd-tdep.h \ + ppcnbsd-tdep.h cli-out.h gdb_expat.h breakpoint.h infcall.h obsd-tdep.h \ +-exec.h m32r-tdep.h osabi.h gdbcore.h amd64bsd-nat.h \ ++exec.h m32r-tdep.h osabi.h gdbcore.h x86bsd-nat.h \ + i386bsd-nat.h xml-support.h xml-tdesc.h alphabsd-tdep.h gdb_obstack.h \ + ia64-tdep.h ada-lang.h varobj.h varobj-iter.h frv-tdep.h \ + nto-tdep.h serial.h \ +diff --git gdb/amd64bsd-nat.c gdb/amd64bsd-nat.c +index e278a91..b87672a 100644 +--- gdb/amd64bsd-nat.c ++++ gdb/amd64bsd-nat.c +@@ -31,14 +31,10 @@ + + #include "amd64-tdep.h" + #include "amd64-nat.h" +-#include "amd64bsd-nat.h" ++#include "x86bsd-nat.h" + #include "inf-ptrace.h" + + +-#ifdef PT_GETXSTATE_INFO +-size_t amd64bsd_xsave_len; +-#endif +- + /* Fetch register REGNUM from the inferior. If REGNUM is -1, do this + for all registers (including the floating-point registers). */ + +@@ -67,9 +63,9 @@ amd64bsd_fetch_inferior_registers (struct target_ops *ops, + #ifdef PT_GETXSTATE_INFO + void *xstateregs; + +- if (amd64bsd_xsave_len != 0) ++ if (x86bsd_xsave_len != 0) + { +- xstateregs = alloca (amd64bsd_xsave_len); ++ xstateregs = alloca (x86bsd_xsave_len); + if (ptrace (PT_GETXSTATE, get_ptrace_pid (inferior_ptid), + (PTRACE_TYPE_ARG3) xstateregs, 0) == -1) + perror_with_name (_("Couldn't get extended state status")); +@@ -120,9 +116,9 @@ amd64bsd_store_inferior_registers (struct target_ops *ops, + #ifdef PT_GETXSTATE_INFO + void *xstateregs; + +- if (amd64bsd_xsave_len != 0) ++ if (x86bsd_xsave_len != 0) + { +- xstateregs = alloca (amd64bsd_xsave_len); ++ xstateregs = alloca (x86bsd_xsave_len); + if (ptrace (PT_GETXSTATE, get_ptrace_pid (inferior_ptid), + (PTRACE_TYPE_ARG3) xstateregs, 0) == -1) + perror_with_name (_("Couldn't get extended state status")); +@@ -130,7 +126,7 @@ amd64bsd_store_inferior_registers (struct target_ops *ops, + amd64_collect_xsave (regcache, regnum, xstateregs, 0); + + if (ptrace (PT_SETXSTATE, get_ptrace_pid (inferior_ptid), +- (PTRACE_TYPE_ARG3) xstateregs, amd64bsd_xsave_len) == -1) ++ (PTRACE_TYPE_ARG3) xstateregs, x86bsd_xsave_len) == -1) + perror_with_name (_("Couldn't write extended state status")); + return; + } +@@ -156,80 +152,8 @@ amd64bsd_target (void) + { + struct target_ops *t; + +- t = inf_ptrace_target (); ++ t = x86bsd_target (); + t->to_fetch_registers = amd64bsd_fetch_inferior_registers; + t->to_store_registers = amd64bsd_store_inferior_registers; + return t; + } +- +- +-/* Support for debug registers. */ +- +-#ifdef HAVE_PT_GETDBREGS +- +-static unsigned long +-amd64bsd_dr_get (ptid_t ptid, int regnum) +-{ +- struct dbreg dbregs; +- +- if (ptrace (PT_GETDBREGS, get_ptrace_pid (inferior_ptid), +- (PTRACE_TYPE_ARG3) &dbregs, 0) == -1) +- perror_with_name (_("Couldn't read debug registers")); +- +- return DBREG_DRX ((&dbregs), regnum); +-} +- +-static void +-amd64bsd_dr_set (int regnum, unsigned long value) +-{ +- struct dbreg dbregs; +- +- if (ptrace (PT_GETDBREGS, get_ptrace_pid (inferior_ptid), +- (PTRACE_TYPE_ARG3) &dbregs, 0) == -1) +- perror_with_name (_("Couldn't get debug registers")); +- +- /* For some mysterious reason, some of the reserved bits in the +- debug control register get set. Mask these off, otherwise the +- ptrace call below will fail. */ +- DBREG_DRX ((&dbregs), 7) &= ~(0xffffffff0000fc00); +- +- 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")); +-} +- +-void +-amd64bsd_dr_set_control (unsigned long control) +-{ +- amd64bsd_dr_set (7, control); +-} +- +-void +-amd64bsd_dr_set_addr (int regnum, CORE_ADDR addr) +-{ +- gdb_assert (regnum >= 0 && regnum <= 4); +- +- amd64bsd_dr_set (regnum, addr); +-} +- +-CORE_ADDR +-amd64bsd_dr_get_addr (int regnum) +-{ +- return amd64bsd_dr_get (inferior_ptid, regnum); +-} +- +-unsigned long +-amd64bsd_dr_get_status (void) +-{ +- return amd64bsd_dr_get (inferior_ptid, 6); +-} +- +-unsigned long +-amd64bsd_dr_get_control (void) +-{ +- return amd64bsd_dr_get (inferior_ptid, 7); +-} +- +-#endif /* PT_GETDBREGS */ +diff --git gdb/amd64bsd-nat.h gdb/amd64bsd-nat.h +deleted file mode 100644 +index f6a4022..0000000 +--- gdb/amd64bsd-nat.h ++++ /dev/null +@@ -1,38 +0,0 @@ +-/* Native-dependent code for AMD64 BSD's. +- +- Copyright (C) 2011-2016 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/>. */ +- +-#ifndef AMD64BSD_NAT_H +-#define AMD64BSD_NAT_H +- +-/* Low level amd64 XSAVE info. */ +-extern size_t amd64bsd_xsave_len; +- +-/* Low level amd64 debug register functions. */ +- +-extern void amd64bsd_dr_set_control (unsigned long control); +- +-extern void amd64bsd_dr_set_addr (int regnum, CORE_ADDR addr); +- +-extern CORE_ADDR amd64bsd_dr_get_addr (int regnum); +- +-extern unsigned long amd64bsd_dr_get_status (void); +- +-extern unsigned long amd64bsd_dr_get_control (void); +- +-#endif /* amd64bsd-nat.h */ +diff --git gdb/amd64fbsd-nat.c gdb/amd64fbsd-nat.c +index 63a7197..66c374c 100644 +--- gdb/amd64fbsd-nat.c ++++ gdb/amd64fbsd-nat.c +@@ -32,7 +32,7 @@ + #include "fbsd-nat.h" + #include "amd64-tdep.h" + #include "amd64-nat.h" +-#include "amd64bsd-nat.h" ++#include "x86bsd-nat.h" + #include "x86-nat.h" + + +@@ -140,17 +140,6 @@ amd64fbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) + } + + +-static void (*super_mourn_inferior) (struct target_ops *ops); +- +-static void +-amd64fbsd_mourn_inferior (struct target_ops *ops) +-{ +-#ifdef HAVE_PT_GETDBREGS +- x86_cleanup_dregs (); +-#endif +- super_mourn_inferior (ops); +-} +- + /* Implement the to_read_description method. */ + + static const struct target_desc * +@@ -175,13 +164,13 @@ amd64fbsd_read_description (struct target_ops *ops) + if (ptrace (PT_GETXSTATE_INFO, ptid_get_pid (inferior_ptid), + (PTRACE_TYPE_ARG3) &info, sizeof (info)) == 0) + { +- amd64bsd_xsave_len = info.xsave_len; ++ x86bsd_xsave_len = info.xsave_len; + xcr0 = info.xsave_mask; + } + xsave_probed = 1; + } + +- if (amd64bsd_xsave_len != 0) ++ if (x86bsd_xsave_len != 0) + { + if (is64) + return amd64_target_description (xcr0); +@@ -209,22 +198,6 @@ _initialize_amd64fbsd_nat (void) + + /* Add some extra features to the common *BSD/i386 target. */ + t = amd64bsd_target (); +- +-#ifdef HAVE_PT_GETDBREGS +- +- 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 */ +- +- super_mourn_inferior = t->to_mourn_inferior; +- t->to_mourn_inferior = amd64fbsd_mourn_inferior; + t->to_read_description = amd64fbsd_read_description; + + fbsd_nat_add_target (t); +diff --git gdb/config/i386/fbsd.mh gdb/config/i386/fbsd.mh +index e5bff3a..1db6660 100644 +--- gdb/config/i386/fbsd.mh ++++ gdb/config/i386/fbsd.mh +@@ -1,7 +1,7 @@ + # Host: FreeBSD/i386 + NATDEPFILES= fork-child.o inf-ptrace.o \ +- fbsd-nat.o x86-nat.o x86-dregs.o i386bsd-nat.o i386fbsd-nat.o \ +- bsd-kvm.o ++ fbsd-nat.o x86-nat.o x86-dregs.o x86bsd-nat.o i386bsd-nat.o \ ++ i386fbsd-nat.o bsd-kvm.o + NAT_FILE= nm-fbsd.h + HAVE_NATIVE_GCORE_HOST = 1 + +diff --git gdb/config/i386/fbsd64.mh gdb/config/i386/fbsd64.mh +index 329c526..e196c00 100644 +--- gdb/config/i386/fbsd64.mh ++++ gdb/config/i386/fbsd64.mh +@@ -1,7 +1,7 @@ + # Host: FreeBSD/amd64 + NATDEPFILES= fork-child.o inf-ptrace.o \ + fbsd-nat.o amd64-nat.o amd64bsd-nat.o amd64fbsd-nat.o \ +- bsd-kvm.o x86-nat.o x86-dregs.o ++ bsd-kvm.o x86-nat.o x86-dregs.o x86bsd-nat.o + HAVE_NATIVE_GCORE_HOST = 1 + + LOADLIBES= -lkvm +diff --git gdb/config/i386/nbsd64.mh gdb/config/i386/nbsd64.mh +index 5de8cf5..5fa369f 100644 +--- gdb/config/i386/nbsd64.mh ++++ gdb/config/i386/nbsd64.mh +@@ -1,3 +1,3 @@ + # Host: NetBSD/amd64 + NATDEPFILES= fork-child.o inf-ptrace.o \ +- nbsd-nat.o amd64-nat.o amd64bsd-nat.o amd64nbsd-nat.o ++ nbsd-nat.o amd64-nat.o x86bsd-nat.o amd64bsd-nat.o amd64nbsd-nat.o +diff --git gdb/config/i386/nbsdelf.mh gdb/config/i386/nbsdelf.mh +index d27c842..f8b9d6c 100644 +--- gdb/config/i386/nbsdelf.mh ++++ gdb/config/i386/nbsdelf.mh +@@ -1,5 +1,5 @@ + # Host: NetBSD/i386 ELF + NATDEPFILES= fork-child.o inf-ptrace.o \ +- nbsd-nat.o i386bsd-nat.o i386nbsd-nat.o bsd-kvm.o ++ nbsd-nat.o x86bsd-nat.o i386bsd-nat.o i386nbsd-nat.o bsd-kvm.o + + LOADLIBES= -lkvm +diff --git gdb/config/i386/obsd.mh gdb/config/i386/obsd.mh +index a9041f4..3845d26 100644 +--- gdb/config/i386/obsd.mh ++++ gdb/config/i386/obsd.mh +@@ -1,5 +1,5 @@ + # Host: OpenBSD/i386 ELF + NATDEPFILES= fork-child.o inf-ptrace.o obsd-nat.o \ +- i386bsd-nat.o i386obsd-nat.o bsd-kvm.o ++ x86bsd-nat.o i386bsd-nat.o i386obsd-nat.o bsd-kvm.o + + LOADLIBES= -lkvm +diff --git gdb/config/i386/obsd64.mh gdb/config/i386/obsd64.mh +index 386a582..2a8c42c 100644 +--- gdb/config/i386/obsd64.mh ++++ gdb/config/i386/obsd64.mh +@@ -1,5 +1,5 @@ + # Host: OpenBSD/amd64 + NATDEPFILES= fork-child.o inf-ptrace.o obsd-nat.o \ +- amd64-nat.o amd64bsd-nat.o amd64obsd-nat.o bsd-kvm.o ++ amd64-nat.o x86bsd-nat.o amd64bsd-nat.o amd64obsd-nat.o bsd-kvm.o + + LOADLIBES= -lkvm +diff --git gdb/i386bsd-nat.c gdb/i386bsd-nat.c +index f5f4a0f..b6b143b 100644 +--- gdb/i386bsd-nat.c ++++ gdb/i386bsd-nat.c +@@ -29,6 +29,7 @@ + + #include "i386-tdep.h" + #include "i387-tdep.h" ++#include "x86bsd-nat.h" + #include "i386bsd-nat.h" + #include "inf-ptrace.h" + +@@ -81,10 +82,6 @@ static int i386bsd_r_reg_offset[] = + so that we try PT_GETXMMREGS the first time around. */ + static int have_ptrace_xmmregs = -1; + #endif +- +-#ifdef PT_GETXSTATE_INFO +-size_t i386bsd_xsave_len; +-#endif + + + /* Supply the general-purpose registers in GREGS, to REGCACHE. */ +@@ -155,11 +152,11 @@ i386bsd_fetch_inferior_registers (struct target_ops *ops, + #endif + + #ifdef PT_GETXSTATE_INFO +- if (i386bsd_xsave_len != 0) ++ if (x86bsd_xsave_len != 0) + { + void *xstateregs; + +- xstateregs = alloca (i386bsd_xsave_len); ++ xstateregs = alloca (x86bsd_xsave_len); + if (ptrace (PT_GETXSTATE, get_ptrace_pid (inferior_ptid), + (PTRACE_TYPE_ARG3) xstateregs, 0) == -1) + perror_with_name (_("Couldn't get extended state status")); +@@ -225,11 +222,11 @@ i386bsd_store_inferior_registers (struct target_ops *ops, + #endif + + #ifdef PT_GETXSTATE_INFO +- if (i386bsd_xsave_len != 0) ++ if (x86bsd_xsave_len != 0) + { + void *xstateregs; + +- xstateregs = alloca (i386bsd_xsave_len); ++ xstateregs = alloca (x86bsd_xsave_len); + if (ptrace (PT_GETXSTATE, get_ptrace_pid (inferior_ptid), + (PTRACE_TYPE_ARG3) xstateregs, 0) == -1) + perror_with_name (_("Couldn't get extended state status")); +@@ -237,7 +234,7 @@ i386bsd_store_inferior_registers (struct target_ops *ops, + i387_collect_xsave (regcache, -1, xstateregs, 0); + + if (ptrace (PT_SETXSTATE, get_ptrace_pid (inferior_ptid), +- (PTRACE_TYPE_ARG3) xstateregs, i386bsd_xsave_len) == -1) ++ (PTRACE_TYPE_ARG3) xstateregs, x86bsd_xsave_len) == -1) + perror_with_name (_("Couldn't write extended state status")); + return; + } +@@ -283,91 +280,13 @@ i386bsd_target (void) + { + struct target_ops *t; + +- t = inf_ptrace_target (); ++ t = x86bsd_target (); + t->to_fetch_registers = i386bsd_fetch_inferior_registers; + t->to_store_registers = i386bsd_store_inferior_registers; + return t; + } + + +-/* Support for debug registers. */ +- +-#ifdef HAVE_PT_GETDBREGS +- +-/* Not all versions of FreeBSD/i386 that support the debug registers +- have this macro. */ +-#ifndef DBREG_DRX +-#define DBREG_DRX(d, x) ((&d->dr0)[x]) +-#endif +- +-static unsigned long +-i386bsd_dr_get (ptid_t ptid, int regnum) +-{ +- struct dbreg dbregs; +- +- if (ptrace (PT_GETDBREGS, get_ptrace_pid (inferior_ptid), +- (PTRACE_TYPE_ARG3) &dbregs, 0) == -1) +- perror_with_name (_("Couldn't read debug registers")); +- +- return DBREG_DRX ((&dbregs), regnum); +-} +- +-static void +-i386bsd_dr_set (int regnum, unsigned int value) +-{ +- struct dbreg dbregs; +- +- if (ptrace (PT_GETDBREGS, get_ptrace_pid (inferior_ptid), +- (PTRACE_TYPE_ARG3) &dbregs, 0) == -1) +- perror_with_name (_("Couldn't get debug registers")); +- +- /* For some mysterious reason, some of the reserved bits in the +- debug control register get set. Mask these off, otherwise the +- ptrace call below will fail. */ +- DBREG_DRX ((&dbregs), 7) &= ~(0x0000fc00); +- +- 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")); +-} +- +-void +-i386bsd_dr_set_control (unsigned long control) +-{ +- i386bsd_dr_set (7, control); +-} +- +-void +-i386bsd_dr_set_addr (int regnum, CORE_ADDR addr) +-{ +- gdb_assert (regnum >= 0 && regnum <= 4); +- +- i386bsd_dr_set (regnum, addr); +-} +- +-CORE_ADDR +-i386bsd_dr_get_addr (int regnum) +-{ +- return i386bsd_dr_get (inferior_ptid, regnum); +-} +- +-unsigned long +-i386bsd_dr_get_status (void) +-{ +- return i386bsd_dr_get (inferior_ptid, 6); +-} +- +-unsigned long +-i386bsd_dr_get_control (void) +-{ +- return i386bsd_dr_get (inferior_ptid, 7); +-} +- +-#endif /* PT_GETDBREGS */ +- +- + /* Provide a prototype to silence -Wmissing-prototypes. */ + void _initialize_i386bsd_nat (void); + +diff --git gdb/i386bsd-nat.h gdb/i386bsd-nat.h +index 78ea551..1b51d19 100644 +--- gdb/i386bsd-nat.h ++++ gdb/i386bsd-nat.h +@@ -25,19 +25,4 @@ + + extern struct target_ops *i386bsd_target (void); + +-/* Low level i386 XSAVE info. */ +-extern size_t i386bsd_xsave_len; +- +-/* low level i386 debug register functions used in i386fbsd-nat.c. */ +- +-extern void i386bsd_dr_set_control (unsigned long control); +- +-extern void i386bsd_dr_set_addr (int regnum, CORE_ADDR addr); +- +-extern CORE_ADDR i386bsd_dr_get_addr (int regnum); +- +-extern unsigned long i386bsd_dr_get_status (void); +- +-extern unsigned long i386bsd_dr_get_control (void); +- + #endif /* i386bsd-nat.h */ +diff --git gdb/i386fbsd-nat.c gdb/i386fbsd-nat.c +index 7d371a6..716b513 100644 +--- gdb/i386fbsd-nat.c ++++ gdb/i386fbsd-nat.c +@@ -30,6 +30,7 @@ + #include "fbsd-nat.h" + #include "i386-tdep.h" + #include "x86-nat.h" ++#include "x86bsd-nat.h" + #include "i386bsd-nat.h" + + /* Resume execution of the inferior process. If STEP is nonzero, +@@ -132,13 +133,13 @@ i386fbsd_read_description (struct target_ops *ops) + if (ptrace (PT_GETXSTATE_INFO, ptid_get_pid (inferior_ptid), + (PTRACE_TYPE_ARG3) &info, sizeof (info)) == 0) + { +- i386bsd_xsave_len = info.xsave_len; ++ x86bsd_xsave_len = info.xsave_len; + xcr0 = info.xsave_mask; + } + xsave_probed = 1; + } + +- if (i386bsd_xsave_len != 0) ++ if (x86bsd_xsave_len != 0) + { + return i386_target_description (xcr0); + } +@@ -158,19 +159,6 @@ _initialize_i386fbsd_nat (void) + /* Add some extra features to the common *BSD/i386 target. */ + t = i386bsd_target (); + +-#ifdef HAVE_PT_GETDBREGS +- +- x86_use_watchpoints (t); +- +- x86_dr_low.set_control = i386bsd_dr_set_control; +- x86_dr_low.set_addr = i386bsd_dr_set_addr; +- x86_dr_low.get_addr = i386bsd_dr_get_addr; +- x86_dr_low.get_status = i386bsd_dr_get_status; +- x86_dr_low.get_control = i386bsd_dr_get_control; +- x86_set_debug_register_length (4); +- +-#endif /* HAVE_PT_GETDBREGS */ +- + #ifdef PT_GETXSTATE_INFO + t->to_read_description = i386fbsd_read_description; + #endif +diff --git gdb/x86bsd-nat.c gdb/x86bsd-nat.c +new file mode 100644 +index 0000000..0c56848 +--- /dev/null ++++ gdb/x86bsd-nat.c +@@ -0,0 +1,150 @@ ++/* Native-dependent code for X86 BSD's. ++ ++ Copyright (C) 2003-2016 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" ++ ++/* We include <signal.h> to make sure `struct fxsave64' is defined on ++ NetBSD, since NetBSD's <machine/reg.h> needs it. */ ++#include <signal.h> ++#include <sys/types.h> ++#include <sys/ptrace.h> ++#include <machine/reg.h> ++ ++#include "x86-nat.h" ++#include "x86bsd-nat.h" ++#include "inf-ptrace.h" ++ ++ ++#ifdef PT_GETXSTATE_INFO ++size_t x86bsd_xsave_len; ++#endif ++ ++/* Support for debug registers. */ ++ ++#ifdef HAVE_PT_GETDBREGS ++static void (*super_mourn_inferior) (struct target_ops *ops); ++ ++/* Implement the "to_mourn_inferior" target_ops method. */ ++ ++static void ++x86bsd_mourn_inferior (struct target_ops *ops) ++{ ++ x86_cleanup_dregs (); ++ super_mourn_inferior (ops); ++} ++ ++/* Not all versions of FreeBSD/i386 that support the debug registers ++ have this macro. */ ++#ifndef DBREG_DRX ++#define DBREG_DRX(d, x) ((&d->dr0)[x]) ++#endif ++ ++static unsigned long ++x86bsd_dr_get (ptid_t ptid, int regnum) ++{ ++ struct dbreg dbregs; ++ ++ if (ptrace (PT_GETDBREGS, get_ptrace_pid (inferior_ptid), ++ (PTRACE_TYPE_ARG3) &dbregs, 0) == -1) ++ perror_with_name (_("Couldn't read debug registers")); ++ ++ return DBREG_DRX ((&dbregs), regnum); ++} ++ ++static void ++x86bsd_dr_set (int regnum, unsigned long value) ++{ ++ struct dbreg dbregs; ++ ++ if (ptrace (PT_GETDBREGS, get_ptrace_pid (inferior_ptid), ++ (PTRACE_TYPE_ARG3) &dbregs, 0) == -1) ++ perror_with_name (_("Couldn't get debug registers")); ++ ++ /* For some mysterious reason, some of the reserved bits in the ++ debug control register get set. Mask these off, otherwise the ++ ptrace call below will fail. */ ++ DBREG_DRX ((&dbregs), 7) &= ~(0xffffffff0000fc00); ++ ++ 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")); ++} ++ ++static void ++x86bsd_dr_set_control (unsigned long control) ++{ ++ x86bsd_dr_set (7, control); ++} ++ ++static void ++x86bsd_dr_set_addr (int regnum, CORE_ADDR addr) ++{ ++ gdb_assert (regnum >= 0 && regnum <= 4); ++ ++ x86bsd_dr_set (regnum, addr); ++} ++ ++static CORE_ADDR ++x86bsd_dr_get_addr (int regnum) ++{ ++ return x86bsd_dr_get (inferior_ptid, regnum); ++} ++ ++static unsigned long ++x86bsd_dr_get_status (void) ++{ ++ return x86bsd_dr_get (inferior_ptid, 6); ++} ++ ++static unsigned long ++x86bsd_dr_get_control (void) ++{ ++ return x86bsd_dr_get (inferior_ptid, 7); ++} ++ ++#endif /* PT_GETDBREGS */ ++ ++/* Create a prototype *BSD/x86 target. The client can override it ++ with local methods. */ ++ ++struct target_ops * ++x86bsd_target (void) ++{ ++ struct target_ops *t; ++ ++ t = inf_ptrace_target (); ++ ++#ifdef HAVE_PT_GETDBREGS ++ x86_use_watchpoints (t); ++ ++ x86_dr_low.set_control = x86bsd_dr_set_control; ++ x86_dr_low.set_addr = x86bsd_dr_set_addr; ++ x86_dr_low.get_addr = x86bsd_dr_get_addr; ++ x86_dr_low.get_status = x86bsd_dr_get_status; ++ x86_dr_low.get_control = x86bsd_dr_get_control; ++ x86_set_debug_register_length (sizeof (void *)); ++ super_mourn_inferior = t->to_mourn_inferior; ++ t->to_mourn_inferior = x86bsd_mourn_inferior; ++#endif /* HAVE_PT_GETDBREGS */ ++ ++ return t; ++} +diff --git gdb/x86bsd-nat.h gdb/x86bsd-nat.h +new file mode 100644 +index 0000000..6d39697 +--- /dev/null ++++ gdb/x86bsd-nat.h +@@ -0,0 +1,31 @@ ++/* Native-dependent code for x86 BSD's. ++ ++ Copyright (C) 2011-2016 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/>. */ ++ ++#ifndef X86BSD_NAT_H ++#define X86BSD_NAT_H ++ ++/* Low level x86 XSAVE info. */ ++extern size_t x86bsd_xsave_len; ++ ++/* Create a prototype *BSD/x86 target. The client can override it ++ with local methods. */ ++ ++extern struct target_ops *x86bsd_target (void); ++ ++#endif /* x86bsd-nat.h */ diff --git a/devel/gdb/files/commit-aa1ed4a b/devel/gdb/files/commit-aa1ed4a new file mode 100644 index 000000000000..ef845e4a9b51 --- /dev/null +++ b/devel/gdb/files/commit-aa1ed4a @@ -0,0 +1,191 @@ +commit aa1ed4a93a2eb0fb90d274c15288f3aad1791f60 +Author: John Baldwin <jhb@FreeBSD.org> +Date: Sun Jun 12 08:56:31 2016 -0700 + + Add elfcore_grok_freebsd_note to parse FreeBSD ELF core notes. + + Move parsing of FreeBSD-specific ELF core notes out of elfcore_grok_note + into a new elfcore_grok_freebsd_note function. Add core note grok routines + for FreeBSD's psinfo and prstatus notes while here rather than depending + on the native handling in elfcore_grok_note. + + bfd/ChangeLog: + + * elf.c (elfcore_grok_note): Remove handling of NT_X86_XSTATE for + FreeBSD. Remove case for NT_FREEBSD_THRMISC. + (elfcore_grok_freebsd_psinfo): New function. + (elfcore_grok_freebsd_prstatus): New function. + (elfcore_grok_freebsd_note): New function. + (elf_parse_notes): Use "elfcore_grok_freebsd_note" for "FreeBSD" + notes. + +diff --git bfd/elf.c bfd/elf.c +index aaf2b53..cfcafaa 100644 +--- bfd/elf.c ++++ bfd/elf.c +@@ -9327,9 +9327,6 @@ elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note) + if (note->namesz == 6 + && strcmp (note->namedata, "LINUX") == 0) + return elfcore_grok_xstatereg (abfd, note); +- else if (note->namesz == 8 +- && strcmp (note->namedata, "FreeBSD") == 0) +- return elfcore_grok_xstatereg (abfd, note); + else + return TRUE; + +@@ -9485,12 +9482,6 @@ elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note) + return elfcore_make_note_pseudosection (abfd, ".note.linuxcore.siginfo", + note); + +- case NT_FREEBSD_THRMISC: +- if (note->namesz == 8 +- && strcmp (note->namedata, "FreeBSD") == 0) +- return elfcore_make_note_pseudosection (abfd, ".thrmisc", note); +- else +- return TRUE; + } + } + +@@ -9556,6 +9547,134 @@ elfobj_grok_stapsdt_note (bfd *abfd, Elf_Internal_Note *note) + } + + static bfd_boolean ++elfcore_grok_freebsd_psinfo (bfd *abfd, Elf_Internal_Note *note) ++{ ++ size_t offset; ++ ++ /* Check for version 1 in pr_version. */ ++ if (bfd_h_get_32 (abfd, (bfd_byte *) note->descdata) != 1) ++ return FALSE; ++ offset = 4; ++ ++ /* Skip over pr_psinfosz. */ ++ switch (abfd->arch_info->bits_per_word) ++ { ++ case 32: ++ offset += 4; ++ break; ++ ++ case 64: ++ offset += 4; /* Padding before pr_psinfosz. */ ++ offset += 8; ++ break; ++ ++ default: ++ return FALSE; ++ } ++ ++ /* pr_fname is PRFNAMESZ (16) + 1 bytes in size. */ ++ elf_tdata (abfd)->core->program ++ = _bfd_elfcore_strndup (abfd, note->descdata + offset, 17); ++ offset += 17; ++ ++ /* pr_psargs is PRARGSZ (80) + 1 bytes in size. */ ++ elf_tdata (abfd)->core->command ++ = _bfd_elfcore_strndup (abfd, note->descdata + offset, 81); ++ ++ return TRUE; ++} ++ ++static bfd_boolean ++elfcore_grok_freebsd_prstatus (bfd *abfd, Elf_Internal_Note *note) ++{ ++ size_t offset; ++ size_t size; ++ ++ /* Check for version 1 in pr_version. */ ++ if (bfd_h_get_32 (abfd, (bfd_byte *) note->descdata) != 1) ++ return FALSE; ++ offset = 4; ++ ++ /* Skip over pr_statussz. */ ++ switch (abfd->arch_info->bits_per_word) ++ { ++ case 32: ++ offset += 4; ++ break; ++ ++ case 64: ++ offset += 4; /* Padding before pr_statussz. */ ++ offset += 8; ++ break; ++ ++ default: ++ return FALSE; ++ } ++ ++ /* Extract size of pr_reg from pr_gregsetsz. */ ++ if (abfd->arch_info->bits_per_word == 32) ++ size = bfd_h_get_32 (abfd, (bfd_byte *) note->descdata + offset); ++ else ++ size = bfd_h_get_64 (abfd, (bfd_byte *) note->descdata + offset); ++ ++ /* Skip over pr_gregsetsz and pr_fpregsetsz. */ ++ offset += (abfd->arch_info->bits_per_word / 8) * 2; ++ ++ /* Skip over pr_osreldate. */ ++ offset += 4; ++ ++ /* Read signal from pr_cursig. */ ++ if (elf_tdata (abfd)->core->signal == 0) ++ elf_tdata (abfd)->core->signal ++ = bfd_h_get_32 (abfd, (bfd_byte *) note->descdata + offset); ++ offset += 4; ++ ++ /* Read TID from pr_pid. */ ++ elf_tdata (abfd)->core->lwpid ++ = bfd_h_get_32 (abfd, (bfd_byte *) note->descdata + offset); ++ offset += 4; ++ ++ /* Padding before pr_reg. */ ++ if (abfd->arch_info->bits_per_word == 64) ++ offset += 4; ++ ++ /* Make a ".reg/999" section and a ".reg" section. */ ++ return _bfd_elfcore_make_pseudosection (abfd, ".reg", ++ size, note->descpos + offset); ++} ++ ++static bfd_boolean ++elfcore_grok_freebsd_note (bfd *abfd, Elf_Internal_Note *note) ++{ ++ switch (note->type) ++ { ++ case NT_PRSTATUS: ++ return elfcore_grok_freebsd_prstatus (abfd, note); ++ ++ case NT_FPREGSET: ++ return elfcore_grok_prfpreg (abfd, note); ++ ++ case NT_PRPSINFO: ++ return elfcore_grok_freebsd_psinfo (abfd, note); ++ ++ case NT_FREEBSD_THRMISC: ++ if (note->namesz == 8) ++ return elfcore_make_note_pseudosection (abfd, ".thrmisc", note); ++ else ++ return TRUE; ++ ++ case NT_X86_XSTATE: ++ if (note->namesz == 8) ++ return elfcore_grok_xstatereg (abfd, note); ++ else ++ return TRUE; ++ ++ default: ++ return TRUE; ++ } ++} ++ ++static bfd_boolean + elfcore_netbsd_get_lwpid (Elf_Internal_Note *note, int *lwpidp) + { + char *cp; +@@ -10467,6 +10586,7 @@ elf_parse_notes (bfd *abfd, char *buf, size_t size, file_ptr offset) + grokers[] = + { + GROKER_ELEMENT ("", elfcore_grok_note), ++ GROKER_ELEMENT ("FreeBSD", elfcore_grok_freebsd_note), + GROKER_ELEMENT ("NetBSD-CORE", elfcore_grok_netbsd_note), + GROKER_ELEMENT ( "OpenBSD", elfcore_grok_openbsd_note), + GROKER_ELEMENT ("QNX", elfcore_grok_nto_note), diff --git a/devel/gdb/files/commit-b00f86d b/devel/gdb/files/commit-b00f86d new file mode 100644 index 000000000000..d38125d37423 --- /dev/null +++ b/devel/gdb/files/commit-b00f86d @@ -0,0 +1,34 @@ +commit b00f86d0720d2cf44f3edb6101682074da1abe5d +Author: John Baldwin <jhb@FreeBSD.org> +Date: Wed Jun 15 22:44:11 2016 -0700 + + Add constants for FreeBSD-specific auxiliary vector entry types. + + include/ChangeLog: + + * elf/common.h (AT_FREEBSD_EXECPATH, AT_FREEBSD_CANARY) + (AT_FREEBSD_CANARYLEN, AT_FREEBSD_OSRELDATE, AT_FREEBSD_NCPUS) + (AT_FREEBSD_PAGESIZES, AT_FREEBSD_PAGESIZESLEN) + (AT_FREEBSD_TIMEKEEP, AT_FREEBSD_STACKPROT): Define. + +diff --git include/elf/common.h include/elf/common.h +index 087d876..d2da009d 100644 +--- include/elf/common.h ++++ include/elf/common.h +@@ -1012,6 +1012,16 @@ + #define AT_L2_CACHESHAPE 36 + #define AT_L3_CACHESHAPE 37 + ++#define AT_FREEBSD_EXECPATH 15 /* Path to the executable. */ ++#define AT_FREEBSD_CANARY 16 /* Canary for SSP. */ ++#define AT_FREEBSD_CANARYLEN 17 /* Length of the canary. */ ++#define AT_FREEBSD_OSRELDATE 18 /* OSRELDATE. */ ++#define AT_FREEBSD_NCPUS 19 /* Number of CPUs. */ ++#define AT_FREEBSD_PAGESIZES 20 /* Pagesizes. */ ++#define AT_FREEBSD_PAGESIZESLEN 21 /* Number of pagesizes. */ ++#define AT_FREEBSD_TIMEKEEP 22 /* Pointer to timehands. */ ++#define AT_FREEBSD_STACKPROT 23 /* Initial stack protection. */ ++ + #define AT_SUN_UID 2000 /* Effective user ID. */ + #define AT_SUN_RUID 2001 /* Real user ID. */ + #define AT_SUN_GID 2002 /* Effective group ID. */ diff --git a/devel/gdb/files/commit-bb2a62e b/devel/gdb/files/commit-bb2a62e new file mode 100644 index 000000000000..641d2e22f1bb --- /dev/null +++ b/devel/gdb/files/commit-bb2a62e @@ -0,0 +1,27 @@ +commit bb2a62e694953c099c41d49f59947d3d91cc7c27 +Author: John Baldwin <jhb@FreeBSD.org> +Date: Fri Jun 24 18:24:21 2016 -0700 + + Honor detach-on-fork on FreeBSD. + + Only detach from the new child process in the follow fork callback + if detach_fork is true. + + gdb/ChangeLog: + + * fbsd-nat.c (fbsd_follow_fork): Only detach child if + "detach_fork" is true. + +diff --git gdb/fbsd-nat.c gdb/fbsd-nat.c +index c9548e9..0999712 100644 +--- gdb/fbsd-nat.c ++++ gdb/fbsd-nat.c +@@ -826,7 +826,7 @@ static int + fbsd_follow_fork (struct target_ops *ops, int follow_child, + int detach_fork) + { +- if (!follow_child) ++ if (!follow_child && detach_fork) + { + struct thread_info *tp = inferior_thread (); + pid_t child_pid = ptid_get_pid (tp->pending_follow.value.related_pid); diff --git a/devel/gdb/files/commit-e6cdd38 b/devel/gdb/files/commit-e6cdd38 new file mode 100644 index 000000000000..313f3b37d469 --- /dev/null +++ b/devel/gdb/files/commit-e6cdd38 @@ -0,0 +1,644 @@ +commit e6cdd38e8f0fead14cd3c528e9a4b666e1871752 +Author: John Baldwin <jhb@FreeBSD.org> +Date: Sun Jun 12 21:24:42 2016 -0700 + + Add support for catching system calls to native FreeBSD targets. + + All platforms on FreeBSD use a shared system call table, so use a + single XML file to describe the system calls available on each FreeBSD + platform. + + Recent versions of FreeBSD include the identifier of the current + system call when reporting a system call entry or exit event in the + ptrace_lwpinfo structure obtained via PT_LWPINFO in fbsd_wait. As + such, FreeBSD native targets do not use the gdbarch method to fetch + the system call code. In addition, FreeBSD register sets fetched via + ptrace do not include an equivalent of 'orig_rax' (on amd64 for + example), so the system call code cannot be extracted from the + available registers during a system call exit. However, GDB assumes + that system call catch points are not supported if the gdbarch method + is not present. As a workaround, FreeBSD ABIs install a dummy gdbarch + method that throws an internal_error if it is ever invoked. + + gdb/ChangeLog: + + * configure.ac: Check for support for system call LWP fields on + FreeBSD. + * config.in, configure: Rebuild. + * data-directory/Makefile.in (SYSCALLS_FILES): Add freebsd.xml. + * fbsd-nat.c (fbsd_wait) [HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE]: + Report system call events. + [HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE] + (fbsd_set_syscall_catchpoint): New function. + (fbsd_nat_add_target) [HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE]: + Set "to_set_syscall_catchpoint" to "fbsd_set_syscall_catchpoint". + * fbsd-tdep.c: Include xml-syscall.h + (fbsd_get_syscall_number): New function. + (fbsd_init_abi): Set XML system call file name. + Add "get_syscall_number" gdbarch method. + * syscalls/freebsd.xml: New file. + +diff --git gdb/config.in gdb/config.in +index 905caf0..c82a5b4 100644 +--- gdb/config.in ++++ gdb/config.in +@@ -456,6 +456,9 @@ + /* Define to 1 if `struct ptrace_lwpinfo' is a member of `pl_tdname'. */ + #undef HAVE_STRUCT_PTRACE_LWPINFO_PL_TDNAME + ++/* Define to 1 if `struct ptrace_lwpinfo' is a member of `pl_syscall_code'. */ ++#undef HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE ++ + /* Define to 1 if your system has struct reg in <machine/reg.h>. */ + #undef HAVE_STRUCT_REG + +diff --git gdb/configure gdb/configure +index 60ea884..ea11b50 100755 +--- gdb/configure ++++ gdb/configure +@@ -12927,6 +12927,20 @@ _ACEOF + fi + + ++# See if <sys/ptrace.h> supports syscall fields on FreeBSD. The ++# pl_syscall_code member of `struct ptrace_lwpinfo' was added in ++# FreeBSD 10.3. ++ac_fn_c_check_member "$LINENO" "struct ptrace_lwpinfo" "pl_syscall_code" "ac_cv_member_struct_ptrace_lwpinfo_pl_syscall_code" "#include <sys/ptrace.h> ++" ++if test "x$ac_cv_member_struct_ptrace_lwpinfo_pl_syscall_code" = x""yes; then : ++ ++cat >>confdefs.h <<_ACEOF ++#define HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE 1 ++_ACEOF ++ ++ ++fi ++ + + # Detect which type of /proc is in use, such as for Solaris. + +diff --git gdb/configure.ac gdb/configure.ac +index 6a72f72..920c228 100644 +--- gdb/configure.ac ++++ gdb/configure.ac +@@ -1526,6 +1526,11 @@ fi + AC_CHECK_MEMBERS([struct ptrace_lwpinfo.pl_tdname], [], [], + [#include <sys/ptrace.h>]) + ++# See if <sys/ptrace.h> supports syscall fields on FreeBSD. The ++# pl_syscall_code member of `struct ptrace_lwpinfo' was added in ++# FreeBSD 10.3. ++AC_CHECK_MEMBERS([struct ptrace_lwpinfo.pl_syscall_code], [], [], ++ [#include <sys/ptrace.h>]) + + # Detect which type of /proc is in use, such as for Solaris. + +diff --git gdb/data-directory/Makefile.in gdb/data-directory/Makefile.in +index c05f379..0beca55 100644 +--- gdb/data-directory/Makefile.in ++++ gdb/data-directory/Makefile.in +@@ -51,7 +51,8 @@ SYSCALLS_FILES = \ + i386-linux.xml amd64-linux.xml \ + sparc-linux.xml sparc64-linux.xml \ + mips-o32-linux.xml mips-n32-linux.xml mips-n64-linux.xml \ +- s390-linux.xml s390x-linux.xml ++ s390-linux.xml s390x-linux.xml \ ++ freebsd.xml + + PYTHON_DIR = python + PYTHON_INSTALL_DIR = $(DESTDIR)$(GDB_DATADIR)/$(PYTHON_DIR) +diff --git gdb/fbsd-nat.c gdb/fbsd-nat.c +index dc65e29..c9548e9 100644 +--- gdb/fbsd-nat.c ++++ gdb/fbsd-nat.c +@@ -779,6 +779,40 @@ fbsd_wait (struct target_ops *ops, + return wptid; + } + #endif ++ ++ /* Note that PL_FLAG_SCE is set for any event reported while ++ a thread is executing a system call in the kernel. In ++ particular, signals that interrupt a sleep in a system ++ call will report this flag as part of their event. Stops ++ explicitly for system call entry and exit always use ++ SIGTRAP, so only treat SIGTRAP events as system call ++ entry/exit events. */ ++ if (pl.pl_flags & (PL_FLAG_SCE | PL_FLAG_SCX) ++ && ourstatus->value.sig == SIGTRAP) ++ { ++#ifdef HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE ++ if (catch_syscall_enabled ()) ++ { ++ if (catching_syscall_number (pl.pl_syscall_code)) ++ { ++ if (pl.pl_flags & PL_FLAG_SCE) ++ ourstatus->kind = TARGET_WAITKIND_SYSCALL_ENTRY; ++ else ++ ourstatus->kind = TARGET_WAITKIND_SYSCALL_RETURN; ++ ourstatus->value.syscall_number = pl.pl_syscall_code; ++ return wptid; ++ } ++ } ++#endif ++ /* If the core isn't interested in this event, just ++ continue the process explicitly and wait for another ++ event. Note that PT_SYSCALL is "sticky" on FreeBSD ++ and once system call stops are enabled on a process ++ it stops for all system call entries and exits. */ ++ if (ptrace (PT_CONTINUE, pid, (caddr_t) 1, 0) == -1) ++ perror_with_name (("ptrace")); ++ continue; ++ } + } + return wptid; + } +@@ -889,6 +923,19 @@ fbsd_remove_exec_catchpoint (struct target_ops *self, int pid) + return 0; + } + #endif ++ ++#ifdef HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE ++static int ++fbsd_set_syscall_catchpoint (struct target_ops *self, int pid, int needed, ++ int any_count, int table_size, int *table) ++{ ++ ++ /* Ignore the arguments. inf-ptrace.c will use PT_SYSCALL which ++ will catch all system call entries and exits. The system calls ++ are filtered by GDB rather than the kernel. */ ++ return 0; ++} ++#endif + #endif + + void +@@ -925,6 +972,9 @@ fbsd_nat_add_target (struct target_ops *t) + t->to_insert_exec_catchpoint = fbsd_insert_exec_catchpoint; + t->to_remove_exec_catchpoint = fbsd_remove_exec_catchpoint; + #endif ++#ifdef HAVE_STRUCT_PTRACE_LWPINFO_PL_SYSCALL_CODE ++ t->to_set_syscall_catchpoint = fbsd_set_syscall_catchpoint; ++#endif + #endif + add_target (t); + } +diff --git gdb/fbsd-tdep.c gdb/fbsd-tdep.c +index e8f8605..4329f97 100644 +--- gdb/fbsd-tdep.c ++++ gdb/fbsd-tdep.c +@@ -24,6 +24,7 @@ + #include "regcache.h" + #include "regset.h" + #include "gdbthread.h" ++#include "xml-syscall.h" + + #include "elf-bfd.h" + #include "fbsd-tdep.h" +@@ -317,6 +318,22 @@ fbsd_print_auxv_entry (struct gdbarch *gdbarch, struct ui_file *file, + fprint_auxv_entry (file, name, description, format, type, val); + } + ++/* Implement the "get_syscall_number" gdbarch method. */ ++ ++static LONGEST ++fbsd_get_syscall_number (struct gdbarch *gdbarch, ++ ptid_t ptid) ++{ ++ ++ /* FreeBSD doesn't use gdbarch_get_syscall_number since FreeBSD ++ native targets fetch the system call number from the ++ 'pl_syscall_code' member of struct ptrace_lwpinfo in fbsd_wait. ++ However, system call catching requires this function to be ++ set. */ ++ ++ internal_error (__FILE__, __LINE__, _("fbsd_get_sycall_number called")); ++} ++ + /* To be called from GDB_OSABI_FREEBSD_ELF handlers. */ + + void +@@ -326,4 +343,8 @@ fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) + set_gdbarch_core_thread_name (gdbarch, fbsd_core_thread_name); + set_gdbarch_make_corefile_notes (gdbarch, fbsd_make_corefile_notes); + set_gdbarch_print_auxv_entry (gdbarch, fbsd_print_auxv_entry); ++ ++ /* `catch syscall' */ ++ set_xml_syscall_file_name (gdbarch, "syscalls/freebsd.xml"); ++ set_gdbarch_get_syscall_number (gdbarch, fbsd_get_syscall_number); + } +diff --git gdb/syscalls/freebsd.xml gdb/syscalls/freebsd.xml +new file mode 100644 +index 0000000..fb7c38b +--- /dev/null ++++ gdb/syscalls/freebsd.xml +@@ -0,0 +1,410 @@ ++<?xml version="1.0"?> ++<!-- Copyright (C) 2009-2016 Free Software Foundation, Inc. ++ ++ Copying and distribution of this file, with or without modification, ++ are permitted in any medium without royalty provided the copyright ++ notice and this notice are preserved. --> ++ ++<!DOCTYPE feature SYSTEM "gdb-syscalls.dtd"> ++ ++<!-- This file was generated using the following file: ++ ++ /usr/src/sys/sys/syscall.h ++ ++ The file mentioned above belongs to the FreeBSD Kernel. --> ++ ++<syscalls_info> ++ <syscall name="syscall" number="0"/> ++ <syscall name="exit" number="1"/> ++ <syscall name="fork" number="2"/> ++ <syscall name="read" number="3"/> ++ <syscall name="write" number="4"/> ++ <syscall name="open" number="5"/> ++ <syscall name="close" number="6"/> ++ <syscall name="wait4" number="7"/> ++ <syscall name="link" number="9"/> ++ <syscall name="unlink" number="10"/> ++ <syscall name="chdir" number="12"/> ++ <syscall name="fchdir" number="13"/> ++ <syscall name="mknod" number="14"/> ++ <syscall name="chmod" number="15"/> ++ <syscall name="chown" number="16"/> ++ <syscall name="break" number="17"/> ++ <syscall name="getpid" number="20"/> ++ <syscall name="mount" number="21"/> ++ <syscall name="unmount" number="22"/> ++ <syscall name="setuid" number="23"/> ++ <syscall name="getuid" number="24"/> ++ <syscall name="geteuid" number="25"/> ++ <syscall name="ptrace" number="26"/> ++ <syscall name="recvmsg" number="27"/> ++ <syscall name="sendmsg" number="28"/> ++ <syscall name="recvfrom" number="29"/> ++ <syscall name="accept" number="30"/> ++ <syscall name="getpeername" number="31"/> ++ <syscall name="getsockname" number="32"/> ++ <syscall name="access" number="33"/> ++ <syscall name="chflags" number="34"/> ++ <syscall name="fchflags" number="35"/> ++ <syscall name="sync" number="36"/> ++ <syscall name="kill" number="37"/> ++ <syscall name="getppid" number="39"/> ++ <syscall name="dup" number="41"/> ++ <syscall name="pipe" number="42"/> ++ <syscall name="getegid" number="43"/> ++ <syscall name="profil" number="44"/> ++ <syscall name="ktrace" number="45"/> ++ <syscall name="getgid" number="47"/> ++ <syscall name="getlogin" number="49"/> ++ <syscall name="setlogin" number="50"/> ++ <syscall name="acct" number="51"/> ++ <syscall name="sigaltstack" number="53"/> ++ <syscall name="ioctl" number="54"/> ++ <syscall name="reboot" number="55"/> ++ <syscall name="revoke" number="56"/> ++ <syscall name="symlink" number="57"/> ++ <syscall name="readlink" number="58"/> ++ <syscall name="execve" number="59"/> ++ <syscall name="umask" number="60"/> ++ <syscall name="chroot" number="61"/> ++ <syscall name="msync" number="65"/> ++ <syscall name="vfork" number="66"/> ++ <syscall name="sbrk" number="69"/> ++ <syscall name="sstk" number="70"/> ++ <syscall name="vadvise" number="72"/> ++ <syscall name="munmap" number="73"/> ++ <syscall name="mprotect" number="74"/> ++ <syscall name="madvise" number="75"/> ++ <syscall name="mincore" number="78"/> ++ <syscall name="getgroups" number="79"/> ++ <syscall name="setgroups" number="80"/> ++ <syscall name="getpgrp" number="81"/> ++ <syscall name="setpgid" number="82"/> ++ <syscall name="setitimer" number="83"/> ++ <syscall name="swapon" number="85"/> ++ <syscall name="getitimer" number="86"/> ++ <syscall name="getdtablesize" number="89"/> ++ <syscall name="dup2" number="90"/> ++ <syscall name="fcntl" number="92"/> ++ <syscall name="select" number="93"/> ++ <syscall name="fsync" number="95"/> ++ <syscall name="setpriority" number="96"/> ++ <syscall name="socket" number="97"/> ++ <syscall name="connect" number="98"/> ++ <syscall name="getpriority" number="100"/> ++ <syscall name="bind" number="104"/> ++ <syscall name="setsockopt" number="105"/> ++ <syscall name="listen" number="106"/> ++ <syscall name="gettimeofday" number="116"/> ++ <syscall name="getrusage" number="117"/> ++ <syscall name="getsockopt" number="118"/> ++ <syscall name="readv" number="120"/> ++ <syscall name="writev" number="121"/> ++ <syscall name="settimeofday" number="122"/> ++ <syscall name="fchown" number="123"/> ++ <syscall name="fchmod" number="124"/> ++ <syscall name="setreuid" number="126"/> ++ <syscall name="setregid" number="127"/> ++ <syscall name="rename" number="128"/> ++ <syscall name="flock" number="131"/> ++ <syscall name="mkfifo" number="132"/> ++ <syscall name="sendto" number="133"/> ++ <syscall name="shutdown" number="134"/> ++ <syscall name="socketpair" number="135"/> ++ <syscall name="mkdir" number="136"/> ++ <syscall name="rmdir" number="137"/> ++ <syscall name="utimes" number="138"/> ++ <syscall name="adjtime" number="140"/> ++ <syscall name="setsid" number="147"/> ++ <syscall name="quotactl" number="148"/> ++ <syscall name="nlm_syscall" number="154"/> ++ <syscall name="nfssvc" number="155"/> ++ <syscall name="lgetfh" number="160"/> ++ <syscall name="getfh" number="161"/> ++ <syscall name="sysarch" number="165"/> ++ <syscall name="rtprio" number="166"/> ++ <syscall name="semsys" number="169"/> ++ <syscall name="msgsys" number="170"/> ++ <syscall name="shmsys" number="171"/> ++ <syscall name="setfib" number="175"/> ++ <syscall name="ntp_adjtime" number="176"/> ++ <syscall name="setgid" number="181"/> ++ <syscall name="setegid" number="182"/> ++ <syscall name="seteuid" number="183"/> ++ <syscall name="stat" number="188"/> ++ <syscall name="fstat" number="189"/> ++ <syscall name="lstat" number="190"/> ++ <syscall name="pathconf" number="191"/> ++ <syscall name="fpathconf" number="192"/> ++ <syscall name="getrlimit" number="194"/> ++ <syscall name="setrlimit" number="195"/> ++ <syscall name="getdirentries" number="196"/> ++ <syscall name="__syscall" number="198"/> ++ <syscall name="__sysctl" number="202"/> ++ <syscall name="mlock" number="203"/> ++ <syscall name="munlock" number="204"/> ++ <syscall name="undelete" number="205"/> ++ <syscall name="futimes" number="206"/> ++ <syscall name="getpgid" number="207"/> ++ <syscall name="poll" number="209"/> ++ <syscall name="freebsd7___semctl" number="220"/> ++ <syscall name="semget" number="221"/> ++ <syscall name="semop" number="222"/> ++ <syscall name="freebsd7_msgctl" number="224"/> ++ <syscall name="msgget" number="225"/> ++ <syscall name="msgsnd" number="226"/> ++ <syscall name="msgrcv" number="227"/> ++ <syscall name="shmat" number="228"/> ++ <syscall name="freebsd7_shmctl" number="229"/> ++ <syscall name="shmdt" number="230"/> ++ <syscall name="shmget" number="231"/> ++ <syscall name="clock_gettime" number="232"/> ++ <syscall name="clock_settime" number="233"/> ++ <syscall name="clock_getres" number="234"/> ++ <syscall name="ktimer_create" number="235"/> ++ <syscall name="ktimer_delete" number="236"/> ++ <syscall name="ktimer_settime" number="237"/> ++ <syscall name="ktimer_gettime" number="238"/> ++ <syscall name="ktimer_getoverrun" number="239"/> ++ <syscall name="nanosleep" number="240"/> ++ <syscall name="ffclock_getcounter" number="241"/> ++ <syscall name="ffclock_setestimate" number="242"/> ++ <syscall name="ffclock_getestimate" number="243"/> ++ <syscall name="clock_getcpuclockid2" number="247"/> ++ <syscall name="ntp_gettime" number="248"/> ++ <syscall name="minherit" number="250"/> ++ <syscall name="rfork" number="251"/> ++ <syscall name="openbsd_poll" number="252"/> ++ <syscall name="issetugid" number="253"/> ++ <syscall name="lchown" number="254"/> ++ <syscall name="aio_read" number="255"/> ++ <syscall name="aio_write" number="256"/> ++ <syscall name="lio_listio" number="257"/> ++ <syscall name="getdents" number="272"/> ++ <syscall name="lchmod" number="274"/> ++ <syscall name="netbsd_lchown" number="275"/> ++ <syscall name="lutimes" number="276"/> ++ <syscall name="netbsd_msync" number="277"/> ++ <syscall name="nstat" number="278"/> ++ <syscall name="nfstat" number="279"/> ++ <syscall name="nlstat" number="280"/> ++ <syscall name="preadv" number="289"/> ++ <syscall name="pwritev" number="290"/> ++ <syscall name="fhopen" number="298"/> ++ <syscall name="fhstat" number="299"/> ++ <syscall name="modnext" number="300"/> ++ <syscall name="modstat" number="301"/> ++ <syscall name="modfnext" number="302"/> ++ <syscall name="modfind" number="303"/> ++ <syscall name="kldload" number="304"/> ++ <syscall name="kldunload" number="305"/> ++ <syscall name="kldfind" number="306"/> ++ <syscall name="kldnext" number="307"/> ++ <syscall name="kldstat" number="308"/> ++ <syscall name="kldfirstmod" number="309"/> ++ <syscall name="getsid" number="310"/> ++ <syscall name="setresuid" number="311"/> ++ <syscall name="setresgid" number="312"/> ++ <syscall name="aio_return" number="314"/> ++ <syscall name="aio_suspend" number="315"/> ++ <syscall name="aio_cancel" number="316"/> ++ <syscall name="aio_error" number="317"/> ++ <syscall name="yield" number="321"/> ++ <syscall name="mlockall" number="324"/> ++ <syscall name="munlockall" number="325"/> ++ <syscall name="__getcwd" number="326"/> ++ <syscall name="sched_setparam" number="327"/> ++ <syscall name="sched_getparam" number="328"/> ++ <syscall name="sched_setscheduler" number="329"/> ++ <syscall name="sched_getscheduler" number="330"/> ++ <syscall name="sched_yield" number="331"/> ++ <syscall name="sched_get_priority_max" number="332"/> ++ <syscall name="sched_get_priority_min" number="333"/> ++ <syscall name="sched_rr_get_interval" number="334"/> ++ <syscall name="utrace" number="335"/> ++ <syscall name="kldsym" number="337"/> ++ <syscall name="jail" number="338"/> ++ <syscall name="nnpfs_syscall" number="339"/> ++ <syscall name="sigprocmask" number="340"/> ++ <syscall name="sigsuspend" number="341"/> ++ <syscall name="sigpending" number="343"/> ++ <syscall name="sigtimedwait" number="345"/> ++ <syscall name="sigwaitinfo" number="346"/> ++ <syscall name="__acl_get_file" number="347"/> ++ <syscall name="__acl_set_file" number="348"/> ++ <syscall name="__acl_get_fd" number="349"/> ++ <syscall name="__acl_set_fd" number="350"/> ++ <syscall name="__acl_delete_file" number="351"/> ++ <syscall name="__acl_delete_fd" number="352"/> ++ <syscall name="__acl_aclcheck_file" number="353"/> ++ <syscall name="__acl_aclcheck_fd" number="354"/> ++ <syscall name="extattrctl" number="355"/> ++ <syscall name="extattr_set_file" number="356"/> ++ <syscall name="extattr_get_file" number="357"/> ++ <syscall name="extattr_delete_file" number="358"/> ++ <syscall name="aio_waitcomplete" number="359"/> ++ <syscall name="getresuid" number="360"/> ++ <syscall name="getresgid" number="361"/> ++ <syscall name="kqueue" number="362"/> ++ <syscall name="kevent" number="363"/> ++ <syscall name="extattr_set_fd" number="371"/> ++ <syscall name="extattr_get_fd" number="372"/> ++ <syscall name="extattr_delete_fd" number="373"/> ++ <syscall name="__setugid" number="374"/> ++ <syscall name="eaccess" number="376"/> ++ <syscall name="afs3_syscall" number="377"/> ++ <syscall name="nmount" number="378"/> ++ <syscall name="__mac_get_proc" number="384"/> ++ <syscall name="__mac_set_proc" number="385"/> ++ <syscall name="__mac_get_fd" number="386"/> ++ <syscall name="__mac_get_file" number="387"/> ++ <syscall name="__mac_set_fd" number="388"/> ++ <syscall name="__mac_set_file" number="389"/> ++ <syscall name="kenv" number="390"/> ++ <syscall name="lchflags" number="391"/> ++ <syscall name="uuidgen" number="392"/> ++ <syscall name="sendfile" number="393"/> ++ <syscall name="mac_syscall" number="394"/> ++ <syscall name="getfsstat" number="395"/> ++ <syscall name="statfs" number="396"/> ++ <syscall name="fstatfs" number="397"/> ++ <syscall name="fhstatfs" number="398"/> ++ <syscall name="ksem_close" number="400"/> ++ <syscall name="ksem_post" number="401"/> ++ <syscall name="ksem_wait" number="402"/> ++ <syscall name="ksem_trywait" number="403"/> ++ <syscall name="ksem_init" number="404"/> ++ <syscall name="ksem_open" number="405"/> ++ <syscall name="ksem_unlink" number="406"/> ++ <syscall name="ksem_getvalue" number="407"/> ++ <syscall name="ksem_destroy" number="408"/> ++ <syscall name="__mac_get_pid" number="409"/> ++ <syscall name="__mac_get_link" number="410"/> ++ <syscall name="__mac_set_link" number="411"/> ++ <syscall name="extattr_set_link" number="412"/> ++ <syscall name="extattr_get_link" number="413"/> ++ <syscall name="extattr_delete_link" number="414"/> ++ <syscall name="__mac_execve" number="415"/> ++ <syscall name="sigaction" number="416"/> ++ <syscall name="sigreturn" number="417"/> ++ <syscall name="getcontext" number="421"/> ++ <syscall name="setcontext" number="422"/> ++ <syscall name="swapcontext" number="423"/> ++ <syscall name="swapoff" number="424"/> ++ <syscall name="__acl_get_link" number="425"/> ++ <syscall name="__acl_set_link" number="426"/> ++ <syscall name="__acl_delete_link" number="427"/> ++ <syscall name="__acl_aclcheck_link" number="428"/> ++ <syscall name="sigwait" number="429"/> ++ <syscall name="thr_create" number="430"/> ++ <syscall name="thr_exit" number="431"/> ++ <syscall name="thr_self" number="432"/> ++ <syscall name="thr_kill" number="433"/> ++ <syscall name="jail_attach" number="436"/> ++ <syscall name="extattr_list_fd" number="437"/> ++ <syscall name="extattr_list_file" number="438"/> ++ <syscall name="extattr_list_link" number="439"/> ++ <syscall name="ksem_timedwait" number="441"/> ++ <syscall name="thr_suspend" number="442"/> ++ <syscall name="thr_wake" number="443"/> ++ <syscall name="kldunloadf" number="444"/> ++ <syscall name="audit" number="445"/> ++ <syscall name="auditon" number="446"/> ++ <syscall name="getauid" number="447"/> ++ <syscall name="setauid" number="448"/> ++ <syscall name="getaudit" number="449"/> ++ <syscall name="setaudit" number="450"/> ++ <syscall name="getaudit_addr" number="451"/> ++ <syscall name="setaudit_addr" number="452"/> ++ <syscall name="auditctl" number="453"/> ++ <syscall name="_umtx_op" number="454"/> ++ <syscall name="thr_new" number="455"/> ++ <syscall name="sigqueue" number="456"/> ++ <syscall name="kmq_open" number="457"/> ++ <syscall name="kmq_setattr" number="458"/> ++ <syscall name="kmq_timedreceive" number="459"/> ++ <syscall name="kmq_timedsend" number="460"/> ++ <syscall name="kmq_notify" number="461"/> ++ <syscall name="kmq_unlink" number="462"/> ++ <syscall name="abort2" number="463"/> ++ <syscall name="thr_set_name" number="464"/> ++ <syscall name="aio_fsync" number="465"/> ++ <syscall name="rtprio_thread" number="466"/> ++ <syscall name="sctp_peeloff" number="471"/> ++ <syscall name="sctp_generic_sendmsg" number="472"/> ++ <syscall name="sctp_generic_sendmsg_iov" number="473"/> ++ <syscall name="sctp_generic_recvmsg" number="474"/> ++ <syscall name="pread" number="475"/> ++ <syscall name="pwrite" number="476"/> ++ <syscall name="mmap" number="477"/> ++ <syscall name="lseek" number="478"/> ++ <syscall name="truncate" number="479"/> ++ <syscall name="ftruncate" number="480"/> ++ <syscall name="thr_kill2" number="481"/> ++ <syscall name="shm_open" number="482"/> ++ <syscall name="shm_unlink" number="483"/> ++ <syscall name="cpuset" number="484"/> ++ <syscall name="cpuset_setid" number="485"/> ++ <syscall name="cpuset_getid" number="486"/> ++ <syscall name="cpuset_getaffinity" number="487"/> ++ <syscall name="cpuset_setaffinity" number="488"/> ++ <syscall name="faccessat" number="489"/> ++ <syscall name="fchmodat" number="490"/> ++ <syscall name="fchownat" number="491"/> ++ <syscall name="fexecve" number="492"/> ++ <syscall name="fstatat" number="493"/> ++ <syscall name="futimesat" number="494"/> ++ <syscall name="linkat" number="495"/> ++ <syscall name="mkdirat" number="496"/> ++ <syscall name="mkfifoat" number="497"/> ++ <syscall name="mknodat" number="498"/> ++ <syscall name="openat" number="499"/> ++ <syscall name="readlinkat" number="500"/> ++ <syscall name="renameat" number="501"/> ++ <syscall name="symlinkat" number="502"/> ++ <syscall name="unlinkat" number="503"/> ++ <syscall name="posix_openpt" number="504"/> ++ <syscall name="gssd_syscall" number="505"/> ++ <syscall name="jail_get" number="506"/> ++ <syscall name="jail_set" number="507"/> ++ <syscall name="jail_remove" number="508"/> ++ <syscall name="closefrom" number="509"/> ++ <syscall name="__semctl" number="510"/> ++ <syscall name="msgctl" number="511"/> ++ <syscall name="shmctl" number="512"/> ++ <syscall name="lpathconf" number="513"/> ++ <syscall name="__cap_rights_get" number="515"/> ++ <syscall name="cap_enter" number="516"/> ++ <syscall name="cap_getmode" number="517"/> ++ <syscall name="pdfork" number="518"/> ++ <syscall name="pdkill" number="519"/> ++ <syscall name="pdgetpid" number="520"/> ++ <syscall name="pselect" number="522"/> ++ <syscall name="getloginclass" number="523"/> ++ <syscall name="setloginclass" number="524"/> ++ <syscall name="rctl_get_racct" number="525"/> ++ <syscall name="rctl_get_rules" number="526"/> ++ <syscall name="rctl_get_limits" number="527"/> ++ <syscall name="rctl_add_rule" number="528"/> ++ <syscall name="rctl_remove_rule" number="529"/> ++ <syscall name="posix_fallocate" number="530"/> ++ <syscall name="posix_fadvise" number="531"/> ++ <syscall name="wait6" number="532"/> ++ <syscall name="cap_rights_limit" number="533"/> ++ <syscall name="cap_ioctls_limit" number="534"/> ++ <syscall name="cap_ioctls_get" number="535"/> ++ <syscall name="cap_fcntls_limit" number="536"/> ++ <syscall name="cap_fcntls_get" number="537"/> ++ <syscall name="bindat" number="538"/> ++ <syscall name="connectat" number="539"/> ++ <syscall name="chflagsat" number="540"/> ++ <syscall name="accept4" number="541"/> ++ <syscall name="pipe2" number="542"/> ++ <syscall name="aio_mlock" number="543"/> ++ <syscall name="procctl" number="544"/> ++ <syscall name="ppoll" number="545"/> ++ <syscall name="futimens" number="546"/> ++ <syscall name="utimensat" number="547"/> ++ <syscall name="numa_getaffinity" number="548"/> ++ <syscall name="numa_setaffinity" number="549"/> ++</syscalls_info> diff --git a/devel/gdb/files/commit-ee95032 b/devel/gdb/files/commit-ee95032 new file mode 100644 index 000000000000..2eb1f725697c --- /dev/null +++ b/devel/gdb/files/commit-ee95032 @@ -0,0 +1,24 @@ +commit ee950322ca2c77494b1742f304632f667ed6ce79 +Author: John Baldwin <jhb@FreeBSD.org> +Date: Fri Jul 1 10:18:50 2016 -0700 + + Use 'ptid_t' instead of 'ptid' for fbsd_next_vfork_done's return type. + + 'ptid' compiles in C++, but not C. + + gdb/ChangeLog: + * fbsd-nat.c (fbsd_is_vfork_done_pending): Fix return type. + +diff --git gdb/fbsd-nat.c gdb/fbsd-nat.c +index fcb7ff5..fa9516e 100644 +--- gdb/fbsd-nat.c ++++ gdb/fbsd-nat.c +@@ -609,7 +609,7 @@ fbsd_is_vfork_done_pending (pid_t pid) + /* Check for a pending vfork done event. If one is found, remove it + from the list and return the PTID. */ + +-static ptid ++static ptid_t + fbsd_next_vfork_done (void) + { + struct fbsd_fork_info *info; diff --git a/devel/gdb/pkg-plist b/devel/gdb/pkg-plist index 64a3fe2a0ee2..da41ea8d1dca 100644 --- a/devel/gdb/pkg-plist +++ b/devel/gdb/pkg-plist @@ -40,3 +40,18 @@ man/man1/gdb%%VER%%.1.gz %%GUILE%%%%DATADIR%%%%VER%%/guile/gdb/support.scm %%GUILE%%%%DATADIR%%%%VER%%/guile/gdb/types.go %%GUILE%%%%DATADIR%%%%VER%%/guile/gdb/types.scm +%%EXPAT%%%%DATADIR%%%%VER%%/syscalls/aarch64-linux.xml +%%EXPAT%%%%DATADIR%%%%VER%%/syscalls/amd64-linux.xml +%%EXPAT%%%%DATADIR%%%%VER%%/syscalls/arm-linux.xml +%%EXPAT%%%%DATADIR%%%%VER%%/syscalls/freebsd.xml +%%EXPAT%%%%DATADIR%%%%VER%%/syscalls/gdb-syscalls.dtd +%%EXPAT%%%%DATADIR%%%%VER%%/syscalls/i386-linux.xml +%%EXPAT%%%%DATADIR%%%%VER%%/syscalls/mips-n32-linux.xml +%%EXPAT%%%%DATADIR%%%%VER%%/syscalls/mips-n64-linux.xml +%%EXPAT%%%%DATADIR%%%%VER%%/syscalls/mips-o32-linux.xml +%%EXPAT%%%%DATADIR%%%%VER%%/syscalls/ppc-linux.xml +%%EXPAT%%%%DATADIR%%%%VER%%/syscalls/ppc64-linux.xml +%%EXPAT%%%%DATADIR%%%%VER%%/syscalls/s390-linux.xml +%%EXPAT%%%%DATADIR%%%%VER%%/syscalls/s390x-linux.xml +%%EXPAT%%%%DATADIR%%%%VER%%/syscalls/sparc-linux.xml +%%EXPAT%%%%DATADIR%%%%VER%%/syscalls/sparc64-linux.xml |