Index: head/devel/gdb/Makefile =================================================================== --- head/devel/gdb/Makefile (revision 450894) +++ head/devel/gdb/Makefile (revision 450895) @@ -1,145 +1,145 @@ # Created by: Steven Kreuzer # $FreeBSD$ PORTNAME= gdb -PORTVERSION= 8.0 -PORTREVISION= 3 +PORTVERSION= 8.0.1 CATEGORIES= devel MASTER_SITES= GNU MAINTAINER= pizzamig@FreeBSD.org COMMENT= GNU GDB of newer version than comes with the system LICENSE= GPLv3 +LICENSE_FILE= ${WRKSRC}/COPYING3 +# untested on sparc64, might work +ONLY_FOR_ARCHS= aarch64 amd64 armv6 i386 mips powerpc powerpc64 + TEST_DEPENDS= runtest:misc/dejagnu TEST_TARGET= check # XXX: This should be compiler:c++11-lib as GDB doesn't really require # C++14. However, clang in 10.3 crashes while building this port. # Requiring C++14 forces 10.3 to use an external version of clang while # still using the base system clang on 11.0 and later. USES= compiler:c++14-lang cpe iconv gmake libtool tar:xz USE_CSTD= gnu89 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-64-bit-bfd \ --with-gdb-datadir=${PREFIX}/share/gdb${PORTVERSION:S/.//g} \ --with-separate-debug-dir=/usr/lib/debug \ ${ICONV_CONFIGURE_ARG} \ --with-expat=yes --with-libexpat-prefix=${LOCALBASE} \ --without-libunwind-ia64 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-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 LIB_DEPENDS+= libexpat.so:textproc/expat2 VER= ${PORTVERSION:S/.//g} PLIST_SUB= VER=${VER} - -# untested elsewhere, might work -ONLY_FOR_ARCHS= aarch64 amd64 armv6 i386 mips powerpc powerpc64 OPTIONS_DEFINE= DEBUG GDB_LINK GUILE KGDB PYTHON TUI OPTIONS_DEFAULT= GDB_LINK KGDB PYTHON TUI PORT_READLINE OPTIONS_SINGLE= READLINE OPTIONS_SINGLE_READLINE= BUNDLED_READLINE PORT_READLINE GDB_LINK_DESC= Create ${PREFIX}/bin/gdb symlink KGDB_DESC= Kernel Debugging Support BUNDLED_READLINE_DESC= from gdb distfile PORT_READLINE_DESC= from devel/readline port TUI_DESC= Text User Interface enabled OPTIONS_SUB= yes BUNDLED_READLINE_CONFIGURE_OFF= --with-system-readline DEBUG_CFLAGS= -g GUILE_CONFIGURE_WITH= guile GUILE_USES= pkgconfig GUILE_LIB_DEPENDS= libguile-2.0.so:lang/guile2 PORT_READLINE_USES= readline:port PYTHON_CONFIGURE_ON= --with-python=${PYTHON_CMD} PYTHON_CONFIGURE_OFF= --without-python PYTHON_USES= python TUI_CONFIGURE_ENABLE= tui .include .if ! ${PORT_OPTIONS:MBUNDLED_READLINE} EXCLUDE+= readline .endif .if ${ARCH} == "amd64" CONFIGURE_TARGET= x86_64-portbld-freebsd${OSREL} .endif .if ${COMPILER_TYPE} == "clang" CFLAGS+= -Wno-extended-offsetof .endif post-patch: @${REINPLACE_CMD} -e 's|$$| [GDB v${PORTVERSION} for FreeBSD]|' \ ${WRKSRC}/gdb/version.in post-patch-KGDB-on: @${CP} -r ${FILESDIR}/kgdb/*.[ch] ${WRKSRC}/gdb/ @${PATCH} -d ${PATCH_WRKSRC} ${PATCH_ARGS} < ${FILESDIR}/extrapatch-kgdb do-install: ${INSTALL_PROGRAM} ${WRKSRC}/gdb/gdb \ ${STAGEDIR}${PREFIX}/bin/gdb${VER} ${INSTALL_MAN} ${WRKSRC}/gdb/doc/gdb.1 \ ${STAGEDIR}${MAN1PREFIX}/man/man1/gdb${VER}.1 (cd ${WRKSRC}/gdb/data-directory ; \ ${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} install-syscalls ) do-install-KGDB-on: ${INSTALL_PROGRAM} ${WRKSRC}/gdb/kgdb \ ${STAGEDIR}${PREFIX}/bin/kgdb${VER} ${INSTALL_MAN} ${FILESDIR}/kgdb/kgdb.1 \ ${STAGEDIR}${MAN1PREFIX}/man/man1/kgdb${VER}.1 do-install-TUI-on: ${LN} -sf gdb${VER} ${STAGEDIR}${PREFIX}/bin/gdbtui${VER} do-install-GDB_LINK-on: ${LN} -sf gdb${VER} ${STAGEDIR}${PREFIX}/bin/gdb .if ${PORT_OPTIONS:MKGDB} ${LN} -sf kgdb${VER} ${STAGEDIR}${PREFIX}/bin/kgdb .endif 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 ) . for f in gdb gdb/command gdb/function gdb/printer @(cd ${STAGEDIR}${PREFIX}/share/gdb${VER}/python/${f} ; ${CHMOD} 644 *.py* ) . endfor 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 ) .include Index: head/devel/gdb/distinfo =================================================================== --- head/devel/gdb/distinfo (revision 450894) +++ head/devel/gdb/distinfo (revision 450895) @@ -1,3 +1,3 @@ -TIMESTAMP = 1498935083 -SHA256 (gdb-8.0.tar.xz) = f6a24ffe4917e67014ef9273eb8b547cb96a13e5ca74895b06d683b391f3f4ee -SIZE (gdb-8.0.tar.xz) = 19588616 +TIMESTAMP = 1505207991 +SHA256 (gdb-8.0.1.tar.xz) = 3dbd5f93e36ba2815ad0efab030dcd0c7b211d7b353a40a53f4c02d7d56295e3 +SIZE (gdb-8.0.1.tar.xz) = 19583920 Index: head/devel/gdb/files/patch-gdb-gdb_wchar.h =================================================================== --- head/devel/gdb/files/patch-gdb-gdb_wchar.h (revision 450894) +++ head/devel/gdb/files/patch-gdb-gdb_wchar.h (nonexistent) @@ -1,22 +0,0 @@ -diff --git gdb/gdb_wchar.h gdb/gdb_wchar.h -index 868fe04..1311080 100644 ---- gdb/gdb_wchar.h -+++ gdb/gdb_wchar.h -@@ -59,7 +59,7 @@ - iconvlist. */ - #if defined (HAVE_ICONV) && defined (HAVE_BTOWC) \ - && (defined (__STDC_ISO_10646__) \ -- || (defined (_LIBICONV_VERSION) && _LIBICONV_VERSION >= 0x108)) -+ || (!defined (LIBICONV_PLUG) && defined (_LIBICONV_VERSION) && _LIBICONV_VERSION >= 0x108)) - - typedef wchar_t gdb_wchar_t; - typedef wint_t gdb_wint_t; -@@ -82,7 +82,7 @@ typedef wint_t gdb_wint_t; - #define INTERMEDIATE_ENCODING intermediate_encoding () - const char *intermediate_encoding (void); - --#elif defined (_LIBICONV_VERSION) && _LIBICONV_VERSION >= 0x108 -+#elif !defined (LIBICONV_PLUG) && defined (_LIBICONV_VERSION) && _LIBICONV_VERSION >= 0x108 - #define INTERMEDIATE_ENCODING "wchar_t" - #else - /* This shouldn't happen, because the earlier #if should have filtered Property changes on: head/devel/gdb/files/patch-gdb-gdb_wchar.h ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/devel/gdb/files/patch-gdb-configure.host =================================================================== --- head/devel/gdb/files/patch-gdb-configure.host (revision 450894) +++ head/devel/gdb/files/patch-gdb-configure.host (nonexistent) @@ -1,12 +0,0 @@ -diff --git gdb/configure.host gdb/configure.host -index 48714f4..53989d3 100644 ---- gdb/configure.host -+++ 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 ;; Property changes on: head/devel/gdb/files/patch-gdb-configure.host ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/devel/gdb/files/patch-gdb-configure =================================================================== --- head/devel/gdb/files/patch-gdb-configure (revision 450894) +++ head/devel/gdb/files/patch-gdb-configure (nonexistent) @@ -1,20 +0,0 @@ -diff --git gdb/configure gdb/configure -index 9f05b4bb7e..e14886b67d 100755 ---- gdb/configure -+++ gdb/configure -@@ -15103,12 +15103,10 @@ if test "${ERROR_ON_WARNING}" = yes ; then - WERROR_CFLAGS="-Werror" - fi - --# The options we'll try to enable. -+# These options work in either C or C++ modes. - build_warnings="-Wall -Wpointer-arith \ ---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-unused -Wno-switch -Wno-char-subscripts \ -+-Wempty-body -Wno-sign-compare -Wno-narrowing" - - # Enable -Wno-format by default when using gcc on mingw since many - # GCC versions complain about %I64. Property changes on: head/devel/gdb/files/patch-gdb-configure ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/devel/gdb/files/patch-libiberty-basename =================================================================== --- head/devel/gdb/files/patch-libiberty-basename (revision 450894) +++ head/devel/gdb/files/patch-libiberty-basename (nonexistent) @@ -1,11 +0,0 @@ ---- include/libiberty.h -+++ include/libiberty.h -@@ -109,7 +109,7 @@ - || defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) \ - || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) \ - || defined (__DragonFly__) || defined (HAVE_DECL_BASENAME) --extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1); -+#include - #else - /* Do not allow basename to be used if there is no prototype seen. We - either need to use the above prototype or have one from Property changes on: head/devel/gdb/files/patch-libiberty-basename ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/devel/gdb/files/patch-gdb-corelow.c =================================================================== --- head/devel/gdb/files/patch-gdb-corelow.c (revision 450894) +++ head/devel/gdb/files/patch-gdb-corelow.c (nonexistent) @@ -1,11 +0,0 @@ ---- gdb/corelow.c.orig 2017-07-29 11:06:52.922688000 -0700 -+++ gdb/corelow.c 2017-07-29 11:07:23.883255000 -0700 -@@ -517,7 +517,7 @@ get_core_register_section (struct regcache *regcache, - bool variable_size_section = (regset != NULL - && regset->flags & REGSET_VARIABLE_SIZE); - -- thread_section_name section_name (name, regcache->ptid ()); -+ thread_section_name section_name (name, regcache_get_ptid (regcache)); - - section = bfd_get_section_by_name (core_bfd, section_name.c_str ()); - if (! section) Property changes on: head/devel/gdb/files/patch-gdb-corelow.c ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/devel/gdb/files/patch-gdb-amd64-bsd-nat.c =================================================================== --- head/devel/gdb/files/patch-gdb-amd64-bsd-nat.c (revision 450894) +++ head/devel/gdb/files/patch-gdb-amd64-bsd-nat.c (nonexistent) @@ -1,32 +0,0 @@ -diff --git gdb/amd64-bsd-nat.c gdb/amd64-bsd-nat.c -index ca61a3551b..0f875f8296 100644 ---- gdb/amd64-bsd-nat.c -+++ gdb/amd64-bsd-nat.c -@@ -28,6 +28,7 @@ - #include - #include - #include -+#include - - #include "amd64-tdep.h" - #include "amd64-nat.h" -@@ -95,12 +96,19 @@ amd64bsd_store_inferior_registers (struct target_ops *ops, - if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum)) - { - struct reg regs; -+ register_t old_rflags; - - if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1) - perror_with_name (_("Couldn't get registers")); - -+ old_rflags = regs.r_rflags; - amd64_collect_native_gregset (regcache, ®s, regnum); - -+ /* This is a workaround about the PSL_USERCHANGE posix limitation. */ -+ if ((regs.r_rflags ^ old_rflags ) & ~PSL_USERCHANGE) -+ { -+ regs.r_rflags ^= (regs.r_rflags ^ old_rflags ) & ~PSL_USERCHANGE; -+ } - if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1) - perror_with_name (_("Couldn't write registers")); - Property changes on: head/devel/gdb/files/patch-gdb-amd64-bsd-nat.c ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/devel/gdb/files/patch-gdb-fbsd-nat.c =================================================================== --- head/devel/gdb/files/patch-gdb-fbsd-nat.c (revision 450894) +++ head/devel/gdb/files/patch-gdb-fbsd-nat.c (nonexistent) @@ -1,19 +0,0 @@ -diff --git gdb/fbsd-nat.c gdb/fbsd-nat.c -index ef5ad1ec92..dedb1ba59c 100644 ---- gdb/fbsd-nat.c -+++ gdb/fbsd-nat.c -@@ -682,6 +682,14 @@ fbsd_resume (struct target_ops *ops, - struct thread_info *tp; - int request; - -+#ifndef PT_LWP_EVENTS -+ /* When LWP events are not supported, a new thread might already be -+ running that has not yet reported an event when GDB wishes to -+ only run a single thread. Force an update of the thread list -+ to ensure that any such threads are suspended before the process -+ is resumed. */ -+ fbsd_add_threads (ptid_get_pid (ptid)); -+#endif - ALL_NON_EXITED_THREADS (tp) - { - if (ptid_get_pid (tp->ptid) != ptid_get_pid (ptid)) Property changes on: head/devel/gdb/files/patch-gdb-fbsd-nat.c ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/devel/gdb/files/patch-gdb-python-python-config.py =================================================================== --- head/devel/gdb/files/patch-gdb-python-python-config.py (revision 450894) +++ head/devel/gdb/files/patch-gdb-python-python-config.py (nonexistent) @@ -1,13 +0,0 @@ -diff --git gdb/python/python-config.py gdb/python/python-config.py -index c2b2969..39af8d9 100644 ---- gdb/python/python-config.py -+++ gdb/python/python-config.py -@@ -59,6 +59,8 @@ for opt in opt_flags: - - elif opt in ('--libs', '--ldflags'): - libs = [] -+ if getvar('LDFLAGS') is not None: -+ libs.extend(getvar('LDFLAGS').split()) - if getvar('LIBS') is not None: - libs.extend(getvar('LIBS').split()) - if getvar('SYSLIBS') is not None: Property changes on: head/devel/gdb/files/patch-gdb-python-python-config.py ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/devel/gdb/files/patch-gdb-i386-fbsd-nat.c =================================================================== --- head/devel/gdb/files/patch-gdb-i386-fbsd-nat.c (revision 450894) +++ head/devel/gdb/files/patch-gdb-i386-fbsd-nat.c (nonexistent) @@ -1,12 +0,0 @@ -diff --git gdb/i386-fbsd-nat.c gdb/i386-fbsd-nat.c -index dca6c0162b..6629950feb 100644 ---- gdb/i386-fbsd-nat.c -+++ gdb/i386-fbsd-nat.c -@@ -163,7 +163,6 @@ _initialize_i386fbsd_nat (void) - t->to_read_description = i386fbsd_read_description; - #endif - -- t->to_resume = i386fbsd_resume; - fbsd_nat_add_target (t); - - /* Support debugging kernel virtual memory images. */ Property changes on: head/devel/gdb/files/patch-gdb-i386-fbsd-nat.c ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/devel/gdb/files/patch-gdb-gnulib-import-stddef.in.h =================================================================== --- head/devel/gdb/files/patch-gdb-gnulib-import-stddef.in.h (revision 450894) +++ head/devel/gdb/files/patch-gdb-gnulib-import-stddef.in.h (nonexistent) @@ -1,13 +0,0 @@ -diff --git gdb/gnulib/import/stddef.in.h gdb/gnulib/import/stddef.in.h -index f4c4a1070d..023ea2064d 100644 ---- gdb/gnulib/import/stddef.in.h -+++ gdb/gnulib/import/stddef.in.h -@@ -84,7 +84,7 @@ - /* Some platforms lack max_align_t. The check for _GCC_MAX_ALIGN_T is - a hack in case the configure-time test was done with g++ even though - we are currently compiling with gcc. */ --#if ! (@HAVE_MAX_ALIGN_T@ || defined _GCC_MAX_ALIGN_T) -+#if 0 - /* On the x86, the maximum storage alignment of double, long, etc. is 4, - but GCC's C11 ABI for x86 says that max_align_t has an alignment of 8, - and the C11 standard allows this. Work around this problem by Property changes on: head/devel/gdb/files/patch-gdb-gnulib-import-stddef.in.h ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/devel/gdb/files/kgdb/kgdb-main.c =================================================================== --- head/devel/gdb/files/kgdb/kgdb-main.c (revision 450894) +++ head/devel/gdb/files/kgdb/kgdb-main.c (revision 450895) @@ -1,407 +1,407 @@ /* * Copyright (c) 2004 Marcel Moolenaar * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include __FBSDID("$FreeBSD$"); #include #include #include #include #include #include #include #include #include #include #include #include #include /* libgdb stuff. */ #include #include #include #include #include #include #include #include #include "observer.h" #include #include #include #include #include #include #include "kgdb.h" static int verbose; static char crashdir[PATH_MAX]; static char *dumpnr; static char *kernel; static char *remote; static char *vmcore; /* * TODO: * - test remote kgdb (see if threads and klds work) * - possibly split kthr.c out into a separate thread_stratum target that * uses new_objfile test to push itself when a FreeBSD kernel is loaded * (check for kernel osabi) (probably don't bother with this) * + test alternate kgdb_lookup() * + fix kgdb build on amd64 to include i386 cross-debug support * - propose expanded libkvm interface that supports cross-debug and moves * MD bits of kgdb into the library (examining PCB's and exporting a * stable-ABI struct of registers, similarly for trapframe handling and * stop-pcb stuff * + use tid's as lwp IDs instead of PIDs in ptid's */ static void usage(void) { fprintf(stderr, "usage: %s [-afqvw] [-b rate] [-d crashdir] [-c core | -n dumpnr | -r device]\n" "\t[kernel [core]]\n", getprogname()); exit(1); } static void kernel_from_dumpnr(const char *nr) { char line[PATH_MAX], path[PATH_MAX]; FILE *info; char *dir; struct stat st; int l; /* * If there's a kernel image right here in the crash directory, then * use it. The kernel image is either called kernel. or is in a * subdirectory kernel. and called kernel. The latter allows us * to collect the modules in the same place. */ snprintf(path, sizeof(path), "%s/kernel.%s", crashdir, nr); if (stat(path, &st) == 0) { if (S_ISREG(st.st_mode)) { kernel = strdup(path); return; } if (S_ISDIR(st.st_mode)) { snprintf(path, sizeof(path), "%s/kernel.%s/kernel", crashdir, nr); if (stat(path, &st) == 0 && S_ISREG(st.st_mode)) { kernel = strdup(path); return; } } } /* * No kernel image here. Parse the dump header. The kernel object * directory can be found there and we probably have the kernel * image still in it. The object directory may also have a kernel * with debugging info (called either kernel.full or kernel.debug). * If we have a debug kernel, use it. */ snprintf(path, sizeof(path), "%s/info.%s", crashdir, nr); info = fopen(path, "r"); if (info == NULL) { warn("%s", path); return; } while (fgets(line, sizeof(line), info) != NULL) { l = strlen(line); if (l > 0 && line[l - 1] == '\n') line[--l] = '\0'; if (strncmp(line, " ", 4) == 0) { fclose(info); dir = strchr(line, ':'); dir = (dir == NULL) ? line + 4 : dir + 1; /* * Check for kernel.full first as if it exists * kernel.debug will also exist, but will only * contain debug symbols and not be recognized * as a valid kernel by the osabi sniffer. */ snprintf(path, sizeof(path), "%s/kernel.full", dir); if (stat(path, &st) == 0 && S_ISREG(st.st_mode)) { kernel = strdup(path); return; } snprintf(path, sizeof(path), "%s/kernel.debug", dir); if (stat(path, &st) == 0 && S_ISREG(st.st_mode)) { kernel = strdup(path); return; } snprintf(path, sizeof(path), "%s/kernel", dir); if (stat(path, &st) == 0 && S_ISREG(st.st_mode)) { kernel = strdup(path); return; } return; } } fclose(info); } /* * Remote targets can support any number of syntaxes and we want to * support them all with one addition: we support specifying a device * node for a serial device without the "/dev/" prefix. * * What we do is to stat(2) the existing remote target first. If that * fails, we try it with "/dev/" prepended. If that succeeds we use * the resulting path, otherwise we use the original target. If * either stat(2) succeeds make sure the file is either a character * device or a FIFO. */ static void verify_remote(void) { char path[PATH_MAX]; struct stat st; if (stat(remote, &st) != 0) { snprintf(path, sizeof(path), "/dev/%s", remote); if (stat(path, &st) != 0) return; free(remote); remote = strdup(path); } if (!S_ISCHR(st.st_mode) && !S_ISFIFO(st.st_mode)) errx(1, "%s: not a special file, FIFO or socket", remote); } static void -add_arg(struct captured_main_args *args, char *arg) +add_arg(struct captured_main_args *args, char const *arg) { args->argc++; args->argv = (char **)reallocf(args->argv, (args->argc + 1) * sizeof(char *)); if (args->argv == NULL) err(1, "Out of memory building argument list"); - args->argv[args->argc] = arg; + args->argv[args->argc] = (char *)arg; } int main(int argc, char *argv[]) { char path[PATH_MAX]; struct stat st; struct captured_main_args args; char *s; int a, ch; dumpnr = NULL; strlcpy(crashdir, "/var/crash", sizeof(crashdir)); s = getenv("KGDB_CRASH_DIR"); if (s != NULL) strlcpy(crashdir, s, sizeof(crashdir)); /* Convert long options into short options. */ for (a = 1; a < argc; a++) { s = argv[a]; if (s[0] == '-') { s++; /* Long options take either 1 or 2 dashes. */ if (s[0] == '-') s++; if (strcmp(s, "quiet") == 0) - argv[a] = "-q"; + argv[a] = (char *)"-q"; else if (strcmp(s, "fullname") == 0) - argv[a] = "-f"; + argv[a] = (char *)"-f"; } } kgdb_quiet = 0; memset (&args, 0, sizeof args); args.interpreter_p = INTERP_CONSOLE; args.argv = (char **)xmalloc(sizeof(char *)); args.argv[0] = argv[0]; while ((ch = getopt(argc, argv, "ab:c:d:fn:qr:vw")) != -1) { switch (ch) { case 'a': annotation_level++; break; case 'b': { int i; char *p; i = strtol(optarg, &p, 0); if (*p != '\0' || p == optarg) warnx("warning: could not set baud rate to `%s'.\n", optarg); else baud_rate = i; break; } case 'c': /* use given core file. */ if (vmcore != NULL) { warnx("option %c: can only be specified once", optopt); usage(); /* NOTREACHED */ } vmcore = strdup(optarg); break; case 'd': /* lookup dumps in given directory. */ strlcpy(crashdir, optarg, sizeof(crashdir)); break; case 'f': annotation_level = 1; break; case 'n': /* use dump with given number. */ dumpnr = optarg; break; case 'q': kgdb_quiet = 1; add_arg(&args, "-q"); break; case 'r': /* use given device for remote session. */ if (remote != NULL) { warnx("option %c: can only be specified once", optopt); usage(); /* NOTREACHED */ } remote = strdup(optarg); break; case 'v': /* increase verbosity. */ verbose++; break; case 'w': /* core file is writeable. */ add_arg(&args, "--write"); break; case '?': default: usage(); } } if (((vmcore != NULL) ? 1 : 0) + ((dumpnr != NULL) ? 1 : 0) + ((remote != NULL) ? 1 : 0) > 1) { warnx("options -c, -n and -r are mutually exclusive"); usage(); /* NOTREACHED */ } if (verbose > 1) warnx("using %s as the crash directory", crashdir); if (argc > optind) kernel = strdup(argv[optind++]); if (argc > optind && (dumpnr != NULL || remote != NULL)) { warnx("options -n and -r do not take a core file. Ignored"); optind = argc; } if (dumpnr != NULL) { snprintf(path, sizeof(path), "%s/vmcore.%s", crashdir, dumpnr); if (stat(path, &st) == -1) err(1, "%s", path); if (!S_ISREG(st.st_mode)) errx(1, "%s: not a regular file", path); vmcore = strdup(path); } else if (remote != NULL) { verify_remote(); } else if (argc > optind) { if (vmcore == NULL) vmcore = strdup(argv[optind++]); if (argc > optind) warnx("multiple core files specified. Ignored"); } else if (vmcore == NULL && kernel == NULL) { vmcore = strdup(_PATH_MEM); kernel = strdup(getbootfile()); } if (verbose) { if (vmcore != NULL) warnx("core file: %s", vmcore); if (remote != NULL) warnx("device file: %s", remote); if (kernel != NULL) warnx("kernel image: %s", kernel); } /* A remote target requires an explicit kernel argument. */ if (remote != NULL && kernel == NULL) { warnx("remote debugging requires a kernel"); usage(); /* NOTREACHED */ } /* If we don't have a kernel image yet, try to find one. */ if (kernel == NULL) { if (dumpnr != NULL) kernel_from_dumpnr(dumpnr); if (kernel == NULL) errx(1, "couldn't find a suitable kernel image"); if (verbose) warnx("kernel image: %s", kernel); } /* Set an alternate prompt. */ add_arg(&args, "-iex"); add_arg(&args, "set prompt (kgdb) "); /* Open the vmcore if requested. */ if (vmcore != NULL) { add_arg(&args, "-ex"); if (asprintf(&s, "target vmcore %s", vmcore) < 0) err(1, "couldn't build command line"); add_arg(&args, s); } /* Open the remote target if requested. */ if (remote != NULL) { add_arg(&args, "-ex"); if (asprintf(&s, "target remote %s", remote) < 0) err(1, "couldn't build command line"); add_arg(&args, s); } add_arg(&args, kernel); /* The libgdb code uses optind too. Reset it... */ optind = 0; /* Terminate argv list. */ add_arg(&args, NULL); return (gdb_main(&args)); } Index: head/devel/gdb/files/patch-aarch64-fbsd =================================================================== --- head/devel/gdb/files/patch-aarch64-fbsd (revision 450894) +++ head/devel/gdb/files/patch-aarch64-fbsd (revision 450895) @@ -1,470 +1,468 @@ -diff --git gdb/Makefile.in gdb/Makefile.in -index 1d2dbaf3f7..d8e2b49523 100644 ---- gdb/Makefile.in +--- 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: head/devel/gdb/files/patch-armfbsd =================================================================== --- head/devel/gdb/files/patch-armfbsd (revision 450894) +++ head/devel/gdb/files/patch-armfbsd (revision 450895) @@ -1,365 +1,362 @@ -diff --git gdb/arm-fbsd-nat.c gdb/arm-fbsd-nat.c -new file mode 100644 -index 0000000000..b883411ceb ---- /dev/null +--- gdb/arm-fbsd-nat.c.orig 2017-09-14 09:28:17 UTC +++ gdb/arm-fbsd-nat.c @@ -0,0 +1,215 @@ +/* Native-dependent code for BSD Unix running on ARM's, for GDB. + + Copyright (C) 1988-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 . */ + +#include "defs.h" +#include "gdbcore.h" +#include "inferior.h" +#include "regcache.h" +#include "target.h" +#include "gregset.h" +#include +#include +#include +#include + +#include "fbsd-nat.h" +#include "arm-tdep.h" +#include "inf-ptrace.h" + +extern int arm_apcs_32; + +static pid_t +ptrace_pid (ptid_t ptid) +{ + pid_t pid; + +#ifdef __FreeBSD__ + pid = ptid_get_lwp (ptid); + if (pid == 0) +#endif + pid = ptid_get_pid (ptid); + return pid; +} + +static void +arm_supply_gregset (struct regcache *regcache, const gregset_t *gregset, int regnum) +{ + int r; + CORE_ADDR r_pc; + + /* Integer registers. */ + for (r = ARM_A1_REGNUM; r < ARM_SP_REGNUM; r++) + if ((r == regnum) || (regnum == -1)) + regcache_raw_supply (regcache, r, (char *) &gregset->r[r]); + + if ((regnum == ARM_SP_REGNUM) || (regnum == -1)) + regcache_raw_supply (regcache, ARM_SP_REGNUM, + (char *) &gregset->r_sp); + if ((regnum == ARM_LR_REGNUM) || (regnum == -1)) + regcache_raw_supply (regcache, ARM_LR_REGNUM, + (char *) &gregset->r_lr); + /* This is ok: we're running native... */ + if ((regnum == ARM_PC_REGNUM) || (regnum == -1)) + { + r_pc = gdbarch_addr_bits_remove (get_regcache_arch (regcache), gregset->r_pc); + regcache_raw_supply (regcache, ARM_PC_REGNUM, (char *) &r_pc); + } + + if ((regnum == ARM_PS_REGNUM) || (regnum == -1)) + { + if (arm_apcs_32) + regcache_raw_supply (regcache, ARM_PS_REGNUM, + (char *) &gregset->r_cpsr); + else + regcache_raw_supply (regcache, ARM_PS_REGNUM, + (char *) &gregset->r_pc); + } +} + +static void +armbsd_collect_gregset (const struct regcache *regcache, gregset_t *gregset, int regnum) +{ + int ret; + int r; + + for (r = ARM_A1_REGNUM; r < ARM_SP_REGNUM; r++) + if ((regnum == r) || (regnum == -1)) + regcache_raw_collect (regcache, r, + (char *) &gregset->r[r]); + + if ((regnum == ARM_SP_REGNUM) || (regnum == -1)) + regcache_raw_collect (regcache, ARM_SP_REGNUM, + (char *) &gregset->r_sp); + if ((regnum == ARM_LR_REGNUM) || (regnum == -1)) + regcache_raw_collect (regcache, ARM_LR_REGNUM, + (char *) &gregset->r_lr); + + + if ((regnum == ARM_PC_REGNUM) || (regnum == -1)) + regcache_raw_collect (regcache, ARM_PC_REGNUM, + (char *) &gregset->r_pc); + if ((regnum == ARM_PS_REGNUM) || (regnum == -1)) + { + if (arm_apcs_32) + { + regcache_raw_collect (regcache, ARM_PS_REGNUM, + (char *) &gregset->r_cpsr); + } + else + { + unsigned psr_val; + + regcache_raw_collect (regcache, ARM_PS_REGNUM, + (char *) &psr_val); + + psr_val ^= gdbarch_addr_bits_remove (get_regcache_arch (regcache), psr_val); + gregset->r_pc = gdbarch_addr_bits_remove + (get_regcache_arch (regcache), gregset->r_pc); + gregset->r_pc |= psr_val; + } + } +} + +/* Fill GDB's register array with the general-purpose register values + in *GREGSETP. */ + +void +supply_gregset (struct regcache *regcache, const gregset_t *gregsetp) +{ + arm_supply_gregset (regcache, gregsetp, -1); +} + +/* Fill register REGNUM (if it is a general-purpose register) in + *GREGSETPS with the value in GDB's register array. If REGNUM is -1, + do this for all registers. */ + +void +fill_gregset (const struct regcache *regcache, gdb_gregset_t *gregsetp, int regnum) +{ + armbsd_collect_gregset (regcache, gregsetp, regnum); +} + +/* Fill GDB's register array with the floating-point register values + in *FPREGSETP. */ + +void +supply_fpregset (struct regcache *regcache, const fpregset_t *fpregsetp) +{ +} + +/* Fill register REGNUM (if it is a floating-point register) in + *FPREGSETP with the value in GDB's register array. If REGNUM is -1, + do this for all registers. */ + +void +fill_fpregset (const struct regcache *regcache, gdb_fpregset_t *fpregsetp, int regnum) +{ +} + +/* Fetch register REGNO from the child process. If REGNO is -1, do it + for all registers. */ + +static void +armfbsd_fetch_inferior_registers (struct target_ops *ops, + struct regcache *regcache, int regno) +{ + gdb_gregset_t regs; + + if (ptrace (PT_GETREGS, ptrace_pid (inferior_ptid), + (PTRACE_TYPE_ARG3) ®s, 0) == -1) + perror_with_name (_("Couldn't get registers")); + + arm_supply_gregset (regcache, ®s, regno); + /* TODO: fpregs */ +} + +/* Store register REGNO back into the child process. If REGNO is -1, + do this for all registers. */ + +static void +armfbsd_store_inferior_registers (struct target_ops *ops, + struct regcache *regcache, int regno) +{ + gdb_gregset_t regs; + + if (ptrace (PT_GETREGS, ptrace_pid (inferior_ptid), + (PTRACE_TYPE_ARG3) ®s, 0) == -1) + perror_with_name (_("Couldn't get registers")); + + fill_gregset (regcache, ®s, regno); + + if (ptrace (PT_SETREGS, ptrace_pid (inferior_ptid), + (PTRACE_TYPE_ARG3) ®s, 0) == -1) + perror_with_name (_("Couldn't write registers")); + /* TODO: FP regs */ +} + +void _initialize_armfbsd_nat (void); + +void +_initialize_armfbsd_nat (void) +{ + struct target_ops *t; + + /* Add in local overrides. */ + t = inf_ptrace_target (); + t->to_fetch_registers = armfbsd_fetch_inferior_registers; + t->to_store_registers = armfbsd_store_inferior_registers; + fbsd_nat_add_target (t); +} diff --git gdb/arm-fbsd-tdep.c gdb/arm-fbsd-tdep.c new file mode 100644 index 0000000000..c76bc96700 --- /dev/null +++ gdb/arm-fbsd-tdep.c @@ -0,0 +1,109 @@ +/* Target-dependent code for PowerPC systems running FreeBSD. + + Copyright (C) 2013-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 . */ + +#include "defs.h" +#include "arch-utils.h" +#include "frame.h" +#include "gdbcore.h" +#include "frame-unwind.h" +#include "gdbtypes.h" +#include "osabi.h" +#include "regcache.h" +#include "regset.h" +#include "symtab.h" +#include "target.h" +#include "trad-frame.h" + +#include "arm-tdep.h" +#include "solib-svr4.h" + +/* Description of the longjmp buffer. */ +#define ARM_FBSD_JB_PC 24 +#define ARM_FBSD_JB_ELEMENT_SIZE INT_REGISTER_SIZE + +/* For compatibility with previous implemenations of GDB on arm/FreeBSD, + override the default little-endian breakpoint. */ +static const gdb_byte arm_fbsd_arm_le_breakpoint[] = {0x11, 0x00, 0x00, 0xe6}; +static const gdb_byte arm_fbsd_arm_be_breakpoint[] = {0xe6, 0x00, 0x00, 0x11}; +static const gdb_byte arm_fbsd_thumb_le_breakpoint[] = {0xfe, 0xde}; +static const gdb_byte arm_fbsd_thumb_be_breakpoint[] = {0xde, 0xfe}; + +static void +arm_freebsd_init_abi_common (struct gdbarch_info info, + struct gdbarch *gdbarch) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + + tdep->lowest_pc = 0x8000; + switch (info.byte_order) + { + case BFD_ENDIAN_LITTLE: + tdep->arm_breakpoint = arm_fbsd_arm_le_breakpoint; + tdep->thumb_breakpoint = arm_fbsd_thumb_le_breakpoint; + tdep->arm_breakpoint_size = sizeof (arm_fbsd_arm_le_breakpoint); + tdep->thumb_breakpoint_size = sizeof (arm_fbsd_thumb_le_breakpoint); + break; + + case BFD_ENDIAN_BIG: + tdep->arm_breakpoint = arm_fbsd_arm_be_breakpoint; + tdep->thumb_breakpoint = arm_fbsd_thumb_be_breakpoint; + tdep->arm_breakpoint_size = sizeof (arm_fbsd_arm_be_breakpoint); + tdep->thumb_breakpoint_size = sizeof (arm_fbsd_thumb_be_breakpoint); + break; + + default: + internal_error (__FILE__, __LINE__, + _("arm_gdbarch_init: bad byte order for float format")); + } + + tdep->jb_pc = ARM_FBSD_JB_PC; + tdep->jb_elt_size = ARM_FBSD_JB_ELEMENT_SIZE; + + /* Single stepping. */ + set_gdbarch_software_single_step (gdbarch, arm_software_single_step); +} + +static void +arm_freebsd_elf_init_abi (struct gdbarch_info info, + struct gdbarch *gdbarch) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + + arm_freebsd_init_abi_common (info, gdbarch); + if (tdep->fp_model == ARM_FLOAT_AUTO) + tdep->fp_model = ARM_FLOAT_SOFT_VFP; + + /* NetBSD ELF uses SVR4-style shared libraries. */ + set_solib_svr4_fetch_link_map_offsets + (gdbarch, svr4_ilp32_fetch_link_map_offsets); +} + + + +/* Provide a prototype to silence -Wmissing-prototypes. */ + +void _initialize_armfbsd_tdep (void); + +void +_initialize_armfbsd_tdep (void) +{ + + gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_FREEBSD, + arm_freebsd_elf_init_abi); +} diff --git gdb/config/arm/fbsd.mh gdb/config/arm/fbsd.mh new file mode 100644 index 0000000000..7b2fd44b91 --- /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/Makefile.in gdb/Makefile.in index 1d2dbaf3f7..6e96a88a98 100644 --- gdb/Makefile.in +++ gdb/Makefile.in @@ -780,6 +780,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 \ @@ -2488,6 +2489,7 @@ ALLDEPFILES = \ arc-tdep.c \ arm.c \ arm-bsd-tdep.c \ + arm-fbsd-tdep.c \ arm-get-next-pcs.c \ arm-linux.c \ arm-linux-nat.c \ Index: head/devel/gdb/files/patch-fixes =================================================================== --- head/devel/gdb/files/patch-fixes (revision 450894) +++ head/devel/gdb/files/patch-fixes (revision 450895) @@ -1,12 +1,10 @@ -diff --git gdb/compile/compile-loc2c.c gdb/compile/compile-loc2c.c -index a53214f2e5..67af62bb58 100644 ---- gdb/compile/compile-loc2c.c +--- gdb/compile/compile-loc2c.c.orig 2017-09-14 09:28:17 UTC +++ gdb/compile/compile-loc2c.c @@ -669,6 +669,7 @@ do_compile_dwarf_expr_to_c (int indent, string_file &stream, uint64_t uoffset, reg; int64_t offset; + uoffset = 0; print_spaces (indent - 2, &stream); if (info[op_ptr - base].label) { Index: head/devel/gdb/files/patch-gdb_amd64-bsd-nat.c =================================================================== --- head/devel/gdb/files/patch-gdb_amd64-bsd-nat.c (nonexistent) +++ head/devel/gdb/files/patch-gdb_amd64-bsd-nat.c (revision 450895) @@ -0,0 +1,30 @@ +--- gdb/amd64-bsd-nat.c.orig 2017-09-14 09:28:17 UTC ++++ gdb/amd64-bsd-nat.c +@@ -28,6 +28,7 @@ + #include + #include + #include ++#include + + #include "amd64-tdep.h" + #include "amd64-nat.h" +@@ -95,12 +96,19 @@ amd64bsd_store_inferior_registers (struct target_ops *ops, + if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum)) + { + struct reg regs; ++ register_t old_rflags; + + if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1) + perror_with_name (_("Couldn't get registers")); + ++ old_rflags = regs.r_rflags; + amd64_collect_native_gregset (regcache, ®s, regnum); + ++ /* This is a workaround about the PSL_USERCHANGE posix limitation. */ ++ if ((regs.r_rflags ^ old_rflags ) & ~PSL_USERCHANGE) ++ { ++ regs.r_rflags ^= (regs.r_rflags ^ old_rflags ) & ~PSL_USERCHANGE; ++ } + if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1) + perror_with_name (_("Couldn't write registers")); + Property changes on: head/devel/gdb/files/patch-gdb_amd64-bsd-nat.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/devel/gdb/files/patch-gdb_common_common-defs.h =================================================================== --- head/devel/gdb/files/patch-gdb_common_common-defs.h (nonexistent) +++ head/devel/gdb/files/patch-gdb_common_common-defs.h (revision 450895) @@ -0,0 +1,18 @@ +--- gdb/common/common-defs.h.orig 2017-09-12 12:25:12 UTC ++++ gdb/common/common-defs.h +@@ -44,9 +44,15 @@ + + Must do this before including any system header, since other system + headers may include stdint.h/inttypes.h. */ ++#ifndef __STDC_CONSTANT_MACROS + #define __STDC_CONSTANT_MACROS 1 ++#endif ++#ifndef __STDC_LIMIT_MACROS + #define __STDC_LIMIT_MACROS 1 ++#endif ++#ifndef __STDC_FORMAT_MACROS + #define __STDC_FORMAT_MACROS 1 ++#endif + + #include + #include Property changes on: head/devel/gdb/files/patch-gdb_common_common-defs.h ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/devel/gdb/files/patch-gdb_configure =================================================================== --- head/devel/gdb/files/patch-gdb_configure (nonexistent) +++ head/devel/gdb/files/patch-gdb_configure (revision 450895) @@ -0,0 +1,18 @@ +--- gdb/configure.orig 2017-09-14 09:28:17 UTC ++++ gdb/configure +@@ -15103,12 +15103,10 @@ if test "${ERROR_ON_WARNING}" = yes ; then + WERROR_CFLAGS="-Werror" + fi + +-# The options we'll try to enable. ++# These options work in either C or C++ modes. + build_warnings="-Wall -Wpointer-arith \ +--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-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. Property changes on: head/devel/gdb/files/patch-gdb_configure ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/devel/gdb/files/patch-gdb_configure.host =================================================================== --- head/devel/gdb/files/patch-gdb_configure.host (nonexistent) +++ head/devel/gdb/files/patch-gdb_configure.host (revision 450895) @@ -0,0 +1,10 @@ +--- 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 ;; Property changes on: head/devel/gdb/files/patch-gdb_configure.host ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/devel/gdb/files/patch-gdb_corelow.c =================================================================== --- head/devel/gdb/files/patch-gdb_corelow.c (nonexistent) +++ head/devel/gdb/files/patch-gdb_corelow.c (revision 450895) @@ -0,0 +1,11 @@ +--- gdb/corelow.c.orig 2017-07-29 11:06:52 UTC ++++ gdb/corelow.c +@@ -517,7 +517,7 @@ get_core_register_section (struct regcache *regcache, + bool variable_size_section = (regset != NULL + && regset->flags & REGSET_VARIABLE_SIZE); + +- thread_section_name section_name (name, regcache->ptid ()); ++ thread_section_name section_name (name, regcache_get_ptid (regcache)); + + section = bfd_get_section_by_name (core_bfd, section_name.c_str ()); + if (! section) Property changes on: head/devel/gdb/files/patch-gdb_corelow.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/devel/gdb/files/patch-gdb_fbsd-nat.c =================================================================== --- head/devel/gdb/files/patch-gdb_fbsd-nat.c (nonexistent) +++ head/devel/gdb/files/patch-gdb_fbsd-nat.c (revision 450895) @@ -0,0 +1,17 @@ +--- gdb/fbsd-nat.c.orig 2017-09-14 09:28:17 UTC ++++ gdb/fbsd-nat.c +@@ -682,6 +682,14 @@ fbsd_resume (struct target_ops *ops, + struct thread_info *tp; + int request; + ++#ifndef PT_LWP_EVENTS ++ /* When LWP events are not supported, a new thread might already be ++ running that has not yet reported an event when GDB wishes to ++ only run a single thread. Force an update of the thread list ++ to ensure that any such threads are suspended before the process ++ is resumed. */ ++ fbsd_add_threads (ptid_get_pid (ptid)); ++#endif + ALL_NON_EXITED_THREADS (tp) + { + if (ptid_get_pid (tp->ptid) != ptid_get_pid (ptid)) Property changes on: head/devel/gdb/files/patch-gdb_fbsd-nat.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/devel/gdb/files/patch-gdb_gdb__wchar.h =================================================================== --- head/devel/gdb/files/patch-gdb_gdb__wchar.h (nonexistent) +++ head/devel/gdb/files/patch-gdb_gdb__wchar.h (revision 450895) @@ -0,0 +1,20 @@ +--- gdb/gdb_wchar.h.orig 2017-09-14 09:28:17 UTC ++++ gdb/gdb_wchar.h +@@ -59,7 +59,7 @@ + iconvlist. */ + #if defined (HAVE_ICONV) && defined (HAVE_BTOWC) \ + && (defined (__STDC_ISO_10646__) \ +- || (defined (_LIBICONV_VERSION) && _LIBICONV_VERSION >= 0x108)) ++ || (!defined (LIBICONV_PLUG) && defined (_LIBICONV_VERSION) && _LIBICONV_VERSION >= 0x108)) + + typedef wchar_t gdb_wchar_t; + typedef wint_t gdb_wint_t; +@@ -82,7 +82,7 @@ typedef wint_t gdb_wint_t; + #define INTERMEDIATE_ENCODING intermediate_encoding () + const char *intermediate_encoding (void); + +-#elif defined (_LIBICONV_VERSION) && _LIBICONV_VERSION >= 0x108 ++#elif !defined (LIBICONV_PLUG) && defined (_LIBICONV_VERSION) && _LIBICONV_VERSION >= 0x108 + #define INTERMEDIATE_ENCODING "wchar_t" + #else + /* This shouldn't happen, because the earlier #if should have filtered Property changes on: head/devel/gdb/files/patch-gdb_gdb__wchar.h ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/devel/gdb/files/patch-gdb_gnulib_import_stddef.in.h =================================================================== --- head/devel/gdb/files/patch-gdb_gnulib_import_stddef.in.h (nonexistent) +++ head/devel/gdb/files/patch-gdb_gnulib_import_stddef.in.h (revision 450895) @@ -0,0 +1,11 @@ +--- gdb/gnulib/import/stddef.in.h.orig 2017-09-14 09:28:17 UTC ++++ gdb/gnulib/import/stddef.in.h +@@ -84,7 +84,7 @@ + /* Some platforms lack max_align_t. The check for _GCC_MAX_ALIGN_T is + a hack in case the configure-time test was done with g++ even though + we are currently compiling with gcc. */ +-#if ! (@HAVE_MAX_ALIGN_T@ || defined _GCC_MAX_ALIGN_T) ++#if 0 + /* On the x86, the maximum storage alignment of double, long, etc. is 4, + but GCC's C11 ABI for x86 says that max_align_t has an alignment of 8, + and the C11 standard allows this. Work around this problem by Property changes on: head/devel/gdb/files/patch-gdb_gnulib_import_stddef.in.h ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/devel/gdb/files/patch-gdb_i386-fbsd-nat.c =================================================================== --- head/devel/gdb/files/patch-gdb_i386-fbsd-nat.c (nonexistent) +++ head/devel/gdb/files/patch-gdb_i386-fbsd-nat.c (revision 450895) @@ -0,0 +1,10 @@ +--- gdb/i386-fbsd-nat.c 2017-09-14 09:28:17 UTC ++++ gdb/i386-fbsd-nat.c +@@ -163,7 +163,6 @@ _initialize_i386fbsd_nat (void) + t->to_read_description = i386fbsd_read_description; + #endif + +- t->to_resume = i386fbsd_resume; + fbsd_nat_add_target (t); + + /* Support debugging kernel virtual memory images. */ Property changes on: head/devel/gdb/files/patch-gdb_i386-fbsd-nat.c ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/devel/gdb/files/patch-gdb_python_python-config.py =================================================================== --- head/devel/gdb/files/patch-gdb_python_python-config.py (nonexistent) +++ head/devel/gdb/files/patch-gdb_python_python-config.py (revision 450895) @@ -0,0 +1,11 @@ +--- gdb/python/python-config.py 2017-09-14 09:28:17 UTC ++++ gdb/python/python-config.py +@@ -59,6 +59,8 @@ for opt in opt_flags: + + elif opt in ('--libs', '--ldflags'): + libs = [] ++ if getvar('LDFLAGS') is not None: ++ libs.extend(getvar('LDFLAGS').split()) + if getvar('LIBS') is not None: + libs.extend(getvar('LIBS').split()) + if getvar('SYSLIBS') is not None: Property changes on: head/devel/gdb/files/patch-gdb_python_python-config.py ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/devel/gdb/files/patch-include_libiberty.h =================================================================== --- head/devel/gdb/files/patch-include_libiberty.h (nonexistent) +++ head/devel/gdb/files/patch-include_libiberty.h (revision 450895) @@ -0,0 +1,11 @@ +--- include/libiberty.h 2017-09-14 09:28:17 UTC ++++ include/libiberty.h +@@ -109,7 +109,7 @@ + || defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) \ + || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) \ + || defined (__DragonFly__) || defined (HAVE_DECL_BASENAME) +-extern char *basename (const char *) ATTRIBUTE_RETURNS_NONNULL ATTRIBUTE_NONNULL(1); ++#include + #else + /* Do not allow basename to be used if there is no prototype seen. We + either need to use the above prototype or have one from Property changes on: head/devel/gdb/files/patch-include_libiberty.h ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/devel/gdb/files/patch-libiberty_configure =================================================================== --- head/devel/gdb/files/patch-libiberty_configure (nonexistent) +++ head/devel/gdb/files/patch-libiberty_configure (revision 450895) @@ -0,0 +1,12 @@ +--- libiberty/configure.orig 2017-09-12 12:10:11 UTC ++++ libiberty/configure +@@ -4398,8 +4398,7 @@ + ac_libiberty_warn_cflags= + save_CFLAGS="$CFLAGS" + for real_option in -W -Wall -Wwrite-strings -Wc++-compat \ +- -Wstrict-prototypes \ +- -Wshadow=local; do ++ -Wstrict-prototypes ; do + # Do the check with the no- prefix removed since gcc silently + # accepts any -Wno-* option on purpose + case $real_option in Property changes on: head/devel/gdb/files/patch-libiberty_configure ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/devel/gdb/files/patch-nowarning =================================================================== --- head/devel/gdb/files/patch-nowarning (revision 450894) +++ head/devel/gdb/files/patch-nowarning (revision 450895) @@ -1,65 +1,65 @@ ---- gdb/arm-tdep.c.orig 2016-07-08 15:42:17.131392993 +0200 -+++ gdb/arm-tdep.c 2016-07-08 15:44:10.506386463 +0200 +--- 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; Index: head/devel/gdb/files/patch-unified =================================================================== --- head/devel/gdb/files/patch-unified (revision 450894) +++ head/devel/gdb/files/patch-unified (revision 450895) @@ -1,18 +1,16 @@ -diff --git gdb/gdb.c gdb/gdb.c -index e554015..dcb9925 100644 ---- gdb/gdb.c +--- gdb/gdb.c.orig 2017-09-14 09:28:17 UTC +++ gdb/gdb.c @@ -28,6 +28,12 @@ main (int argc, char **argv) memset (&args, 0, sizeof args); args.argc = argc; args.argv = argv; - args.interpreter_p = INTERP_CONSOLE; + if (strncmp(basename(argv[0]), "insight", 7) == 0) { + args.interpreter_p = "insight"; + } else if (strncmp(basename(argv[0]), "gdbtui", 6) == 0) { + args.interpreter_p = INTERP_TUI; + } else { + args.interpreter_p = INTERP_CONSOLE; + } return gdb_main (&args); }