FreeBSD Bugzilla – Attachment 161140 Details for
Bug 203170
[MAINTAINER UPDATE] devel/gdb update to version 7.10
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
The patch to update the port
D-gdb-7.10.diff (text/plain), 51.71 KB, created by
luca.pizzamiglio
on 2015-09-17 09:45:40 UTC
(
hide
)
Description:
The patch to update the port
Filename:
MIME Type:
Creator:
luca.pizzamiglio
Created:
2015-09-17 09:45:40 UTC
Size:
51.71 KB
patch
obsolete
>diff --git devel/gdb/Makefile devel/gdb/Makefile >index 0041287..f36d61c 100644 >--- devel/gdb/Makefile >+++ devel/gdb/Makefile >@@ -2,7 +2,7 @@ > # $FreeBSD$ > > PORTNAME= gdb >-PORTVERSION= 7.9.1 >+PORTVERSION= 7.10 > CATEGORIES= devel > MASTER_SITES= GNU > >@@ -17,7 +17,7 @@ CPE_VENDOR= gnu > GNU_CONFIGURE= yes > CONFIGURE_ENV= CONFIGURED_M4=m4 CONFIGURED_BISON=byacc > CONFIGURE_ARGS= --program-suffix=${PORTVERSION:S/.//g} \ >- --enable-targets=all \ >+ --enable-targets=all --enable-64-bit-bfd \ > --with-gdb-datadir=${PREFIX}/share/gdb${PORTVERSION:S/.//g} \ > --with-separate-debug-dir=/usr/lib/debug \ > ${ICONV_CONFIGURE_ARG} \ >@@ -26,12 +26,6 @@ CFLAGS:= ${CFLAGS:C/ +$//} # blanks at EOL creep in sometimes > CFLAGS+= -DRL_NO_COMPAT -Wno-unused-function -Wno-unused-variable > EXCLUDE= dejagnu expect sim texinfo intl > EXTRACT_AFTER_ARGS= ${EXCLUDE:S/^/--exclude /} >-EXTRA_PATCHES= ${FILESDIR}/commit-c5cb74e \ >- ${FILESDIR}/commit-cf424ae \ >- ${FILESDIR}/commit-773eacf \ >- ${FILESDIR}/commit-2526815 \ >- ${FILESDIR}/commit-3ce5b6e \ >- ${FILESDIR}/commit-97de354 > > VER= ${PORTVERSION:S/.//g} > PLIST_SUB= VER=${VER} >@@ -63,10 +57,10 @@ EXPAT_LIB_DEPENDS= libexpat.so:${PORTSDIR}/textproc/expat2 > GUILE_CONFIGURE_ON= --with-guile > GUILE_USES= pkgconfig > GUILE_LIB_DEPENDS= libguile-2.0.so:${PORTSDIR}/lang/guile2 >+PORT_READLINE_USES= readline:port > PYTHON_CONFIGURE_ON= --with-python=${PYTHON_CMD} > PYTHON_CONFIGURE_OFF= --without-python > PYTHON_USES= python:2 >-PORT_READLINE_USES= readline:port > TUI_CONFIGURE_ENABLE= tui > > .include <bsd.port.options.mk> >@@ -82,10 +76,10 @@ CONFIGURE_TARGET= x86_64-portbld-freebsd${OSREL} > post-patch: > @${REINPLACE_CMD} -e 's|$$| [GDB v${PORTVERSION} for FreeBSD]|' \ > ${WRKSRC}/gdb/version.in >-.if ${PORT_OPTIONS:MTHREADS} >+ >+post-patch-THREADS-on: > @${CP} ${FILESDIR}/fbsd-threads.c ${WRKSRC}/gdb/ > @${PATCH} ${PATCH_ARGS} < ${FILESDIR}/extrapatch-threads >-.endif > > do-install: > ${INSTALL_PROGRAM} ${WRKSRC}/gdb/gdb \ >@@ -93,30 +87,23 @@ do-install: > ${INSTALL_MAN} ${WRKSRC}/gdb/doc/gdb.1 \ > ${STAGEDIR}${MAN1PREFIX}/man/man1/gdb${VER}.1 > >-.if ${PORT_OPTIONS:MTUI} >+do-install-TUI-on: > ${LN} -sf gdb${VER} ${STAGEDIR}${PREFIX}/bin/gdbtui${VER} >-.endif > >-.if ${PORT_OPTIONS:MGDB_LINK} >+do-install-GDB_LINK-on: > ${LN} -sf gdb${VER} ${STAGEDIR}${PREFIX}/bin/gdb >-.endif > >-.if ${PORT_OPTIONS:MPYTHON} >+do-install-PYTHON-on: > (cd ${WRKSRC}/gdb; ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install-python ) > (cd ${WRKSRC}/gdb/data-directory ; \ > ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install-python ) >-.endif >+. for f in gdb gdb/command gdb/function >+ @(cd ${STAGEDIR}${PREFIX}/share/gdb${VER}/python/${f} ; ${CHMOD} 644 *.py* ) >+. endfor > >-.if ${PORT_OPTIONS:MGUILE} >+do-install-GUILE-on: > (cd ${WRKSRC}/gdb; ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install-guile ) > (cd ${WRKSRC}/gdb/data-directory ; \ > ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install-guile ) >-.endif >- >-.if ${PORT_OPTIONS:MPYTHON} >-. for f in gdb gdb/command gdb/function >- @(cd ${STAGEDIR}${PREFIX}/share/gdb${VER}/python/${f} ; ${CHMOD} 644 *.py* ) >-. endfor >-.endif > > .include <bsd.port.mk> >diff --git devel/gdb/distinfo devel/gdb/distinfo >index 68696bd..7640812 100644 >--- devel/gdb/distinfo >+++ devel/gdb/distinfo >@@ -1,2 +1,2 @@ >-SHA256 (gdb-7.9.1.tar.xz) = cd9c543a411a05b2b647dd38936034b68c2b5d6f10e0d51dc168c166c973ba40 >-SIZE (gdb-7.9.1.tar.xz) = 17867692 >+SHA256 (gdb-7.10.tar.xz) = 7ebdaa44f9786ce0c142da4e36797d2020c55fa091905ac5af1846b5756208a8 >+SIZE (gdb-7.10.tar.xz) = 18540820 >diff --git devel/gdb/files/commit-2526815 devel/gdb/files/commit-2526815 >deleted file mode 100644 >index 72a46ed..0000000 >--- devel/gdb/files/commit-2526815 >+++ /dev/null >@@ -1,186 +0,0 @@ >-diff --git gdb/config.in gdb/config.in >-index 3ccac37..8a27df0 100644 >---- gdb/config.in >-+++ gdb/config.in >-@@ -213,6 +213,9 @@ >- /* Define to 1 if you have the <inttypes.h> header file. */ >- #undef HAVE_INTTYPES_H >- >-+/* Define to 1 if your system has the kinfo_getvmmap function. */ >-+#undef HAVE_KINFO_GETVMMAP >-+ >- /* Define if you have <langinfo.h> and nl_langinfo(CODESET). */ >- #undef HAVE_LANGINFO_CODESET >- >-diff --git gdb/configure gdb/configure >-index cca0aeb..78d206b 100755 >---- gdb/configure >-+++ gdb/configure >-@@ -7159,6 +7159,66 @@ if test "$ac_res" != no; then : >- fi >- >- >-+# On FreeBSD we may need libutil for kinfo_getvmmap (used by fbsd-nat.c). >-+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing kinfo_getvmmap" >&5 >-+$as_echo_n "checking for library containing kinfo_getvmmap... " >&6; } >-+if test "${ac_cv_search_kinfo_getvmmap+set}" = set; then : >-+ $as_echo_n "(cached) " >&6 >-+else >-+ ac_func_search_save_LIBS=$LIBS >-+cat confdefs.h - <<_ACEOF >conftest.$ac_ext >-+/* end confdefs.h. */ >-+ >-+/* Override any GCC internal prototype to avoid an error. >-+ Use char because int might match the return type of a GCC >-+ builtin and then its argument prototype would still apply. */ >-+#ifdef __cplusplus >-+extern "C" >-+#endif >-+char kinfo_getvmmap (); >-+int >-+main () >-+{ >-+return kinfo_getvmmap (); >-+ ; >-+ return 0; >-+} >-+_ACEOF >-+for ac_lib in '' util; do >-+ if test -z "$ac_lib"; then >-+ ac_res="none required" >-+ else >-+ ac_res=-l$ac_lib >-+ LIBS="-l$ac_lib $ac_func_search_save_LIBS" >-+ fi >-+ if ac_fn_c_try_link "$LINENO"; then : >-+ ac_cv_search_kinfo_getvmmap=$ac_res >-+fi >-+rm -f core conftest.err conftest.$ac_objext \ >-+ conftest$ac_exeext >-+ if test "${ac_cv_search_kinfo_getvmmap+set}" = set; then : >-+ break >-+fi >-+done >-+if test "${ac_cv_search_kinfo_getvmmap+set}" = set; then : >-+ >-+else >-+ ac_cv_search_kinfo_getvmmap=no >-+fi >-+rm conftest.$ac_ext >-+LIBS=$ac_func_search_save_LIBS >-+fi >-+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_kinfo_getvmmap" >&5 >-+$as_echo "$ac_cv_search_kinfo_getvmmap" >&6; } >-+ac_res=$ac_cv_search_kinfo_getvmmap >-+if test "$ac_res" != no; then : >-+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" >-+ >-+$as_echo "#define HAVE_KINFO_GETVMMAP 1" >>confdefs.h >-+ >-+fi >-+ >-+ >- >- >- >-diff --git gdb/configure.ac gdb/configure.ac >-index 4a0b6a3..38747e8 100644 >---- gdb/configure.ac >-+++ gdb/configure.ac >-@@ -537,6 +537,11 @@ AM_ZLIB >- # On HP/UX we may need libxpdl for dlgetmodinfo (used by solib-pa64.c). >- AC_SEARCH_LIBS(dlgetmodinfo, [dl xpdl]) >- >-+# On FreeBSD we may need libutil for kinfo_getvmmap (used by fbsd-nat.c). >-+AC_SEARCH_LIBS(kinfo_getvmmap, util, >-+ [AC_DEFINE(HAVE_KINFO_GETVMMAP, 1, >-+ [Define to 1 if your system has the kinfo_getvmmap function. ])]) >-+ >- AM_ICONV >- >- # GDB may fork/exec the iconv program to get the list of supported character >-diff --git gdb/fbsd-nat.c gdb/fbsd-nat.c >-index 062eede..1ce197d 100644 >---- gdb/fbsd-nat.c >-+++ gdb/fbsd-nat.c >-@@ -26,6 +26,10 @@ >- #include <sys/types.h> >- #include <sys/procfs.h> >- #include <sys/sysctl.h> >-+#ifdef HAVE_KINFO_GETVMMAP >-+#include <sys/user.h> >-+#include <libutil.h> >-+#endif >- >- #include "elf-bfd.h" >- #include "fbsd-nat.h" >-@@ -62,6 +66,64 @@ fbsd_pid_to_exec_file (struct target_ops *self, int pid) >- return NULL; >- } >- >-+#ifdef HAVE_KINFO_GETVMMAP >-+/* Iterate over all the memory regions in the current inferior, >-+ calling FUNC for each memory region. OBFD is passed as the last >-+ argument to FUNC. */ >-+ >-+int >-+fbsd_find_memory_regions (struct target_ops *self, >-+ find_memory_region_ftype func, void *obfd) >-+{ >-+ pid_t pid = ptid_get_pid (inferior_ptid); >-+ struct kinfo_vmentry *vmentl, *kve; >-+ uint64_t size; >-+ struct cleanup *cleanup; >-+ int i, nitems; >-+ >-+ vmentl = kinfo_getvmmap (pid, &nitems); >-+ if (vmentl == NULL) >-+ perror_with_name (_("Couldn't fetch VM map entries.")); >-+ cleanup = make_cleanup (free, vmentl); >-+ >-+ for (i = 0; i < nitems; i++) >-+ { >-+ kve = &vmentl[i]; >-+ >-+ /* Skip unreadable segments and those where MAP_NOCORE has been set. */ >-+ if (!(kve->kve_protection & KVME_PROT_READ) >-+ || kve->kve_flags & KVME_FLAG_NOCOREDUMP) >-+ continue; >-+ >-+ /* Skip segments with an invalid type. */ >-+ if (kve->kve_type != KVME_TYPE_DEFAULT >-+ && kve->kve_type != KVME_TYPE_VNODE >-+ && kve->kve_type != KVME_TYPE_SWAP >-+ && kve->kve_type != KVME_TYPE_PHYS) >-+ continue; >-+ >-+ size = kve->kve_end - kve->kve_start; >-+ if (info_verbose) >-+ { >-+ fprintf_filtered (gdb_stdout, >-+ "Save segment, %ld bytes at %s (%c%c%c)\n", >-+ (long) size, >-+ paddress (target_gdbarch (), kve->kve_start), >-+ kve->kve_protection & KVME_PROT_READ ? 'r' : '-', >-+ kve->kve_protection & KVME_PROT_WRITE ? 'w' : '-', >-+ kve->kve_protection & KVME_PROT_EXEC ? 'x' : '-'); >-+ } >-+ >-+ /* Invoke the callback function to create the corefile segment. >-+ Pass MODIFIED as true, we do not know the real modification state. */ >-+ func (kve->kve_start, size, kve->kve_protection & KVME_PROT_READ, >-+ kve->kve_protection & KVME_PROT_WRITE, >-+ kve->kve_protection & KVME_PROT_EXEC, 1, obfd); >-+ } >-+ do_cleanups (cleanup); >-+ return 0; >-+} >-+#else >- static int >- fbsd_read_mapping (FILE *mapfile, unsigned long *start, unsigned long *end, >- char *protection) >-@@ -137,3 +199,4 @@ fbsd_find_memory_regions (struct target_ops *self, >- do_cleanups (cleanup); >- return 0; >- } >-+#endif >diff --git devel/gdb/files/commit-3ce5b6e devel/gdb/files/commit-3ce5b6e >deleted file mode 100644 >index 6b4ec0e..0000000 >--- devel/gdb/files/commit-3ce5b6e >+++ /dev/null >@@ -1,21 +0,0 @@ >-diff --git gdb/fbsd-tdep.c gdb/fbsd-tdep.c >-index 5d17f03..9609cd8 100644 >---- gdb/fbsd-tdep.c >-+++ gdb/fbsd-tdep.c >-@@ -89,7 +89,7 @@ fbsd_collect_regset_section_cb (const char *sect_name, int size, >- static char * >- fbsd_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size) >- { >-- const struct regcache *regcache = get_current_regcache (); >-+ struct regcache *regcache = get_current_regcache (); >- char *note_data; >- Elf_Internal_Ehdr *i_ehdrp; >- struct fbsd_collect_regset_section_cb_data data; >-@@ -104,6 +104,7 @@ fbsd_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size) >- data.obfd = obfd; >- data.note_data = NULL; >- data.note_size = note_size; >-+ target_fetch_registers (regcache, -1); >- gdbarch_iterate_over_regset_sections (gdbarch, >- fbsd_collect_regset_section_cb, >- &data, regcache); >diff --git devel/gdb/files/commit-773eacf devel/gdb/files/commit-773eacf >deleted file mode 100644 >index ca1bda4..0000000 >--- devel/gdb/files/commit-773eacf >+++ /dev/null >@@ -1,99 +0,0 @@ >-diff --git gdb/amd64fbsd-tdep.c gdb/amd64fbsd-tdep.c >-index e11b0f3..62dcb83 100644 >---- gdb/amd64fbsd-tdep.c >-+++ gdb/amd64fbsd-tdep.c >-@@ -51,8 +51,8 @@ amd64fbsd_sigtramp_p (struct frame_info *this_frame) >- >- if (!safe_frame_unwind_memory (this_frame, pc, buf, sizeof buf)) >- return 0; >-- if (memcmp (buf, amd64fbsd_sigtramp_code, sizeof amd64fbsd_sigtramp_code) != >-- 0) >-+ if (memcmp (buf, amd64fbsd_sigtramp_code, sizeof amd64fbsd_sigtramp_code) >-+ != 0) >- return 0; >- >- return 1; >-diff --git gdb/i386fbsd-tdep.c gdb/i386fbsd-tdep.c >-index d4516ee..ed41706 100644 >---- gdb/i386fbsd-tdep.c >-+++ gdb/i386fbsd-tdep.c >-@@ -105,24 +105,24 @@ static const gdb_byte i386fbsd_osigtramp_end[] = >- }; >- >- /* The three different trampolines are all the same size. */ >--gdb_static_assert (sizeof i386fbsd_sigtramp_start == >-- sizeof i386fbsd_freebsd4_sigtramp_start); >--gdb_static_assert (sizeof i386fbsd_sigtramp_start == >-- sizeof i386fbsd_osigtramp_start); >--gdb_static_assert (sizeof i386fbsd_sigtramp_middle == >-- sizeof i386fbsd_freebsd4_sigtramp_middle); >--gdb_static_assert (sizeof i386fbsd_sigtramp_middle == >-- sizeof i386fbsd_osigtramp_middle); >--gdb_static_assert (sizeof i386fbsd_sigtramp_end == >-- sizeof i386fbsd_freebsd4_sigtramp_end); >--gdb_static_assert (sizeof i386fbsd_sigtramp_end == >-- sizeof i386fbsd_osigtramp_end); >-+gdb_static_assert (sizeof i386fbsd_sigtramp_start >-+ == sizeof i386fbsd_freebsd4_sigtramp_start); >-+gdb_static_assert (sizeof i386fbsd_sigtramp_start >-+ == sizeof i386fbsd_osigtramp_start); >-+gdb_static_assert (sizeof i386fbsd_sigtramp_middle >-+ == sizeof i386fbsd_freebsd4_sigtramp_middle); >-+gdb_static_assert (sizeof i386fbsd_sigtramp_middle >-+ == sizeof i386fbsd_osigtramp_middle); >-+gdb_static_assert (sizeof i386fbsd_sigtramp_end >-+ == sizeof i386fbsd_freebsd4_sigtramp_end); >-+gdb_static_assert (sizeof i386fbsd_sigtramp_end >-+ == sizeof i386fbsd_osigtramp_end); >- >- /* We assume that the middle is the largest chunk below. */ >--gdb_static_assert (sizeof i386fbsd_sigtramp_middle > >-- sizeof i386fbsd_sigtramp_start); >--gdb_static_assert (sizeof i386fbsd_sigtramp_middle > >-- sizeof i386fbsd_sigtramp_end); >-+gdb_static_assert (sizeof i386fbsd_sigtramp_middle >-+ > sizeof i386fbsd_sigtramp_start); >-+gdb_static_assert (sizeof i386fbsd_sigtramp_middle >-+ > sizeof i386fbsd_sigtramp_end); >- >- static int >- i386fbsd_sigtramp_p (struct frame_info *this_frame) >-@@ -135,19 +135,25 @@ i386fbsd_sigtramp_p (struct frame_info *this_frame) >- if (!safe_frame_unwind_memory (this_frame, pc, buf, >- sizeof i386fbsd_sigtramp_start)) >- return 0; >-- if (memcmp (buf, i386fbsd_sigtramp_start, sizeof i386fbsd_sigtramp_start) == >-- 0) { >-- middle = i386fbsd_sigtramp_middle; >-- end = i386fbsd_sigtramp_end; >-- } else if (memcmp (buf, i386fbsd_freebsd4_sigtramp_start, >-- sizeof i386fbsd_freebsd4_sigtramp_start) == 0) { >-- middle = i386fbsd_freebsd4_sigtramp_middle; >-- end = i386fbsd_freebsd4_sigtramp_end; >-- } else if (memcmp (buf, i386fbsd_osigtramp_start, >-- sizeof i386fbsd_osigtramp_start) == 0) { >-- middle = i386fbsd_osigtramp_middle; >-- end = i386fbsd_osigtramp_end; >-- } else >-+ if (memcmp (buf, i386fbsd_sigtramp_start, sizeof i386fbsd_sigtramp_start) >-+ == 0) >-+ { >-+ middle = i386fbsd_sigtramp_middle; >-+ end = i386fbsd_sigtramp_end; >-+ } >-+ else if (memcmp (buf, i386fbsd_freebsd4_sigtramp_start, >-+ sizeof i386fbsd_freebsd4_sigtramp_start) == 0) >-+ { >-+ middle = i386fbsd_freebsd4_sigtramp_middle; >-+ end = i386fbsd_freebsd4_sigtramp_end; >-+ } >-+ else if (memcmp (buf, i386fbsd_osigtramp_start, >-+ sizeof i386fbsd_osigtramp_start) == 0) >-+ { >-+ middle = i386fbsd_osigtramp_middle; >-+ end = i386fbsd_osigtramp_end; >-+ } >-+ else >- return 0; >- >- /* Since the end is shorter than the middle, check for a matching end >diff --git devel/gdb/files/commit-97de354 devel/gdb/files/commit-97de354 >deleted file mode 100644 >index 5709edb..0000000 >--- devel/gdb/files/commit-97de354 >+++ /dev/null >@@ -1,690 +0,0 @@ >-diff --git bfd/elf.c bfd/elf.c >-index a031b9e..41fb023 100644 >---- bfd/elf.c >-+++ bfd/elf.c >-@@ -8737,6 +8737,9 @@ elfcore_grok_note (bfd *abfd, Elf_Internal_Note *note) >- if (note->namesz == 6 >- && strcmp (note->namedata, "LINUX") == 0) >- return elfcore_grok_xstatereg (abfd, note); >-+ else if (note->namesz == 8 >-+ && strcmp (note->namedata, "FreeBSD") == 0) >-+ return elfcore_grok_xstatereg (abfd, note); >- else >- return TRUE; >- >-@@ -9556,7 +9559,11 @@ char * >- elfcore_write_xstatereg (bfd *abfd, char *buf, int *bufsiz, >- const void *xfpregs, int size) >- { >-- char *note_name = "LINUX"; >-+ char *note_name; >-+ if (get_elf_backend_data (abfd)->elf_osabi == ELFOSABI_FREEBSD) >-+ note_name = "FreeBSD"; >-+ else >-+ note_name = "LINUX"; >- return elfcore_write_note (abfd, buf, bufsiz, >- note_name, NT_X86_XSTATE, xfpregs, size); >- } >-diff --git gdb/amd64-tdep.c gdb/amd64-tdep.c >-index 3e5d1bd..461b701 100644 >---- gdb/amd64-tdep.c >-+++ gdb/amd64-tdep.c >-@@ -39,6 +39,7 @@ >- #include "disasm.h" >- #include "amd64-tdep.h" >- #include "i387-tdep.h" >-+#include "x86-xstate.h" >- >- #include "features/i386/amd64.c" >- #include "features/i386/amd64-avx.c" >-@@ -3118,6 +3119,25 @@ amd64_x32_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) >- set_gdbarch_ptr_bit (gdbarch, 32); >- } >- >-+/* Return the target description for a specified XSAVE feature mask. */ >-+ >-+const struct target_desc * >-+amd64_target_description (uint64_t xcr0) >-+{ >-+ switch (xcr0 & X86_XSTATE_ALL_MASK) >-+ { >-+ case X86_XSTATE_MPX_AVX512_MASK: >-+ case X86_XSTATE_AVX512_MASK: >-+ return tdesc_amd64_avx512; >-+ case X86_XSTATE_MPX_MASK: >-+ return tdesc_amd64_mpx; >-+ case X86_XSTATE_AVX_MASK: >-+ return tdesc_amd64_avx; >-+ default: >-+ return tdesc_amd64; >-+ } >-+} >-+ >- /* Provide a prototype to silence -Wmissing-prototypes. */ >- void _initialize_amd64_tdep (void); >- >-diff --git gdb/amd64-tdep.h gdb/amd64-tdep.h >-index 318fd43..704225e 100644 >---- gdb/amd64-tdep.h >-+++ gdb/amd64-tdep.h >-@@ -84,6 +84,8 @@ enum amd64_regnum >- >- #define AMD64_NUM_REGS (AMD64_ZMM31H_REGNUM + 1) >- >-+extern struct target_desc *tdesc_amd64; >-+ >- extern struct displaced_step_closure *amd64_displaced_step_copy_insn >- (struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to, >- struct regcache *regs); >-@@ -95,6 +97,7 @@ extern void amd64_displaced_step_fixup (struct gdbarch *gdbarch, >- extern void amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch); >- extern void amd64_x32_init_abi (struct gdbarch_info info, >- struct gdbarch *gdbarch); >-+extern const struct target_desc *amd64_target_description (uint64_t xcr0); >- >- /* Fill register REGNUM in REGCACHE with the appropriate >- floating-point or SSE register value from *FXSAVE. If REGNUM is >-diff --git gdb/amd64bsd-nat.c gdb/amd64bsd-nat.c >-index 31060a123..66d4289 100644 >---- gdb/amd64bsd-nat.c >-+++ gdb/amd64bsd-nat.c >-@@ -35,6 +35,10 @@ >- #include "inf-ptrace.h" >- >- >-+#ifdef PT_GETXSTATE_INFO >-+size_t amd64bsd_xsave_len; >-+#endif >-+ >- /* Fetch register REGNUM from the inferior. If REGNUM is -1, do this >- for all registers (including the floating-point registers). */ >- >-@@ -60,6 +64,20 @@ amd64bsd_fetch_inferior_registers (struct target_ops *ops, >- if (regnum == -1 || !amd64_native_gregset_supplies_p (gdbarch, regnum)) >- { >- struct fpreg fpregs; >-+#ifdef PT_GETXSTATE_INFO >-+ char *xstateregs; >-+ >-+ if (amd64bsd_xsave_len != 0) >-+ { >-+ xstateregs = alloca (amd64bsd_xsave_len); >-+ if (ptrace (PT_GETXSTATE, ptid_get_pid (inferior_ptid), >-+ (PTRACE_TYPE_ARG3) xstateregs, 0) == -1) >-+ perror_with_name (_("Couldn't get extended state status")); >-+ >-+ amd64_supply_xsave (regcache, -1, xstateregs); >-+ return; >-+ } >-+#endif >- >- if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), >- (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) >-@@ -99,6 +117,24 @@ amd64bsd_store_inferior_registers (struct target_ops *ops, >- if (regnum == -1 || !amd64_native_gregset_supplies_p (gdbarch, regnum)) >- { >- struct fpreg fpregs; >-+#ifdef PT_GETXSTATE_INFO >-+ char *xstateregs; >-+ >-+ if (amd64bsd_xsave_len != 0) >-+ { >-+ xstateregs = alloca (amd64bsd_xsave_len); >-+ if (ptrace (PT_GETXSTATE, ptid_get_pid (inferior_ptid), >-+ (PTRACE_TYPE_ARG3) xstateregs, 0) == -1) >-+ perror_with_name (_("Couldn't get extended state status")); >-+ >-+ amd64_collect_xsave (regcache, regnum, xstateregs, 0); >-+ >-+ if (ptrace (PT_SETXSTATE, ptid_get_pid (inferior_ptid), >-+ (PTRACE_TYPE_ARG3) xstateregs, amd64bsd_xsave_len) == -1) >-+ perror_with_name (_("Couldn't write extended state status")); >-+ return; >-+ } >-+#endif >- >- if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), >- (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) >-diff --git gdb/amd64bsd-nat.h gdb/amd64bsd-nat.h >-index 167eb56..09776ee 100644 >---- gdb/amd64bsd-nat.h >-+++ gdb/amd64bsd-nat.h >-@@ -20,6 +20,9 @@ >- #ifndef AMD64BSD_NAT_H >- #define AMD64BSD_NAT_H >- >-+/* Low level amd64 XSAVE info. */ >-+extern size_t amd64bsd_xsave_len; >-+ >- /* Low level amd64 debug register functions. */ >- >- extern void amd64bsd_dr_set_control (unsigned long control); >-diff --git gdb/amd64fbsd-nat.c gdb/amd64fbsd-nat.c >-index b1b261c..a721f48 100644 >---- gdb/amd64fbsd-nat.c >-+++ gdb/amd64fbsd-nat.c >-@@ -151,6 +151,50 @@ amd64fbsd_mourn_inferior (struct target_ops *ops) >- super_mourn_inferior (ops); >- } >- >-+/* Implement the to_read_description method. */ >-+ >-+static const struct target_desc * >-+amd64fbsd_read_description (struct target_ops *ops) >-+{ >-+#ifdef PT_GETXSTATE_INFO >-+ static int xsave_probed; >-+ static uint64_t xcr0; >-+#endif >-+ struct reg regs; >-+ int is64; >-+ >-+ if (ptrace (PT_GETREGS, ptid_get_pid (inferior_ptid), >-+ (PTRACE_TYPE_ARG3) ®s, 0) == -1) >-+ perror_with_name (_("Couldn't get registers")); >-+ is64 = (regs.r_cs == GSEL (GUCODE_SEL, SEL_UPL)); >-+#ifdef PT_GETXSTATE_INFO >-+ if (!xsave_probed) >-+ { >-+ struct ptrace_xstate_info info; >-+ >-+ if (ptrace (PT_GETXSTATE_INFO, ptid_get_pid (inferior_ptid), >-+ (PTRACE_TYPE_ARG3) &info, sizeof (info)) == 0) >-+ { >-+ amd64bsd_xsave_len = info.xsave_len; >-+ xcr0 = info.xsave_mask; >-+ } >-+ xsave_probed = 1; >-+ } >-+ >-+ if (amd64bsd_xsave_len != 0) >-+ { >-+ if (is64) >-+ return amd64_target_description (xcr0); >-+ else >-+ return i386_target_description (xcr0); >-+ } >-+#endif >-+ if (is64) >-+ return tdesc_amd64; >-+ else >-+ return tdesc_i386; >-+} >-+ >- /* Provide a prototype to silence -Wmissing-prototypes. */ >- void _initialize_amd64fbsd_nat (void); >- >-@@ -181,6 +225,7 @@ _initialize_amd64fbsd_nat (void) >- >- super_mourn_inferior = t->to_mourn_inferior; >- t->to_mourn_inferior = amd64fbsd_mourn_inferior; >-+ t->to_read_description = amd64fbsd_read_description; >- >- t->to_pid_to_exec_file = fbsd_pid_to_exec_file; >- t->to_find_memory_regions = fbsd_find_memory_regions; >-diff --git gdb/amd64fbsd-tdep.c gdb/amd64fbsd-tdep.c >-index 62dcb83..52705d9 100644 >---- gdb/amd64fbsd-tdep.c >-+++ gdb/amd64fbsd-tdep.c >-@@ -23,6 +23,9 @@ >- #include "gdbcore.h" >- #include "regcache.h" >- #include "osabi.h" >-+#include "regset.h" >-+#include "i386fbsd-tdep.h" >-+#include "x86-xstate.h" >- >- #include "amd64-tdep.h" >- #include "bsd-uthread.h" >-@@ -169,6 +172,59 @@ static int amd64fbsd_jmp_buf_reg_offset[] = >- 0 * 8 /* %rip */ >- }; >- >-+/* Implement the core_read_description gdbarch method. */ >-+ >-+static const struct target_desc * >-+amd64fbsd_core_read_description (struct gdbarch *gdbarch, >-+ struct target_ops *target, >-+ bfd *abfd) >-+{ >-+ return amd64_target_description (i386fbsd_core_read_xcr0 (abfd)); >-+} >-+ >-+/* Similar to amd64_supply_fpregset, but use XSAVE extended state. */ >-+ >-+static void >-+amd64fbsd_supply_xstateregset (const struct regset *regset, >-+ struct regcache *regcache, int regnum, >-+ const void *xstateregs, size_t len) >-+{ >-+ amd64_supply_xsave (regcache, regnum, xstateregs); >-+} >-+ >-+/* Similar to amd64_collect_fpregset, but use XSAVE extended state. */ >-+ >-+static void >-+amd64fbsd_collect_xstateregset (const struct regset *regset, >-+ const struct regcache *regcache, >-+ int regnum, void *xstateregs, size_t len) >-+{ >-+ amd64_collect_xsave (regcache, regnum, xstateregs, 1); >-+} >-+ >-+static const struct regset amd64fbsd_xstateregset = >-+ { >-+ NULL, >-+ amd64fbsd_supply_xstateregset, >-+ amd64fbsd_collect_xstateregset >-+ }; >-+ >-+/* Iterate over core file register note sections. */ >-+ >-+static void >-+amd64fbsd_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", tdep->sizeof_gregset, &i386_gregset, NULL, cb_data); >-+ cb (".reg2", tdep->sizeof_fpregset, &amd64_fpregset, NULL, cb_data); >-+ cb (".reg-xstate", X86_XSTATE_SIZE(tdep->xcr0), >-+ &amd64fbsd_xstateregset, "XSAVE extended state", cb_data); >-+} >-+ >- static void >- amd64fbsd_supply_uthread (struct regcache *regcache, >- int regnum, CORE_ADDR addr) >-@@ -233,6 +289,15 @@ amd64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) >- tdep->sc_reg_offset = amd64fbsd_sc_reg_offset; >- tdep->sc_num_regs = ARRAY_SIZE (amd64fbsd_sc_reg_offset); >- >-+ tdep->xsave_xcr0_offset = I386_FBSD_XSAVE_XCR0_OFFSET; >-+ >-+ /* Iterate over core file register note sections. */ >-+ set_gdbarch_iterate_over_regset_sections >-+ (gdbarch, amd64fbsd_iterate_over_regset_sections); >-+ >-+ set_gdbarch_core_read_description (gdbarch, >-+ amd64fbsd_core_read_description); >-+ >- /* FreeBSD provides a user-level threads implementation. */ >- bsd_uthread_set_supply_uthread (gdbarch, amd64fbsd_supply_uthread); >- bsd_uthread_set_collect_uthread (gdbarch, amd64fbsd_collect_uthread); >-diff --git gdb/i386-tdep.c gdb/i386-tdep.c >-index 4d97915..0c7eb5a 100644 >---- gdb/i386-tdep.c >-+++ gdb/i386-tdep.c >-@@ -8598,6 +8598,25 @@ i386_coff_osabi_sniffer (bfd *abfd) >- } >- >- >-+/* Return the target description for a specified XSAVE feature mask. */ >-+ >-+const struct target_desc * >-+i386_target_description (uint64_t xcr0) >-+{ >-+ switch (xcr0 & X86_XSTATE_ALL_MASK) >-+ { >-+ case X86_XSTATE_MPX_AVX512_MASK: >-+ case X86_XSTATE_AVX512_MASK: >-+ return tdesc_i386_avx512; >-+ case X86_XSTATE_MPX_MASK: >-+ return tdesc_i386_mpx; >-+ case X86_XSTATE_AVX_MASK: >-+ return tdesc_i386_avx; >-+ default: >-+ return tdesc_i386; >-+ } >-+} >-+ >- /* Provide a prototype to silence -Wmissing-prototypes. */ >- void _initialize_i386_tdep (void); >- >-diff --git gdb/i386-tdep.h gdb/i386-tdep.h >-index 8bfd412..7880f6c 100644 >---- gdb/i386-tdep.h >-+++ gdb/i386-tdep.h >-@@ -328,6 +328,8 @@ enum record_i386_regnum >- /* Size of the largest register. */ >- #define I386_MAX_REGISTER_SIZE 64 >- >-+extern struct target_desc *tdesc_i386; >-+ >- /* Types for i386-specific registers. */ >- extern struct type *i387_ext_type (struct gdbarch *gdbarch); >- >-@@ -416,6 +418,7 @@ extern void i386_svr4_init_abi (struct gdbarch_info, struct gdbarch *); >- >- extern int i386_process_record (struct gdbarch *gdbarch, >- struct regcache *regcache, CORE_ADDR addr); >-+extern const struct target_desc *i386_target_description (uint64_t xcr0); >- >- >- >-diff --git gdb/i386bsd-nat.c gdb/i386bsd-nat.c >-index 16e0707..ac8a19b 100644 >---- gdb/i386bsd-nat.c >-+++ gdb/i386bsd-nat.c >-@@ -81,6 +81,10 @@ static int i386bsd_r_reg_offset[] = >- so that we try PT_GETXMMREGS the first time around. */ >- static int have_ptrace_xmmregs = -1; >- #endif >-+ >-+#ifdef PT_GETXSTATE_INFO >-+size_t i386bsd_xsave_len; >-+#endif >- >- >- /* Supply the general-purpose registers in GREGS, to REGCACHE. */ >-@@ -148,7 +152,24 @@ i386bsd_fetch_inferior_registers (struct target_ops *ops, >- struct fpreg fpregs; >- #ifdef HAVE_PT_GETXMMREGS >- char xmmregs[512]; >-+#endif >-+ >-+#ifdef PT_GETXSTATE_INFO >-+ if (i386bsd_xsave_len != 0) >-+ { >-+ char *xstateregs; >-+ >-+ xstateregs = alloca (i386bsd_xsave_len); >-+ if (ptrace (PT_GETXSTATE, ptid_get_pid (inferior_ptid), >-+ (PTRACE_TYPE_ARG3) xstateregs, 0) == -1) >-+ perror_with_name (_("Couldn't get extended state status")); >- >-+ i387_supply_xsave (regcache, -1, xstateregs); >-+ return; >-+ } >-+#endif >-+ >-+#ifdef HAVE_PT_GETXMMREGS >- if (have_ptrace_xmmregs != 0 >- && ptrace(PT_GETXMMREGS, ptid_get_pid (inferior_ptid), >- (PTRACE_TYPE_ARG3) xmmregs, 0) == 0) >-@@ -158,18 +179,15 @@ i386bsd_fetch_inferior_registers (struct target_ops *ops, >- } >- else >- { >-+ have_ptrace_xmmregs = 0; >-+#endif >- if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), >- (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) >- perror_with_name (_("Couldn't get floating point status")); >- >- i387_supply_fsave (regcache, -1, &fpregs); >-+#ifdef HAVE_PT_GETXMMREGS >- } >--#else >-- if (ptrace (PT_GETFPREGS, ptid_get_pid (inferior_ptid), >-- (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) >-- perror_with_name (_("Couldn't get floating point status")); >-- >-- i387_supply_fsave (regcache, -1, &fpregs); >- #endif >- } >- } >-@@ -204,7 +222,28 @@ i386bsd_store_inferior_registers (struct target_ops *ops, >- struct fpreg fpregs; >- #ifdef HAVE_PT_GETXMMREGS >- char xmmregs[512]; >-+#endif >-+ >-+#ifdef PT_GETXSTATE_INFO >-+ if (i386bsd_xsave_len != 0) >-+ { >-+ char *xstateregs; >-+ >-+ xstateregs = alloca (i386bsd_xsave_len); >-+ if (ptrace (PT_GETXSTATE, ptid_get_pid (inferior_ptid), >-+ (PTRACE_TYPE_ARG3) xstateregs, 0) == -1) >-+ perror_with_name (_("Couldn't get extended state status")); >- >-+ i387_collect_xsave (regcache, -1, xstateregs, 0); >-+ >-+ if (ptrace (PT_SETXSTATE, ptid_get_pid (inferior_ptid), >-+ (PTRACE_TYPE_ARG3) xstateregs, i386bsd_xsave_len) == -1) >-+ perror_with_name (_("Couldn't write extended state status")); >-+ return; >-+ } >-+#endif >-+ >-+#ifdef HAVE_PT_GETXMMREGS >- if (have_ptrace_xmmregs != 0 >- && ptrace(PT_GETXMMREGS, ptid_get_pid (inferior_ptid), >- (PTRACE_TYPE_ARG3) xmmregs, 0) == 0) >-diff --git gdb/i386bsd-nat.h gdb/i386bsd-nat.h >-index a11f554..2f50c32 100644 >---- gdb/i386bsd-nat.h >-+++ gdb/i386bsd-nat.h >-@@ -25,6 +25,9 @@ >- >- extern struct target_ops *i386bsd_target (void); >- >-+/* Low level i386 XSAVE info. */ >-+extern size_t i386bsd_xsave_len; >-+ >- /* low level i386 debug register functions used in i386fbsd-nat.c. */ >- >- extern void i386bsd_dr_set_control (unsigned long control); >-diff --git gdb/i386fbsd-nat.c gdb/i386fbsd-nat.c >-index ad439e3..6c43f2c 100644 >---- gdb/i386fbsd-nat.c >-+++ gdb/i386fbsd-nat.c >-@@ -116,6 +116,37 @@ i386fbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) >- } >- >- >-+#ifdef PT_GETXSTATE_INFO >-+/* Implement the to_read_description method. */ >-+ >-+static const struct target_desc * >-+i386fbsd_read_description (struct target_ops *ops) >-+{ >-+ static int xsave_probed; >-+ static uint64_t xcr0; >-+ >-+ if (!xsave_probed) >-+ { >-+ struct ptrace_xstate_info info; >-+ >-+ if (ptrace (PT_GETXSTATE_INFO, ptid_get_pid (inferior_ptid), >-+ (PTRACE_TYPE_ARG3) &info, sizeof (info)) == 0) >-+ { >-+ i386bsd_xsave_len = info.xsave_len; >-+ xcr0 = info.xsave_mask; >-+ } >-+ xsave_probed = 1; >-+ } >-+ >-+ if (i386bsd_xsave_len != 0) >-+ { >-+ return i386_target_description (xcr0); >-+ } >-+ else >-+ return tdesc_i386; >-+} >-+#endif >-+ >- /* Prevent warning from -Wmissing-prototypes. */ >- void _initialize_i386fbsd_nat (void); >- >-@@ -140,6 +171,9 @@ _initialize_i386fbsd_nat (void) >- >- #endif /* HAVE_PT_GETDBREGS */ >- >-+#ifdef PT_GETXSTATE_INFO >-+ t->to_read_description = i386fbsd_read_description; >-+#endif >- >- t->to_resume = i386fbsd_resume; >- t->to_pid_to_exec_file = fbsd_pid_to_exec_file; >-diff --git gdb/i386fbsd-tdep.c gdb/i386fbsd-tdep.c >-index ed41706..99e08cb 100644 >---- gdb/i386fbsd-tdep.c >-+++ gdb/i386fbsd-tdep.c >-@@ -22,6 +22,9 @@ >- #include "gdbcore.h" >- #include "osabi.h" >- #include "regcache.h" >-+#include "regset.h" >-+#include "i386fbsd-tdep.h" >-+#include "x86-xstate.h" >- >- #include "i386-tdep.h" >- #include "i387-tdep.h" >-@@ -235,6 +238,100 @@ static int i386fbsd_jmp_buf_reg_offset[] = >- 0 * 4 /* %eip */ >- }; >- >-+/* Get XSAVE extended state xcr0 from core dump. */ >-+ >-+uint64_t >-+i386fbsd_core_read_xcr0 (bfd *abfd) >-+{ >-+ asection *xstate = bfd_get_section_by_name (abfd, ".reg-xstate"); >-+ uint64_t xcr0; >-+ >-+ if (xstate) >-+ { >-+ size_t size = bfd_section_size (abfd, xstate); >-+ >-+ /* Check extended state size. */ >-+ if (size < X86_XSTATE_AVX_SIZE) >-+ xcr0 = X86_XSTATE_SSE_MASK; >-+ else >-+ { >-+ char contents[8]; >-+ >-+ if (! bfd_get_section_contents (abfd, xstate, contents, >-+ I386_FBSD_XSAVE_XCR0_OFFSET, >-+ 8)) >-+ { >-+ warning (_("Couldn't read `xcr0' bytes from " >-+ "`.reg-xstate' section in core file.")); >-+ return 0; >-+ } >-+ >-+ xcr0 = bfd_get_64 (abfd, contents); >-+ } >-+ } >-+ else >-+ xcr0 = 0; >-+ >-+ return xcr0; >-+} >-+ >-+/* Implement the core_read_description gdbarch method. */ >-+ >-+static const struct target_desc * >-+i386fbsd_core_read_description (struct gdbarch *gdbarch, >-+ struct target_ops *target, >-+ bfd *abfd) >-+{ >-+ return i386_target_description (i386fbsd_core_read_xcr0 (abfd)); >-+} >-+ >-+/* Similar to i386_supply_fpregset, but use XSAVE extended state. */ >-+ >-+static void >-+i386fbsd_supply_xstateregset (const struct regset *regset, >-+ struct regcache *regcache, int regnum, >-+ const void *xstateregs, size_t len) >-+{ >-+ i387_supply_xsave (regcache, regnum, xstateregs); >-+} >-+ >-+/* Similar to i386_collect_fpregset, but use XSAVE extended state. */ >-+ >-+static void >-+i386fbsd_collect_xstateregset (const struct regset *regset, >-+ const struct regcache *regcache, >-+ int regnum, void *xstateregs, size_t len) >-+{ >-+ i387_collect_xsave (regcache, regnum, xstateregs, 1); >-+} >-+ >-+/* Register set definitions. */ >-+ >-+static const struct regset i386fbsd_xstateregset = >-+ { >-+ NULL, >-+ i386fbsd_supply_xstateregset, >-+ i386fbsd_collect_xstateregset >-+ }; >-+ >-+/* Iterate over core file register note sections. */ >-+ >-+static void >-+i386fbsd_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", tdep->sizeof_gregset, &i386_gregset, NULL, cb_data); >-+ cb (".reg2", tdep->sizeof_fpregset, &i386_fpregset, NULL, cb_data); >-+ >-+ if (tdep->xcr0 & X86_XSTATE_AVX) >-+ cb (".reg-xstate", X86_XSTATE_SIZE(tdep->xcr0), >-+ &i386fbsd_xstateregset, "XSAVE extended state", cb_data); >-+} >-+ >- static void >- i386fbsd_supply_uthread (struct regcache *regcache, >- int regnum, CORE_ADDR addr) >-@@ -376,6 +473,15 @@ i386fbsd4_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) >- /* FreeBSD 4.0 introduced a new `struct sigcontext'. */ >- tdep->sc_reg_offset = i386fbsd4_sc_reg_offset; >- tdep->sc_num_regs = ARRAY_SIZE (i386fbsd4_sc_reg_offset); >-+ >-+ tdep->xsave_xcr0_offset = I386_FBSD_XSAVE_XCR0_OFFSET; >-+ >-+ /* Iterate over core file register note sections. */ >-+ set_gdbarch_iterate_over_regset_sections >-+ (gdbarch, i386fbsd_iterate_over_regset_sections); >-+ >-+ set_gdbarch_core_read_description (gdbarch, >-+ i386fbsd_core_read_description); >- } >- >- >-diff --git gdb/i386fbsd-tdep.h gdb/i386fbsd-tdep.h >-new file mode 100644 >-index 0000000..8d6f998 >---- /dev/null >-+++ gdb/i386fbsd-tdep.h >-@@ -0,0 +1,31 @@ >-+/* Target-dependent code for FreeBSD x86. >-+ >-+ Copyright (C) 2015 Free Software Foundation, Inc. >-+ >-+ This file is part of GDB. >-+ >-+ This program is free software; you can redistribute it and/or modify >-+ it under the terms of the GNU General Public License as published by >-+ the Free Software Foundation; either version 3 of the License, or >-+ (at your option) any later version. >-+ >-+ This program is distributed in the hope that it will be useful, >-+ but WITHOUT ANY WARRANTY; without even the implied warranty of >-+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >-+ GNU General Public License for more details. >-+ >-+ You should have received a copy of the GNU General Public License >-+ along with this program. If not, see <http://www.gnu.org/licenses/>. */ >-+ >-+#ifndef I386FBSD_TDEP_H >-+#define I386FBSD_TDEP_H >-+ >-+/* Get XSAVE extended state xcr0 from core dump. */ >-+extern uint64_t i386fbsd_core_read_xcr0 (bfd *abfd); >-+ >-+/* The format of the XSAVE extended area is determined by hardware. >-+ Cores store the XSAVE extended area in a NT_X86_XSTATE note that >-+ matches the layout on Linux. */ >-+#define I386_FBSD_XSAVE_XCR0_OFFSET 464 >-+ >-+#endif /* i386fbsd-tdep.h */ >diff --git devel/gdb/files/commit-c5cb74e devel/gdb/files/commit-c5cb74e >deleted file mode 100644 >index 6bbae88..0000000 >--- devel/gdb/files/commit-c5cb74e >+++ /dev/null >@@ -1,22 +0,0 @@ >-diff --git gdb/amd64fbsd-tdep.c gdb/amd64fbsd-tdep.c >-index 2d49cdf..abb0cab 100644 >---- gdb/amd64fbsd-tdep.c >-+++ gdb/amd64fbsd-tdep.c >-@@ -37,12 +37,16 @@ >- static CORE_ADDR >- amd64fbsd_sigcontext_addr (struct frame_info *this_frame) >- { >-+ struct gdbarch *gdbarch = get_frame_arch (this_frame); >-+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); >- CORE_ADDR sp; >-+ gdb_byte buf[8]; >- >- /* The `struct sigcontext' (which really is an `ucontext_t' on >- FreeBSD/amd64) lives at a fixed offset in the signal frame. See >- <machine/sigframe.h>. */ >-- sp = frame_unwind_register_unsigned (this_frame, AMD64_RSP_REGNUM); >-+ get_frame_register (this_frame, AMD64_RSP_REGNUM, buf); >-+ sp = extract_unsigned_integer (buf, 8, byte_order); >- return sp + 16; >- } >- >diff --git devel/gdb/files/commit-cf424ae devel/gdb/files/commit-cf424ae >deleted file mode 100644 >index 5e20c80..0000000 >--- devel/gdb/files/commit-cf424ae >+++ /dev/null >@@ -1,348 +0,0 @@ >-diff --git gdb/amd64fbsd-nat.c gdb/amd64fbsd-nat.c >-index 1c396e2..b1b261c 100644 >---- gdb/amd64fbsd-nat.c >-+++ gdb/amd64fbsd-nat.c >-@@ -26,6 +26,7 @@ >- #include <sys/types.h> >- #include <sys/ptrace.h> >- #include <sys/sysctl.h> >-+#include <sys/user.h> >- #include <machine/reg.h> >- >- #include "fbsd-nat.h" >-@@ -244,24 +245,31 @@ Please report this to <bug-gdb@gnu.org>."), >- >- SC_RBP_OFFSET = offset; >- >-- /* FreeBSD provides a kern.ps_strings sysctl that we can use to >-- locate the sigtramp. That way we can still recognize a sigtramp >-- if its location is changed in a new kernel. Of course this is >-- still based on the assumption that the sigtramp is placed >-- directly under the location where the program arguments and >-- environment can be found. */ >-+#ifdef KERN_PROC_SIGTRAMP >-+ /* Normally signal frames are detected via amd64fbsd_sigtramp_p. >-+ However, FreeBSD 9.2 through 10.1 do not include the page holding >-+ the signal code in core dumps. These releases do provide a >-+ kern.proc.sigtramp.<pid> sysctl that returns the location of the >-+ signal trampoline for a running process. We fetch the location >-+ of the current (gdb) process and use this to identify signal >-+ frames in core dumps from these releases. Note that this only >-+ works for core dumps of 64-bit (FreeBSD/amd64) processes and does >-+ not handle core dumps of 32-bit (FreeBSD/i386) processes. */ >- { >-- int mib[2]; >-- long ps_strings; >-+ int mib[4]; >-+ struct kinfo_sigtramp kst; >- size_t len; >- >- mib[0] = CTL_KERN; >-- mib[1] = KERN_PS_STRINGS; >-- len = sizeof (ps_strings); >-- if (sysctl (mib, 2, &ps_strings, &len, NULL, 0) == 0) >-+ mib[1] = KERN_PROC; >-+ mib[2] = KERN_PROC_SIGTRAMP; >-+ mib[3] = getpid (); >-+ len = sizeof (kst); >-+ if (sysctl (mib, 4, &kst, &len, NULL, 0) == 0) >- { >-- amd64fbsd_sigtramp_start_addr = ps_strings - 32; >-- amd64fbsd_sigtramp_end_addr = ps_strings; >-+ amd64fbsd_sigtramp_start_addr = (uintptr_t) kst.ksigtramp_start; >-+ amd64fbsd_sigtramp_end_addr = (uintptr_t) kst.ksigtramp_end; >- } >- } >-+#endif >- } >-diff --git gdb/amd64fbsd-tdep.c gdb/amd64fbsd-tdep.c >-index abb0cab..e11b0f3 100644 >---- gdb/amd64fbsd-tdep.c >-+++ gdb/amd64fbsd-tdep.c >-@@ -31,6 +31,33 @@ >- >- /* Support for signal handlers. */ >- >-+/* Return whether THIS_FRAME corresponds to a FreeBSD sigtramp >-+ routine. */ >-+ >-+static const gdb_byte amd64fbsd_sigtramp_code[] = >-+{ >-+ 0x48, 0x8d, 0x7c, 0x24, 0x10, /* lea SIGF_UC(%rsp),%rdi */ >-+ 0x6a, 0x00, /* pushq $0 */ >-+ 0x48, 0xc7, 0xc0, 0xa1, 0x01, 0x00, 0x00, >-+ /* movq $SYS_sigreturn,%rax */ >-+ 0x0f, 0x05 /* syscall */ >-+}; >-+ >-+static int >-+amd64fbsd_sigtramp_p (struct frame_info *this_frame) >-+{ >-+ CORE_ADDR pc = get_frame_pc (this_frame); >-+ gdb_byte buf[sizeof amd64fbsd_sigtramp_code]; >-+ >-+ if (!safe_frame_unwind_memory (this_frame, pc, buf, sizeof buf)) >-+ return 0; >-+ if (memcmp (buf, amd64fbsd_sigtramp_code, sizeof amd64fbsd_sigtramp_code) != >-+ 0) >-+ return 0; >-+ >-+ return 1; >-+} >-+ >- /* Assuming THIS_FRAME is for a BSD sigtramp routine, return the >- address of the associated sigcontext structure. */ >- >-@@ -88,8 +115,8 @@ static int amd64fbsd_r_reg_offset[] = >- }; >- >- /* Location of the signal trampoline. */ >--CORE_ADDR amd64fbsd_sigtramp_start_addr = 0x7fffffffffc0ULL; >--CORE_ADDR amd64fbsd_sigtramp_end_addr = 0x7fffffffffe0ULL; >-+CORE_ADDR amd64fbsd_sigtramp_start_addr; >-+CORE_ADDR amd64fbsd_sigtramp_end_addr; >- >- /* From <machine/signal.h>. */ >- int amd64fbsd_sc_reg_offset[] = >-@@ -199,6 +226,7 @@ amd64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) >- >- amd64_init_abi (info, gdbarch); >- >-+ tdep->sigtramp_p = amd64fbsd_sigtramp_p; >- tdep->sigtramp_start = amd64fbsd_sigtramp_start_addr; >- tdep->sigtramp_end = amd64fbsd_sigtramp_end_addr; >- tdep->sigcontext_addr = amd64fbsd_sigcontext_addr; >-diff --git gdb/i386fbsd-nat.c gdb/i386fbsd-nat.c >-index f4951d1..ad439e3 100644 >---- gdb/i386fbsd-nat.c >-+++ gdb/i386fbsd-nat.c >-@@ -25,6 +25,7 @@ >- #include <sys/types.h> >- #include <sys/ptrace.h> >- #include <sys/sysctl.h> >-+#include <sys/user.h> >- >- #include "fbsd-nat.h" >- #include "i386-tdep.h" >-@@ -148,25 +149,28 @@ _initialize_i386fbsd_nat (void) >- /* Support debugging kernel virtual memory images. */ >- bsd_kvm_add_target (i386fbsd_supply_pcb); >- >-- /* FreeBSD provides a kern.ps_strings sysctl that we can use to >-- locate the sigtramp. That way we can still recognize a sigtramp >-- if its location is changed in a new kernel. Of course this is >-- still based on the assumption that the sigtramp is placed >-- directly under the location where the program arguments and >-- environment can be found. */ >--#ifdef KERN_PS_STRINGS >-+#ifdef KERN_PROC_SIGTRAMP >-+ /* Normally signal frames are detected via i386fbsd_sigtramp_p. >-+ However, FreeBSD 9.2 through 10.1 do not include the page holding >-+ the signal code in core dumps. These releases do provide a >-+ kern.proc.sigtramp.<pid> sysctl that returns the location of the >-+ signal trampoline for a running process. We fetch the location >-+ of the current (gdb) process and use this to identify signal >-+ frames in core dumps from these releases. */ >- { >-- int mib[2]; >-- u_long ps_strings; >-+ int mib[4]; >-+ struct kinfo_sigtramp kst; >- size_t len; >- >- mib[0] = CTL_KERN; >-- mib[1] = KERN_PS_STRINGS; >-- len = sizeof (ps_strings); >-- if (sysctl (mib, 2, &ps_strings, &len, NULL, 0) == 0) >-+ mib[1] = KERN_PROC; >-+ mib[2] = KERN_PROC_SIGTRAMP; >-+ mib[3] = getpid (); >-+ len = sizeof (kst); >-+ if (sysctl (mib, 4, &kst, &len, NULL, 0) == 0) >- { >-- i386fbsd_sigtramp_start_addr = ps_strings - 128; >-- i386fbsd_sigtramp_end_addr = ps_strings; >-+ i386fbsd_sigtramp_start_addr = (uintptr_t) kst.ksigtramp_start; >-+ i386fbsd_sigtramp_end_addr = (uintptr_t) kst.ksigtramp_end; >- } >- } >- #endif >-diff --git gdb/i386fbsd-tdep.c gdb/i386fbsd-tdep.c >-index 8d237f0..d4516ee 100644 >---- gdb/i386fbsd-tdep.c >-+++ gdb/i386fbsd-tdep.c >-@@ -29,6 +29,154 @@ >- #include "fbsd-tdep.h" >- #include "solib-svr4.h" >- >-+/* Support for signal handlers. */ >-+ >-+/* Return whether THIS_FRAME corresponds to a FreeBSD sigtramp >-+ routine. */ >-+ >-+/* FreeBSD/i386 supports three different signal trampolines, one for >-+ versions before 4.0, a second for 4.x, and a third for 5.0 and >-+ later. To complicate matters, FreeBSD/i386 binaries running under >-+ an amd64 kernel use a different set of trampolines. These >-+ trampolines differ from the i386 kernel trampolines in that they >-+ omit a middle section that conditionally restores %gs. */ >-+ >-+static const gdb_byte i386fbsd_sigtramp_start[] = >-+{ >-+ 0x8d, 0x44, 0x24, 0x20, /* lea SIGF_UC(%esp),%eax */ >-+ 0x50 /* pushl %eax */ >-+}; >-+ >-+static const gdb_byte i386fbsd_sigtramp_middle[] = >-+{ >-+ 0xf7, 0x40, 0x54, 0x00, 0x00, 0x02, 0x00, >-+ /* testl $PSL_VM,UC_EFLAGS(%eax) */ >-+ 0x75, 0x03, /* jne +3 */ >-+ 0x8e, 0x68, 0x14 /* mov UC_GS(%eax),%gs */ >-+}; >-+ >-+static const gdb_byte i386fbsd_sigtramp_end[] = >-+{ >-+ 0xb8, 0xa1, 0x01, 0x00, 0x00, /* movl $SYS_sigreturn,%eax */ >-+ 0x50, /* pushl %eax */ >-+ 0xcd, 0x80 /* int $0x80 */ >-+}; >-+ >-+static const gdb_byte i386fbsd_freebsd4_sigtramp_start[] = >-+{ >-+ 0x8d, 0x44, 0x24, 0x14, /* lea SIGF_UC4(%esp),%eax */ >-+ 0x50 /* pushl %eax */ >-+}; >-+ >-+static const gdb_byte i386fbsd_freebsd4_sigtramp_middle[] = >-+{ >-+ 0xf7, 0x40, 0x54, 0x00, 0x00, 0x02, 0x00, >-+ /* testl $PSL_VM,UC4_EFLAGS(%eax) */ >-+ 0x75, 0x03, /* jne +3 */ >-+ 0x8e, 0x68, 0x14 /* mov UC4_GS(%eax),%gs */ >-+}; >-+ >-+static const gdb_byte i386fbsd_freebsd4_sigtramp_end[] = >-+{ >-+ 0xb8, 0x58, 0x01, 0x00, 0x00, /* movl $344,%eax */ >-+ 0x50, /* pushl %eax */ >-+ 0xcd, 0x80 /* int $0x80 */ >-+}; >-+ >-+static const gdb_byte i386fbsd_osigtramp_start[] = >-+{ >-+ 0x8d, 0x44, 0x24, 0x14, /* lea SIGF_SC(%esp),%eax */ >-+ 0x50 /* pushl %eax */ >-+}; >-+ >-+static const gdb_byte i386fbsd_osigtramp_middle[] = >-+{ >-+ 0xf7, 0x40, 0x18, 0x00, 0x00, 0x02, 0x00, >-+ /* testl $PSL_VM,SC_PS(%eax) */ >-+ 0x75, 0x03, /* jne +3 */ >-+ 0x8e, 0x68, 0x44 /* mov SC_GS(%eax),%gs */ >-+}; >-+ >-+static const gdb_byte i386fbsd_osigtramp_end[] = >-+{ >-+ 0xb8, 0x67, 0x00, 0x00, 0x00, /* movl $103,%eax */ >-+ 0x50, /* pushl %eax */ >-+ 0xcd, 0x80 /* int $0x80 */ >-+}; >-+ >-+/* The three different trampolines are all the same size. */ >-+gdb_static_assert (sizeof i386fbsd_sigtramp_start == >-+ sizeof i386fbsd_freebsd4_sigtramp_start); >-+gdb_static_assert (sizeof i386fbsd_sigtramp_start == >-+ sizeof i386fbsd_osigtramp_start); >-+gdb_static_assert (sizeof i386fbsd_sigtramp_middle == >-+ sizeof i386fbsd_freebsd4_sigtramp_middle); >-+gdb_static_assert (sizeof i386fbsd_sigtramp_middle == >-+ sizeof i386fbsd_osigtramp_middle); >-+gdb_static_assert (sizeof i386fbsd_sigtramp_end == >-+ sizeof i386fbsd_freebsd4_sigtramp_end); >-+gdb_static_assert (sizeof i386fbsd_sigtramp_end == >-+ sizeof i386fbsd_osigtramp_end); >-+ >-+/* We assume that the middle is the largest chunk below. */ >-+gdb_static_assert (sizeof i386fbsd_sigtramp_middle > >-+ sizeof i386fbsd_sigtramp_start); >-+gdb_static_assert (sizeof i386fbsd_sigtramp_middle > >-+ sizeof i386fbsd_sigtramp_end); >-+ >-+static int >-+i386fbsd_sigtramp_p (struct frame_info *this_frame) >-+{ >-+ CORE_ADDR pc = get_frame_pc (this_frame); >-+ gdb_byte buf[sizeof i386fbsd_sigtramp_middle]; >-+ const gdb_byte *middle, *end; >-+ >-+ /* Look for a matching start. */ >-+ if (!safe_frame_unwind_memory (this_frame, pc, buf, >-+ sizeof i386fbsd_sigtramp_start)) >-+ return 0; >-+ if (memcmp (buf, i386fbsd_sigtramp_start, sizeof i386fbsd_sigtramp_start) == >-+ 0) { >-+ middle = i386fbsd_sigtramp_middle; >-+ end = i386fbsd_sigtramp_end; >-+ } else if (memcmp (buf, i386fbsd_freebsd4_sigtramp_start, >-+ sizeof i386fbsd_freebsd4_sigtramp_start) == 0) { >-+ middle = i386fbsd_freebsd4_sigtramp_middle; >-+ end = i386fbsd_freebsd4_sigtramp_end; >-+ } else if (memcmp (buf, i386fbsd_osigtramp_start, >-+ sizeof i386fbsd_osigtramp_start) == 0) { >-+ middle = i386fbsd_osigtramp_middle; >-+ end = i386fbsd_osigtramp_end; >-+ } else >-+ return 0; >-+ >-+ /* Since the end is shorter than the middle, check for a matching end >-+ next. */ >-+ pc += sizeof i386fbsd_sigtramp_start; >-+ if (!safe_frame_unwind_memory (this_frame, pc, buf, >-+ sizeof i386fbsd_sigtramp_end)) >-+ return 0; >-+ if (memcmp (buf, end, sizeof i386fbsd_sigtramp_end) == 0) >-+ return 1; >-+ >-+ /* If the end didn't match, check for a matching middle. */ >-+ if (!safe_frame_unwind_memory (this_frame, pc, buf, >-+ sizeof i386fbsd_sigtramp_middle)) >-+ return 0; >-+ if (memcmp (buf, middle, sizeof i386fbsd_sigtramp_middle) != 0) >-+ return 0; >-+ >-+ /* The middle matched, check for a matching end. */ >-+ pc += sizeof i386fbsd_sigtramp_middle; >-+ if (!safe_frame_unwind_memory (this_frame, pc, buf, >-+ sizeof i386fbsd_sigtramp_end)) >-+ return 0; >-+ if (memcmp (buf, end, sizeof i386fbsd_sigtramp_end) != 0) >-+ return 0; >-+ >-+ return 1; >-+} >-+ >- /* FreeBSD 3.0-RELEASE or later. */ >- >- /* From <machine/reg.h>. */ >-@@ -43,8 +191,8 @@ static int i386fbsd_r_reg_offset[] = >- }; >- >- /* Sigtramp routine location. */ >--CORE_ADDR i386fbsd_sigtramp_start_addr = 0xbfbfdf20; >--CORE_ADDR i386fbsd_sigtramp_end_addr = 0xbfbfdff0; >-+CORE_ADDR i386fbsd_sigtramp_start_addr; >-+CORE_ADDR i386fbsd_sigtramp_end_addr; >- >- /* From <machine/signal.h>. */ >- int i386fbsd_sc_reg_offset[] = >-@@ -139,6 +287,8 @@ i386fbsdaout_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) >- /* FreeBSD uses -freg-struct-return by default. */ >- tdep->struct_return = reg_struct_return; >- >-+ tdep->sigtramp_p = i386fbsd_sigtramp_p; >-+ >- /* FreeBSD uses a different memory layout. */ >- tdep->sigtramp_start = i386fbsd_sigtramp_start_addr; >- tdep->sigtramp_end = i386fbsd_sigtramp_end_addr; >diff --git devel/gdb/files/fbsd-threads.c devel/gdb/files/fbsd-threads.c >index 50c0f8e..8051758 100644 >--- devel/gdb/files/fbsd-threads.c >+++ devel/gdb/files/fbsd-threads.c >@@ -675,7 +675,7 @@ attach_thread (ptid_t ptid, const td_thrhandle_t *th_p, > memset(private, 0, sizeof(struct private_thread_info)); > > tp = add_thread_with_info(ptid, private); >- tp->private = private; >+ tp->priv = private; > tp->private_dtor = free_private_thread_info; > } > >@@ -1176,9 +1176,9 @@ fbsd_thread_pid_to_str (struct target_ops *ops, ptid_t ptid) > if (ti.ti_lid != 0) > { > // Need to find the name of this LWP, even though it shouldn't change >- fbsd_find_lwp_name(ti.ti_lid, tinfo->private); >+ fbsd_find_lwp_name(ti.ti_lid, tinfo->priv); > >- if (tinfo->private->lwp_name == NULL) >+ if (tinfo->priv->lwp_name == NULL) > { > snprintf(buf, sizeof (buf), "Thread %llx (LWP %d)", > (unsigned long long)th.th_thread, ti.ti_lid); >@@ -1187,7 +1187,7 @@ fbsd_thread_pid_to_str (struct target_ops *ops, ptid_t ptid) > { > snprintf(buf, sizeof (buf), "Thread %llx (LWP %d %s)", > (unsigned long long)th.th_thread, ti.ti_lid, >- tinfo->private->lwp_name); >+ tinfo->priv->lwp_name); > } > } > else >diff --git devel/gdb/files/patch-gdb-configure devel/gdb/files/patch-gdb-configure >index ed1f2de..d51e112 100644 >--- devel/gdb/files/patch-gdb-configure >+++ devel/gdb/files/patch-gdb-configure >@@ -22,16 +22,3 @@ index 355f190..9c60e01 100755 > " > if test "x$ac_cv_member_struct_reg_r_gs" = x""yes; then : > >-@@ -12945,10 +12947,9 @@ fi >- >- build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \ >- -Wpointer-sign \ >---Wno-unused -Wunused-value -Wunused-function \ >-+-Wno-unused -Wunused-value \ >- -Wno-switch -Wno-char-subscripts -Wmissing-prototypes \ >---Wdeclaration-after-statement -Wempty-body -Wmissing-parameter-type \ >---Wold-style-declaration -Wold-style-definition" >-+-Wdeclaration-after-statement -Wempty-body -Wold-style-definition" >- >- # Enable -Wno-format by default when using gcc on mingw since many >- # GCC versions complain about %I64. >diff --git devel/gdb/files/patch-gdb-i386fbsd-nat.c devel/gdb/files/patch-gdb-i386fbsd-nat.c >index 062289d..13ee2c19 100644 >--- devel/gdb/files/patch-gdb-i386fbsd-nat.c >+++ devel/gdb/files/patch-gdb-i386fbsd-nat.c >@@ -7,6 +7,5 @@ index 6c43f2c..a205a26 100644 > #endif > > - t->to_resume = i386fbsd_resume; >- t->to_pid_to_exec_file = fbsd_pid_to_exec_file; >- t->to_find_memory_regions = fbsd_find_memory_regions; >- add_target (t); >+ fbsd_nat_add_target (t); >+ /* Support debugging kernel virtual memory images. */ >diff --git devel/gdb/pkg-plist devel/gdb/pkg-plist >index 684be1d..542a9bc 100644 >--- devel/gdb/pkg-plist >+++ devel/gdb/pkg-plist >@@ -9,6 +9,7 @@ man/man1/gdb%%VER%%.1.gz > %%PYTHON%%%%DATADIR%%%%VER%%/python/gdb/printing.py > %%PYTHON%%%%DATADIR%%%%VER%%/python/gdb/prompt.py > %%PYTHON%%%%DATADIR%%%%VER%%/python/gdb/types.py >+%%PYTHON%%%%DATADIR%%%%VER%%/python/gdb/unwinder.py > %%PYTHON%%%%DATADIR%%%%VER%%/python/gdb/xmethod.py > %%PYTHON%%%%DATADIR%%%%VER%%/python/gdb/command/__init__.py > %%PYTHON%%%%DATADIR%%%%VER%%/python/gdb/command/explore.py >@@ -16,6 +17,7 @@ man/man1/gdb%%VER%%.1.gz > %%PYTHON%%%%DATADIR%%%%VER%%/python/gdb/command/pretty_printers.py > %%PYTHON%%%%DATADIR%%%%VER%%/python/gdb/command/prompt.py > %%PYTHON%%%%DATADIR%%%%VER%%/python/gdb/command/type_printers.py >+%%PYTHON%%%%DATADIR%%%%VER%%/python/gdb/command/unwinders.py > %%PYTHON%%%%DATADIR%%%%VER%%/python/gdb/command/xmethods.py > %%PYTHON%%%%DATADIR%%%%VER%%/python/gdb/function/__init__.py > %%PYTHON%%%%DATADIR%%%%VER%%/python/gdb/function/caller_is.py
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 203170
: 161140