Index: devel/gdb/Makefile =================================================================== --- devel/gdb/Makefile +++ devel/gdb/Makefile @@ -2,8 +2,7 @@ # $FreeBSD$ PORTNAME= gdb -PORTVERSION= 8.0.1 -PORTREVISION= 2 +PORTVERSION= 8.1 CATEGORIES= devel MASTER_SITES= GNU @@ -39,26 +38,26 @@ 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-45eba0ab7d \ - ${FILESDIR}/commit-3c3ae77e68 \ - ${FILESDIR}/commit-b5430a3ced \ - ${FILESDIR}/commit-762c974a09 \ - ${FILESDIR}/commit-929edea98d \ - ${FILESDIR}/commit-6e5eab33ab \ - ${FILESDIR}/commit-382b69bbb7 \ - ${FILESDIR}/commit-2af9fc4432 \ - ${FILESDIR}/commit-0b9305edf1 \ - ${FILESDIR}/commit-e6f3b9c319 \ - ${FILESDIR}/commit-4b654465bf \ - ${FILESDIR}/commit-b30ff123fb \ - ${FILESDIR}/commit-48aeef91c2 \ - ${FILESDIR}/commit-0aa37b654c \ - ${FILESDIR}/commit-0335ac6d12 \ - ${FILESDIR}/commit-12c4bd7f53 \ - ${FILESDIR}/commit-6d5be5d6b8 \ - ${FILESDIR}/commit-a80a647180 \ - ${FILESDIR}/commit-544c67cda1 \ - ${FILESDIR}/commit-a181c0bf74 +#EXTRA_PATCHES= ${FILESDIR}/commit-45eba0ab7d \ +# ${FILESDIR}/commit-3c3ae77e68 \ +# ${FILESDIR}/commit-b5430a3ced \ +# ${FILESDIR}/commit-762c974a09 \ +# ${FILESDIR}/commit-929edea98d \ +# ${FILESDIR}/commit-6e5eab33ab \ +# ${FILESDIR}/commit-382b69bbb7 \ +# ${FILESDIR}/commit-2af9fc4432 \ +# ${FILESDIR}/commit-0b9305edf1 \ +# ${FILESDIR}/commit-e6f3b9c319 \ +# ${FILESDIR}/commit-4b654465bf \ +# ${FILESDIR}/commit-b30ff123fb \ +# ${FILESDIR}/commit-48aeef91c2 \ +# ${FILESDIR}/commit-0aa37b654c \ +# ${FILESDIR}/commit-0335ac6d12 \ +# ${FILESDIR}/commit-12c4bd7f53 \ +# ${FILESDIR}/commit-6d5be5d6b8 \ +# ${FILESDIR}/commit-a80a647180 \ +# ${FILESDIR}/commit-544c67cda1 \ +# ${FILESDIR}/commit-a181c0bf74 LIB_DEPENDS+= libexpat.so:textproc/expat2 VER= ${PORTVERSION:S/.//g} Index: devel/gdb/distinfo =================================================================== --- devel/gdb/distinfo +++ devel/gdb/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1505207991 -SHA256 (gdb-8.0.1.tar.xz) = 3dbd5f93e36ba2815ad0efab030dcd0c7b211d7b353a40a53f4c02d7d56295e3 -SIZE (gdb-8.0.1.tar.xz) = 19583920 +TIMESTAMP = 1517392551 +SHA256 (gdb-8.1.tar.xz) = af61a0263858e69c5dce51eab26662ff3d2ad9aa68da9583e8143b5426be4b34 +SIZE (gdb-8.1.tar.xz) = 20095080 Index: devel/gdb/files/commit-0335ac6d12 =================================================================== --- devel/gdb/files/commit-0335ac6d12 +++ /dev/null @@ -1,24 +0,0 @@ -commit 0335ac6d12906bfb4b48410d8a7229c21c727cf2 -Author: John Baldwin -Date: Tue Aug 15 08:04:23 2017 -0700 - - Fix compile on big-endian platforms in siginfo_t converter. - - gdb/ChangeLog: - - * fbsd-nat.c (fbsd_convert_siginfo): Fix compile on big-endian - platforms. - -diff --git gdb/fbsd-nat.c gdb/fbsd-nat.c -index c89343a24f..6ba6a01a70 100644 ---- gdb/fbsd-nat.c -+++ gdb/fbsd-nat.c -@@ -314,7 +314,7 @@ fbsd_convert_siginfo (siginfo_t *si) - 32-bits of the pointer value. */ - #if _BYTE_ORDER == _BIG_ENDIAN - if (si->si_value.sival_int == 0) -- si32->si_value.sival_ptr = (uintptr_t) si->si_value.sival_ptr; -+ si32.si_value.sival_ptr = (uintptr_t) si->si_value.sival_ptr; - else - si32.si_value.sival_int = si->si_value.sival_int; - #else Index: devel/gdb/files/commit-0aa37b654c =================================================================== --- devel/gdb/files/commit-0aa37b654c +++ /dev/null @@ -1,90 +0,0 @@ -commit 0aa37b654c0f31e446ab47826f0bcbec15d0112f -Author: John Baldwin -Date: Mon Jun 26 18:18:19 2017 -0700 - - Support the fs_base and gs_base registers on FreeBSD/amd64 native processes. - - Use ptrace operations to fetch and store the fs_base and gs_base registers - for FreeBSD/amd64 processes. Note that FreeBSD does not currently store the - value of these registers in core dumps, so these registers are only - available when inspecting a running process. - - gdb/ChangeLog: - - * amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers): Use - PT_GETFSBASE and PT_GETGSBASE. - (amd64bsd_store_inferior_registers): Use PT_SETFSBASE and - PT_SETGSBASE. - -diff --git gdb/amd64-bsd-nat.c gdb/amd64-bsd-nat.c -index ca61a3551b..41dee84269 100644 ---- gdb/amd64-bsd-nat.c -+++ gdb/amd64-bsd-nat.c -@@ -57,6 +57,33 @@ amd64bsd_fetch_inferior_registers (struct target_ops *ops, - return; - } - -+#ifdef PT_GETFSBASE -+ if (regnum == -1 || regnum == AMD64_FSBASE_REGNUM) -+ { -+ register_t base; -+ -+ if (ptrace (PT_GETFSBASE, pid, (PTRACE_TYPE_ARG3) &base, 0) == -1) -+ perror_with_name (_("Couldn't get segment register fs_base")); -+ -+ regcache_raw_supply (regcache, AMD64_FSBASE_REGNUM, &base); -+ if (regnum != -1) -+ return; -+ } -+#endif -+#ifdef PT_GETGSBASE -+ if (regnum == -1 || regnum == AMD64_GSBASE_REGNUM) -+ { -+ register_t base; -+ -+ if (ptrace (PT_GETGSBASE, pid, (PTRACE_TYPE_ARG3) &base, 0) == -1) -+ perror_with_name (_("Couldn't get segment register gs_base")); -+ -+ regcache_raw_supply (regcache, AMD64_GSBASE_REGNUM, &base); -+ if (regnum != -1) -+ return; -+ } -+#endif -+ - if (regnum == -1 || !amd64_native_gregset_supplies_p (gdbarch, regnum)) - { - struct fpreg fpregs; -@@ -108,6 +135,33 @@ amd64bsd_store_inferior_registers (struct target_ops *ops, - return; - } - -+#ifdef PT_SETFSBASE -+ if (regnum == -1 || regnum == AMD64_FSBASE_REGNUM) -+ { -+ register_t base; -+ -+ regcache_raw_collect (regcache, AMD64_FSBASE_REGNUM, &base); -+ -+ if (ptrace (PT_SETFSBASE, pid, (PTRACE_TYPE_ARG3) &base, 0) == -1) -+ perror_with_name (_("Couldn't write segment register fs_base")); -+ if (regnum != -1) -+ return; -+ } -+#endif -+#ifdef PT_SETGSBASE -+ if (regnum == -1 || regnum == AMD64_GSBASE_REGNUM) -+ { -+ register_t base; -+ -+ regcache_raw_collect (regcache, AMD64_GSBASE_REGNUM, &base); -+ -+ if (ptrace (PT_SETGSBASE, pid, (PTRACE_TYPE_ARG3) &base, 0) == -1) -+ perror_with_name (_("Couldn't write segment register gs_base")); -+ if (regnum != -1) -+ return; -+ } -+#endif -+ - if (regnum == -1 || !amd64_native_gregset_supplies_p (gdbarch, regnum)) - { - struct fpreg fpregs; Index: devel/gdb/files/commit-0b9305edf1 =================================================================== --- devel/gdb/files/commit-0b9305edf1 +++ /dev/null @@ -1,30 +0,0 @@ -commit 0b9305edf1d0b15913643b132dad02d4ca4fbb43 -Author: John Baldwin -Date: Wed Jun 28 11:41:41 2017 -0700 - - Recognize the recently-added FreeBSD core dump note for LWP info. - - This core dump note contains the same information returned by the - ptrace PT_LWPINFO operation for each LWP belonging to a process. - - binutils/ChangeLog: - - * readelf.c (get_freebsd_elfcore_note_type): Handle - NT_FREEBSD_PTLWPINFO. - - include/ChangeLog: - - * elf/common.h (NT_FREEBSD_PTLWPINFO): Define. - -diff --git include/elf/common.h include/elf/common.h -index 2976c06067..3a144f03bc 100644 ---- include/elf/common.h -+++ include/elf/common.h -@@ -641,6 +641,7 @@ - #define NT_FREEBSD_PROCSTAT_OSREL 14 /* Procstat osreldate data. */ - #define NT_FREEBSD_PROCSTAT_PSSTRINGS 15 /* Procstat ps_strings data. */ - #define NT_FREEBSD_PROCSTAT_AUXV 16 /* Procstat auxv data. */ -+#define NT_FREEBSD_PTLWPINFO 17 /* Thread ptrace miscellaneous info. */ - - /* Note segments for core files on NetBSD systems. Note name - must start with "NetBSD-CORE". */ Index: devel/gdb/files/commit-12c4bd7f53 =================================================================== --- devel/gdb/files/commit-12c4bd7f53 +++ /dev/null @@ -1,45 +0,0 @@ -commit 12c4bd7f53e9cefcf7c3a7f8cbf9e552526cb963 -Author: John Baldwin -Date: Thu Oct 5 09:50:01 2017 -0700 - - Handle FreeBSD-specific AT_EHDRFLAGS and AT_HWCAP auxiliary vector types. - - FreeBSD recently added two additional ELF auxiliary vectors. FreeBSD's - AT_HWCAP uses a different number compared to AT_HWCAP on Linux as the - numerical value was already in use for a different vector on FreeBSD. - - include/ChangeLog: - - * elf/common.h (AT_FREEBSD_EHDRFLAGS, AT_FREEBSD_HWCAP): Define. - - gdb/ChangeLog: - - * fbsd-tdep.c (fbsd_print_auxv_entry): Handle AT_EHDRFLAGS and - AT_HWCAP. - -diff --git gdb/fbsd-tdep.c gdb/fbsd-tdep.c -index 727e28a645..fa4cd912ef 100644 ---- gdb/fbsd-tdep.c -+++ gdb/fbsd-tdep.c -@@ -392,6 +392,8 @@ fbsd_print_auxv_entry (struct gdbarch *gdbarch, struct ui_file *file, - TAG (PAGESIZESLEN, _("Number of pagesizes"), AUXV_FORMAT_DEC); - TAG (TIMEKEEP, _("Pointer to timehands"), AUXV_FORMAT_HEX); - TAG (STACKPROT, _("Initial stack protection"), AUXV_FORMAT_HEX); -+ TAG (EHDRFLAGS, _("ELF header e_flags"), AUXV_FORMAT_HEX); -+ TAG (HWCAP, _("Machine-dependent CPU capability hints"), AUXV_FORMAT_HEX); - default: - default_print_auxv_entry (gdbarch, file, type, val); - return; -diff --git include/elf/common.h include/elf/common.h -index d08731cca1..f89ab32889 100644 ---- include/elf/common.h -+++ include/elf/common.h -@@ -1144,6 +1144,8 @@ - #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_FREEBSD_EHDRFLAGS 24 /* e_flags field from ELF header. */ -+#define AT_FREEBSD_HWCAP 25 /* CPU feature flags. */ - - #define AT_SUN_UID 2000 /* Effective user ID. */ - #define AT_SUN_RUID 2001 /* Real user ID. */ Index: devel/gdb/files/commit-2af9fc4432 =================================================================== --- devel/gdb/files/commit-2af9fc4432 +++ /dev/null @@ -1,35 +0,0 @@ -commit 2af9fc4432bbda5ebd805bf5b56d81cd80d0cbf5 -Author: John Baldwin -Date: Wed Jun 28 11:21:10 2017 -0700 - - Use the thread_section_name helper class in fbsd_core_thread_name. - - gdb/ChangeLog: - - * fbsd-tdep.c (fbsd_core_thread_name): Use thread_section_name. - -diff --git gdb/fbsd-tdep.c gdb/fbsd-tdep.c -index 24a3c20dd6..32df104208 100644 ---- gdb/fbsd-tdep.c -+++ gdb/fbsd-tdep.c -@@ -75,7 +75,6 @@ fbsd_core_thread_name (struct gdbarch *gdbarch, struct thread_info *thr) - static char buf[80]; - struct bfd_section *section; - bfd_size_type size; -- char sectionstr[32]; - - if (ptid_get_lwp (thr->ptid) != 0) - { -@@ -86,9 +85,9 @@ fbsd_core_thread_name (struct gdbarch *gdbarch, struct thread_info *thr) - structure. Rather than define the full structure here, just - extract the null-terminated name from the start of the - note. */ -- xsnprintf (sectionstr, sizeof sectionstr, ".thrmisc/%ld", -- ptid_get_lwp (thr->ptid)); -- section = bfd_get_section_by_name (core_bfd, sectionstr); -+ thread_section_name section_name (".thrmisc", thr->ptid); -+ -+ section = bfd_get_section_by_name (core_bfd, section_name.c_str ()); - if (section != NULL && bfd_section_size (core_bfd, section) > 0) - { - /* Truncate the name if it is longer than "buf". */ Index: devel/gdb/files/commit-382b69bbb7 =================================================================== --- devel/gdb/files/commit-382b69bbb7 +++ /dev/null @@ -1,220 +0,0 @@ -commit 382b69bbb7a4fec5213d2382fe70a68d7a46b3e7 -Author: John Baldwin -Date: Wed Jun 28 11:11:20 2017 -0700 - - Add a new gdbarch method to fetch signal information from core files. - - Previously the core_xfer_partial method used core_get_siginfo to handle - TARGET_OBJECT_SIGNAL_INFO requests. However, core_get_siginfo looked for - Linux-specific sections in the core file. To support fetching siginfo - from cores on other systems, add a new gdbarch method (`core_xfer_siginfo`) - and move the body of the existing core_get_siginfo into a - linux_core_xfer_siginfo implementation of this method in linux-tdep.c. - - gdb/ChangeLog: - - * corelow.c (get_core_siginfo): Remove. - (core_xfer_partial): Use the gdbarch "core_xfer_siginfo" method - instead of get_core_siginfo. - * gdbarch.sh (core_xfer_siginfo): New gdbarch callback. - * gdbarch.h: Re-generate. - * gdbarch.c: Re-generate. - * linux-tdep.c (linux_core_xfer_siginfo): New. - (linux_init_abi): Install gdbarch "core_xfer_siginfo" method. - -diff --git gdb/corelow.c gdb/corelow.c -index 578c910bb5..5dbabc79e6 100644 ---- gdb/corelow.c -+++ gdb/corelow.c -@@ -668,25 +668,6 @@ add_to_spuid_list (bfd *abfd, asection *asect, void *list_p) - list->pos += 4; - } - --/* Read siginfo data from the core, if possible. Returns -1 on -- failure. Otherwise, returns the number of bytes read. ABFD is the -- core file's BFD; READBUF, OFFSET, and LEN are all as specified by -- the to_xfer_partial interface. */ -- --static LONGEST --get_core_siginfo (bfd *abfd, gdb_byte *readbuf, ULONGEST offset, ULONGEST len) --{ -- thread_section_name section_name (".note.linuxcore.siginfo", inferior_ptid); -- asection *section = bfd_get_section_by_name (abfd, section_name.c_str ()); -- if (section == NULL) -- return -1; -- -- if (!bfd_get_section_contents (abfd, section, readbuf, offset, len)) -- return -1; -- -- return len; --} -- - static enum target_xfer_status - core_xfer_partial (struct target_ops *ops, enum target_object object, - const char *annex, gdb_byte *readbuf, -@@ -874,12 +855,20 @@ core_xfer_partial (struct target_ops *ops, enum target_object object, - case TARGET_OBJECT_SIGNAL_INFO: - if (readbuf) - { -- LONGEST l = get_core_siginfo (core_bfd, readbuf, offset, len); -- -- if (l > 0) -+ if (core_gdbarch -+ && gdbarch_core_xfer_siginfo_p (core_gdbarch)) - { -- *xfered_len = len; -- return TARGET_XFER_OK; -+ LONGEST l = gdbarch_core_xfer_siginfo (core_gdbarch, readbuf, -+ offset, len); -+ -+ if (l >= 0) -+ { -+ *xfered_len = l; -+ if (l == 0) -+ return TARGET_XFER_EOF; -+ else -+ return TARGET_XFER_OK; -+ } - } - } - return TARGET_XFER_E_IO; -diff --git gdb/gdbarch.c gdb/gdbarch.c -index e5efdfbb26..24521b5e23 100644 ---- gdb/gdbarch.c -+++ gdb/gdbarch.c -@@ -287,6 +287,7 @@ struct gdbarch - gdbarch_core_xfer_shared_libraries_aix_ftype *core_xfer_shared_libraries_aix; - gdbarch_core_pid_to_str_ftype *core_pid_to_str; - gdbarch_core_thread_name_ftype *core_thread_name; -+ gdbarch_core_xfer_siginfo_ftype *core_xfer_siginfo; - const char * gcore_bfd_target; - int vtable_function_descriptors; - int vbit_in_delta; -@@ -646,6 +647,7 @@ verify_gdbarch (struct gdbarch *gdbarch) - /* Skip verify of core_xfer_shared_libraries_aix, has predicate. */ - /* Skip verify of core_pid_to_str, has predicate. */ - /* Skip verify of core_thread_name, has predicate. */ -+ /* Skip verify of core_xfer_siginfo, has predicate. */ - /* Skip verify of gcore_bfd_target, has predicate. */ - /* Skip verify of vtable_function_descriptors, invalid_p == 0 */ - /* Skip verify of vbit_in_delta, invalid_p == 0 */ -@@ -884,6 +886,12 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) - "gdbarch_dump: core_xfer_shared_libraries_aix = <%s>\n", - host_address_to_string (gdbarch->core_xfer_shared_libraries_aix)); - fprintf_unfiltered (file, -+ "gdbarch_dump: gdbarch_core_xfer_siginfo_p() = %d\n", -+ gdbarch_core_xfer_siginfo_p (gdbarch)); -+ fprintf_unfiltered (file, -+ "gdbarch_dump: core_xfer_siginfo = <%s>\n", -+ host_address_to_string (gdbarch->core_xfer_siginfo)); -+ fprintf_unfiltered (file, - "gdbarch_dump: decr_pc_after_break = %s\n", - core_addr_to_string_nz (gdbarch->decr_pc_after_break)); - fprintf_unfiltered (file, -@@ -3797,6 +3805,30 @@ set_gdbarch_core_thread_name (struct gdbarch *gdbarch, - } - - int -+gdbarch_core_xfer_siginfo_p (struct gdbarch *gdbarch) -+{ -+ gdb_assert (gdbarch != NULL); -+ return gdbarch->core_xfer_siginfo != NULL; -+} -+ -+LONGEST -+gdbarch_core_xfer_siginfo (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len) -+{ -+ gdb_assert (gdbarch != NULL); -+ gdb_assert (gdbarch->core_xfer_siginfo != NULL); -+ if (gdbarch_debug >= 2) -+ fprintf_unfiltered (gdb_stdlog, "gdbarch_core_xfer_siginfo called\n"); -+ return gdbarch->core_xfer_siginfo (gdbarch, readbuf, offset, len); -+} -+ -+void -+set_gdbarch_core_xfer_siginfo (struct gdbarch *gdbarch, -+ gdbarch_core_xfer_siginfo_ftype core_xfer_siginfo) -+{ -+ gdbarch->core_xfer_siginfo = core_xfer_siginfo; -+} -+ -+int - gdbarch_gcore_bfd_target_p (struct gdbarch *gdbarch) - { - gdb_assert (gdbarch != NULL); -diff --git gdb/gdbarch.h gdb/gdbarch.h -index ab7561f851..1c95301f6f 100644 ---- gdb/gdbarch.h -+++ gdb/gdbarch.h -@@ -933,6 +933,16 @@ typedef const char * (gdbarch_core_thread_name_ftype) (struct gdbarch *gdbarch, - extern const char * gdbarch_core_thread_name (struct gdbarch *gdbarch, struct thread_info *thr); - extern void set_gdbarch_core_thread_name (struct gdbarch *gdbarch, gdbarch_core_thread_name_ftype *core_thread_name); - -+/* Read offset OFFSET of TARGET_OBJECT_SIGNAL_INFO signal information -+ from core file into buffer READBUF with length LEN. Return the number -+ of bytes read (zero indicates EOF, a negative value indicates failure). */ -+ -+extern int gdbarch_core_xfer_siginfo_p (struct gdbarch *gdbarch); -+ -+typedef LONGEST (gdbarch_core_xfer_siginfo_ftype) (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len); -+extern LONGEST gdbarch_core_xfer_siginfo (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len); -+extern void set_gdbarch_core_xfer_siginfo (struct gdbarch *gdbarch, gdbarch_core_xfer_siginfo_ftype *core_xfer_siginfo); -+ - /* BFD target to use when generating a core file. */ - - extern int gdbarch_gcore_bfd_target_p (struct gdbarch *gdbarch); -diff --git gdb/gdbarch.sh gdb/gdbarch.sh -index 22f5715037..3aab17f958 100755 ---- gdb/gdbarch.sh -+++ gdb/gdbarch.sh -@@ -755,6 +755,11 @@ M;const char *;core_pid_to_str;ptid_t ptid;ptid - # How the core target extracts the name of a thread from a core file. - M;const char *;core_thread_name;struct thread_info *thr;thr - -+# Read offset OFFSET of TARGET_OBJECT_SIGNAL_INFO signal information -+# from core file into buffer READBUF with length LEN. Return the number -+# of bytes read (zero indicates EOF, a negative value indicates failure). -+M;LONGEST;core_xfer_siginfo;gdb_byte *readbuf, ULONGEST offset, ULONGEST len; readbuf, offset, len -+ - # BFD target to use when generating a core file. - V;const char *;gcore_bfd_target;;;0;0;;;pstring (gdbarch->gcore_bfd_target) - -diff --git gdb/linux-tdep.c gdb/linux-tdep.c -index 2792cbd4c8..5c7f8a0758 100644 ---- gdb/linux-tdep.c -+++ gdb/linux-tdep.c -@@ -1127,6 +1127,26 @@ linux_core_info_proc (struct gdbarch *gdbarch, const char *args, - error (_("unable to handle request")); - } - -+/* Read siginfo data from the core, if possible. Returns -1 on -+ failure. Otherwise, returns the number of bytes read. READBUF, -+ OFFSET, and LEN are all as specified by the to_xfer_partial -+ interface. */ -+ -+static LONGEST -+linux_core_xfer_siginfo (struct gdbarch *gdbarch, gdb_byte *readbuf, -+ ULONGEST offset, ULONGEST len) -+{ -+ thread_section_name section_name (".note.linuxcore.siginfo", inferior_ptid); -+ asection *section = bfd_get_section_by_name (core_bfd, section_name.c_str ()); -+ if (section == NULL) -+ return -1; -+ -+ if (!bfd_get_section_contents (core_bfd, section, readbuf, offset, len)) -+ return -1; -+ -+ return len; -+} -+ - typedef int linux_find_memory_region_ftype (ULONGEST vaddr, ULONGEST size, - ULONGEST offset, ULONGEST inode, - int read, int write, -@@ -2516,6 +2536,7 @@ linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - set_gdbarch_core_pid_to_str (gdbarch, linux_core_pid_to_str); - set_gdbarch_info_proc (gdbarch, linux_info_proc); - set_gdbarch_core_info_proc (gdbarch, linux_core_info_proc); -+ set_gdbarch_core_xfer_siginfo (gdbarch, linux_core_xfer_siginfo); - set_gdbarch_find_memory_regions (gdbarch, linux_find_memory_regions); - set_gdbarch_make_corefile_notes (gdbarch, linux_make_corefile_notes); - set_gdbarch_has_shared_address_space (gdbarch, Index: devel/gdb/files/commit-3c3ae77e68 =================================================================== --- devel/gdb/files/commit-3c3ae77e68 +++ /dev/null @@ -1,156 +0,0 @@ -commit 3c3ae77e68a9032ef9f174bf6b1cc992b6a4cb35 -Author: Pedro Alves -Date: Thu May 4 15:14:37 2017 +0100 - - Fix get_core_register_section leak, introduce thread_section_name - - This plugs a leak introduced in the previous change to - get_core_register_section, which removed an xfree call that is - actually necessary because the 'section_name' local is static. - - From [1] it looks like the reason the variable was made static to - begin with, was just "laziness" to avoid having to think about freeing - it on every function return path: - - https://sourceware.org/ml/gdb-patches/2005-03/msg00237.html - - The easiest to fix that nowadays is to use a std::string. - - I don't see a need to xstrdup the section name in the single-threaded - case though, and also there's more than one place that computes a - multi-threaded section name in the same way. So put the section name - computation in a wrapper class with state. - - gdb/ChangeLog: - 2017-05-04 Pedro Alves - - * corelow.c (thread_section_name): New class. - (get_core_register_section, get_core_siginfo): Use it. - -diff --git gdb/corelow.c gdb/corelow.c -index 2266f2467a..0aff02d4db 100644 ---- gdb/corelow.c -+++ gdb/corelow.c -@@ -485,6 +485,51 @@ core_detach (struct target_ops *ops, const char *args, int from_tty) - printf_filtered (_("No core file now.\n")); - } - -+/* Build either a single-thread or multi-threaded section name for -+ PTID. -+ -+ If ptid's lwp member is zero, we want to do the single-threaded -+ thing: look for a section named NAME (as passed to the -+ constructor). If ptid's lwp member is non-zero, we'll want do the -+ multi-threaded thing: look for a section named "NAME/LWP", where -+ LWP is the shortest ASCII decimal representation of ptid's lwp -+ member. */ -+ -+class thread_section_name -+{ -+public: -+ /* NAME is the single-threaded section name. If PTID represents an -+ LWP, then the build section name is "NAME/LWP", otherwise it's -+ just "NAME" unmodified. */ -+ thread_section_name (const char *name, ptid_t ptid) -+ { -+ if (ptid.lwp_p ()) -+ { -+ m_storage = string_printf ("%s/%ld", name, ptid.lwp ()); -+ m_section_name = m_storage.c_str (); -+ } -+ else -+ m_section_name = name; -+ } -+ -+ /* Return the computed section name. The result is valid as long as -+ this thread_section_name object is live. */ -+ const char *c_str () const -+ { return m_section_name; } -+ -+ /* Disable copy. */ -+ thread_section_name (const thread_section_name &) = delete; -+ void operator= (const thread_section_name &) = delete; -+ -+private: -+ /* Either a pointer into M_STORAGE, or a pointer to the name passed -+ as parameter to the constructor. */ -+ const char *m_section_name; -+ /* If we need to build a new section name, this is where we store -+ it. */ -+ std::string m_storage; -+}; -+ - /* Try to retrieve registers from a section in core_bfd, and supply - them to core_vec->core_read_registers, as the register set numbered - WHICH. -@@ -511,21 +556,15 @@ get_core_register_section (struct regcache *regcache, - const char *human_name, - int required) - { -- static char *section_name; - struct bfd_section *section; - bfd_size_type size; - char *contents; - bool variable_size_section = (regset != NULL - && regset->flags & REGSET_VARIABLE_SIZE); -- ptid_t ptid = regcache_get_ptid (regcache); - -- if (ptid_get_lwp (ptid)) -- section_name = xstrprintf ("%s/%ld", name, -- ptid_get_lwp (ptid)); -- else -- section_name = xstrdup (name); -+ thread_section_name section_name (name, regcache->ptid ()); - -- section = bfd_get_section_by_name (core_bfd, section_name); -+ section = bfd_get_section_by_name (core_bfd, section_name.c_str ()); - if (! section) - { - if (required) -@@ -537,13 +576,14 @@ get_core_register_section (struct regcache *regcache, - size = bfd_section_size (core_bfd, section); - if (size < min_size) - { -- warning (_("Section `%s' in core file too small."), section_name); -+ warning (_("Section `%s' in core file too small."), -+ section_name.c_str ()); - return; - } - if (size != min_size && !variable_size_section) - { - warning (_("Unexpected size of section `%s' in core file."), -- section_name); -+ section_name.c_str ()); - } - - contents = (char *) alloca (size); -@@ -551,7 +591,7 @@ get_core_register_section (struct regcache *regcache, - (file_ptr) 0, size)) - { - warning (_("Couldn't read %s registers from `%s' section in core file."), -- human_name, name); -+ human_name, section_name.c_str ()); - return; - } - -@@ -681,18 +721,8 @@ add_to_spuid_list (bfd *abfd, asection *asect, void *list_p) - static LONGEST - get_core_siginfo (bfd *abfd, gdb_byte *readbuf, ULONGEST offset, ULONGEST len) - { -- asection *section; -- char *section_name; -- const char *name = ".note.linuxcore.siginfo"; -- -- if (ptid_get_lwp (inferior_ptid)) -- section_name = xstrprintf ("%s/%ld", name, -- ptid_get_lwp (inferior_ptid)); -- else -- section_name = xstrdup (name); -- -- section = bfd_get_section_by_name (abfd, section_name); -- xfree (section_name); -+ thread_section_name section_name (".note.linuxcore.siginfo", inferior_ptid); -+ asection *section = bfd_get_section_by_name (abfd, section_name.c_str ()); - if (section == NULL) - return -1; - Index: devel/gdb/files/commit-45eba0ab7d =================================================================== --- devel/gdb/files/commit-45eba0ab7d +++ /dev/null @@ -1,45 +0,0 @@ -commit 45eba0ab7d26435121facb68847fbd0cd4a313c1 -Author: Andreas Arnez -Date: Thu May 4 11:06:10 2017 +0200 - - Remove some superfluous code in corelow.c - - In corelow.c I stumbled upon an extra semicolon and an xfree of a NULL - pointer. Remove them. - - gdb/ChangeLog: - - * corelow.c (sniff_core_bfd): Remove extra semicolon. - (get_core_register_section): Remove xfree of NULL pointer. - -diff --git gdb/corelow.c gdb/corelow.c -index 3267c37843..2266f2467a 100644 ---- gdb/corelow.c -+++ gdb/corelow.c -@@ -129,7 +129,7 @@ sniff_core_bfd (bfd *abfd) - { - struct core_fns *cf; - struct core_fns *yummy = NULL; -- int matches = 0;; -+ int matches = 0; - - /* Don't sniff if we have support for register sets in - CORE_GDBARCH. */ -@@ -511,7 +511,7 @@ get_core_register_section (struct regcache *regcache, - const char *human_name, - int required) - { -- static char *section_name = NULL; -+ static char *section_name; - struct bfd_section *section; - bfd_size_type size; - char *contents; -@@ -519,8 +519,6 @@ get_core_register_section (struct regcache *regcache, - && regset->flags & REGSET_VARIABLE_SIZE); - ptid_t ptid = regcache_get_ptid (regcache); - -- xfree (section_name); -- - if (ptid_get_lwp (ptid)) - section_name = xstrprintf ("%s/%ld", name, - ptid_get_lwp (ptid)); Index: devel/gdb/files/commit-48aeef91c2 =================================================================== --- devel/gdb/files/commit-48aeef91c2 +++ /dev/null @@ -1,805 +0,0 @@ -commit 48aeef91c248291dd03583798904612426b1f40a -Author: John Baldwin -Date: Mon Jun 26 18:14:43 2017 -0700 - - Include the fs_base and gs_base registers in amd64 target descriptions. - - This permits these registers to be used with non-Linux targets. - - gdb/ChangeLog: - - * features/Makefile (amd64.dat, amd64-avx.dat, amd64-mpx.dat) - (amd64-avx-mpx.dat, amd64-avx-avx512.dat) - (amd64-avx-mpx-avx512-pku.dat): Add i386/64bit-segments.xml in - those rules. - * features/i386/amd64-avx-avx512.xml: Add 64bit-segments.xml. - * features/i386/amd64-avx-mpx-avx512-pku.xml: Add 64bit-segments.xml. - * features/i386/amd64-avx-mpx.xml: Add 64bit-segments.xml. - * features/i386/amd64-avx.xml: Add 64bit-segments.xml. - * features/i386/amd64-mpx.xml: Add 64bit-segments.xml. - * features/i386/amd64.xml: Add 64bit-segments.xml. - * features/i386/amd64-avx-avx512.c: Regenerated. - * features/i386/amd64-avx-mpx-avx512-pku.c: Regenerated. - * features/i386/amd64-avx-mpx.c: Regenerated. - * features/i386/amd64-avx.c: Regenerated. - * features/i386/amd64-mpx.c: Regenerated. - * features/i386/amd64.c: Regenerated. - * regformats/i386/amd64-avx-avx512.dat: Regenerated. - * regformats/i386/amd64-avx-mpx-avx512-pku.dat: Regenerated. - * regformats/i386/amd64-avx-mpx.dat: Regenerated. - * regformats/i386/amd64-avx.dat: Regenerated. - * regformats/i386/amd64-mpx.dat: Regenerated. - * regformats/i386/amd64.dat: Regenerated. - -diff --git gdb/features/Makefile gdb/features/Makefile -index 3bc8b5ae85..75741acbe1 100644 ---- gdb/features/Makefile -+++ gdb/features/Makefile -@@ -263,7 +263,8 @@ $(outdir)/arm/arm-with-iwmmxt.dat: arm/arm-core.xml arm/xscale-iwmmxt.xml - $(outdir)/i386/i386.dat: i386/32bit-core.xml i386/32bit-sse.xml - $(outdir)/i386/i386-linux.dat: i386/32bit-core.xml i386/32bit-sse.xml \ - i386/32bit-linux.xml --$(outdir)/i386/amd64.dat: i386/64bit-core.xml i386/64bit-sse.xml -+$(outdir)/i386/amd64.dat: i386/64bit-core.xml i386/64bit-sse.xml \ -+ i386/64bit-segments.xml - $(outdir)/i386/amd64-linux.dat: i386/64bit-core.xml i386/64bit-sse.xml \ - i386/64bit-linux.xml i386/64bit-segments.xml - $(outdir)/i386/i386-avx.dat: i386/32bit-core.xml i386/32bit-avx.xml -@@ -289,7 +290,8 @@ $(outdir)/i386/i386-avx-mpx-avx512-pku-linux.dat: i386/32bit-core.xml \ - i386/32bit-pkeys.xml i386/32bit-linux.xml - $(outdir)/i386/i386-mmx.dat: i386/32bit-core.xml - $(outdir)/i386/i386-mmx-linux.dat: i386/32bit-core.xml i386/32bit-linux.xml --$(outdir)/i386/amd64-avx.dat: i386/64bit-core.xml i386/64bit-avx.xml -+$(outdir)/i386/amd64-avx.dat: i386/64bit-core.xml i386/64bit-avx.xml \ -+ i386/64bit-segments.xml - $(outdir)/i386/amd64-avx-linux.dat: i386/64bit-core.xml i386/64bit-avx.xml \ - i386/64bit-linux.xml i386/64bit-segments.xml - $(outdir)/i386/amd64-mpx-linux.dat: i386/64bit-core.xml i386/64bit-avx.xml \ -@@ -297,16 +299,16 @@ $(outdir)/i386/amd64-mpx-linux.dat: i386/64bit-core.xml i386/64bit-avx.xml \ - $(outdir)/i386/amd64-avx-mpx-linux.dat: i386/64bit-core.xml \ - i386/64bit-linux.xml i386/64bit-segments.xml i386/64bit-mpx.xml - $(outdir)/i386/amd64-mpx.dat: i386/64bit-core.xml i386/64bit-avx.xml \ -- i386/64bit-mpx.xml -+ i386/64bit-segments.xml i386/64bit-mpx.xml - $(outdir)/i386/amd64-avx-mpx.dat: i386/64bit-core.xml \ -- i386/64bit-mpx.xml -+ i386/64bit-segments.xml i386/64bit-mpx.xml - $(outdir)/i386/amd64-avx-avx512.dat: i386/64bit-core.xml i386/64bit-avx.xml \ -- i386/64bit-avx512.xml -+ i386/64bit-avx512.xml i386/64bit-segments.xml - $(outdir)/i386/amd64-avx-avx512-linux.dat: i386/64bit-core.xml i386/64bit-avx.xml \ - i386/64bit-avx512.xml i386/64bit-linux.xml - $(outdir)/i386/amd64-avx-mpx-avx512-pku.dat: i386/64bit-core.xml \ - i386/64bit-avx.xml i386/64bit-mpx.xml i386/64bit-avx512.xml \ -- i386/64bit-pkeys.xml -+ i386/64bit-pkeys.xml i386/64bit-segments.xml - $(outdir)/i386/amd64-avx-mpx-avx512-pku-linux.dat: i386/64bit-core.xml \ - i386/64bit-avx.xml i386/64bit-mpx.xml i386/64bit-avx512.xml \ - i386/64bit-linux.xml i386/64bit-segments.xml \ -diff --git gdb/features/i386/amd64-avx-avx512.c gdb/features/i386/amd64-avx-avx512.c -index 8a185c108d..f1ebde1071 100644 ---- gdb/features/i386/amd64-avx-avx512.c -+++ gdb/features/i386/amd64-avx-avx512.c -@@ -146,23 +146,27 @@ initialize_tdesc_amd64_avx_avx512 (void) - tdesc_create_reg (feature, "xmm15", 55, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "mxcsr", 56, 1, "vector", 32, "i386_mxcsr"); - -+ feature = tdesc_create_feature (result, "org.gnu.gdb.i386.segments"); -+ tdesc_create_reg (feature, "fs_base", 57, 1, NULL, 64, "int"); -+ tdesc_create_reg (feature, "gs_base", 58, 1, NULL, 64, "int"); -+ - feature = tdesc_create_feature (result, "org.gnu.gdb.i386.avx"); -- tdesc_create_reg (feature, "ymm0h", 57, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm1h", 58, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm2h", 59, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm3h", 60, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm4h", 61, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm5h", 62, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm6h", 63, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm7h", 64, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm8h", 65, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm9h", 66, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm10h", 67, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm11h", 68, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm12h", 69, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm13h", 70, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm14h", 71, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm15h", 72, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm0h", 59, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm1h", 60, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm2h", 61, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm3h", 62, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm4h", 63, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm5h", 64, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm6h", 65, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm7h", 66, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm8h", 67, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm9h", 68, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm10h", 69, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm11h", 70, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm12h", 71, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm13h", 72, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm14h", 73, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm15h", 74, 1, NULL, 128, "uint128"); - - feature = tdesc_create_feature (result, "org.gnu.gdb.i386.avx512"); - field_type = tdesc_named_type (feature, "ieee_single"); -@@ -202,78 +206,78 @@ initialize_tdesc_amd64_avx_avx512 (void) - field_type = tdesc_named_type (feature, "uint128"); - tdesc_create_vector (feature, "v2ui128", field_type, 2); - -- tdesc_create_reg (feature, "xmm16", 73, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm17", 74, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm18", 75, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm19", 76, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm20", 77, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm21", 78, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm22", 79, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm23", 80, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm24", 81, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm25", 82, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm26", 83, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm27", 84, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm28", 85, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm29", 86, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm30", 87, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm31", 88, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "ymm16h", 89, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm17h", 90, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm18h", 91, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm19h", 92, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm20h", 93, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm21h", 94, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm22h", 95, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm23h", 96, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm24h", 97, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm25h", 98, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm26h", 99, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm27h", 100, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm28h", 101, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm29h", 102, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm30h", 103, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm31h", 104, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "k0", 105, 1, NULL, 64, "uint64"); -- tdesc_create_reg (feature, "k1", 106, 1, NULL, 64, "uint64"); -- tdesc_create_reg (feature, "k2", 107, 1, NULL, 64, "uint64"); -- tdesc_create_reg (feature, "k3", 108, 1, NULL, 64, "uint64"); -- tdesc_create_reg (feature, "k4", 109, 1, NULL, 64, "uint64"); -- tdesc_create_reg (feature, "k5", 110, 1, NULL, 64, "uint64"); -- tdesc_create_reg (feature, "k6", 111, 1, NULL, 64, "uint64"); -- tdesc_create_reg (feature, "k7", 112, 1, NULL, 64, "uint64"); -- tdesc_create_reg (feature, "zmm0h", 113, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm1h", 114, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm2h", 115, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm3h", 116, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm4h", 117, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm5h", 118, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm6h", 119, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm7h", 120, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm8h", 121, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm9h", 122, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm10h", 123, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm11h", 124, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm12h", 125, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm13h", 126, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm14h", 127, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm15h", 128, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm16h", 129, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm17h", 130, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm18h", 131, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm19h", 132, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm20h", 133, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm21h", 134, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm22h", 135, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm23h", 136, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm24h", 137, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm25h", 138, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm26h", 139, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm27h", 140, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm28h", 141, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm29h", 142, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm30h", 143, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm31h", 144, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "xmm16", 75, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm17", 76, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm18", 77, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm19", 78, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm20", 79, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm21", 80, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm22", 81, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm23", 82, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm24", 83, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm25", 84, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm26", 85, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm27", 86, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm28", 87, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm29", 88, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm30", 89, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm31", 90, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "ymm16h", 91, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm17h", 92, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm18h", 93, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm19h", 94, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm20h", 95, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm21h", 96, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm22h", 97, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm23h", 98, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm24h", 99, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm25h", 100, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm26h", 101, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm27h", 102, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm28h", 103, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm29h", 104, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm30h", 105, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm31h", 106, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "k0", 107, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "k1", 108, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "k2", 109, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "k3", 110, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "k4", 111, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "k5", 112, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "k6", 113, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "k7", 114, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "zmm0h", 115, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm1h", 116, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm2h", 117, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm3h", 118, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm4h", 119, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm5h", 120, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm6h", 121, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm7h", 122, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm8h", 123, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm9h", 124, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm10h", 125, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm11h", 126, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm12h", 127, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm13h", 128, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm14h", 129, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm15h", 130, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm16h", 131, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm17h", 132, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm18h", 133, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm19h", 134, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm20h", 135, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm21h", 136, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm22h", 137, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm23h", 138, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm24h", 139, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm25h", 140, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm26h", 141, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm27h", 142, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm28h", 143, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm29h", 144, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm30h", 145, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm31h", 146, 1, NULL, 256, "v2ui128"); - - tdesc_amd64_avx_avx512 = result; - } -diff --git gdb/features/i386/amd64-avx-avx512.xml gdb/features/i386/amd64-avx-avx512.xml -index a4587433c8..fdf8136f74 100644 ---- gdb/features/i386/amd64-avx-avx512.xml -+++ gdb/features/i386/amd64-avx-avx512.xml -@@ -12,6 +12,7 @@ - i386:x86-64 - - -+ - - - -diff --git gdb/features/i386/amd64-avx-mpx-avx512-pku.c gdb/features/i386/amd64-avx-mpx-avx512-pku.c -index dfe7d7778a..f119e52f5d 100644 ---- gdb/features/i386/amd64-avx-mpx-avx512-pku.c -+++ gdb/features/i386/amd64-avx-mpx-avx512-pku.c -@@ -146,23 +146,27 @@ initialize_tdesc_amd64_avx_mpx_avx512_pku (void) - tdesc_create_reg (feature, "xmm15", 55, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "mxcsr", 56, 1, "vector", 32, "i386_mxcsr"); - -+ feature = tdesc_create_feature (result, "org.gnu.gdb.i386.segments"); -+ tdesc_create_reg (feature, "fs_base", 57, 1, NULL, 64, "int"); -+ tdesc_create_reg (feature, "gs_base", 58, 1, NULL, 64, "int"); -+ - feature = tdesc_create_feature (result, "org.gnu.gdb.i386.avx"); -- tdesc_create_reg (feature, "ymm0h", 57, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm1h", 58, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm2h", 59, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm3h", 60, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm4h", 61, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm5h", 62, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm6h", 63, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm7h", 64, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm8h", 65, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm9h", 66, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm10h", 67, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm11h", 68, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm12h", 69, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm13h", 70, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm14h", 71, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm15h", 72, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm0h", 59, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm1h", 60, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm2h", 61, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm3h", 62, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm4h", 63, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm5h", 64, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm6h", 65, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm7h", 66, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm8h", 67, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm9h", 68, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm10h", 69, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm11h", 70, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm12h", 71, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm13h", 72, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm14h", 73, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm15h", 74, 1, NULL, 128, "uint128"); - - feature = tdesc_create_feature (result, "org.gnu.gdb.i386.mpx"); - type = tdesc_create_struct (feature, "br128"); -@@ -195,12 +199,12 @@ initialize_tdesc_amd64_avx_mpx_avx512_pku (void) - field_type = tdesc_named_type (feature, "_bndcfgu"); - tdesc_add_field (type, "config", field_type); - -- tdesc_create_reg (feature, "bnd0raw", 73, 1, NULL, 128, "br128"); -- tdesc_create_reg (feature, "bnd1raw", 74, 1, NULL, 128, "br128"); -- tdesc_create_reg (feature, "bnd2raw", 75, 1, NULL, 128, "br128"); -- tdesc_create_reg (feature, "bnd3raw", 76, 1, NULL, 128, "br128"); -- tdesc_create_reg (feature, "bndcfgu", 77, 1, NULL, 64, "cfgu"); -- tdesc_create_reg (feature, "bndstatus", 78, 1, NULL, 64, "status"); -+ tdesc_create_reg (feature, "bnd0raw", 75, 1, NULL, 128, "br128"); -+ tdesc_create_reg (feature, "bnd1raw", 76, 1, NULL, 128, "br128"); -+ tdesc_create_reg (feature, "bnd2raw", 77, 1, NULL, 128, "br128"); -+ tdesc_create_reg (feature, "bnd3raw", 78, 1, NULL, 128, "br128"); -+ tdesc_create_reg (feature, "bndcfgu", 79, 1, NULL, 64, "cfgu"); -+ tdesc_create_reg (feature, "bndstatus", 80, 1, NULL, 64, "status"); - - feature = tdesc_create_feature (result, "org.gnu.gdb.i386.avx512"); - field_type = tdesc_named_type (feature, "ieee_single"); -@@ -240,81 +244,81 @@ initialize_tdesc_amd64_avx_mpx_avx512_pku (void) - field_type = tdesc_named_type (feature, "uint128"); - tdesc_create_vector (feature, "v2ui128", field_type, 2); - -- tdesc_create_reg (feature, "xmm16", 79, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm17", 80, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm18", 81, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm19", 82, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm20", 83, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm21", 84, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm22", 85, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm23", 86, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm24", 87, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm25", 88, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm26", 89, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm27", 90, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm28", 91, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm29", 92, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm30", 93, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "xmm31", 94, 1, NULL, 128, "vec128"); -- tdesc_create_reg (feature, "ymm16h", 95, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm17h", 96, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm18h", 97, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm19h", 98, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm20h", 99, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm21h", 100, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm22h", 101, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm23h", 102, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm24h", 103, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm25h", 104, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm26h", 105, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm27h", 106, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm28h", 107, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm29h", 108, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm30h", 109, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm31h", 110, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "k0", 111, 1, NULL, 64, "uint64"); -- tdesc_create_reg (feature, "k1", 112, 1, NULL, 64, "uint64"); -- tdesc_create_reg (feature, "k2", 113, 1, NULL, 64, "uint64"); -- tdesc_create_reg (feature, "k3", 114, 1, NULL, 64, "uint64"); -- tdesc_create_reg (feature, "k4", 115, 1, NULL, 64, "uint64"); -- tdesc_create_reg (feature, "k5", 116, 1, NULL, 64, "uint64"); -- tdesc_create_reg (feature, "k6", 117, 1, NULL, 64, "uint64"); -- tdesc_create_reg (feature, "k7", 118, 1, NULL, 64, "uint64"); -- tdesc_create_reg (feature, "zmm0h", 119, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm1h", 120, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm2h", 121, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm3h", 122, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm4h", 123, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm5h", 124, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm6h", 125, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm7h", 126, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm8h", 127, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm9h", 128, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm10h", 129, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm11h", 130, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm12h", 131, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm13h", 132, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm14h", 133, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm15h", 134, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm16h", 135, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm17h", 136, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm18h", 137, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm19h", 138, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm20h", 139, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm21h", 140, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm22h", 141, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm23h", 142, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm24h", 143, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm25h", 144, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm26h", 145, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm27h", 146, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm28h", 147, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm29h", 148, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm30h", 149, 1, NULL, 256, "v2ui128"); -- tdesc_create_reg (feature, "zmm31h", 150, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "xmm16", 81, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm17", 82, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm18", 83, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm19", 84, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm20", 85, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm21", 86, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm22", 87, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm23", 88, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm24", 89, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm25", 90, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm26", 91, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm27", 92, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm28", 93, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm29", 94, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm30", 95, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "xmm31", 96, 1, NULL, 128, "vec128"); -+ tdesc_create_reg (feature, "ymm16h", 97, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm17h", 98, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm18h", 99, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm19h", 100, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm20h", 101, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm21h", 102, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm22h", 103, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm23h", 104, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm24h", 105, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm25h", 106, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm26h", 107, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm27h", 108, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm28h", 109, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm29h", 110, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm30h", 111, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm31h", 112, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "k0", 113, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "k1", 114, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "k2", 115, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "k3", 116, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "k4", 117, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "k5", 118, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "k6", 119, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "k7", 120, 1, NULL, 64, "uint64"); -+ tdesc_create_reg (feature, "zmm0h", 121, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm1h", 122, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm2h", 123, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm3h", 124, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm4h", 125, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm5h", 126, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm6h", 127, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm7h", 128, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm8h", 129, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm9h", 130, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm10h", 131, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm11h", 132, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm12h", 133, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm13h", 134, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm14h", 135, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm15h", 136, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm16h", 137, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm17h", 138, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm18h", 139, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm19h", 140, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm20h", 141, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm21h", 142, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm22h", 143, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm23h", 144, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm24h", 145, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm25h", 146, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm26h", 147, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm27h", 148, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm28h", 149, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm29h", 150, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm30h", 151, 1, NULL, 256, "v2ui128"); -+ tdesc_create_reg (feature, "zmm31h", 152, 1, NULL, 256, "v2ui128"); - - feature = tdesc_create_feature (result, "org.gnu.gdb.i386.pkeys"); -- tdesc_create_reg (feature, "pkru", 151, 1, NULL, 32, "uint32"); -+ tdesc_create_reg (feature, "pkru", 153, 1, NULL, 32, "uint32"); - - tdesc_amd64_avx_mpx_avx512_pku = result; - } -diff --git gdb/features/i386/amd64-avx-mpx-avx512-pku.xml gdb/features/i386/amd64-avx-mpx-avx512-pku.xml -index e769108873..d8203e3400 100644 ---- gdb/features/i386/amd64-avx-mpx-avx512-pku.xml -+++ gdb/features/i386/amd64-avx-mpx-avx512-pku.xml -@@ -12,6 +12,7 @@ - i386:x86-64 - - -+ - - - -diff --git gdb/features/i386/amd64-avx-mpx.c gdb/features/i386/amd64-avx-mpx.c -index ab56f42f13..0c5161fe8d 100644 ---- gdb/features/i386/amd64-avx-mpx.c -+++ gdb/features/i386/amd64-avx-mpx.c -@@ -146,23 +146,27 @@ initialize_tdesc_amd64_avx_mpx (void) - tdesc_create_reg (feature, "xmm15", 55, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "mxcsr", 56, 1, "vector", 32, "i386_mxcsr"); - -+ feature = tdesc_create_feature (result, "org.gnu.gdb.i386.segments"); -+ tdesc_create_reg (feature, "fs_base", 57, 1, NULL, 64, "int"); -+ tdesc_create_reg (feature, "gs_base", 58, 1, NULL, 64, "int"); -+ - feature = tdesc_create_feature (result, "org.gnu.gdb.i386.avx"); -- tdesc_create_reg (feature, "ymm0h", 57, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm1h", 58, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm2h", 59, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm3h", 60, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm4h", 61, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm5h", 62, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm6h", 63, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm7h", 64, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm8h", 65, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm9h", 66, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm10h", 67, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm11h", 68, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm12h", 69, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm13h", 70, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm14h", 71, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm15h", 72, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm0h", 59, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm1h", 60, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm2h", 61, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm3h", 62, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm4h", 63, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm5h", 64, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm6h", 65, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm7h", 66, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm8h", 67, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm9h", 68, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm10h", 69, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm11h", 70, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm12h", 71, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm13h", 72, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm14h", 73, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm15h", 74, 1, NULL, 128, "uint128"); - - feature = tdesc_create_feature (result, "org.gnu.gdb.i386.mpx"); - type = tdesc_create_struct (feature, "br128"); -@@ -195,12 +199,12 @@ initialize_tdesc_amd64_avx_mpx (void) - field_type = tdesc_named_type (feature, "_bndcfgu"); - tdesc_add_field (type, "config", field_type); - -- tdesc_create_reg (feature, "bnd0raw", 73, 1, NULL, 128, "br128"); -- tdesc_create_reg (feature, "bnd1raw", 74, 1, NULL, 128, "br128"); -- tdesc_create_reg (feature, "bnd2raw", 75, 1, NULL, 128, "br128"); -- tdesc_create_reg (feature, "bnd3raw", 76, 1, NULL, 128, "br128"); -- tdesc_create_reg (feature, "bndcfgu", 77, 1, NULL, 64, "cfgu"); -- tdesc_create_reg (feature, "bndstatus", 78, 1, NULL, 64, "status"); -+ tdesc_create_reg (feature, "bnd0raw", 75, 1, NULL, 128, "br128"); -+ tdesc_create_reg (feature, "bnd1raw", 76, 1, NULL, 128, "br128"); -+ tdesc_create_reg (feature, "bnd2raw", 77, 1, NULL, 128, "br128"); -+ tdesc_create_reg (feature, "bnd3raw", 78, 1, NULL, 128, "br128"); -+ tdesc_create_reg (feature, "bndcfgu", 79, 1, NULL, 64, "cfgu"); -+ tdesc_create_reg (feature, "bndstatus", 80, 1, NULL, 64, "status"); - - tdesc_amd64_avx_mpx = result; - } -diff --git gdb/features/i386/amd64-avx-mpx.xml gdb/features/i386/amd64-avx-mpx.xml -index 0001dc8413..001cc58fa6 100644 ---- gdb/features/i386/amd64-avx-mpx.xml -+++ gdb/features/i386/amd64-avx-mpx.xml -@@ -12,6 +12,7 @@ - i386:x86-64 - - -+ - - - -diff --git gdb/features/i386/amd64-avx.c gdb/features/i386/amd64-avx.c -index 42bd69ab97..61d3ff56a4 100644 ---- gdb/features/i386/amd64-avx.c -+++ gdb/features/i386/amd64-avx.c -@@ -146,23 +146,27 @@ initialize_tdesc_amd64_avx (void) - tdesc_create_reg (feature, "xmm15", 55, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "mxcsr", 56, 1, "vector", 32, "i386_mxcsr"); - -+ feature = tdesc_create_feature (result, "org.gnu.gdb.i386.segments"); -+ tdesc_create_reg (feature, "fs_base", 57, 1, NULL, 64, "int"); -+ tdesc_create_reg (feature, "gs_base", 58, 1, NULL, 64, "int"); -+ - feature = tdesc_create_feature (result, "org.gnu.gdb.i386.avx"); -- tdesc_create_reg (feature, "ymm0h", 57, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm1h", 58, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm2h", 59, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm3h", 60, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm4h", 61, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm5h", 62, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm6h", 63, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm7h", 64, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm8h", 65, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm9h", 66, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm10h", 67, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm11h", 68, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm12h", 69, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm13h", 70, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm14h", 71, 1, NULL, 128, "uint128"); -- tdesc_create_reg (feature, "ymm15h", 72, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm0h", 59, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm1h", 60, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm2h", 61, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm3h", 62, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm4h", 63, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm5h", 64, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm6h", 65, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm7h", 66, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm8h", 67, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm9h", 68, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm10h", 69, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm11h", 70, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm12h", 71, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm13h", 72, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm14h", 73, 1, NULL, 128, "uint128"); -+ tdesc_create_reg (feature, "ymm15h", 74, 1, NULL, 128, "uint128"); - - tdesc_amd64_avx = result; - } -diff --git gdb/features/i386/amd64-avx.xml gdb/features/i386/amd64-avx.xml -index d3b63b8132..a0fec551d9 100644 ---- gdb/features/i386/amd64-avx.xml -+++ gdb/features/i386/amd64-avx.xml -@@ -12,5 +12,6 @@ - i386:x86-64 - - -+ - - -diff --git gdb/features/i386/amd64-mpx.c gdb/features/i386/amd64-mpx.c -index 41f0e7834b..026fdb8625 100644 ---- gdb/features/i386/amd64-mpx.c -+++ gdb/features/i386/amd64-mpx.c -@@ -146,6 +146,10 @@ initialize_tdesc_amd64_mpx (void) - tdesc_create_reg (feature, "xmm15", 55, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "mxcsr", 56, 1, "vector", 32, "i386_mxcsr"); - -+ feature = tdesc_create_feature (result, "org.gnu.gdb.i386.segments"); -+ tdesc_create_reg (feature, "fs_base", 57, 1, NULL, 64, "int"); -+ tdesc_create_reg (feature, "gs_base", 58, 1, NULL, 64, "int"); -+ - feature = tdesc_create_feature (result, "org.gnu.gdb.i386.mpx"); - type = tdesc_create_struct (feature, "br128"); - field_type = tdesc_named_type (feature, "uint64"); -@@ -177,12 +181,12 @@ initialize_tdesc_amd64_mpx (void) - field_type = tdesc_named_type (feature, "_bndcfgu"); - tdesc_add_field (type, "config", field_type); - -- tdesc_create_reg (feature, "bnd0raw", 57, 1, NULL, 128, "br128"); -- tdesc_create_reg (feature, "bnd1raw", 58, 1, NULL, 128, "br128"); -- tdesc_create_reg (feature, "bnd2raw", 59, 1, NULL, 128, "br128"); -- tdesc_create_reg (feature, "bnd3raw", 60, 1, NULL, 128, "br128"); -- tdesc_create_reg (feature, "bndcfgu", 61, 1, NULL, 64, "cfgu"); -- tdesc_create_reg (feature, "bndstatus", 62, 1, NULL, 64, "status"); -+ tdesc_create_reg (feature, "bnd0raw", 59, 1, NULL, 128, "br128"); -+ tdesc_create_reg (feature, "bnd1raw", 60, 1, NULL, 128, "br128"); -+ tdesc_create_reg (feature, "bnd2raw", 61, 1, NULL, 128, "br128"); -+ tdesc_create_reg (feature, "bnd3raw", 62, 1, NULL, 128, "br128"); -+ tdesc_create_reg (feature, "bndcfgu", 63, 1, NULL, 64, "cfgu"); -+ tdesc_create_reg (feature, "bndstatus", 64, 1, NULL, 64, "status"); - - tdesc_amd64_mpx = result; - } -diff --git gdb/features/i386/amd64-mpx.xml gdb/features/i386/amd64-mpx.xml -index 7692006e9c..7e0253d661 100644 ---- gdb/features/i386/amd64-mpx.xml -+++ gdb/features/i386/amd64-mpx.xml -@@ -12,5 +12,6 @@ - i386:x86-64 - - -+ - - -diff --git gdb/features/i386/amd64.c gdb/features/i386/amd64.c -index b875a9b322..31ab6ccfba 100644 ---- gdb/features/i386/amd64.c -+++ gdb/features/i386/amd64.c -@@ -146,5 +146,9 @@ initialize_tdesc_amd64 (void) - tdesc_create_reg (feature, "xmm15", 55, 1, NULL, 128, "vec128"); - tdesc_create_reg (feature, "mxcsr", 56, 1, "vector", 32, "i386_mxcsr"); - -+ feature = tdesc_create_feature (result, "org.gnu.gdb.i386.segments"); -+ tdesc_create_reg (feature, "fs_base", 57, 1, NULL, 64, "int"); -+ tdesc_create_reg (feature, "gs_base", 58, 1, NULL, 64, "int"); -+ - tdesc_amd64 = result; - } -diff --git gdb/features/i386/amd64.xml gdb/features/i386/amd64.xml -index d11c07e234..1962a2af37 100644 ---- gdb/features/i386/amd64.xml -+++ gdb/features/i386/amd64.xml -@@ -12,4 +12,5 @@ - i386:x86-64 - - -+ - -diff --git gdb/regformats/i386/amd64-avx-avx512.dat gdb/regformats/i386/amd64-avx-avx512.dat -index b7938e6919..1fbe4733f5 100644 ---- gdb/regformats/i386/amd64-avx-avx512.dat -+++ gdb/regformats/i386/amd64-avx-avx512.dat -@@ -60,6 +60,8 @@ expedite:rbp,rsp,rip - 128:xmm14 - 128:xmm15 - 32:mxcsr -+64:fs_base -+64:gs_base - 128:ymm0h - 128:ymm1h - 128:ymm2h -diff --git gdb/regformats/i386/amd64-avx-mpx-avx512-pku.dat gdb/regformats/i386/amd64-avx-mpx-avx512-pku.dat -index b3340d3276..23c3a4062e 100644 ---- gdb/regformats/i386/amd64-avx-mpx-avx512-pku.dat -+++ gdb/regformats/i386/amd64-avx-mpx-avx512-pku.dat -@@ -60,6 +60,8 @@ expedite:rbp,rsp,rip - 128:xmm14 - 128:xmm15 - 32:mxcsr -+64:fs_base -+64:gs_base - 128:ymm0h - 128:ymm1h - 128:ymm2h -diff --git gdb/regformats/i386/amd64-avx-mpx.dat gdb/regformats/i386/amd64-avx-mpx.dat -index d985641b01..655775b0f9 100644 ---- gdb/regformats/i386/amd64-avx-mpx.dat -+++ gdb/regformats/i386/amd64-avx-mpx.dat -@@ -60,6 +60,8 @@ expedite:rbp,rsp,rip - 128:xmm14 - 128:xmm15 - 32:mxcsr -+64:fs_base -+64:gs_base - 128:ymm0h - 128:ymm1h - 128:ymm2h -diff --git gdb/regformats/i386/amd64-avx.dat gdb/regformats/i386/amd64-avx.dat -index 223233667a..8b9d81e743 100644 ---- gdb/regformats/i386/amd64-avx.dat -+++ gdb/regformats/i386/amd64-avx.dat -@@ -60,6 +60,8 @@ expedite:rbp,rsp,rip - 128:xmm14 - 128:xmm15 - 32:mxcsr -+64:fs_base -+64:gs_base - 128:ymm0h - 128:ymm1h - 128:ymm2h -diff --git gdb/regformats/i386/amd64-mpx.dat gdb/regformats/i386/amd64-mpx.dat -index 43b87769c2..d5e60babd8 100644 ---- gdb/regformats/i386/amd64-mpx.dat -+++ gdb/regformats/i386/amd64-mpx.dat -@@ -60,6 +60,8 @@ expedite:rbp,rsp,rip - 128:xmm14 - 128:xmm15 - 32:mxcsr -+64:fs_base -+64:gs_base - 128:bnd0raw - 128:bnd1raw - 128:bnd2raw -diff --git gdb/regformats/i386/amd64.dat gdb/regformats/i386/amd64.dat -index 0ff917019d..66f26ad094 100644 ---- gdb/regformats/i386/amd64.dat -+++ gdb/regformats/i386/amd64.dat -@@ -60,3 +60,5 @@ expedite:rbp,rsp,rip - 128:xmm14 - 128:xmm15 - 32:mxcsr -+64:fs_base -+64:gs_base Index: devel/gdb/files/commit-4b654465bf =================================================================== --- devel/gdb/files/commit-4b654465bf +++ /dev/null @@ -1,118 +0,0 @@ -commit 4b654465bfc3034c969d2d942c14b2cedfd3e3b6 -Author: John Baldwin -Date: Wed Jun 28 12:50:56 2017 -0700 - - Read signal information from FreeBSD core dumps. - - FreeBSD recently added a new ELF core note which dumps the entire LWP - info structure (the same structure returned by the ptrace PT_LWPINFO - operation) for each thread. The plan is for this note to eventually - supplant the older "thrmisc" ELF core note as it contains more - information and it permits new information to be exported via both - ptrace() and core dumps using the same structure. - - For signal information, the implementation is similar to the native - implementation for FreeBSD processes. The PL_FLAG_SI flag must be - checked to determine if the embedded siginfo_t structure is valid, and - if so it is transferred into the caller's buffer. - - gdb/ChangeLog: - - * fbsd-tdep.c (LWPINFO_OFFSET, LWPINFO_PL_FLAGS) - (LWPINFO64_PL_SIGINFO, LWPINFO32_PL_SIGINFO, PL_FLAG_SI) - (SIZE64_SIGINFO_T, SIZE32_SIGINFO_T, fbsd_core_xfer_siginfo): New. - (fbsd_init_abi): Install gdbarch "core_xfer_siginfo" method. - -diff --git gdb/fbsd-tdep.c gdb/fbsd-tdep.c -index 32df104208..6f30197a83 100644 ---- gdb/fbsd-tdep.c -+++ gdb/fbsd-tdep.c -@@ -30,6 +30,28 @@ - #include "fbsd-tdep.h" - - -+/* FreeBSD kernels 12.0 and later include a copy of the -+ 'ptrace_lwpinfo' structure returned by the PT_LWPINFO ptrace -+ operation in an ELF core note (NT_FREEBSD_PTLWPINFO) for each LWP. -+ The constants below define the offset of field members and flags in -+ this structure used by methods in this file. Note that the -+ 'ptrace_lwpinfo' struct in the note is preceded by a 4 byte integer -+ containing the size of the structure. */ -+ -+#define LWPINFO_OFFSET 0x4 -+ -+/* Offsets in ptrace_lwpinfo. */ -+#define LWPINFO_PL_FLAGS 0x8 -+#define LWPINFO64_PL_SIGINFO 0x30 -+#define LWPINFO32_PL_SIGINFO 0x2c -+ -+/* Flags in pl_flags. */ -+#define PL_FLAG_SI 0x20 /* siginfo is valid */ -+ -+/* Sizes of siginfo_t. */ -+#define SIZE64_SIGINFO_T 80 -+#define SIZE32_SIGINFO_T 64 -+ - static struct gdbarch_data *fbsd_gdbarch_data_handle; - - struct fbsd_gdbarch_data -@@ -113,6 +135,51 @@ fbsd_core_thread_name (struct gdbarch *gdbarch, struct thread_info *thr) - return NULL; - } - -+/* Implement the "core_xfer_siginfo" gdbarch method. */ -+ -+static LONGEST -+fbsd_core_xfer_siginfo (struct gdbarch *gdbarch, gdb_byte *readbuf, -+ ULONGEST offset, ULONGEST len) -+{ -+ size_t siginfo_size; -+ -+ if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32) -+ siginfo_size = SIZE32_SIGINFO_T; -+ else -+ siginfo_size = SIZE64_SIGINFO_T; -+ if (offset > siginfo_size) -+ return -1; -+ -+ thread_section_name section_name (".note.freebsdcore.lwpinfo", inferior_ptid); -+ asection *section = bfd_get_section_by_name (core_bfd, section_name.c_str ()); -+ if (section == NULL) -+ return -1; -+ -+ gdb_byte buf[4]; -+ if (!bfd_get_section_contents (core_bfd, section, buf, -+ LWPINFO_OFFSET + LWPINFO_PL_FLAGS, 4)) -+ return -1; -+ -+ int pl_flags = extract_signed_integer (buf, 4, gdbarch_byte_order (gdbarch)); -+ if (!(pl_flags & PL_FLAG_SI)) -+ return -1; -+ -+ if (offset + len > siginfo_size) -+ len = siginfo_size - offset; -+ -+ ULONGEST siginfo_offset; -+ if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32) -+ siginfo_offset = LWPINFO_OFFSET + LWPINFO32_PL_SIGINFO; -+ else -+ siginfo_offset = LWPINFO_OFFSET + LWPINFO64_PL_SIGINFO; -+ -+ if (!bfd_get_section_contents (core_bfd, section, readbuf, -+ siginfo_offset + offset, len)) -+ return -1; -+ -+ return len; -+} -+ - static int - find_signalled_thread (struct thread_info *info, void *data) - { -@@ -447,6 +514,7 @@ 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_core_xfer_siginfo (gdbarch, fbsd_core_xfer_siginfo); - set_gdbarch_make_corefile_notes (gdbarch, fbsd_make_corefile_notes); - set_gdbarch_print_auxv_entry (gdbarch, fbsd_print_auxv_entry); - set_gdbarch_get_siginfo_type (gdbarch, fbsd_get_siginfo_type); Index: devel/gdb/files/commit-544c67cda1 =================================================================== --- devel/gdb/files/commit-544c67cda1 +++ /dev/null @@ -1,159 +0,0 @@ -commit 544c67cda1686c1b204cb96c0d7885b08d37b8d6 -Author: John Baldwin -Date: Fri Oct 6 11:41:45 2017 -0700 - - Account for padding in FreeBSD/mipsn32 NT_PRSTATUS notes. - - Add a new ELF backend method to grok FreeBSD NT_PRSTATUS core dump - notes. Define a method for MIPS N32 to override the default - elfcore_grok_freebsd_prstatus that accounts for additional padding - between pr_pid and pr_reg that is not present in other 32-bit FreeBSD - platforms. - - * elf-bfd.h (struct elf_backend_data): Add - `elf_backend_grok_freebsd_prstatus'. - * elf.c (elfcore_grok_freebsd_note): Call - `elf_backend_grok_freebsd_prstatus' to handle NT_PRSTATUS if - present. - * elfn32-mips.c (elf_n32_mips_grok_freebsd_prstatus): New - function. - (elf_backend_grok_freebsd_prstatus): Define. - * elfxx-target.h (elf_backend_grok_freebsd_prstatus): Define. - (elfNN_bed): Initialize `elf_backend_grok_freebsd_prstatus'. - -diff --git bfd/elf-bfd.h bfd/elf-bfd.h -index fd08748ae2..399e298a8d 100644 ---- bfd/elf-bfd.h -+++ bfd/elf-bfd.h -@@ -1270,6 +1270,11 @@ struct elf_backend_data - bfd_boolean (*elf_backend_grok_psinfo) - (bfd *, Elf_Internal_Note *); - -+ /* This function, if defined, is called when a "FreeBSD" NT_PRSTATUS -+ note is found in a core file. */ -+ bfd_boolean (*elf_backend_grok_freebsd_prstatus) -+ (bfd *, Elf_Internal_Note *); -+ - /* This function, if defined, is called to write a note to a corefile. */ - char *(*elf_backend_write_core_note) - (bfd *abfd, char *buf, int *bufsiz, int note_type, ...); -diff --git bfd/elf.c bfd/elf.c -index 02deceaf4c..c6de70d6b5 100644 ---- bfd/elf.c -+++ bfd/elf.c -@@ -9981,9 +9981,14 @@ elfcore_grok_freebsd_prstatus (bfd *abfd, Elf_Internal_Note *note) - static bfd_boolean - elfcore_grok_freebsd_note (bfd *abfd, Elf_Internal_Note *note) - { -+ const struct elf_backend_data *bed = get_elf_backend_data (abfd); -+ - switch (note->type) - { - case NT_PRSTATUS: -+ if (bed->elf_backend_grok_freebsd_prstatus) -+ if ((*bed->elf_backend_grok_freebsd_prstatus) (abfd, note)) -+ return TRUE; - return elfcore_grok_freebsd_prstatus (abfd, note); - - case NT_FPREGSET: -diff --git bfd/elfn32-mips.c bfd/elfn32-mips.c -index dce7ba1c7a..fdae18365e 100644 ---- bfd/elfn32-mips.c -+++ bfd/elfn32-mips.c -@@ -80,6 +80,8 @@ static bfd_boolean elf32_mips_grok_prstatus - (bfd *, Elf_Internal_Note *); - static bfd_boolean elf32_mips_grok_psinfo - (bfd *, Elf_Internal_Note *); -+static bfd_boolean elf_n32_mips_grok_freebsd_prstatus -+ (bfd *, Elf_Internal_Note *); - static irix_compat_t elf_n32_mips_irix_compat - (bfd *); - -@@ -3578,6 +3580,56 @@ elf32_mips_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) - - return TRUE; - } -+ -+static bfd_boolean -+elf_n32_mips_grok_freebsd_prstatus (bfd *abfd, Elf_Internal_Note *note) -+{ -+ size_t offset; -+ size_t size; -+ size_t min_size; -+ -+ /* Compute offset of pr_getregsz, skipping over pr_statussz. -+ Also compute minimum size of this note. */ -+ offset = 4 + 4; -+ min_size = offset + 4 * 2 + 4 + 4 + 4; -+ -+ if (note->descsz < min_size) -+ return FALSE; -+ -+ /* Check for version 1 in pr_version. */ -+ if (bfd_h_get_32 (abfd, (bfd_byte *) note->descdata) != 1) -+ return FALSE; -+ -+ /* Extract size of pr_reg from pr_gregsetsz. */ -+ /* Skip over pr_gregsetsz and pr_fpregsetsz. */ -+ size = bfd_h_get_32 (abfd, (bfd_byte *) note->descdata + offset); -+ offset += 4 * 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. */ -+ offset += 4; -+ -+ /* Make sure that there is enough data remaining in the note. */ -+ if (note->descsz - offset < size) -+ return FALSE; -+ -+ /* Make a ".reg/999" section and a ".reg" section. */ -+ return _bfd_elfcore_make_pseudosection (abfd, ".reg", -+ size, note->descpos + offset); -+} - - /* Depending on the target vector we generate some version of Irix - executables or "normal" MIPS ELF ABI executables. */ -@@ -3684,6 +3736,8 @@ static const struct ecoff_debug_swap mips_elf32_ecoff_debug_swap = { - _bfd_mips_elf_copy_indirect_symbol - #define elf_backend_grok_prstatus elf32_mips_grok_prstatus - #define elf_backend_grok_psinfo elf32_mips_grok_psinfo -+#define elf_backend_grok_freebsd_prstatus \ -+ elf_n32_mips_grok_freebsd_prstatus - #define elf_backend_ecoff_debug_swap &mips_elf32_ecoff_debug_swap - - #define elf_backend_got_header_size (4 * MIPS_RESERVED_GOTNO) -diff --git bfd/elfxx-target.h bfd/elfxx-target.h -index 551883fa09..6efca84e4e 100644 ---- bfd/elfxx-target.h -+++ bfd/elfxx-target.h -@@ -597,6 +597,9 @@ - #ifndef elf_backend_grok_psinfo - #define elf_backend_grok_psinfo NULL - #endif -+#ifndef elf_backend_grok_freebsd_prstatus -+#define elf_backend_grok_freebsd_prstatus NULL -+#endif - #ifndef elf_backend_write_core_note - #define elf_backend_write_core_note NULL - #endif -@@ -820,6 +823,7 @@ static struct elf_backend_data elfNN_bed = - elf_backend_sort_relocs_p, - elf_backend_grok_prstatus, - elf_backend_grok_psinfo, -+ elf_backend_grok_freebsd_prstatus, - elf_backend_write_core_note, - elf_backend_lookup_section_flags_hook, - elf_backend_reloc_type_class, Index: devel/gdb/files/commit-6d5be5d6b8 =================================================================== --- devel/gdb/files/commit-6d5be5d6b8 +++ /dev/null @@ -1,24 +0,0 @@ -commit 6d5be5d6b8b4412e65bc037472aa2e727c25ccf5 -Author: John Baldwin -Date: Thu Oct 5 09:50:01 2017 -0700 - - Handle the NT_ARM_VFP core dump note on FreeBSD. - - bfd/ChangeLog: - - * elf.c (elfcore_grok_freebsd_note): Handle NT_ARM_VFP. - -diff --git bfd/elf.c bfd/elf.c -index fd7f773730..02deceaf4c 100644 ---- bfd/elf.c -+++ bfd/elf.c -@@ -10022,6 +10022,9 @@ elfcore_grok_freebsd_note (bfd *abfd, Elf_Internal_Note *note) - return elfcore_make_note_pseudosection (abfd, ".note.freebsdcore.lwpinfo", - note); - -+ case NT_ARM_VFP: -+ return elfcore_grok_arm_vfp (abfd, note); -+ - default: - return TRUE; - } Index: devel/gdb/files/commit-6e5eab33ab =================================================================== --- devel/gdb/files/commit-6e5eab33ab +++ /dev/null @@ -1,120 +0,0 @@ -commit 6e5eab33abe09041b29e0ce484f684ad0ffe80a5 -Author: John Baldwin -Date: Wed Jun 28 10:41:57 2017 -0700 - - Move the thread_section_name class to gdbcore.h. - - This allows it to be used outside of corelow.c. - -diff --git gdb/corelow.c gdb/corelow.c -index 0aff02d4db..578c910bb5 100644 ---- gdb/corelow.c -+++ gdb/corelow.c -@@ -485,51 +485,6 @@ core_detach (struct target_ops *ops, const char *args, int from_tty) - printf_filtered (_("No core file now.\n")); - } - --/* Build either a single-thread or multi-threaded section name for -- PTID. -- -- If ptid's lwp member is zero, we want to do the single-threaded -- thing: look for a section named NAME (as passed to the -- constructor). If ptid's lwp member is non-zero, we'll want do the -- multi-threaded thing: look for a section named "NAME/LWP", where -- LWP is the shortest ASCII decimal representation of ptid's lwp -- member. */ -- --class thread_section_name --{ --public: -- /* NAME is the single-threaded section name. If PTID represents an -- LWP, then the build section name is "NAME/LWP", otherwise it's -- just "NAME" unmodified. */ -- thread_section_name (const char *name, ptid_t ptid) -- { -- if (ptid.lwp_p ()) -- { -- m_storage = string_printf ("%s/%ld", name, ptid.lwp ()); -- m_section_name = m_storage.c_str (); -- } -- else -- m_section_name = name; -- } -- -- /* Return the computed section name. The result is valid as long as -- this thread_section_name object is live. */ -- const char *c_str () const -- { return m_section_name; } -- -- /* Disable copy. */ -- thread_section_name (const thread_section_name &) = delete; -- void operator= (const thread_section_name &) = delete; -- --private: -- /* Either a pointer into M_STORAGE, or a pointer to the name passed -- as parameter to the constructor. */ -- const char *m_section_name; -- /* If we need to build a new section name, this is where we store -- it. */ -- std::string m_storage; --}; -- - /* Try to retrieve registers from a section in core_bfd, and supply - them to core_vec->core_read_registers, as the register set numbered - WHICH. -diff --git gdb/gdbcore.h gdb/gdbcore.h -index e3eed0395d..87f3dcd64d 100644 ---- gdb/gdbcore.h -+++ gdb/gdbcore.h -@@ -226,6 +226,51 @@ struct core_fns - - }; - -+/* Build either a single-thread or multi-threaded section name for -+ PTID. -+ -+ If ptid's lwp member is zero, we want to do the single-threaded -+ thing: look for a section named NAME (as passed to the -+ constructor). If ptid's lwp member is non-zero, we'll want do the -+ multi-threaded thing: look for a section named "NAME/LWP", where -+ LWP is the shortest ASCII decimal representation of ptid's lwp -+ member. */ -+ -+class thread_section_name -+{ -+public: -+ /* NAME is the single-threaded section name. If PTID represents an -+ LWP, then the build section name is "NAME/LWP", otherwise it's -+ just "NAME" unmodified. */ -+ thread_section_name (const char *name, ptid_t ptid) -+ { -+ if (ptid.lwp_p ()) -+ { -+ m_storage = string_printf ("%s/%ld", name, ptid.lwp ()); -+ m_section_name = m_storage.c_str (); -+ } -+ else -+ m_section_name = name; -+ } -+ -+ /* Return the computed section name. The result is valid as long as -+ this thread_section_name object is live. */ -+ const char *c_str () const -+ { return m_section_name; } -+ -+ /* Disable copy. */ -+ thread_section_name (const thread_section_name &) = delete; -+ void operator= (const thread_section_name &) = delete; -+ -+private: -+ /* Either a pointer into M_STORAGE, or a pointer to the name passed -+ as parameter to the constructor. */ -+ const char *m_section_name; -+ /* If we need to build a new section name, this is where we store -+ it. */ -+ std::string m_storage; -+}; -+ - /* NOTE: cagney/2004-04-05: Replaced by "regset.h" and - regset_from_core_section(). */ - extern void deprecated_add_core_fns (struct core_fns *cf); Index: devel/gdb/files/commit-762c974a09 =================================================================== --- devel/gdb/files/commit-762c974a09 +++ /dev/null @@ -1,167 +0,0 @@ -commit 762c974a09746bda8a5d64ed3ee887adeae742b9 -Author: John Baldwin -Date: Wed Jun 28 08:14:06 2017 -0700 - - Implement the "get_siginfo_type" gdbarch method for FreeBSD architectures. - - As with Linux architectures, cache the created type in the gdbarch when it - is first created. Currently FreeBSD uses an identical siginfo type on - all architectures, so there is no support for architecture-specific fields. - - gdb/ChangeLog: - - * fbsd-tdep.c (fbsd_gdbarch_data_handle, struct fbsd_gdbarch_data) - (init_fbsd_gdbarch_data, get_fbsd_gdbarch_data) - (fbsd_get_siginfo_type): New. - (fbsd_init_abi): Install gdbarch "get_siginfo_type" method. - (_initialize_fbsd_tdep): New. - -diff --git gdb/fbsd-tdep.c gdb/fbsd-tdep.c -index b834ce38b4..24a3c20dd6 100644 ---- gdb/fbsd-tdep.c -+++ gdb/fbsd-tdep.c -@@ -30,6 +30,26 @@ - #include "fbsd-tdep.h" - - -+static struct gdbarch_data *fbsd_gdbarch_data_handle; -+ -+struct fbsd_gdbarch_data -+ { -+ struct type *siginfo_type; -+ }; -+ -+static void * -+init_fbsd_gdbarch_data (struct gdbarch *gdbarch) -+{ -+ return GDBARCH_OBSTACK_ZALLOC (gdbarch, struct fbsd_gdbarch_data); -+} -+ -+static struct fbsd_gdbarch_data * -+get_fbsd_gdbarch_data (struct gdbarch *gdbarch) -+{ -+ return ((struct fbsd_gdbarch_data *) -+ gdbarch_data (gdbarch, fbsd_gdbarch_data_handle)); -+} -+ - /* This is how we want PTIDs from core files to be printed. */ - - static const char * -@@ -314,6 +334,97 @@ fbsd_print_auxv_entry (struct gdbarch *gdbarch, struct ui_file *file, - fprint_auxv_entry (file, name, description, format, type, val); - } - -+/* Implement the "get_siginfo_type" gdbarch method. */ -+ -+static struct type * -+fbsd_get_siginfo_type (struct gdbarch *gdbarch) -+{ -+ struct fbsd_gdbarch_data *fbsd_gdbarch_data; -+ struct type *int_type, *int32_type, *uint32_type, *long_type, *void_ptr_type; -+ struct type *uid_type, *pid_type; -+ struct type *sigval_type, *reason_type; -+ struct type *siginfo_type; -+ struct type *type; -+ -+ fbsd_gdbarch_data = get_fbsd_gdbarch_data (gdbarch); -+ if (fbsd_gdbarch_data->siginfo_type != NULL) -+ return fbsd_gdbarch_data->siginfo_type; -+ -+ int_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), -+ 0, "int"); -+ int32_type = arch_integer_type (gdbarch, 32, 0, "int32_t"); -+ uint32_type = arch_integer_type (gdbarch, 32, 1, "uint32_t"); -+ long_type = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch), -+ 0, "long"); -+ void_ptr_type = lookup_pointer_type (builtin_type (gdbarch)->builtin_void); -+ -+ /* union sigval */ -+ sigval_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION); -+ TYPE_NAME (sigval_type) = xstrdup ("sigval"); -+ append_composite_type_field (sigval_type, "sival_int", int_type); -+ append_composite_type_field (sigval_type, "sival_ptr", void_ptr_type); -+ -+ /* __pid_t */ -+ pid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, -+ TYPE_LENGTH (int32_type), "__pid_t"); -+ TYPE_TARGET_TYPE (pid_type) = int32_type; -+ TYPE_TARGET_STUB (pid_type) = 1; -+ -+ /* __uid_t */ -+ uid_type = arch_type (gdbarch, TYPE_CODE_TYPEDEF, -+ TYPE_LENGTH (uint32_type), "__uid_t"); -+ TYPE_TARGET_TYPE (uid_type) = uint32_type; -+ TYPE_TARGET_STUB (uid_type) = 1; -+ -+ /* _reason */ -+ reason_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION); -+ -+ /* _fault */ -+ type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT); -+ append_composite_type_field (type, "si_trapno", int_type); -+ append_composite_type_field (reason_type, "_fault", type); -+ -+ /* _timer */ -+ type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT); -+ append_composite_type_field (type, "si_timerid", int_type); -+ append_composite_type_field (type, "si_overrun", int_type); -+ append_composite_type_field (reason_type, "_timer", type); -+ -+ /* _mesgq */ -+ type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT); -+ append_composite_type_field (type, "si_mqd", int_type); -+ append_composite_type_field (reason_type, "_mesgq", type); -+ -+ /* _poll */ -+ type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT); -+ append_composite_type_field (type, "si_band", long_type); -+ append_composite_type_field (reason_type, "_poll", type); -+ -+ /* __spare__ */ -+ type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT); -+ append_composite_type_field (type, "__spare1__", long_type); -+ append_composite_type_field (type, "__spare2__", -+ init_vector_type (int_type, 7)); -+ append_composite_type_field (reason_type, "__spare__", type); -+ -+ /* struct siginfo */ -+ siginfo_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT); -+ TYPE_NAME (siginfo_type) = xstrdup ("siginfo"); -+ append_composite_type_field (siginfo_type, "si_signo", int_type); -+ append_composite_type_field (siginfo_type, "si_errno", int_type); -+ append_composite_type_field (siginfo_type, "si_code", int_type); -+ append_composite_type_field (siginfo_type, "si_pid", pid_type); -+ append_composite_type_field (siginfo_type, "si_uid", uid_type); -+ append_composite_type_field (siginfo_type, "si_status", int_type); -+ append_composite_type_field (siginfo_type, "si_addr", void_ptr_type); -+ append_composite_type_field (siginfo_type, "si_value", sigval_type); -+ append_composite_type_field (siginfo_type, "_reason", reason_type); -+ -+ fbsd_gdbarch_data->siginfo_type = siginfo_type; -+ -+ return siginfo_type; -+} -+ - /* Implement the "get_syscall_number" gdbarch method. */ - - static LONGEST -@@ -339,8 +450,19 @@ 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); -+ set_gdbarch_get_siginfo_type (gdbarch, fbsd_get_siginfo_type); - - /* `catch syscall' */ - set_xml_syscall_file_name (gdbarch, "syscalls/freebsd.xml"); - set_gdbarch_get_syscall_number (gdbarch, fbsd_get_syscall_number); - } -+ -+/* Provide a prototype to silence -Wmissing-prototypes. */ -+extern initialize_file_ftype _initialize_fbsd_tdep; -+ -+void -+_initialize_fbsd_tdep (void) -+{ -+ fbsd_gdbarch_data_handle = -+ gdbarch_data_register_post_init (init_fbsd_gdbarch_data); -+} Index: devel/gdb/files/commit-929edea98d =================================================================== --- devel/gdb/files/commit-929edea98d +++ /dev/null @@ -1,211 +0,0 @@ -commit 929edea98d27cf9d72305c1584ee77627da7fa96 -Author: John Baldwin -Date: Wed Jun 28 09:53:06 2017 -0700 - - Fetch signal information for native FreeBSD processes. - - Use the `pl_siginfo' field in the `struct ptrace_lwpinfo' object returned - by the PT_LWPINFO ptrace() request to supply the current contents of - $_siginfo for each thread. Note that FreeBSD does not supply a way to - modify the signal information for a thread, so $_siginfo is read-only for - FreeBSD. - - To handle 32-bit processes on a 64-bit host, define types for 32-bit - compatible siginfo_t and convert the 64-bit siginfo_t to the 32-bit - equivalent when supplying information for a 32-bit process. - - gdb/ChangeLog: - - * fbsd-nat.c [PT_LWPINFO && __LP64__] (union sigval32) - (struct siginfo32): New. - [PT_LWPINFO] (fbsd_siginfo_size, fbsd_convert_siginfo): New. - (fbsd_xfer_partial) [PT_LWPINFO]: Handle TARGET_OBJECT_SIGNAL_INFO - via ptrace(PT_LWPINFO). - -diff --git gdb/fbsd-nat.c gdb/fbsd-nat.c -index ef5ad1ec92..85f56059bd 100644 ---- gdb/fbsd-nat.c -+++ gdb/fbsd-nat.c -@@ -28,6 +28,7 @@ - #include - #include - #include -+#include - #include - #ifdef HAVE_KINFO_GETVMMAP - #include -@@ -216,6 +217,135 @@ static enum target_xfer_status (*super_xfer_partial) (struct target_ops *ops, - ULONGEST len, - ULONGEST *xfered_len); - -+#ifdef PT_LWPINFO -+/* Return the size of siginfo for the current inferior. */ -+ -+#ifdef __LP64__ -+union sigval32 { -+ int sival_int; -+ uint32_t sival_ptr; -+}; -+ -+/* This structure matches the naming and layout of `siginfo_t' in -+ . In particular, the `si_foo' macros defined in that -+ header can be used with both types to copy fields in the `_reason' -+ union. */ -+ -+struct siginfo32 -+{ -+ int si_signo; -+ int si_errno; -+ int si_code; -+ __pid_t si_pid; -+ __uid_t si_uid; -+ int si_status; -+ uint32_t si_addr; -+ union sigval32 si_value; -+ union -+ { -+ struct -+ { -+ int _trapno; -+ } _fault; -+ struct -+ { -+ int _timerid; -+ int _overrun; -+ } _timer; -+ struct -+ { -+ int _mqd; -+ } _mesgq; -+ struct -+ { -+ int32_t _band; -+ } _poll; -+ struct -+ { -+ int32_t __spare1__; -+ int __spare2__[7]; -+ } __spare__; -+ } _reason; -+}; -+#endif -+ -+static size_t -+fbsd_siginfo_size () -+{ -+#ifdef __LP64__ -+ struct gdbarch *gdbarch = get_frame_arch (get_current_frame ()); -+ -+ /* Is the inferior 32-bit? If so, use the 32-bit siginfo size. */ -+ if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32) -+ return sizeof (struct siginfo32); -+#endif -+ return sizeof (siginfo_t); -+} -+ -+/* Convert a native 64-bit siginfo object to a 32-bit object. Note -+ that FreeBSD doesn't support writing to $_siginfo, so this only -+ needs to convert one way. */ -+ -+static void -+fbsd_convert_siginfo (siginfo_t *si) -+{ -+#ifdef __LP64__ -+ struct gdbarch *gdbarch = get_frame_arch (get_current_frame ()); -+ -+ /* Is the inferior 32-bit? If not, nothing to do. */ -+ if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word != 32) -+ return; -+ -+ struct siginfo32 si32; -+ -+ si32.si_signo = si->si_signo; -+ si32.si_errno = si->si_errno; -+ si32.si_code = si->si_code; -+ si32.si_pid = si->si_pid; -+ si32.si_uid = si->si_uid; -+ si32.si_status = si->si_status; -+ si32.si_addr = (uintptr_t) si->si_addr; -+ -+ /* If sival_ptr is being used instead of sival_int on a big-endian -+ platform, then sival_int will be zero since it holds the upper -+ 32-bits of the pointer value. */ -+#if _BYTE_ORDER == _BIG_ENDIAN -+ if (si->si_value.sival_int == 0) -+ si32->si_value.sival_ptr = (uintptr_t) si->si_value.sival_ptr; -+ else -+ si32.si_value.sival_int = si->si_value.sival_int; -+#else -+ si32.si_value.sival_int = si->si_value.sival_int; -+#endif -+ -+ /* Always copy the spare fields and then possibly overwrite them for -+ signal-specific or code-specific fields. */ -+ si32._reason.__spare__.__spare1__ = si->_reason.__spare__.__spare1__; -+ for (int i = 0; i < 7; i++) -+ si32._reason.__spare__.__spare2__[i] = si->_reason.__spare__.__spare2__[i]; -+ switch (si->si_signo) { -+ case SIGILL: -+ case SIGFPE: -+ case SIGSEGV: -+ case SIGBUS: -+ si32.si_trapno = si->si_trapno; -+ break; -+ } -+ switch (si->si_code) { -+ case SI_TIMER: -+ si32.si_timerid = si->si_timerid; -+ si32.si_overrun = si->si_overrun; -+ break; -+ case SI_MESGQ: -+ si32.si_mqd = si->si_mqd; -+ break; -+ } -+ -+ memcpy(si, &si32, sizeof (si32)); -+#endif -+} -+#endif -+ - /* Implement the "to_xfer_partial target_ops" method. */ - - static enum target_xfer_status -@@ -228,6 +358,38 @@ fbsd_xfer_partial (struct target_ops *ops, enum target_object object, - - switch (object) - { -+#ifdef PT_LWPINFO -+ case TARGET_OBJECT_SIGNAL_INFO: -+ { -+ struct ptrace_lwpinfo pl; -+ size_t siginfo_size; -+ -+ /* FreeBSD doesn't support writing to $_siginfo. */ -+ if (writebuf != NULL) -+ return TARGET_XFER_E_IO; -+ -+ if (inferior_ptid.lwp_p ()) -+ pid = inferior_ptid.lwp (); -+ -+ siginfo_size = fbsd_siginfo_size (); -+ if (offset > siginfo_size) -+ return TARGET_XFER_E_IO; -+ -+ if (ptrace (PT_LWPINFO, pid, (PTRACE_TYPE_ARG3) &pl, sizeof (pl)) == -1) -+ return TARGET_XFER_E_IO; -+ -+ if (!(pl.pl_flags & PL_FLAG_SI)) -+ return TARGET_XFER_E_IO; -+ -+ fbsd_convert_siginfo (&pl.pl_siginfo); -+ if (offset + len > siginfo_size) -+ len = siginfo_size - offset; -+ -+ memcpy (readbuf, ((gdb_byte *) &pl.pl_siginfo) + offset, len); -+ *xfered_len = len; -+ return TARGET_XFER_OK; -+ } -+#endif - case TARGET_OBJECT_AUXV: - { - struct cleanup *cleanup = make_cleanup (null_cleanup, NULL); Index: devel/gdb/files/commit-a181c0bf74 =================================================================== --- devel/gdb/files/commit-a181c0bf74 +++ /dev/null @@ -1,79 +0,0 @@ -commit a181c0bf74 -Author: John Baldwin -Date: Mon Oct 9 09:54:42 2017 -0700 - - Use gdbarch_long_bit to determine layout of FreeBSD siginfo_t. - - FreeBSD architectures are either ILP32 or LP64 resulting in two - different layouts for siginfo_t. Previously, the 'bits_per_word' - member of bfd_arch_info was used to determine the layout to use for a - given FreeBSD architecture. However, mipsn32 architectures inherit - from a 64-bit mips architecture where bits_per_word is 64. As a - result, $_siginfo was not properly extracted from FreeBSD/mipsn32 core - dumps. Fix this by using gdbarch_long_bit instead of 'bits_per_word' - to determine if a FreeBSD architecture is ILP32 or LP64. - - gdb/ChangeLog: - - * fbsd-nat.c (fbsd_siginfo_size): Use gdbarch_long_bit. - (fbsd_convert_siginfo): Likewise. - * fbsd-tdep.c (fbsd_core_xfer_siginfo): Likewise. - -diff --git gdb/ChangeLog gdb/ChangeLog -index 7c8c6e4fe5..b04da8bd44 100644 ---- gdb/ChangeLog -+++ gdb/ChangeLog -@@ -1,3 +1,9 @@ -+2017-10-09 John Baldwin -+ -+ * fbsd-nat.c (fbsd_siginfo_size): Use gdbarch_long_bit. -+ (fbsd_convert_siginfo): Likewise. -+ * fbsd-tdep.c (fbsd_core_xfer_siginfo): Likewise. -+ - 2017-10-09 Simon Marchi - - * configure.ac (try_guile_versions): Remove guile-2.2. -diff --git gdb/fbsd-nat.c gdb/fbsd-nat.c -index 5ad0dda5b4..265175a769 100644 ---- gdb/fbsd-nat.c -+++ gdb/fbsd-nat.c -@@ -279,7 +279,7 @@ fbsd_siginfo_size () - struct gdbarch *gdbarch = get_frame_arch (get_current_frame ()); - - /* Is the inferior 32-bit? If so, use the 32-bit siginfo size. */ -- if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32) -+ if (gdbarch_long_bit (gdbarch) == 32) - return sizeof (struct siginfo32); - #endif - return sizeof (siginfo_t); -@@ -296,7 +296,7 @@ fbsd_convert_siginfo (siginfo_t *si) - struct gdbarch *gdbarch = get_frame_arch (get_current_frame ()); - - /* Is the inferior 32-bit? If not, nothing to do. */ -- if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word != 32) -+ if (gdbarch_long_bit (gdbarch) != 32) - return; - - struct siginfo32 si32; -diff --git gdb/fbsd-tdep.c gdb/fbsd-tdep.c -index fa4cd912ef..fa70f7c20b 100644 ---- gdb/fbsd-tdep.c -+++ gdb/fbsd-tdep.c -@@ -143,7 +143,7 @@ fbsd_core_xfer_siginfo (struct gdbarch *gdbarch, gdb_byte *readbuf, - { - size_t siginfo_size; - -- if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32) -+ if (gdbarch_long_bit (gdbarch) == 32) - siginfo_size = SIZE32_SIGINFO_T; - else - siginfo_size = SIZE64_SIGINFO_T; -@@ -168,7 +168,7 @@ fbsd_core_xfer_siginfo (struct gdbarch *gdbarch, gdb_byte *readbuf, - len = siginfo_size - offset; - - ULONGEST siginfo_offset; -- if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32) -+ if (gdbarch_long_bit (gdbarch) == 32) - siginfo_offset = LWPINFO_OFFSET + LWPINFO32_PL_SIGINFO; - else - siginfo_offset = LWPINFO_OFFSET + LWPINFO64_PL_SIGINFO; Index: devel/gdb/files/commit-a80a647180 =================================================================== --- devel/gdb/files/commit-a80a647180 +++ /dev/null @@ -1,53 +0,0 @@ -commit a80a647180bf92692e0f01efe7b323afe7d317c9 -Author: John Baldwin -Date: Thu Oct 5 09:50:01 2017 -0700 - - Add a signal frame unwinder for FreeBSD/mipsn32. - - The N32 signal frame uses an identical layout to N64, so reuse the N64 - handler. The N32 signal trampoline does use one different instruction - relative to N64, so a separate tramp_frame is required. - - gdb/ChangeLog: - - * mips-fbsd-tdep.c (MIPS_INST_ADDIU_A0_SP_N32): Define. - (mipsn32_fbsd_sigframe): Define. - (mips_fbsd_init_abi): Install mipsn32_fbsd_sigframe unwinder - for FreeBSD/mipsn32. - -diff --git gdb/mips-fbsd-tdep.c gdb/mips-fbsd-tdep.c -index 05545e37d8..b1578d0cbb 100644 ---- gdb/mips-fbsd-tdep.c -+++ gdb/mips-fbsd-tdep.c -@@ -426,6 +426,23 @@ mips64_fbsd_sigframe_init (const struct tramp_frame *self, - trad_frame_set_id (cache, frame_id_build (sp, func)); - } - -+#define MIPS_INST_ADDIU_A0_SP_N32 (0x27a40000 \ -+ + N64_SIGFRAME_UCONTEXT_OFFSET) -+ -+static const struct tramp_frame mipsn32_fbsd_sigframe = -+{ -+ SIGTRAMP_FRAME, -+ MIPS_INSN32_SIZE, -+ { -+ { MIPS_INST_ADDIU_A0_SP_N32, -1 }, /* addiu a0, sp, SIGF_UC */ -+ { MIPS_INST_LI_V0_SIGRETURN, -1 }, /* li v0, SYS_sigreturn */ -+ { MIPS_INST_SYSCALL, -1 }, /* syscall */ -+ { MIPS_INST_BREAK, -1 }, /* break */ -+ { TRAMP_SENTINEL_INSN, -1 } -+ }, -+ mips64_fbsd_sigframe_init -+}; -+ - #define MIPS_INST_DADDIU_A0_SP_N64 (0x67a40000 \ - + N64_SIGFRAME_UCONTEXT_OFFSET) - -@@ -519,6 +536,7 @@ mips_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) - tramp_frame_prepend_unwinder (gdbarch, &mips_fbsd_sigframe); - break; - case MIPS_ABI_N32: -+ tramp_frame_prepend_unwinder (gdbarch, &mipsn32_fbsd_sigframe); - break; - case MIPS_ABI_N64: - tramp_frame_prepend_unwinder (gdbarch, &mips64_fbsd_sigframe); Index: devel/gdb/files/commit-b30ff123fb =================================================================== --- devel/gdb/files/commit-b30ff123fb +++ /dev/null @@ -1,40 +0,0 @@ -commit b30ff123fbff63d6c8be1115320efd0158e49a7f -Author: Yao Qi -Date: Thu Jun 22 13:41:27 2017 +0100 - - Regenerate two regformats/i386/.dat files - - The self tests which compare pre-generated target descriptions and - dynamically created target descriptions fail, and it turns out that two - pre-generated target descriptions are wrong, so regenerate them. - - gdb: - - 2017-06-22 Yao Qi - - * regformats/i386/amd64-avx-mpx-avx512-pku-linux.dat: Regenerated. - * regformats/i386/amd64-avx-mpx-avx512-pku.dat: Regenerated. - -diff --git gdb/regformats/i386/amd64-avx-mpx-avx512-pku-linux.dat gdb/regformats/i386/amd64-avx-mpx-avx512-pku-linux.dat -index 3ae6b0e472..9cd0fae820 100644 ---- gdb/regformats/i386/amd64-avx-mpx-avx512-pku-linux.dat -+++ gdb/regformats/i386/amd64-avx-mpx-avx512-pku-linux.dat -@@ -157,3 +157,4 @@ expedite:rbp,rsp,rip - 256:zmm29h - 256:zmm30h - 256:zmm31h -+32:pkru -diff --git gdb/regformats/i386/amd64-avx-mpx-avx512-pku.dat gdb/regformats/i386/amd64-avx-mpx-avx512-pku.dat -index 88185fd8c3..b3340d3276 100644 ---- gdb/regformats/i386/amd64-avx-mpx-avx512-pku.dat -+++ gdb/regformats/i386/amd64-avx-mpx-avx512-pku.dat -@@ -60,9 +60,6 @@ expedite:rbp,rsp,rip - 128:xmm14 - 128:xmm15 - 32:mxcsr --64:orig_rax --64:fs_base --64:gs_base - 128:ymm0h - 128:ymm1h - 128:ymm2h Index: devel/gdb/files/commit-b5430a3ced =================================================================== --- devel/gdb/files/commit-b5430a3ced +++ /dev/null @@ -1,117 +0,0 @@ -commit b5430a3ced5fe5ba484bd9b3215b9ae19ced0160 -Author: John Baldwin -Date: Thu Jun 1 09:40:46 2017 -0700 - - Use the ELF class to determine the word size for FreeBSD core notes. - - FreeBSD ELF cores contain data structures with that have two different - layouts: one for ILP32 platforms and a second for LP64 platforms. - Previously, the code used 'bits_per_word' from 'arch_info', but this - field is not a reliable indicator of the format for FreeBSD MIPS cores - in particular. - - I had originally posted this patch back in November because process - cores for FreeBSD MIPS contained an e_flags value of 0 in the header - which resulted in a bfd_arch which always had 'bits_per_word' set to - 32. This permitted reading o32 cores, but not n64 cores. The feedback - I received then was to try to change n64 cores to use a different - default bfd_arch that had a 64-bit 'bits_per_word' when e_flags was zero. - I submitted a patch to that effect but it was never approved. Instead, - I changed FreeBSD's kernel and gcore commands to preserve the e_flags - field from an executable when generating process cores. With a proper - e_flags field in process cores, n64 cores now use a 64-bit bfd_arch and - now work fine. However, the change to include e_flags in the process - cores had the unintended side effect of breaking handling of o32 - process cores. Specifically, FreeBSD MIPS builds o32 with a default - MIPS architecture of 'mips3', thus FreeBSD process cores with a non-zero - e_flags match the 'mips3' bfd_arch which has 64 'bits_per_word'. - - From this, it seems that 'bits_per_word' for FreeBSD MIPS is not likely - to ever be completely correct. However, FreeBSD core dumps do - reliably set the ELF class to ELFCLASS32 for cores using ILP32 and - ELFCLASS64 for cores using LP64. As such, I think my original patch of - using the ELF class instead of 'bits_per_word' is probably the simplest - and most reliable approach for detecting the note structure layout. - - bfd/ChangeLog: - - * elf.c (elfcore_grok_freebsd_psinfo): Use ELF header class to - determine structure sizes. - (elfcore_grok_freebsd_prstatus): Likewise. - -diff --git bfd/elf.c bfd/elf.c -index 863bd61c5f..34d39c547b 100644 ---- bfd/elf.c -+++ bfd/elf.c -@@ -9814,14 +9814,14 @@ elfcore_grok_freebsd_psinfo (bfd *abfd, Elf_Internal_Note *note) - { - size_t offset; - -- switch (abfd->arch_info->bits_per_word) -+ switch (elf_elfheader (abfd)->e_ident[EI_CLASS]) - { -- case 32: -+ case ELFCLASS32: - if (note->descsz < 108) - return FALSE; - break; - -- case 64: -+ case ELFCLASS64: - if (note->descsz < 120) - return FALSE; - break; -@@ -9836,7 +9836,7 @@ elfcore_grok_freebsd_psinfo (bfd *abfd, Elf_Internal_Note *note) - offset = 4; - - /* Skip over pr_psinfosz. */ -- if (abfd->arch_info->bits_per_word == 32) -+ if (elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS32) - offset += 4; - else - { -@@ -9879,13 +9879,13 @@ elfcore_grok_freebsd_prstatus (bfd *abfd, Elf_Internal_Note *note) - offset = 4; - - /* Skip over pr_statussz. */ -- switch (abfd->arch_info->bits_per_word) -+ switch (elf_elfheader (abfd)->e_ident[EI_CLASS]) - { -- case 32: -+ case ELFCLASS32: - offset += 4; - break; - -- case 64: -+ case ELFCLASS64: - offset += 4; /* Padding before pr_statussz. */ - offset += 8; - break; -@@ -9895,13 +9895,16 @@ elfcore_grok_freebsd_prstatus (bfd *abfd, Elf_Internal_Note *note) - } - - /* Extract size of pr_reg from pr_gregsetsz. */ -- if (abfd->arch_info->bits_per_word == 32) -+ if (elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS32) - 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; -+ if (elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS32) -+ offset += 4 * 2; -+ else -+ offset += 8 * 2; - - /* Skip over pr_osreldate. */ - offset += 4; -@@ -9918,7 +9921,7 @@ elfcore_grok_freebsd_prstatus (bfd *abfd, Elf_Internal_Note *note) - offset += 4; - - /* Padding before pr_reg. */ -- if (abfd->arch_info->bits_per_word == 64) -+ if (elf_elfheader (abfd)->e_ident[EI_CLASS] == ELFCLASS64) - offset += 4; - - /* Make a ".reg/999" section and a ".reg" section. */ Index: devel/gdb/files/commit-e6f3b9c319 =================================================================== --- devel/gdb/files/commit-e6f3b9c319 +++ /dev/null @@ -1,25 +0,0 @@ -commit e6f3b9c3194c0d89efffd6e5b59471950f979e5a -Author: John Baldwin -Date: Wed Jun 28 12:47:14 2017 -0700 - - Create pseudo sections for FreeBSD NT_PTLWPINFO core notes. - - bfd/ChangeLog: - - * elf.c (elfcore_grok_freebsd_note): Handle NT_FREEBSD_PTLWPINFO. - -diff --git bfd/elf.c bfd/elf.c -index 063a6e4bb3..dcb06383d9 100644 ---- bfd/elf.c -+++ bfd/elf.c -@@ -9980,6 +9980,10 @@ elfcore_grok_freebsd_note (bfd *abfd, Elf_Internal_Note *note) - else - return TRUE; - -+ case NT_FREEBSD_PTLWPINFO: -+ return elfcore_make_note_pseudosection (abfd, ".note.freebsdcore.lwpinfo", -+ note); -+ - default: - return TRUE; - } Index: devel/gdb/files/extrapatch-kgdb =================================================================== --- devel/gdb/files/extrapatch-kgdb +++ devel/gdb/files/extrapatch-kgdb @@ -2,7 +2,7 @@ index cf59ae7143..0dd72d35d1 100644 --- gdb/Makefile.in +++ gdb/Makefile.in -@@ -227,7 +227,8 @@ INCGNU = -I$(srcdir)/gnulib/import -I$(GNULIB_BUILDDIR)/import +@@ -230,7 +230,8 @@ INCGNU = -I$(srcdir)/gnulib/import -I$(GNULIB_BUILDDIR)/import # Generated headers in the gnulib directory. These must be listed # so that they are generated before other files are compiled. @@ -12,7 +12,7 @@ # # CLI sub directory definitons -@@ -745,6 +746,7 @@ TARGET_OBS = @TARGET_OBS@ +@@ -629,6 +630,7 @@ TARGET_OBS = @TARGET_OBS@ # All target-dependent objects files that require 64-bit CORE_ADDR # (used with --enable-targets=all --enable-64-bit-bfd). ALL_64_TARGET_OBS = \ @@ -20,7 +20,7 @@ aarch64-fbsd-tdep.o \ aarch64-insn.o \ aarch64-linux-tdep.o \ -@@ -759,6 +761,7 @@ ALL_64_TARGET_OBS = \ +@@ -642,6 +644,7 @@ ALL_64_TARGET_OBS = \ amd64-darwin-tdep.o \ amd64-dicos-tdep.o \ amd64-fbsd-tdep.o \ @@ -28,7 +28,7 @@ amd64-linux-tdep.o \ amd64-nbsd-tdep.o \ amd64-obsd-tdep.o \ -@@ -770,6 +773,7 @@ ALL_64_TARGET_OBS = \ +@@ -656,6 +659,7 @@ ALL_64_TARGET_OBS = \ ia64-vms-tdep.o \ mips64-obsd-tdep.o \ sparc64-fbsd-tdep.o \ @@ -36,7 +36,7 @@ sparc64-linux-tdep.o \ sparc64-nbsd-tdep.o \ sparc64-obsd-tdep.o \ -@@ -797,6 +801,9 @@ ALL_TARGET_OBS = \ +@@ -684,6 +688,9 @@ ALL_TARGET_OBS = \ cris-linux-tdep.o \ cris-tdep.o \ dicos-tdep.o \ @@ -46,7 +46,7 @@ fbsd-tdep.o \ frv-linux-tdep.o \ frv-tdep.o \ -@@ -813,6 +820,7 @@ ALL_TARGET_OBS = \ +@@ -700,6 +707,7 @@ ALL_TARGET_OBS = \ i386-darwin-tdep.o \ i386-dicos-tdep.o \ i386-fbsd-tdep.o \ @@ -54,7 +54,7 @@ i386-gnu-tdep.o \ i386-go32-tdep.o \ i386-linux-tdep.o \ -@@ -837,6 +845,7 @@ ALL_TARGET_OBS = \ +@@ -724,6 +732,7 @@ ALL_TARGET_OBS = \ mep-tdep.o \ microblaze-linux-tdep.o \ microblaze-tdep.o \ @@ -62,7 +62,7 @@ mips-fbsd-tdep.o \ mips-linux-tdep.o \ mips-nbsd-tdep.o \ -@@ -854,6 +863,7 @@ ALL_TARGET_OBS = \ +@@ -741,6 +750,7 @@ ALL_TARGET_OBS = \ nto-tdep.o \ obsd-tdep.o \ ppc-fbsd-tdep.o \ @@ -70,7 +70,7 @@ ppc-linux-tdep.o \ ppc-nbsd-tdep.o \ ppc-obsd-tdep.o \ -@@ -1871,7 +1881,7 @@ generated_files = \ +@@ -1610,7 +1620,7 @@ generated_files = \ # Flags needed to compile Python code PYTHON_CFLAGS = @PYTHON_CFLAGS@ @@ -79,7 +79,7 @@ @$(MAKE) $(FLAGS_TO_PASS) DO=all "DODIRS=`echo $(SUBDIRS) | sed 's/testsuite//'`" subdir_do # Rule for compiling .c files in the top-level gdb directory. -@@ -2210,6 +2220,12 @@ gdb$(EXEEXT): gdb.o $(LIBGDB_OBS) $(ADD_DEPS) $(CDEPS) $(TDEPLIBS) +@@ -1920,6 +1930,12 @@ gdb$(EXEEXT): gdb.o $(LIBGDB_OBS) $(ADD_DEPS) $(CDEPS) $(TDEPLIBS) -o gdb$(EXEEXT) gdb.o $(LIBGDB_OBS) \ $(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES) @@ -92,7 +92,7 @@ # Convenience rule to handle recursion. $(LIBGNU) $(GNULIB_H): all-lib all-lib: $(GNULIB_BUILDDIR)/Makefile -@@ -2254,7 +2270,7 @@ clean mostlyclean: $(CONFIG_CLEAN) +@@ -1964,7 +1980,7 @@ clean mostlyclean: $(CONFIG_CLEAN) @$(MAKE) $(FLAGS_TO_PASS) DO=clean "DODIRS=$(CLEANDIRS)" subdir_do rm -f *.o *.a $(ADD_FILES) *~ init.c-tmp init.l-tmp version.c-tmp rm -f init.c version.c observer.h observer.inc @@ -101,7 +101,7 @@ rm -f gdb[0-9]$(EXEEXT) rm -f test-cp-name-parser$(EXEEXT) rm -f xml-builtin.c stamp-xml -@@ -2461,6 +2477,7 @@ MAKEOVERRIDES = +@@ -2178,6 +2196,7 @@ MAKEOVERRIDES = ALLDEPFILES = \ aarch64-fbsd-nat.c \ @@ -109,7 +109,7 @@ aarch64-fbsd-tdep.c \ aarch64-linux-nat.c \ aarch64-linux-tdep.c \ -@@ -2478,6 +2495,7 @@ ALLDEPFILES = \ +@@ -2195,6 +2212,7 @@ ALLDEPFILES = \ amd64-bsd-nat.c \ amd64-darwin-tdep.c \ amd64-dicos-tdep.c \ @@ -117,8 +117,8 @@ amd64-fbsd-nat.c \ amd64-fbsd-tdep.c \ amd64-linux-nat.c \ -@@ -2513,6 +2531,9 @@ ALLDEPFILES = \ - dcache.c \ +@@ -2228,6 +2246,9 @@ ALLDEPFILES = \ + darwin-nat.c \ dicos-tdep.c \ exec.c \ + fbsd-kld.c \ @@ -127,7 +127,7 @@ fbsd-nat.c \ fbsd-tdep.c \ fork-child.c \ -@@ -2534,6 +2555,7 @@ ALLDEPFILES = \ +@@ -2249,6 +2270,7 @@ ALLDEPFILES = \ i386-darwin-nat.c \ i386-darwin-tdep.c \ i386-dicos-tdep.c \ @@ -135,7 +135,7 @@ i386-fbsd-nat.c \ i386-fbsd-tdep.c \ i386-gnu-nat.c \ -@@ -2575,6 +2597,7 @@ ALLDEPFILES = \ +@@ -2290,6 +2312,7 @@ ALLDEPFILES = \ mingw-hdep.c \ mips-fbsd-nat.c \ mips-fbsd-tdep.c \ @@ -143,7 +143,7 @@ mips-linux-nat.c \ mips-linux-tdep.c \ mips-nbsd-nat.c \ -@@ -2592,6 +2615,7 @@ ALLDEPFILES = \ +@@ -2307,6 +2330,7 @@ ALLDEPFILES = \ obsd-nat.c \ obsd-tdep.c \ posix-hdep.c \ @@ -151,7 +151,7 @@ ppc-fbsd-nat.c \ ppc-fbsd-tdep.c \ ppc-linux-nat.c \ -@@ -2636,6 +2660,7 @@ ALLDEPFILES = \ +@@ -2351,6 +2375,7 @@ ALLDEPFILES = \ sparc-sol2-nat.c \ sparc-sol2-tdep.c \ sparc-tdep.c \ @@ -159,7 +159,7 @@ sparc64-fbsd-nat.c \ sparc64-fbsd-tdep.c \ sparc64-linux-nat.c \ -@@ -2667,6 +2692,12 @@ ALLDEPFILES = \ +@@ -2382,6 +2407,12 @@ ALLDEPFILES = \ xtensa-linux-tdep.c \ xtensa-tdep.c \ xtensa-xtregs.c \ @@ -172,7 +172,7 @@ common/mingw-strerror.c \ common/posix-strerror.c -@@ -2928,7 +2959,7 @@ endif +@@ -2638,7 +2680,7 @@ endif # A list of all the objects we might care about in this build, for # dependency tracking. @@ -195,16 +195,17 @@ /* Define if you have and nl_langinfo(CODESET). */ #undef HAVE_LANGINFO_CODESET -diff --git gdb/config/mips/fbsd.mh gdb/config/mips/fbsd.mh -index f433347a20..5470795612 100644 ---- gdb/config/mips/fbsd.mh -+++ gdb/config/mips/fbsd.mh -@@ -1,3 +1,5 @@ - # Host: FreeBSD/mips - NATDEPFILES= fork-child.o inf-ptrace.o fbsd-nat.o mips-fbsd-nat.o - HAVE_NATIVE_GCORE_HOST = 1 -+ -+LOADLIBES= -lkvm +--- gdb/configure.nat ++++ gdb/configure.nat +@@ -170,6 +170,6 @@ + mips) + # Host: FreeBSD/mips + NATDEPFILES="${NATDEPFILES} mips-fbsd-nat.o" +- LOADLIBES= ++ LOADLIBES= -lkvm + ;; + powerpc) + # Native config information for GDB on PowerPC diff --git gdb/configure gdb/configure index e14886b67d..5682ce42d6 100755 --- gdb/configure @@ -297,11 +298,11 @@ --- gdb/configure.tgt +++ gdb/configure.tgt @@ -203,7 +203,13 @@ i[34567]86-*-dicos*) + ;; i[34567]86-*-freebsd* | i[34567]86-*-kfreebsd*-gnu) # Target: FreeBSD/i386 - gdb_target_obs="i386-tdep.o i387-tdep.o i386-bsd-tdep.o i386-fbsd-tdep.o \ -- fbsd-tdep.o solib-svr4.o" -+ fbsd-tdep.o solib-svr4.o \ +- gdb_target_obs="i386-bsd-tdep.o i386-fbsd-tdep.o " ++ gdb_target_obs="i386-bsd-tdep.o i386-fbsd-tdep.o \ + fbsd-kld.o fbsd-kthr.o fbsd-kvm.o i386fbsd-kern.o" + if test "x$enable_64_bit_bfd" = "xyes"; then + # Target: FreeBSD amd64 @@ -315,8 +316,8 @@ ;; mips*-*-freebsd*) # Target: MIPS running FreeBSD -- gdb_target_obs="mips-tdep.o mips-fbsd-tdep.o solib-svr4.o fbsd-tdep.o" -+ gdb_target_obs="mips-tdep.o mips-fbsd-tdep.o solib-svr4.o fbsd-tdep.o \ +- gdb_target_obs="mips-tdep.o mips-fbsd-tdep.o" ++ gdb_target_obs="mips-tdep.o mips-fbsd-tdep.o \ + fbsd-kld.o fbsd-kthr.o fbsd-kvm.o mipsfbsd-kern.o" gdb_sim=../sim/mips/libsim.a ;; @@ -324,7 +325,7 @@ @@ -436,7 +443,8 @@ powerpc*-*-freebsd*) # Target: FreeBSD/powerpc gdb_target_obs="rs6000-tdep.o ppc-sysv-tdep.o ppc64-tdep.o \ - ppc-fbsd-tdep.o fbsd-tdep.o solib-svr4.o \ + ppc-fbsd-tdep.o \ - ravenscar-thread.o ppc-ravenscar-thread.o" + ravenscar-thread.o ppc-ravenscar-thread.o \ + fbsd-kld.o fbsd-kthr.o fbsd-kvm.o ppcfbsd-kern.o" @@ -332,9 +333,9 @@ powerpc-*-netbsd* | powerpc-*-knetbsd*-gnu) @@ -560,7 +568,8 @@ sparc*-*-freebsd* | sparc*-*-kfreebsd*-gnu) + sparc*-*-freebsd* | sparc*-*-kfreebsd*-gnu) # Target: FreeBSD/sparc64 gdb_target_obs="sparc-tdep.o sparc64-tdep.o sparc64-fbsd-tdep.o \ - fbsd-tdep.o solib-svr4.o \ - ravenscar-thread.o sparc-ravenscar-thread.o" + ravenscar-thread.o sparc-ravenscar-thread.o \ + fbsd-kld.o fbsd-kthr.o fbsd-kvm.o sparc64fbsd-kern.o" @@ -342,11 +343,11 @@ sparc-*-netbsd* | sparc-*-knetbsd*-gnu) # Target: NetBSD/sparc @@ -691,7 +700,9 @@ x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu) + x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu) # Target: FreeBSD/amd64 - gdb_target_obs="amd64-tdep.o amd64-fbsd-tdep.o i386-tdep.o \ - i387-tdep.o i386-bsd-tdep.o i386-fbsd-tdep.o \ -- fbsd-tdep.o solib-svr4.o" -+ fbsd-tdep.o solib-svr4.o \ + gdb_target_obs="amd64-fbsd-tdep.o ${i386_tobjs} \ +- i386-bsd-tdep.o i386-fbsd-tdep.o" ++ i386-bsd-tdep.o i386-fbsd-tdep.o \ + fbsd-kld.o fbsd-kthr.o fbsd-kvm.o amd64fbsd-kern.o \ + i386fbsd-kern.o" ;; Index: devel/gdb/files/kgdb/fbsd-kld.c =================================================================== --- devel/gdb/files/kgdb/fbsd-kld.c +++ devel/gdb/files/kgdb/fbsd-kld.c @@ -27,6 +27,7 @@ #include __FBSDID("$FreeBSD$"); +#include "build-gnulib/config.h" #include #include Index: devel/gdb/files/kgdb/fbsd-kvm.c =================================================================== --- devel/gdb/files/kgdb/fbsd-kvm.c +++ devel/gdb/files/kgdb/fbsd-kvm.c @@ -27,6 +27,7 @@ #include __FBSDID("$FreeBSD$"); +#include "build-gnulib/config.h" #include #include #include Index: devel/gdb/files/patch-aarch64-fbsd =================================================================== --- devel/gdb/files/patch-aarch64-fbsd +++ /dev/null @@ -1,468 +0,0 @@ ---- gdb/Makefile.in.orig 2017-09-14 09:28:17 UTC -+++ gdb/Makefile.in -@@ -745,6 +745,7 @@ TARGET_OBS = @TARGET_OBS@ - # All target-dependent objects files that require 64-bit CORE_ADDR - # (used with --enable-targets=all --enable-64-bit-bfd). - ALL_64_TARGET_OBS = \ -+ aarch64-fbsd-tdep.o \ - aarch64-insn.o \ - aarch64-linux-tdep.o \ - aarch64-newlib-tdep.o \ -@@ -2458,6 +2459,8 @@ force_update: - MAKEOVERRIDES = - - ALLDEPFILES = \ -+ aarch64-fbsd-nat.c \ -+ aarch64-fbsd-tdep.c \ - aarch64-linux-nat.c \ - aarch64-linux-tdep.c \ - aarch64-newlib-tdep.c \ -diff --git gdb/aarch64-fbsd-nat.c gdb/aarch64-fbsd-nat.c -new file mode 100644 -index 0000000000..f7855b9c0b ---- /dev/null -+++ gdb/aarch64-fbsd-nat.c -@@ -0,0 +1,133 @@ -+/* Native-dependent code for FreeBSD/aarch64. -+ -+ Copyright (C) 2017 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 . */ -+ -+#include "defs.h" -+#include "target.h" -+ -+#include -+#include -+#include -+ -+#include "fbsd-nat.h" -+#include "aarch64-tdep.h" -+#include "aarch64-fbsd-tdep.h" -+#include "inf-ptrace.h" -+ -+/* Determine if PT_GETREGS fetches REGNUM. */ -+ -+static bool -+getregs_supplies (struct gdbarch *gdbarch, int regnum) -+{ -+ return (regnum >= AARCH64_X0_REGNUM && regnum <= AARCH64_CPSR_REGNUM); -+} -+ -+/* Determine if PT_GETFPREGS fetches REGNUM. */ -+ -+static bool -+getfpregs_supplies (struct gdbarch *gdbarch, int regnum) -+{ -+ return (regnum >= AARCH64_V0_REGNUM && regnum <= AARCH64_FPCR_REGNUM); -+} -+ -+/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this -+ for all registers. */ -+ -+static void -+aarch64_fbsd_fetch_inferior_registers (struct target_ops *ops, -+ struct regcache *regcache, int regnum) -+{ -+ pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache)); -+ -+ struct gdbarch *gdbarch = get_regcache_arch (regcache); -+ if (regnum == -1 || getregs_supplies (gdbarch, regnum)) -+ { -+ struct reg regs; -+ -+ if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1) -+ perror_with_name (_("Couldn't get registers")); -+ -+ regcache_supply_regset (&aarch64_fbsd_gregset, regcache, regnum, ®s, -+ sizeof (regs)); -+ } -+ -+ if (regnum == -1 || getfpregs_supplies (gdbarch, regnum)) -+ { -+ struct fpreg fpregs; -+ -+ if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) -+ perror_with_name (_("Couldn't get floating point status")); -+ -+ regcache_supply_regset (&aarch64_fbsd_fpregset, regcache, regnum, &fpregs, -+ sizeof (fpregs)); -+ } -+} -+ -+/* Store register REGNUM back into the inferior. If REGNUM is -1, do -+ this for all registers. */ -+ -+static void -+aarch64_fbsd_store_inferior_registers (struct target_ops *ops, -+ struct regcache *regcache, int regnum) -+{ -+ pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache)); -+ -+ struct gdbarch *gdbarch = get_regcache_arch (regcache); -+ if (regnum == -1 || getregs_supplies (gdbarch, regnum)) -+ { -+ struct reg regs; -+ -+ if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1) -+ perror_with_name (_("Couldn't get registers")); -+ -+ regcache_collect_regset (&aarch64_fbsd_gregset, regcache, regnum, ®s, -+ sizeof (regs)); -+ -+ if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1) -+ perror_with_name (_("Couldn't write registers")); -+ } -+ -+ if (regnum == -1 || getfpregs_supplies (gdbarch, regnum)) -+ { -+ struct fpreg fpregs; -+ -+ if (ptrace (PT_GETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) -+ perror_with_name (_("Couldn't get floating point status")); -+ -+ regcache_collect_regset (&aarch64_fbsd_fpregset, regcache, regnum, &fpregs, -+ sizeof (fpregs)); -+ -+ if (ptrace (PT_SETFPREGS, pid, (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) -+ perror_with_name (_("Couldn't write floating point status")); -+ } -+} -+ -+ -+/* Provide a prototype to silence -Wmissing-prototypes. */ -+void _initialize_aarch64_fbsd_nat (void); -+ -+void -+_initialize_aarch64_fbsd_nat (void) -+{ -+ struct target_ops *t; -+ -+ t = inf_ptrace_target (); -+ t->to_fetch_registers = aarch64_fbsd_fetch_inferior_registers; -+ t->to_store_registers = aarch64_fbsd_store_inferior_registers; -+ fbsd_nat_add_target (t); -+} -diff --git gdb/aarch64-fbsd-tdep.c gdb/aarch64-fbsd-tdep.c -new file mode 100644 -index 0000000000..f8ce627282 ---- /dev/null -+++ gdb/aarch64-fbsd-tdep.c -@@ -0,0 +1,208 @@ -+/* Target-dependent code for FreeBSD/aarch64. -+ -+ Copyright (C) 2017 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 . */ -+ -+#include "defs.h" -+ -+#include "gdbarch.h" -+#include "fbsd-tdep.h" -+#include "aarch64-tdep.h" -+#include "aarch64-fbsd-tdep.h" -+#include "osabi.h" -+#include "solib-svr4.h" -+#include "target.h" -+#include "tramp-frame.h" -+#include "trad-frame.h" -+ -+/* In a signal frame, sp points to a 'struct sigframe' which is -+ defined as: -+ -+ struct sigframe { -+ siginfo_t sf_si; -+ ucontext_t sf_uc; -+ }; -+ -+ ucontext_t is defined as: -+ -+ struct __ucontext { -+ sigset_t uc_sigmask; -+ mcontext_t uc_mcontext; -+ ... -+ }; -+ -+ The mcontext_t contains the general purpose register set followed -+ by the floating point register set. The floating point register -+ set is only valid if the _MC_FP_VALID flag is set in mc_flags. */ -+ -+#define AARCH64_MCONTEXT_REG_SIZE 8 -+#define AARCH64_MCONTEXT_FPREG_SIZE 16 -+#define AARCH64_SIGFRAME_UCONTEXT_OFFSET 80 -+#define AARCH64_UCONTEXT_MCONTEXT_OFFSET 16 -+#define AARCH64_MCONTEXT_FPREGS_OFFSET 272 -+#define AARCH64_MCONTEXT_FLAGS_OFFSET 800 -+#define AARCH64_MCONTEXT_FLAG_FP_VALID 0x1 -+ -+/* Implement the "init" method of struct tramp_frame. */ -+ -+static void -+aarch64_fbsd_sigframe_init (const struct tramp_frame *self, -+ struct frame_info *this_frame, -+ struct trad_frame_cache *this_cache, -+ CORE_ADDR func) -+{ -+ struct gdbarch *gdbarch = get_frame_arch (this_frame); -+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); -+ CORE_ADDR sp = get_frame_register_unsigned (this_frame, AARCH64_SP_REGNUM); -+ CORE_ADDR mcontext_addr = -+ sp -+ + AARCH64_SIGFRAME_UCONTEXT_OFFSET -+ + AARCH64_UCONTEXT_MCONTEXT_OFFSET; -+ gdb_byte buf[4]; -+ int i; -+ -+ for (i = 0; i < 30; i++) -+ { -+ trad_frame_set_reg_addr (this_cache, -+ AARCH64_X0_REGNUM + i, -+ mcontext_addr + i * AARCH64_MCONTEXT_REG_SIZE); -+ } -+ trad_frame_set_reg_addr (this_cache, AARCH64_LR_REGNUM, -+ mcontext_addr + 30 * AARCH64_MCONTEXT_REG_SIZE); -+ trad_frame_set_reg_addr (this_cache, AARCH64_SP_REGNUM, -+ mcontext_addr + 31 * AARCH64_MCONTEXT_REG_SIZE); -+ trad_frame_set_reg_addr (this_cache, AARCH64_PC_REGNUM, -+ mcontext_addr + 32 * AARCH64_MCONTEXT_REG_SIZE); -+ trad_frame_set_reg_addr (this_cache, AARCH64_CPSR_REGNUM, -+ mcontext_addr + 33 * AARCH64_MCONTEXT_REG_SIZE); -+ -+ if (target_read_memory (mcontext_addr + AARCH64_MCONTEXT_FLAGS_OFFSET, buf, -+ 4) == 0 -+ && (extract_unsigned_integer (buf, 4, byte_order) -+ & AARCH64_MCONTEXT_FLAG_FP_VALID)) -+ { -+ for (i = 0; i < 32; i++) -+ { -+ trad_frame_set_reg_addr (this_cache, AARCH64_V0_REGNUM + i, -+ mcontext_addr -+ + AARCH64_MCONTEXT_FPREGS_OFFSET -+ + i * AARCH64_MCONTEXT_FPREG_SIZE); -+ } -+ trad_frame_set_reg_addr (this_cache, AARCH64_FPSR_REGNUM, -+ mcontext_addr + AARCH64_MCONTEXT_FPREGS_OFFSET -+ + 32 * AARCH64_MCONTEXT_FPREG_SIZE); -+ trad_frame_set_reg_addr (this_cache, AARCH64_FPCR_REGNUM, -+ mcontext_addr + AARCH64_MCONTEXT_FPREGS_OFFSET -+ + 32 * AARCH64_MCONTEXT_FPREG_SIZE + 4); -+ } -+ -+ trad_frame_set_id (this_cache, frame_id_build (sp, func)); -+} -+ -+static const struct tramp_frame aarch64_fbsd_sigframe = -+{ -+ SIGTRAMP_FRAME, -+ 4, -+ { -+ {0x910003e0, -1}, /* mov x0, sp */ -+ {0x91014000, -1}, /* add x0, x0, #SF_UC */ -+ {0xd2803428, -1}, /* mov x8, #SYS_sigreturn */ -+ {0xd4000001, -1}, /* svc 0x0 */ -+ {TRAMP_SENTINEL_INSN, -1} -+ }, -+ aarch64_fbsd_sigframe_init -+}; -+ -+/* Register maps. */ -+ -+static const struct regcache_map_entry aarch64_fbsd_gregmap[] = -+ { -+ { 30, AARCH64_X0_REGNUM, 8 }, /* x0 ... x29 */ -+ { 1, AARCH64_LR_REGNUM, 8 }, -+ { 1, AARCH64_SP_REGNUM, 8 }, -+ { 1, AARCH64_PC_REGNUM, 8 }, -+ { 1, AARCH64_CPSR_REGNUM, 4 }, -+ { 0 } -+ }; -+ -+static const struct regcache_map_entry aarch64_fbsd_fpregmap[] = -+ { -+ { 32, AARCH64_V0_REGNUM, 16 }, /* v0 ... v31 */ -+ { 1, AARCH64_FPSR_REGNUM, 4 }, -+ { 1, AARCH64_FPCR_REGNUM, 4 }, -+ { 0 } -+ }; -+ -+/* Register set definitions. */ -+ -+const struct regset aarch64_fbsd_gregset = -+ { -+ aarch64_fbsd_gregmap, -+ regcache_supply_regset, regcache_collect_regset -+ }; -+ -+const struct regset aarch64_fbsd_fpregset = -+ { -+ aarch64_fbsd_fpregmap, -+ regcache_supply_regset, regcache_collect_regset -+ }; -+ -+/* Implement the "regset_from_core_section" gdbarch method. */ -+ -+static void -+aarch64_fbsd_iterate_over_regset_sections (struct gdbarch *gdbarch, -+ iterate_over_regset_sections_cb *cb, -+ void *cb_data, -+ const struct regcache *regcache) -+{ -+ cb (".reg", AARCH64_FBSD_SIZEOF_GREGSET, &aarch64_fbsd_gregset, -+ NULL, cb_data); -+ cb (".reg2", AARCH64_FBSD_SIZEOF_FPREGSET, &aarch64_fbsd_fpregset, -+ NULL, cb_data); -+} -+ -+/* Implement the 'init_osabi' method of struct gdb_osabi_handler. */ -+ -+static void -+aarch64_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) -+{ -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ -+ /* Generic FreeBSD support. */ -+ fbsd_init_abi (info, gdbarch); -+ -+ set_solib_svr4_fetch_link_map_offsets (gdbarch, -+ svr4_lp64_fetch_link_map_offsets); -+ -+ tramp_frame_prepend_unwinder (gdbarch, &aarch64_fbsd_sigframe); -+ -+ /* Enable longjmp. */ -+ tdep->jb_pc = 13; -+ -+ set_gdbarch_iterate_over_regset_sections -+ (gdbarch, aarch64_fbsd_iterate_over_regset_sections); -+} -+ -+/* Provide a prototype to silence -Wmissing-prototypes. */ -+extern initialize_file_ftype _initialize_aarch64_fbsd_tdep; -+ -+void -+_initialize_aarch64_fbsd_tdep (void) -+{ -+ gdbarch_register_osabi (bfd_arch_aarch64, 0, GDB_OSABI_FREEBSD, -+ aarch64_fbsd_init_abi); -+} -diff --git gdb/aarch64-fbsd-tdep.h gdb/aarch64-fbsd-tdep.h -new file mode 100644 -index 0000000000..0f66dd3925 ---- /dev/null -+++ gdb/aarch64-fbsd-tdep.h -@@ -0,0 +1,33 @@ -+/* FreeBSD/aarch64 target support, prototypes. -+ -+ Copyright (C) 2017 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 . */ -+ -+#include "regset.h" -+ -+/* The general-purpose regset consists of 30 X registers, plus LR, SP, -+ ELR, and SPSR registers. SPSR is 32 bits but the structure is -+ passed to 64 bit alignment. */ -+#define AARCH64_FBSD_SIZEOF_GREGSET (34 * X_REGISTER_SIZE) -+ -+/* The fp regset consists of 32 V registers, plus FPSR and FPCR which -+ are 4 bytes wide each, and the whole structure is padded to 128 bit -+ alignment. */ -+#define AARCH64_FBSD_SIZEOF_FPREGSET (33 * V_REGISTER_SIZE) -+ -+extern const struct regset aarch64_fbsd_gregset; -+extern const struct regset aarch64_fbsd_fpregset; -diff --git gdb/config/aarch64/fbsd.mh gdb/config/aarch64/fbsd.mh -new file mode 100644 -index 0000000000..4171987bc9 ---- /dev/null -+++ gdb/config/aarch64/fbsd.mh -@@ -0,0 +1,23 @@ -+# Host: Freebsd/aarch64 -+# -+# Copyright (C) 2017 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 . -+ -+NATDEPFILES= inf-ptrace.o fork-child.o aarch64-fbsd-nat.o fbsd-nat.o -+HAVE_NATIVE_GCORE_HOST = 1 -+ -+LOADLIBES= -lkvm -diff --git gdb/configure.host gdb/configure.host -index d74fd04934..304675f137 100644 ---- gdb/configure.host -+++ gdb/configure.host -@@ -84,6 +84,7 @@ case "${host}" in - *-*-darwin*) gdb_host=darwin ;; - - aarch64*-*-linux*) gdb_host=linux ;; -+aarch64*-*-freebsd*) gdb_host=fbsd ;; - - alpha*-*-linux*) gdb_host=alpha-linux ;; - alpha*-*-netbsd* | alpha*-*-knetbsd*-gnu) -diff --git gdb/configure.tgt gdb/configure.tgt -index fdcb7b1d69..f72a0dbbc1 100644 ---- gdb/configure.tgt -+++ gdb/configure.tgt -@@ -44,6 +44,11 @@ aarch64*-*-elf | aarch64*-*-rtems*) - gdb_target_obs="aarch64-tdep.o aarch64-newlib-tdep.o aarch64-insn.o" - ;; - -+aarch64*-*-freebsd*) -+ # Target: FreeBSD/aarch64 -+ gdb_target_obs="aarch64-tdep.o aarch64-fbsd-tdep.o aarch64-insn.o" -+ ;; -+ - aarch64*-*-linux*) - # Target: AArch64 linux - gdb_target_obs="aarch64-tdep.o aarch64-linux-tdep.o aarch64-insn.o \ Index: devel/gdb/files/patch-armfbsd =================================================================== --- devel/gdb/files/patch-armfbsd +++ /dev/null @@ -1,512 +0,0 @@ -diff --git gdb/arm-fbsd-nat.c gdb/arm-fbsd-nat.c -new file mode 100644 -index 0000000000..b1c5c360f8 ---- /dev/null -+++ gdb/arm-fbsd-nat.c -@@ -0,0 +1,151 @@ -+/* Native-dependent code for FreeBSD/arm. -+ -+ Copyright (C) 2017 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 . */ -+ -+#include "defs.h" -+#include "target.h" -+ -+#include -+#include -+#include -+ -+#include "fbsd-nat.h" -+#include "arm-tdep.h" -+#include "arm-fbsd-tdep.h" -+#include "inf-ptrace.h" -+ -+/* Determine if PT_GETREGS fetches REGNUM. */ -+ -+static bool -+getregs_supplies (struct gdbarch *gdbarch, int regnum) -+{ -+ return ((regnum >= ARM_A1_REGNUM && regnum <= ARM_PC_REGNUM) -+ || regnum == ARM_PS_REGNUM); -+} -+ -+#ifdef PT_GETVFPREGS -+/* Determine if PT_GETVFPREGS fetches REGNUM. */ -+ -+static bool -+getvfpregs_supplies (struct gdbarch *gdbarch, int regnum) -+{ -+ return ((regnum >= ARM_D0_REGNUM && regnum <= ARM_D31_REGNUM) -+ || regnum == ARM_FPSCR_REGNUM); -+} -+#endif -+ -+/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this -+ for all registers. */ -+ -+static void -+arm_fbsd_fetch_inferior_registers (struct target_ops *ops, -+ struct regcache *regcache, int regnum) -+{ -+ pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache)); -+ -+ struct gdbarch *gdbarch = get_regcache_arch (regcache); -+ if (regnum == -1 || getregs_supplies (gdbarch, regnum)) -+ { -+ struct reg regs; -+ -+ if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1) -+ perror_with_name (_("Couldn't get registers")); -+ -+ regcache_supply_regset (&arm_fbsd_gregset, regcache, regnum, ®s, -+ sizeof (regs)); -+ } -+ -+#ifdef PT_GETVFPREGS -+ if (regnum == -1 || getvfpregs_supplies (gdbarch, regnum)) -+ { -+ struct vfpreg vfpregs; -+ -+ if (ptrace (PT_GETVFPREGS, pid, (PTRACE_TYPE_ARG3) &vfpregs, 0) == -1) -+ perror_with_name (_("Couldn't get floating point status")); -+ -+ regcache_supply_regset (&arm_fbsd_vfpregset, regcache, regnum, &vfpregs, -+ sizeof (vfpregs)); -+ } -+#endif -+} -+ -+/* Store register REGNUM back into the inferior. If REGNUM is -1, do -+ this for all registers. */ -+ -+static void -+arm_fbsd_store_inferior_registers (struct target_ops *ops, -+ struct regcache *regcache, int regnum) -+{ -+ pid_t pid = get_ptrace_pid (regcache_get_ptid (regcache)); -+ -+ struct gdbarch *gdbarch = get_regcache_arch (regcache); -+ if (regnum == -1 || getregs_supplies (gdbarch, regnum)) -+ { -+ struct reg regs; -+ -+ if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1) -+ perror_with_name (_("Couldn't get registers")); -+ -+ regcache_collect_regset (&arm_fbsd_gregset, regcache, regnum, ®s, -+ sizeof (regs)); -+ -+ if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1) -+ perror_with_name (_("Couldn't write registers")); -+ } -+ -+#ifdef PT_GETVFPREGS -+ if (regnum == -1 || getvfpregs_supplies (gdbarch, regnum)) -+ { -+ struct vfpreg vfpregs; -+ -+ if (ptrace (PT_GETVFPREGS, pid, (PTRACE_TYPE_ARG3) &vfpregs, 0) == -1) -+ perror_with_name (_("Couldn't get floating point status")); -+ -+ regcache_collect_regset (&arm_fbsd_vfpregset, regcache, regnum, &vfpregs, -+ sizeof (vfpregs)); -+ -+ if (ptrace (PT_SETVFPREGS, pid, (PTRACE_TYPE_ARG3) &vfpregs, 0) == -1) -+ perror_with_name (_("Couldn't write floating point status")); -+ } -+#endif -+} -+ -+/* Implement the to_read_description method. */ -+ -+static const struct target_desc * -+arm_fbsd_read_description (struct target_ops *ops) -+{ -+ const struct target_desc *desc; -+ -+ desc = arm_fbsd_read_description_auxv (ops); -+ if (desc == NULL) -+ desc = ops->beneath->to_read_description (ops->beneath); -+ return desc; -+} -+ -+void -+_initialize_arm_fbsd_nat (void) -+{ -+ struct target_ops *t; -+ -+ t = inf_ptrace_target (); -+ t->to_fetch_registers = arm_fbsd_fetch_inferior_registers; -+ t->to_store_registers = arm_fbsd_store_inferior_registers; -+ t->to_read_description = arm_fbsd_read_description; -+ fbsd_nat_add_target (t); -+} -diff --git gdb/arm-fbsd-tdep.c gdb/arm-fbsd-tdep.c -new file mode 100644 -index 0000000000..02697b3de8 ---- /dev/null -+++ gdb/arm-fbsd-tdep.c -@@ -0,0 +1,260 @@ -+/* Target-dependent code for FreeBSD/arm. -+ -+ Copyright (C) 2017 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 . */ -+ -+#include "defs.h" -+ -+#include "elf/common.h" -+#include "arm-tdep.h" -+#include "arm-fbsd-tdep.h" -+#include "auxv.h" -+#include "fbsd-tdep.h" -+#include "osabi.h" -+#include "solib-svr4.h" -+#include "target.h" -+#include "trad-frame.h" -+#include "tramp-frame.h" -+ -+/* In a signal frame, sp points to a 'struct sigframe' which is -+ defined as: -+ -+ struct sigframe { -+ siginfo_t sf_si; -+ ucontext_t sf_uc; -+ mcontext_vfp_t sf_vfp; -+ }; -+ -+ ucontext_t is defined as: -+ -+ struct __ucontext { -+ sigset_t uc_sigmask; -+ mcontext_t uc_mcontext; -+ ... -+ }; -+ -+ mcontext_t is defined as: -+ -+ struct { -+ unsigned int __gregs[17]; -+ size_t mc_vfp_size; -+ void *mc_vfp_ptr; -+ ... -+ }; -+ -+ mcontext_vfp_t is defined as: -+ -+ struct { -+ uint64_t mcv_reg[32]; -+ uint32_t mcv_fpscr; -+ }; -+ -+ If the VFP state is valid, then mc_vfp_ptr will point to sf_vfp in -+ the sigframe, otherwise it is NULL. There is no non-VFP floating -+ point register state saved in the signal frame. */ -+ -+#define ARM_MCONTEXT_REG_SIZE 4 -+#define ARM_MCONTEXT_VFP_REG_SIZE 8 -+#define ARM_SIGFRAME_UCONTEXT_OFFSET 64 -+#define ARM_UCONTEXT_MCONTEXT_OFFSET 16 -+#define ARM_MCONTEXT_VFP_PTR_OFFSET 72 -+ -+/* Implement the "init" method of struct tramp_frame. */ -+ -+static void -+arm_fbsd_sigframe_init (const struct tramp_frame *self, -+ struct frame_info *this_frame, -+ struct trad_frame_cache *this_cache, -+ CORE_ADDR func) -+{ -+ struct gdbarch *gdbarch = get_frame_arch (this_frame); -+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); -+ CORE_ADDR sp = get_frame_register_unsigned (this_frame, ARM_SP_REGNUM); -+ CORE_ADDR mcontext_addr = -+ sp -+ + ARM_SIGFRAME_UCONTEXT_OFFSET -+ + ARM_UCONTEXT_MCONTEXT_OFFSET; -+ CORE_ADDR mcontext_vfp_addr; -+ gdb_byte buf[4]; -+ int i; -+ -+ for (i = 0; i < 16; i++) -+ { -+ trad_frame_set_reg_addr (this_cache, -+ ARM_A1_REGNUM + i, -+ mcontext_addr + i * ARM_MCONTEXT_REG_SIZE); -+ } -+ trad_frame_set_reg_addr (this_cache, ARM_PS_REGNUM, -+ mcontext_addr + 16 * ARM_MCONTEXT_REG_SIZE); -+ -+ mcontext_vfp_addr = 0; -+ if (target_read_memory (mcontext_addr + ARM_MCONTEXT_VFP_PTR_OFFSET, buf, -+ 4) == 0) -+ mcontext_vfp_addr = extract_unsigned_integer (buf, 4, byte_order); -+ if (mcontext_vfp_addr != 0) -+ { -+ for (i = 0; i < 32; i++) -+ { -+ trad_frame_set_reg_addr (this_cache, ARM_D0_REGNUM + i, -+ mcontext_vfp_addr -+ + i * ARM_MCONTEXT_VFP_REG_SIZE); -+ } -+ trad_frame_set_reg_addr (this_cache, ARM_FPSCR_REGNUM, -+ mcontext_vfp_addr -+ + 32 * ARM_MCONTEXT_VFP_REG_SIZE); -+ } -+ -+ trad_frame_set_id (this_cache, frame_id_build (sp, func)); -+} -+ -+static const struct tramp_frame arm_fbsd_sigframe = -+{ -+ SIGTRAMP_FRAME, -+ 4, -+ { -+ {0xe1a0000d, -1}, /* mov r0, sp */ -+ {0xe2800040, -1}, /* add r0, r0, #SIGF_UC */ -+ {0xe59f700c, -1}, /* ldr r7, [pc, #12] */ -+ {0xef0001a1, -1}, /* swi SYS_sigreturn */ -+ {TRAMP_SENTINEL_INSN, -1} -+ }, -+ arm_fbsd_sigframe_init -+}; -+ -+/* Register maps. */ -+ -+static const struct regcache_map_entry arm_fbsd_gregmap[] = -+ { -+ { 13, ARM_A1_REGNUM, 4 }, /* r0 ... r12 */ -+ { 1, ARM_SP_REGNUM, 4 }, -+ { 1, ARM_LR_REGNUM, 4 }, -+ { 1, ARM_PC_REGNUM, 4 }, -+ { 1, ARM_PS_REGNUM, 4 }, -+ { 0 } -+ }; -+ -+static const struct regcache_map_entry arm_fbsd_vfpregmap[] = -+ { -+ { 32, ARM_D0_REGNUM, 8 }, /* d0 ... d31 */ -+ { 1, ARM_FPSCR_REGNUM, 4 }, -+ { 0 } -+ }; -+ -+/* Register set definitions. */ -+ -+const struct regset arm_fbsd_gregset = -+ { -+ arm_fbsd_gregmap, -+ regcache_supply_regset, regcache_collect_regset -+ }; -+ -+const struct regset arm_fbsd_vfpregset = -+ { -+ arm_fbsd_vfpregmap, -+ regcache_supply_regset, regcache_collect_regset -+ }; -+ -+/* Implement the "regset_from_core_section" gdbarch method. */ -+ -+static void -+arm_fbsd_iterate_over_regset_sections (struct gdbarch *gdbarch, -+ iterate_over_regset_sections_cb *cb, -+ void *cb_data, -+ const struct regcache *regcache) -+{ -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ -+ cb (".reg", ARM_FBSD_SIZEOF_GREGSET, &arm_fbsd_gregset, NULL, cb_data); -+ -+ /* While FreeBSD/arm cores do contain a NT_FPREGSET / ".reg2" -+ register set, it is not populated with register values by the -+ kernel but just contains all zeroes. */ -+ if (tdep->vfp_register_count > 0) -+ cb (".reg-arm-vfp", ARM_FBSD_SIZEOF_VFPREGSET, &arm_fbsd_vfpregset, -+ "VFP floating-point", cb_data); -+} -+ -+/* Lookup a target description from a target's AT_HWCAP auxiliary -+ vector. */ -+ -+const struct target_desc * -+arm_fbsd_read_description_auxv (struct target_ops *target) -+{ -+ CORE_ADDR arm_hwcap = 0; -+ -+ if (target_auxv_search (target, AT_FREEBSD_HWCAP, &arm_hwcap) != 1) -+ return NULL; -+ -+ if (arm_hwcap & HWCAP_VFP) -+ { -+ if (arm_hwcap & HWCAP_NEON) -+ return tdesc_arm_with_neon; -+ else if ((arm_hwcap & (HWCAP_VFPv3 | HWCAP_VFPD32)) -+ == (HWCAP_VFPv3 | HWCAP_VFPD32)) -+ return tdesc_arm_with_vfpv3; -+ else -+ return tdesc_arm_with_vfpv2; -+ } -+ -+ return NULL; -+} -+ -+/* Implement the "core_read_description" gdbarch method. */ -+ -+static const struct target_desc * -+arm_fbsd_core_read_description (struct gdbarch *gdbarch, -+ struct target_ops *target, -+ bfd *abfd) -+{ -+ return arm_fbsd_read_description_auxv (target); -+} -+ -+/* Implement the 'init_osabi' method of struct gdb_osabi_handler. */ -+ -+static void -+arm_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) -+{ -+ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); -+ -+ /* Generic FreeBSD support. */ -+ fbsd_init_abi (info, gdbarch); -+ -+ if (tdep->fp_model == ARM_FLOAT_AUTO) -+ tdep->fp_model = ARM_FLOAT_SOFT_VFP; -+ -+ tramp_frame_prepend_unwinder (gdbarch, &arm_fbsd_sigframe); -+ -+ set_solib_svr4_fetch_link_map_offsets -+ (gdbarch, svr4_ilp32_fetch_link_map_offsets); -+ -+ tdep->jb_pc = 24; -+ tdep->jb_elt_size = 4; -+ -+ set_gdbarch_iterate_over_regset_sections -+ (gdbarch, arm_fbsd_iterate_over_regset_sections); -+ set_gdbarch_core_read_description (gdbarch, arm_fbsd_core_read_description); -+ -+ /* Single stepping. */ -+ set_gdbarch_software_single_step (gdbarch, arm_software_single_step); -+} -+ -+void -+_initialize_arm_fbsd_tdep (void) -+{ -+ gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_FREEBSD, -+ arm_fbsd_init_abi); -+} -diff --git gdb/arm-fbsd-tdep.h gdb/arm-fbsd-tdep.h -new file mode 100644 -index 0000000000..8717b804af ---- /dev/null -+++ gdb/arm-fbsd-tdep.h -@@ -0,0 +1,40 @@ -+/* FreeBSD/arm target support, prototypes. -+ -+ Copyright (C) 2017 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 . */ -+ -+#include "regset.h" -+ -+/* The general-purpose regset consists of 13 R registers, plus SP, LR, -+ PC, and CPSR registers. */ -+#define ARM_FBSD_SIZEOF_GREGSET (17 * 4) -+ -+/* The VFP regset consists of 32 D registers plus FPSCR, and the whole -+ structure is padded to 64-bit alignment. */ -+#define ARM_FBSD_SIZEOF_VFPREGSET (33 * 8) -+ -+extern const struct regset arm_fbsd_gregset; -+extern const struct regset arm_fbsd_vfpregset; -+ -+/* Flags passed in AT_HWCAP. */ -+#define HWCAP_VFP 0x00000040 -+#define HWCAP_NEON 0x00001000 -+#define HWCAP_VFPv3 0x00002000 -+#define HWCAP_VFPD32 0x00080000 -+ -+extern const struct target_desc * -+arm_fbsd_read_description_auxv (struct target_ops *target); ---- /dev/null -+++ gdb/config/arm/fbsd.mh -@@ -0,0 +1,3 @@ -+# Host: FreeBSD/arm -+NATDEPFILES= arm-fbsd-nat.o fbsd-nat.o fork-child.o inf-ptrace.o -+HAVE_NATIVE_GCORE_HOST = 1 -diff --git gdb/configure.tgt gdb/configure.tgt -index 122a72608f..06957c111d 100644 ---- gdb/configure.tgt -+++ gdb/configure.tgt -@@ -110,6 +110,11 @@ arm*-*-linux*) - solib-svr4.o symfile-mem.o linux-tdep.o linux-record.o" - build_gdbserver=yes - ;; -+arm*-*-freebsd*) -+ # Target: FreeBSD/arm -+ gdb_target_obs="arm.o arm-get-next-pcs.o arm-tdep.o arm-fbsd-tdep.o \ -+ fbsd-tdep.o solib-svr4.o" -+ ;; - arm*-*-netbsd* | arm*-*-knetbsd*-gnu) - # Target: NetBSD/arm - gdb_target_obs="arm.o arm-get-next-pcs.o arm-tdep.o arm-nbsd-tdep.o \ -diff --git gdb/Makefile.in gdb/Makefile.in -index 9454e3a62f..c9bd60a2d8 100644 ---- gdb/Makefile.in -+++ gdb/Makefile.in -@@ -794,6 +794,7 @@ ALL_TARGET_OBS = \ - arc-tdep.o \ - arm.o \ - arm-bsd-tdep.o \ -+ arm-fbsd-tdep.o \ - arm-get-next-pcs.o \ - arm-linux.o \ - arm-linux-tdep.o \ -@@ -2537,6 +2538,8 @@ ALLDEPFILES = \ - arc-tdep.c \ - arm.c \ - arm-bsd-tdep.c \ -+ arm-fbsd-nat.c \ -+ arm-fbsd-tdep.c \ - arm-get-next-pcs.c \ - arm-linux.c \ - arm-linux-nat.c \ Index: devel/gdb/files/patch-gdb_configure =================================================================== --- devel/gdb/files/patch-gdb_configure +++ devel/gdb/files/patch-gdb_configure @@ -1,6 +1,6 @@ --- gdb/configure.orig 2017-09-14 09:28:17 UTC +++ gdb/configure -@@ -15103,12 +15103,10 @@ if test "${ERROR_ON_WARNING}" = yes ; then +@@ -15292,13 +15292,10 @@ if test "${ERROR_ON_WARNING}" = yes ; then WERROR_CFLAGS="-Werror" fi @@ -10,9 +10,10 @@ --Wno-unused -Wunused-value -Wunused-function \ --Wno-switch -Wno-char-subscripts \ --Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable \ ---Wno-sign-compare -Wno-narrowing" +--Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized \ +--Wno-mismatched-tags" +-Wno-unused -Wno-switch -Wno-char-subscripts \ +-Wempty-body -Wno-sign-compare -Wno-narrowing -Wno-mismatched-tags" - # Enable -Wno-format by default when using gcc on mingw since many - # GCC versions complain about %I64. + case "${host}" in + *-*-mingw32*) Index: devel/gdb/files/patch-gdb_configure.host =================================================================== --- devel/gdb/files/patch-gdb_configure.host +++ /dev/null @@ -1,10 +0,0 @@ ---- gdb/configure.host.orig 2017-09-14 09:28:17 UTC -+++ gdb/configure.host -@@ -90,6 +90,7 @@ alpha*-*-netbsd* | alpha*-*-knetbsd*-gnu) - gdb_host=nbsd ;; - alpha*-*-openbsd*) gdb_host=nbsd ;; - -+arm*-*-freebsd*) gdb_host=fbsd ;; - arm*-*-linux*) gdb_host=linux ;; - arm*-*-netbsdelf* | arm*-*-knetbsd*-gnu) - gdb_host=nbsdelf ;; Index: devel/gdb/files/patch-nowarning =================================================================== --- devel/gdb/files/patch-nowarning +++ /dev/null @@ -1,65 +0,0 @@ ---- gdb/arm-tdep.c.orig 2016-07-08 15:42:17 UTC -+++ gdb/arm-tdep.c -@@ -9880,7 +9880,7 @@ - && !INSN_RECORDED(arm_insn_r)) - { - /* Handle MLA(S) and MUL(S). */ -- if (0 <= insn_op1 && 3 >= insn_op1) -+ if (3 >= insn_op1) - { - record_buf[0] = bits (arm_insn_r->arm_insn, 12, 15); - record_buf[1] = ARM_PS_REGNUM; ---- gdb/cris-tdep.c.orig 2016-07-08 15:45:26.575379589 +0200 -+++ gdb/cris-tdep.c 2016-07-08 15:47:07.849372792 +0200 -@@ -1441,7 +1441,7 @@ - /* Indeterminate/obsolete. */ - return 0; - case cris_ver_v0_3: -- return (version >= 0 && version <= 3); -+ return (version <= 3); - case cris_ver_v3p: - return (version >= 3); - case cris_ver_v8: -@@ -1449,7 +1449,7 @@ - case cris_ver_v8p: - return (version >= 8); - case cris_ver_v0_10: -- return (version >= 0 && version <= 10); -+ return (version <= 10); - case cris_ver_v3_10: - return (version >= 3 && version <= 10); - case cris_ver_v8_10: ---- gdb/main.c.orig 2016-08-03 17:55:42.243017327 +0200 -+++ gdb/main.c 2016-08-03 17:56:04.478015630 +0200 -@@ -226,7 +226,7 @@ - { - /* Append the part of SYSTEM_GDBINIT that follows GDB_DATADIR - to gdb_datadir. */ -- char *tmp_sys_gdbinit = xstrdup (SYSTEM_GDBINIT + datadir_len); -+ char *tmp_sys_gdbinit = xstrdup (&(SYSTEM_GDBINIT[datadir_len])); - char *p; - - for (p = tmp_sys_gdbinit; IS_DIR_SEPARATOR (*p); ++p) ---- gdb/dtrace-probe.c.orig 2016-08-03 17:57:18.454010903 +0200 -+++ gdb/dtrace-probe.c 2016-08-03 17:58:01.001007519 +0200 -@@ -421,7 +421,8 @@ - arg.type_str = xstrdup (p); - - /* Use strtab_size as a sentinel. */ -- while (*p++ != '\0' && p - strtab < strtab_size); -+ while (*p++ != '\0' && p - strtab < strtab_size) -+ ; - - /* Try to parse a type expression from the type string. If - this does not work then we set the type to `long ---- libiberty/stack-limit.c.orig 2016-08-05 14:12:21.942893014 +0200 -+++ libiberty/stack-limit.c 2016-08-05 14:12:58.794890125 +0200 -@@ -51,7 +51,7 @@ - struct rlimit rlim; - if (getrlimit (RLIMIT_STACK, &rlim) == 0 - && rlim.rlim_cur != RLIM_INFINITY -- && rlim.rlim_cur < pref -+ && rlim.rlim_cur < (rlim_t)pref - && (rlim.rlim_max == RLIM_INFINITY || rlim.rlim_cur < rlim.rlim_max)) - { - rlim.rlim_cur = pref;