Page MenuHomeFreeBSD

D20403.diff
No OneTemporary

D20403.diff

Index: head/devel/gdb/Makefile
===================================================================
--- head/devel/gdb/Makefile
+++ head/devel/gdb/Makefile
@@ -2,8 +2,8 @@
# $FreeBSD$
PORTNAME= gdb
-PORTVERSION= 8.2.1
-PORTREVISION= 3
+PORTVERSION= 8.3
+PORTREVISION= 0
CATEGORIES= devel
MASTER_SITES= GNU
@@ -14,12 +14,12 @@
LICENSE_FILE= ${WRKSRC}/COPYING3
# untested on sparc64, might work
-ONLY_FOR_ARCHS= aarch64 amd64 armv6 armv7 i386 mips powerpc powerpc64
+NOT_FOR_ARCHS= sparc64
LIB_DEPENDS= libmpfr.so:math/mpfr
TEST_DEPENDS= runtest:misc/dejagnu
-USES= compiler:c++11-lang cpe gmake libtool tar:xz
+USES= compiler:c++11-lang cpe gmake libtool pkgconfig tar:xz
USE_PYTHON= flavors py3kplist
TEST_TARGET= check
@@ -39,17 +39,24 @@
CFLAGS+= -Wno-unknown-warning-option
EXCLUDE= dejagnu expect sim texinfo intl
EXTRACT_AFTER_ARGS= ${EXCLUDE:S/^/--exclude /}
-EXTRA_PATCHES= ${FILESDIR}/commit-8aa0243d54 \
- ${FILESDIR}/commit-93579f6f90 \
- ${FILESDIR}/commit-2861ee4fde
+EXTRA_PATCHES= ${FILESDIR}/commit-1163a4b7a3 \
+ ${FILESDIR}/commit-dd6876c91c \
+ ${FILESDIR}/commit-6e056c8178 \
+ ${FILESDIR}/commit-36c53a0262 \
+ ${FILESDIR}/commit-ef0bd2046f \
+ ${FILESDIR}/commit-945f3901b5 \
+ ${FILESDIR}/commit-f5424cfa7e \
+ ${FILESDIR}/commit-ce25aa57a3 \
+ ${FILESDIR}/commit-8399425f5f
LIB_DEPENDS+= libexpat.so:textproc/expat2
VER= ${PORTVERSION:S/.//g}
PLIST_SUB= VER=${VER}
-OPTIONS_DEFINE= DEBUG GDB_LINK GUILE KGDB NLS PYTHON TUI
+OPTIONS_DEFINE= DEBUG GDB_LINK GUILE KGDB NLS PYTHON SOURCE_HIGHLIGHT TUI
-OPTIONS_DEFAULT= GDB_LINK KGDB NLS PYTHON TUI PORT_READLINE PORT_ICONV SYSTEM_ZLIB
+OPTIONS_DEFAULT= GDB_LINK KGDB NLS PYTHON SOURCE_HIGHLIGHT TUI
+OPTIONS_DEFAULT+= PORT_READLINE PORT_ICONV SYSTEM_ZLIB
OPTIONS_SINGLE= READLINE ICONV ZLIB
OPTIONS_SINGLE_READLINE= BUNDLED_READLINE PORT_READLINE
@@ -62,6 +69,7 @@
BUNDLED_ZLIB_DESC= from gdb distfile
PORT_READLINE_DESC= from devel/readline port
PORT_ICONV_DESC= use libiconv, with wider charset support
+SOURCE_HIGHLIGHT_DESC= Source Code Styling
SYSTEM_ICONV_DESC= use libc iconv, with no wchar support
SYSTEM_ZLIB_DESC= use system zlib
TUI_DESC= Text User Interface enabled
@@ -79,6 +87,9 @@
PYTHON_CONFIGURE_ON= --with-python=${PYTHON_CMD}
PYTHON_CONFIGURE_OFF= --without-python
PYTHON_USES= python
+SOURCE_HIGHLIGHT_WITH= source-highlight
+SOURCE_HIGHLIGHT_LIB_DEPENDS= \
+ libsource-highlight.so:textproc/source-highlight
SYSTEM_ICONV_USES= iconv
SYSTEM_ZLIB_WITH= system-zlib
TUI_CONFIGURE_ENABLE= tui
@@ -96,7 +107,7 @@
GH_ACCOUNT= bsdjhb:libcxx
GH_PROJECT= libcxx-gdbpy:libcxx
-GH_TAGNAME= 99aae0c:libcxx
+GH_TAGNAME= 229610a:libcxx
# Workaround USE_GITHUB preventing the default DISTFILES
DISTFILES= ${DISTNAME}${EXTRACT_SUFX}
Index: head/devel/gdb/distinfo
===================================================================
--- head/devel/gdb/distinfo
+++ head/devel/gdb/distinfo
@@ -1,5 +1,5 @@
-TIMESTAMP = 1550011043
-SHA256 (gdb-8.2.1.tar.xz) = 0a6a432907a03c5c8eaad3c3cffd50c00a40c3a5e3c4039440624bae703f2202
-SIZE (gdb-8.2.1.tar.xz) = 20170388
-SHA256 (bsdjhb-libcxx-gdbpy-99aae0c_GH0.tar.gz) = 101425f8041489e31370ddd5938b41541b88a2e1051da70fe12d37c9186aa7eb
-SIZE (bsdjhb-libcxx-gdbpy-99aae0c_GH0.tar.gz) = 4607
+TIMESTAMP = 1559324758
+SHA256 (gdb-8.3.tar.xz) = 802f7ee309dcc547d65a68d61ebd6526762d26c3051f52caebe2189ac1ffd72e
+SIZE (gdb-8.3.tar.xz) = 20490300
+SHA256 (bsdjhb-libcxx-gdbpy-229610a_GH0.tar.gz) = d4235f98b71c4d5e3f01744de279e64808229dd46c0f00cac6a12fdeb3a998a1
+SIZE (bsdjhb-libcxx-gdbpy-229610a_GH0.tar.gz) = 5299
Index: head/devel/gdb/files/commit-1163a4b7a3
===================================================================
--- head/devel/gdb/files/commit-1163a4b7a3
+++ head/devel/gdb/files/commit-1163a4b7a3
@@ -0,0 +1,419 @@
+commit 1163a4b7a38a79ebd153dc5ee76ce93877d21dbd
+Author: John Baldwin <jhb@FreeBSD.org>
+Date: Tue Mar 12 13:39:02 2019 -0700
+
+ Support the fs_base and gs_base registers on i386.
+
+ As on amd64, these registers hold the base address of the fs and gs
+ segments, respectively. For i386 these two registers are 32 bits.
+
+ gdb/ChangeLog:
+
+ * amd64-fbsd-nat.c (amd64_fbsd_nat_target::read_description):
+ Update calls to i386_target_description to add 'segments'
+ parameter.
+ * amd64-tdep.c (amd64_init_abi): Set tdep->fsbase_regnum. Don't
+ add segment base registers.
+ * arch/i386.c (i386_create_target_description): Add 'segments'
+ parameter to enable segment base registers.
+ * arch/i386.h (i386_create_target_description): Likewise.
+ * features/i386/32bit-segments.xml: New file.
+ * features/i386/32bit-segments.c: Generate.
+ * i386-fbsd-nat.c (i386_fbsd_nat_target::read_description): Update
+ call to i386_target_description to add 'segments' parameter.
+ * i386-fbsd-tdep.c (i386fbsd_core_read_description): Likewise.
+ * i386-go32-tdep.c (i386_go32_init_abi): Likewise.
+ * i386-linux-tdep.c (i386_linux_read_description): Likewise.
+ * i386-tdep.c (i386_validate_tdesc_p): Add segment base registers
+ if feature is present.
+ (i386_gdbarch_init): Pass I386_NUM_REGS to set_gdbarch_num_regs.
+ Add 'segments' parameter to call to i386_target_description.
+ (i386_target_description): Add 'segments' parameter to enable
+ segment base registers.
+ (_initialize_i386_tdep) [GDB_SELF_TEST]: Add 'segments' parameter
+ to call to i386_target_description.
+ * i386-tdep.h (struct gdbarch_tdep): Add 'fsbase_regnum'.
+ (enum i386_regnum): Add I386_FSBASE_REGNUM and I386_GSBASE_REGNUM.
+ Define I386_NUM_REGS.
+ (i386_target_description): Add 'segments' parameter to enable
+ segment base registers.
+
+ gdb/gdbserver/ChangeLog:
+
+ * linux-x86-tdesc.c (i386_linux_read_description): Update call to
+ i386_create_target_description for 'segments' parameter.
+ * lynx-i386-low.c (lynx_i386_arch_setup): Likewise.
+ * nto-x86-low.c (nto_x86_arch_setup): Likewise.
+ * win32-i386-low.c (i386_arch_setup): Likewise.
+
+diff --git gdb/amd64-fbsd-nat.c gdb/amd64-fbsd-nat.c
+index 74ef240766..9fff763dd3 100644
+--- gdb/amd64-fbsd-nat.c
++++ gdb/amd64-fbsd-nat.c
+@@ -190,13 +190,13 @@ amd64_fbsd_nat_target::read_description ()
+ if (is64)
+ return amd64_target_description (xcr0, true);
+ else
+- return i386_target_description (xcr0);
++ return i386_target_description (xcr0, false);
+ }
+ #endif
+ if (is64)
+ return amd64_target_description (X86_XSTATE_SSE_MASK, true);
+ else
+- return i386_target_description (X86_XSTATE_SSE_MASK);
++ return i386_target_description (X86_XSTATE_SSE_MASK, false);
+ }
+
+ #if defined(HAVE_PT_GETDBREGS) && defined(USE_SIGTRAP_SIGINFO)
+diff --git gdb/amd64-tdep.c gdb/amd64-tdep.c
+index 3f61997d66..d5892954d7 100644
+--- gdb/amd64-tdep.c
++++ gdb/amd64-tdep.c
+@@ -3107,15 +3107,7 @@ amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch,
+
+ if (tdesc_find_feature (tdesc, "org.gnu.gdb.i386.segments") != NULL)
+ {
+- const struct tdesc_feature *feature =
+- tdesc_find_feature (tdesc, "org.gnu.gdb.i386.segments");
+- struct tdesc_arch_data *tdesc_data_segments =
+- (struct tdesc_arch_data *) info.tdep_info;
+-
+- tdesc_numbered_register (feature, tdesc_data_segments,
+- AMD64_FSBASE_REGNUM, "fs_base");
+- tdesc_numbered_register (feature, tdesc_data_segments,
+- AMD64_GSBASE_REGNUM, "gs_base");
++ tdep->fsbase_regnum = AMD64_FSBASE_REGNUM;
+ }
+
+ if (tdesc_find_feature (tdesc, "org.gnu.gdb.i386.pkeys") != NULL)
+diff --git gdb/arch/i386.c gdb/arch/i386.c
+index 7d2901333b..ab24cf71cb 100644
+--- gdb/arch/i386.c
++++ gdb/arch/i386.c
+@@ -28,11 +28,12 @@
+ #include "../features/i386/32bit-avx512.c"
+ #include "../features/i386/32bit-mpx.c"
+ #include "../features/i386/32bit-pkeys.c"
++#include "../features/i386/32bit-segments.c"
+
+ /* Create i386 target descriptions according to XCR0. */
+
+ target_desc *
+-i386_create_target_description (uint64_t xcr0, bool is_linux)
++i386_create_target_description (uint64_t xcr0, bool is_linux, bool segments)
+ {
+ target_desc *tdesc = allocate_target_description ();
+
+@@ -53,6 +54,9 @@ i386_create_target_description (uint64_t xcr0, bool is_linux)
+ if (is_linux)
+ regnum = create_feature_i386_32bit_linux (tdesc, regnum);
+
++ if (segments)
++ regnum = create_feature_i386_32bit_segments (tdesc, regnum);
++
+ if (xcr0 & X86_XSTATE_AVX)
+ regnum = create_feature_i386_32bit_avx (tdesc, regnum);
+
+diff --git gdb/arch/i386.h gdb/arch/i386.h
+index fa85438080..9a831cea30 100644
+--- gdb/arch/i386.h
++++ gdb/arch/i386.h
+@@ -21,6 +21,7 @@
+ #include "common/tdesc.h"
+ #include <stdint.h>
+
+-target_desc *i386_create_target_description (uint64_t xcr0, bool is_linux);
++target_desc *i386_create_target_description (uint64_t xcr0, bool is_linux,
++ bool segments);
+
+ #endif /* ARCH_I386_H */
+diff --git gdb/features/i386/32bit-segments.c gdb/features/i386/32bit-segments.c
+new file mode 100644
+index 0000000000..c22c3dfbc3
+--- /dev/null
++++ gdb/features/i386/32bit-segments.c
+@@ -0,0 +1,15 @@
++/* THIS FILE IS GENERATED. -*- buffer-read-only: t -*- vi:set ro:
++ Original: 32bit-segments.xml */
++
++#include "common/tdesc.h"
++
++static int
++create_feature_i386_32bit_segments (struct target_desc *result, long regnum)
++{
++ struct tdesc_feature *feature;
++
++ feature = tdesc_create_feature (result, "org.gnu.gdb.i386.segments");
++ tdesc_create_reg (feature, "fs_base", regnum++, 1, NULL, 32, "int");
++ tdesc_create_reg (feature, "gs_base", regnum++, 1, NULL, 32, "int");
++ return regnum;
++}
+diff --git gdb/features/i386/32bit-segments.xml gdb/features/i386/32bit-segments.xml
+new file mode 100644
+index 0000000000..098948e5ec
+--- /dev/null
++++ gdb/features/i386/32bit-segments.xml
+@@ -0,0 +1,12 @@
++<?xml version="1.0"?>
++<!-- Copyright (C) 2016-2018 Free Software Foundation, Inc.
++
++ Copying and distribution of this file, with or without modification,
++ are permitted in any medium without royalty provided the copyright
++ notice and this notice are preserved. -->
++
++<!DOCTYPE feature SYSTEM "gdb-target.dtd">
++<feature name="org.gnu.gdb.i386.segments">
++ <reg name="fs_base" bitsize="32" type="int"/>
++ <reg name="gs_base" bitsize="32" type="int"/>
++</feature>
+diff --git gdb/gdbserver/linux-x86-tdesc.c gdb/gdbserver/linux-x86-tdesc.c
+index 04bccc84ed..8f24a3d72d 100644
+--- gdb/gdbserver/linux-x86-tdesc.c
++++ gdb/gdbserver/linux-x86-tdesc.c
+@@ -87,7 +87,7 @@ i386_linux_read_description (uint64_t xcr0)
+
+ if (*tdesc == NULL)
+ {
+- *tdesc = i386_create_target_description (xcr0, true);
++ *tdesc = i386_create_target_description (xcr0, true, false);
+
+ init_target_desc (*tdesc, i386_expedite_regs);
+ }
+diff --git gdb/gdbserver/lynx-i386-low.c gdb/gdbserver/lynx-i386-low.c
+index bc1027dc52..e47f6b92f6 100644
+--- gdb/gdbserver/lynx-i386-low.c
++++ gdb/gdbserver/lynx-i386-low.c
+@@ -331,7 +331,7 @@ static void
+ lynx_i386_arch_setup (void)
+ {
+ struct target_desc *tdesc
+- = i386_create_target_description (X86_XSTATE_SSE_MASK, false);
++ = i386_create_target_description (X86_XSTATE_SSE_MASK, false, false);
+
+ init_target_desc (tdesc, i386_expedite_regs);
+
+diff --git gdb/gdbserver/nto-x86-low.c gdb/gdbserver/nto-x86-low.c
+index 1b00f7f6cc..cfbe7ba6d8 100644
+--- gdb/gdbserver/nto-x86-low.c
++++ gdb/gdbserver/nto-x86-low.c
+@@ -89,7 +89,7 @@ nto_x86_arch_setup (void)
+ {
+ the_low_target.num_regs = 16;
+ struct target_desc *tdesc
+- = i386_create_target_description (X86_XSTATE_SSE_MASK, false);
++ = i386_create_target_description (X86_XSTATE_SSE_MASK, false, false);
+
+ init_target_desc (tdesc, i386_expedite_regs);
+
+diff --git gdb/gdbserver/win32-i386-low.c gdb/gdbserver/win32-i386-low.c
+index 3be75d2bf2..7b187d3bea 100644
+--- gdb/gdbserver/win32-i386-low.c
++++ gdb/gdbserver/win32-i386-low.c
+@@ -439,7 +439,7 @@ i386_arch_setup (void)
+ false, false);
+ const char **expedite_regs = amd64_expedite_regs;
+ #else
+- tdesc = i386_create_target_description (X86_XSTATE_SSE_MASK, false);
++ tdesc = i386_create_target_description (X86_XSTATE_SSE_MASK, false, false);
+ const char **expedite_regs = i386_expedite_regs;
+ #endif
+
+diff --git gdb/i386-fbsd-nat.c gdb/i386-fbsd-nat.c
+index 2309b76506..7106e90801 100644
+--- gdb/i386-fbsd-nat.c
++++ gdb/i386-fbsd-nat.c
+@@ -160,7 +160,7 @@ i386_fbsd_nat_target::read_description ()
+ if (x86bsd_xsave_len == 0)
+ xcr0 = X86_XSTATE_SSE_MASK;
+
+- return i386_target_description (xcr0);
++ return i386_target_description (xcr0, false);
+ }
+ #endif
+
+diff --git gdb/i386-fbsd-tdep.c gdb/i386-fbsd-tdep.c
+index 236edd692a..2f28bad728 100644
+--- gdb/i386-fbsd-tdep.c
++++ gdb/i386-fbsd-tdep.c
+@@ -267,7 +267,7 @@ i386fbsd_core_read_description (struct gdbarch *gdbarch,
+ struct target_ops *target,
+ bfd *abfd)
+ {
+- return i386_target_description (i386fbsd_core_read_xcr0 (abfd));
++ return i386_target_description (i386fbsd_core_read_xcr0 (abfd), false);
+ }
+
+ /* Similar to i386_supply_fpregset, but use XSAVE extended state. */
+diff --git gdb/i386-go32-tdep.c gdb/i386-go32-tdep.c
+index 06833c346c..30db72d880 100644
+--- gdb/i386-go32-tdep.c
++++ gdb/i386-go32-tdep.c
+@@ -35,7 +35,7 @@ i386_go32_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+
+ /* DJGPP does not support the SSE registers. */
+ if (!tdesc_has_registers (info.target_desc))
+- tdep->tdesc = i386_target_description (X86_XSTATE_X87_MASK);
++ tdep->tdesc = i386_target_description (X86_XSTATE_X87_MASK, false);
+
+ /* Native compiler is GCC, which uses the SVR4 register numbering
+ even in COFF and STABS. See the comment in i386_gdbarch_init,
+diff --git gdb/i386-linux-tdep.c gdb/i386-linux-tdep.c
+index da81715061..fa6b86f1c8 100644
+--- gdb/i386-linux-tdep.c
++++ gdb/i386-linux-tdep.c
+@@ -694,7 +694,7 @@ i386_linux_read_description (uint64_t xcr0)
+ [(xcr0 & X86_XSTATE_PKRU) ? 1 : 0];
+
+ if (*tdesc == NULL)
+- *tdesc = i386_create_target_description (xcr0, true);
++ *tdesc = i386_create_target_description (xcr0, true, false);
+
+ return *tdesc;
+ }
+diff --git gdb/i386-tdep.c gdb/i386-tdep.c
+index bc9ba752ed..4e63832b0e 100644
+--- gdb/i386-tdep.c
++++ gdb/i386-tdep.c
+@@ -8175,7 +8175,7 @@ i386_validate_tdesc_p (struct gdbarch_tdep *tdep,
+ const struct tdesc_feature *feature_core;
+
+ const struct tdesc_feature *feature_sse, *feature_avx, *feature_mpx,
+- *feature_avx512, *feature_pkeys;
++ *feature_avx512, *feature_pkeys, *feature_segments;
+ int i, num_regs, valid_p;
+
+ if (! tdesc_has_registers (tdesc))
+@@ -8198,6 +8198,9 @@ i386_validate_tdesc_p (struct gdbarch_tdep *tdep,
+ /* Try AVX512 registers. */
+ feature_avx512 = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.avx512");
+
++ /* Try segment base registers. */
++ feature_segments = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.segments");
++
+ /* Try PKEYS */
+ feature_pkeys = tdesc_find_feature (tdesc, "org.gnu.gdb.i386.pkeys");
+
+@@ -8307,6 +8310,16 @@ i386_validate_tdesc_p (struct gdbarch_tdep *tdep,
+ tdep->mpx_register_names[i]);
+ }
+
++ if (feature_segments)
++ {
++ if (tdep->fsbase_regnum < 0)
++ tdep->fsbase_regnum = I386_FSBASE_REGNUM;
++ valid_p &= tdesc_numbered_register (feature_segments, tdesc_data,
++ tdep->fsbase_regnum, "fs_base");
++ valid_p &= tdesc_numbered_register (feature_segments, tdesc_data,
++ tdep->fsbase_regnum + 1, "gs_base");
++ }
++
+ if (feature_pkeys)
+ {
+ tdep->xcr0 |= X86_XSTATE_PKRU;
+@@ -8543,14 +8556,14 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
+ /* Even though the default ABI only includes general-purpose registers,
+ floating-point registers and the SSE registers, we have to leave a
+ gap for the upper AVX, MPX and AVX512 registers. */
+- set_gdbarch_num_regs (gdbarch, I386_PKEYS_NUM_REGS);
++ set_gdbarch_num_regs (gdbarch, I386_NUM_REGS);
+
+ set_gdbarch_gnu_triplet_regexp (gdbarch, i386_gnu_triplet_regexp);
+
+ /* Get the x86 target description from INFO. */
+ tdesc = info.target_desc;
+ if (! tdesc_has_registers (tdesc))
+- tdesc = i386_target_description (X86_XSTATE_SSE_MASK);
++ tdesc = i386_target_description (X86_XSTATE_SSE_MASK, false);
+ tdep->tdesc = tdesc;
+
+ tdep->num_core_regs = I386_NUM_GREGS + I387_NUM_REGS;
+@@ -8592,6 +8605,9 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
+ tdep->pkru_regnum = -1;
+ tdep->num_pkeys_regs = 0;
+
++ /* No segment base registers. */
++ tdep->fsbase_regnum = -1;
++
+ tdesc_data = tdesc_data_alloc ();
+
+ set_gdbarch_relocate_instruction (gdbarch, i386_relocate_instruction);
+@@ -8717,20 +8733,21 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
+ /* Return the target description for a specified XSAVE feature mask. */
+
+ const struct target_desc *
+-i386_target_description (uint64_t xcr0)
++i386_target_description (uint64_t xcr0, bool segments)
+ {
+ static target_desc *i386_tdescs \
+- [2/*SSE*/][2/*AVX*/][2/*MPX*/][2/*AVX512*/][2/*PKRU*/] = {};
++ [2/*SSE*/][2/*AVX*/][2/*MPX*/][2/*AVX512*/][2/*PKRU*/][2/*segments*/] = {};
+ target_desc **tdesc;
+
+ tdesc = &i386_tdescs[(xcr0 & X86_XSTATE_SSE) ? 1 : 0]
+ [(xcr0 & X86_XSTATE_AVX) ? 1 : 0]
+ [(xcr0 & X86_XSTATE_MPX) ? 1 : 0]
+ [(xcr0 & X86_XSTATE_AVX512) ? 1 : 0]
+- [(xcr0 & X86_XSTATE_PKRU) ? 1 : 0];
++ [(xcr0 & X86_XSTATE_PKRU) ? 1 : 0]
++ [segments ? 1 : 0];
+
+ if (*tdesc == NULL)
+- *tdesc = i386_create_target_description (xcr0, false);
++ *tdesc = i386_create_target_description (xcr0, false, segments);
+
+ return *tdesc;
+ }
+@@ -9072,7 +9089,7 @@ Show Intel Memory Protection Extensions specific variables."),
+
+ for (auto &a : xml_masks)
+ {
+- auto tdesc = i386_target_description (a.mask);
++ auto tdesc = i386_target_description (a.mask, false);
+
+ selftests::record_xml_tdesc (a.xml, tdesc);
+ }
+diff --git gdb/i386-tdep.h gdb/i386-tdep.h
+index 2532306e5c..c0d494824c 100644
+--- gdb/i386-tdep.h
++++ gdb/i386-tdep.h
+@@ -200,6 +200,10 @@ struct gdbarch_tdep
+ /* PKEYS register names. */
+ const char **pkeys_register_names;
+
++ /* Register number for %fsbase. Set this to -1 to indicate the
++ absence of segment base registers. */
++ int fsbase_regnum;
++
+ /* Target description. */
+ const struct target_desc *tdesc;
+
+@@ -296,7 +300,9 @@ enum i386_regnum
+ I386_K7_REGNUM = I386_K0_REGNUM + 7,
+ I386_ZMM0H_REGNUM, /* %zmm0h */
+ I386_ZMM7H_REGNUM = I386_ZMM0H_REGNUM + 7,
+- I386_PKRU_REGNUM
++ I386_PKRU_REGNUM,
++ I386_FSBASE_REGNUM,
++ I386_GSBASE_REGNUM
+ };
+
+ /* Register numbers of RECORD_REGMAP. */
+@@ -337,6 +343,7 @@ enum record_i386_regnum
+ #define I386_MPX_NUM_REGS (I386_BNDSTATUS_REGNUM + 1)
+ #define I386_AVX512_NUM_REGS (I386_ZMM7H_REGNUM + 1)
+ #define I386_PKEYS_NUM_REGS (I386_PKRU_REGNUM + 1)
++#define I386_NUM_REGS (I386_GSBASE_REGNUM + 1)
+
+ /* Size of the largest register. */
+ #define I386_MAX_REGISTER_SIZE 64
+@@ -440,7 +447,8 @@ extern int i386_svr4_reg_to_regnum (struct gdbarch *gdbarch, int reg);
+
+ 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);
++extern const struct target_desc *i386_target_description (uint64_t xcr0,
++ bool segments);
+
+ /* Return true iff the current target is MPX enabled. */
+ extern int i386_mpx_enabled (void);
Index: head/devel/gdb/files/commit-2861ee4fde
===================================================================
--- head/devel/gdb/files/commit-2861ee4fde
+++ head/devel/gdb/files/commit-2861ee4fde
@@ -1,63 +0,0 @@
-commit 2861ee4fde97d0afafc506380c5deaf71c8439ac
-Author: John Baldwin <jhb@FreeBSD.org>
-Date: Wed Dec 5 10:51:16 2018 -0800
-
- Use separate sed expressions to escape auto-load directories.
-
- Not all sed implementations support alternation via \| in the default
- regular expressions. Instead, resort to separate sed expressions via
- -e for $debugdir and $datadir. This fixes the default setting of the
- auto-load directories on FreeBSD. Previously on FreeBSD the sed
- invocation was a no-op causing the debugdir and datadir values to be
- expanded yielding an autoload path of ':${prefix}/share/gdb'.
-
- gdb/ChangeLog:
-
- * configure: Re-generate.
- * configure.ac: Use separate sed expressions to escape variables
- in auto-load directories.
-
-diff --git gdb/configure gdb/configure
-index 7665ba6531..3777230898 100755
---- gdb/configure
-+++ gdb/configure
-@@ -6579,7 +6579,7 @@ else
- with_auto_load_dir='$debugdir:$datadir/auto-load'
- fi
-
--escape_dir=`echo $with_auto_load_dir | sed 's/[$]\(datadir\|debugdir\)\>/\\\\\\\\\\\\&/g'`
-+escape_dir=`echo $with_auto_load_dir | sed -e 's/[$]datadir\>/\\\\\\\\\\\\&/g' -e 's/[$]debugdir\>/\\\\\\\\\\\\&/g'`
-
- test "x$prefix" = xNONE && prefix="$ac_default_prefix"
- test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-@@ -6606,7 +6606,7 @@ else
- with_auto_load_safe_path="$with_auto_load_dir"
- fi
-
--escape_dir=`echo $with_auto_load_safe_path | sed 's/[$]\(datadir\|debugdir\)\>/\\\\\\\\\\\\&/g'`
-+escape_dir=`echo $with_auto_load_safe_path | sed -e 's/[$]datadir\>/\\\\\\\\\\\\&/g' -e 's/[$]debugdir\>/\\\\\\\\\\\\&/g'`
-
- test "x$prefix" = xNONE && prefix="$ac_default_prefix"
- test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-diff --git gdb/configure.ac gdb/configure.ac
-index e1ea60660b..eca7ea6d41 100644
---- gdb/configure.ac
-+++ gdb/configure.ac
-@@ -146,7 +146,7 @@ AC_ARG_WITH(auto-load-dir,
- AS_HELP_STRING([--with-auto-load-dir=PATH],
- [directories from which to load auto-loaded scripts @<:@$debugdir:$datadir/auto-load@:>@]),,
- [with_auto_load_dir='$debugdir:$datadir/auto-load'])
--escape_dir=`echo $with_auto_load_dir | sed 's/[[$]]\(datadir\|debugdir\)\>/\\\\\\\\\\\\&/g'`
-+escape_dir=`echo $with_auto_load_dir | sed -e 's/[[$]]datadir\>/\\\\\\\\\\\\&/g' -e 's/[[$]]debugdir\>/\\\\\\\\\\\\&/g'`
- AC_DEFINE_DIR(AUTO_LOAD_DIR, escape_dir,
- [Directories from which to load auto-loaded scripts.])
- AC_MSG_RESULT([$with_auto_load_dir])
-@@ -161,7 +161,7 @@ AS_HELP_STRING([--without-auto-load-safe-path],
- with_auto_load_safe_path="/"
- fi],
- [with_auto_load_safe_path="$with_auto_load_dir"])
--escape_dir=`echo $with_auto_load_safe_path | sed 's/[[$]]\(datadir\|debugdir\)\>/\\\\\\\\\\\\&/g'`
-+escape_dir=`echo $with_auto_load_safe_path | sed -e 's/[[$]]datadir\>/\\\\\\\\\\\\&/g' -e 's/[[$]]debugdir\>/\\\\\\\\\\\\&/g'`
- AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
- [Directories safe to hold auto-loaded files.])
- AC_MSG_RESULT([$with_auto_load_safe_path])
Index: head/devel/gdb/files/commit-36c53a0262
===================================================================
--- head/devel/gdb/files/commit-36c53a0262
+++ head/devel/gdb/files/commit-36c53a0262
@@ -0,0 +1,60 @@
+commit 36c53a0262f84ad11d738471789dadfa9c4eb320
+Author: John Baldwin <jhb@FreeBSD.org>
+Date: Tue Mar 12 13:39:02 2019 -0700
+
+ Remove code disabled since at least 1999 from lookup_struct_elt_type.
+
+ Update the comment above the function to reflect the code removal and
+ document the existing behavior.
+
+ gdb/ChangeLog:
+
+ * gdbtypes.c (lookup_struct_elt_type): Update comment and
+ remove disabled code block.
+
+diff --git gdb/gdbtypes.c gdb/gdbtypes.c
+index 09284ef259..5924b15520 100644
+--- gdb/gdbtypes.c
++++ gdb/gdbtypes.c
+@@ -1644,8 +1644,7 @@ lookup_template_type (char *name, struct type *type,
+ return (SYMBOL_TYPE (sym));
+ }
+
+-/* Given a type TYPE, lookup the type of the component of type named
+- NAME.
++/* Given a type TYPE, lookup the type of the component named NAME.
+
+ TYPE can be either a struct or union, or a pointer or reference to
+ a struct or union. If it is a pointer or reference, its target
+@@ -1653,8 +1652,8 @@ lookup_template_type (char *name, struct type *type,
+ as specified for the definitions of the expression element types
+ STRUCTOP_STRUCT and STRUCTOP_PTR.
+
+- If NOERR is nonzero, return zero if NAME is not suitably defined.
+- If NAME is the name of a baseclass type, return that type. */
++ If NOERR is nonzero, return NULL if there is no component named
++ NAME. */
+
+ struct type *
+ lookup_struct_elt_type (struct type *type, const char *name, int noerr)
+@@ -1678,20 +1677,6 @@ lookup_struct_elt_type (struct type *type, const char *name, int noerr)
+ type_name.c_str ());
+ }
+
+-#if 0
+- /* FIXME: This change put in by Michael seems incorrect for the case
+- where the structure tag name is the same as the member name.
+- I.e. when doing "ptype bell->bar" for "struct foo { int bar; int
+- foo; } bell;" Disabled by fnf. */
+- {
+- char *type_name;
+-
+- type_name = TYPE_NAME (type);
+- if (type_name != NULL && strcmp (type_name, name) == 0)
+- return type;
+- }
+-#endif
+-
+ for (i = TYPE_NFIELDS (type) - 1; i >= TYPE_N_BASECLASSES (type); i--)
+ {
+ const char *t_field_name = TYPE_FIELD_NAME (type, i);
Index: head/devel/gdb/files/commit-6e056c8178
===================================================================
--- head/devel/gdb/files/commit-6e056c8178
+++ head/devel/gdb/files/commit-6e056c8178
@@ -0,0 +1,166 @@
+commit 6e056c817845f3d736a1be6b68c69b439c6c6d25
+Author: John Baldwin <jhb@FreeBSD.org>
+Date: Tue Mar 12 13:39:02 2019 -0700
+
+ Add a new gdbarch method to resolve the address of TLS variables.
+
+ Permit TLS variable addresses to be resolved purely by an ABI rather
+ than requiring a target method. This doesn't try the target method if
+ the ABI function is present (even if the ABI function fails) to
+ simplify error handling.
+
+ gdb/ChangeLog:
+
+ * gdbarch.sh (get_thread_local_address): New method.
+ * gdbarch.h, gdbarch.c: Regenerate.
+ * target.c (target_translate_tls_address): Use
+ gdbarch_get_thread_local_address if present instead of
+ target::get_thread_local_address.
+
+diff --git gdb/gdbarch.c gdb/gdbarch.c
+index 434ee3bfcf..2b3fcef004 100644
+--- gdb/gdbarch.c
++++ gdb/gdbarch.c
+@@ -251,6 +251,7 @@ struct gdbarch
+ CORE_ADDR deprecated_function_start_offset;
+ gdbarch_remote_register_number_ftype *remote_register_number;
+ gdbarch_fetch_tls_load_module_address_ftype *fetch_tls_load_module_address;
++ gdbarch_get_thread_local_address_ftype *get_thread_local_address;
+ CORE_ADDR frame_args_skip;
+ gdbarch_unwind_pc_ftype *unwind_pc;
+ gdbarch_unwind_sp_ftype *unwind_sp;
+@@ -613,6 +614,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
+ /* Skip verify of deprecated_function_start_offset, invalid_p == 0 */
+ /* Skip verify of remote_register_number, invalid_p == 0 */
+ /* Skip verify of fetch_tls_load_module_address, has predicate. */
++ /* Skip verify of get_thread_local_address, has predicate. */
+ /* Skip verify of frame_args_skip, invalid_p == 0 */
+ /* Skip verify of unwind_pc, invalid_p == 0 */
+ /* Skip verify of unwind_sp, invalid_p == 0 */
+@@ -1073,6 +1075,12 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
+ fprintf_unfiltered (file,
+ "gdbarch_dump: get_syscall_number = <%s>\n",
+ host_address_to_string (gdbarch->get_syscall_number));
++ fprintf_unfiltered (file,
++ "gdbarch_dump: gdbarch_get_thread_local_address_p() = %d\n",
++ gdbarch_get_thread_local_address_p (gdbarch));
++ fprintf_unfiltered (file,
++ "gdbarch_dump: get_thread_local_address = <%s>\n",
++ host_address_to_string (gdbarch->get_thread_local_address));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: gnu_triplet_regexp = <%s>\n",
+ host_address_to_string (gdbarch->gnu_triplet_regexp));
+@@ -3018,6 +3026,30 @@ set_gdbarch_fetch_tls_load_module_address (struct gdbarch *gdbarch,
+ gdbarch->fetch_tls_load_module_address = fetch_tls_load_module_address;
+ }
+
++int
++gdbarch_get_thread_local_address_p (struct gdbarch *gdbarch)
++{
++ gdb_assert (gdbarch != NULL);
++ return gdbarch->get_thread_local_address != NULL;
++}
++
++CORE_ADDR
++gdbarch_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid, CORE_ADDR lm_addr, CORE_ADDR offset)
++{
++ gdb_assert (gdbarch != NULL);
++ gdb_assert (gdbarch->get_thread_local_address != NULL);
++ if (gdbarch_debug >= 2)
++ fprintf_unfiltered (gdb_stdlog, "gdbarch_get_thread_local_address called\n");
++ return gdbarch->get_thread_local_address (gdbarch, ptid, lm_addr, offset);
++}
++
++void
++set_gdbarch_get_thread_local_address (struct gdbarch *gdbarch,
++ gdbarch_get_thread_local_address_ftype get_thread_local_address)
++{
++ gdbarch->get_thread_local_address = get_thread_local_address;
++}
++
+ CORE_ADDR
+ gdbarch_frame_args_skip (struct gdbarch *gdbarch)
+ {
+diff --git gdb/gdbarch.h gdb/gdbarch.h
+index 75618376ab..abb72e752b 100644
+--- gdb/gdbarch.h
++++ gdb/gdbarch.h
+@@ -649,6 +649,18 @@ typedef CORE_ADDR (gdbarch_fetch_tls_load_module_address_ftype) (struct objfile
+ extern CORE_ADDR gdbarch_fetch_tls_load_module_address (struct gdbarch *gdbarch, struct objfile *objfile);
+ extern void set_gdbarch_fetch_tls_load_module_address (struct gdbarch *gdbarch, gdbarch_fetch_tls_load_module_address_ftype *fetch_tls_load_module_address);
+
++/* Return the thread-local address at OFFSET in the thread-local
++ storage for the thread PTID and the shared library or executable
++ file given by LM_ADDR. If that block of thread-local storage hasn't
++ been allocated yet, this function may throw an error. LM_ADDR may
++ be zero for statically linked multithreaded inferiors. */
++
++extern int gdbarch_get_thread_local_address_p (struct gdbarch *gdbarch);
++
++typedef CORE_ADDR (gdbarch_get_thread_local_address_ftype) (struct gdbarch *gdbarch, ptid_t ptid, CORE_ADDR lm_addr, CORE_ADDR offset);
++extern CORE_ADDR gdbarch_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid, CORE_ADDR lm_addr, CORE_ADDR offset);
++extern void set_gdbarch_get_thread_local_address (struct gdbarch *gdbarch, gdbarch_get_thread_local_address_ftype *get_thread_local_address);
++
+ extern CORE_ADDR gdbarch_frame_args_skip (struct gdbarch *gdbarch);
+ extern void set_gdbarch_frame_args_skip (struct gdbarch *gdbarch, CORE_ADDR frame_args_skip);
+
+diff --git gdb/gdbarch.sh gdb/gdbarch.sh
+index 48fcebd19a..63bfbad7d9 100755
+--- gdb/gdbarch.sh
++++ gdb/gdbarch.sh
+@@ -602,6 +602,14 @@ m;int;remote_register_number;int regno;regno;;default_remote_register_number;;0
+
+ # Fetch the target specific address used to represent a load module.
+ F;CORE_ADDR;fetch_tls_load_module_address;struct objfile *objfile;objfile
++
++# Return the thread-local address at OFFSET in the thread-local
++# storage for the thread PTID and the shared library or executable
++# file given by LM_ADDR. If that block of thread-local storage hasn't
++# been allocated yet, this function may throw an error. LM_ADDR may
++# be zero for statically linked multithreaded inferiors.
++
++M;CORE_ADDR;get_thread_local_address;ptid_t ptid, CORE_ADDR lm_addr, CORE_ADDR offset;ptid, lm_addr, offset
+ #
+ v;CORE_ADDR;frame_args_skip;;;0;;;0
+ m;CORE_ADDR;unwind_pc;struct frame_info *next_frame;next_frame;;default_unwind_pc;;0
+diff --git gdb/target.c gdb/target.c
+index 8579c19d05..c27157d209 100644
+--- gdb/target.c
++++ gdb/target.c
+@@ -698,8 +698,9 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
+ {
+ volatile CORE_ADDR addr = 0;
+ struct target_ops *target = current_top_target ();
++ struct gdbarch *gdbarch = target_gdbarch ();
+
+- if (gdbarch_fetch_tls_load_module_address_p (target_gdbarch ()))
++ if (gdbarch_fetch_tls_load_module_address_p (gdbarch))
+ {
+ ptid_t ptid = inferior_ptid;
+
+@@ -708,10 +709,14 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
+ CORE_ADDR lm_addr;
+
+ /* Fetch the load module address for this objfile. */
+- lm_addr = gdbarch_fetch_tls_load_module_address (target_gdbarch (),
++ lm_addr = gdbarch_fetch_tls_load_module_address (gdbarch,
+ objfile);
+
+- addr = target->get_thread_local_address (ptid, lm_addr, offset);
++ if (gdbarch_get_thread_local_address_p (gdbarch))
++ addr = gdbarch_get_thread_local_address (gdbarch, ptid, lm_addr,
++ offset);
++ else
++ addr = target->get_thread_local_address (ptid, lm_addr, offset);
+ }
+ /* If an error occurred, print TLS related messages here. Otherwise,
+ throw the error to some higher catcher. */
+@@ -766,8 +771,6 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset)
+ }
+ END_CATCH
+ }
+- /* It wouldn't be wrong here to try a gdbarch method, too; finding
+- TLS is an ABI-specific thing. But we don't do that yet. */
+ else
+ error (_("Cannot find thread-local variables on this target"));
+
Index: head/devel/gdb/files/commit-8399425f5f
===================================================================
--- head/devel/gdb/files/commit-8399425f5f
+++ head/devel/gdb/files/commit-8399425f5f
@@ -0,0 +1,69 @@
+commit 8399425f5f472ad8e630bb30ad2dbefeddbb68b7
+Author: John Baldwin <jhb@FreeBSD.org>
+Date: Tue Mar 12 13:39:02 2019 -0700
+
+ Support TLS variables on FreeBSD/powerpc.
+
+ Derive the pointer to the DTV array from the %r2 register on 32-bit
+ powerpc and %r13 on 64-bit powerpc.
+
+ gdb/ChangeLog:
+
+ * ppc-fbsd-tdep.c (ppcfbsd_get_thread_local_address): New.
+ (ppcfbsd_init_abi): Install gdbarch
+ "fetch_tls_load_module_address" and "get_thread_local_address"
+ methods.
+
+diff --git gdb/ppc-fbsd-tdep.c gdb/ppc-fbsd-tdep.c
+index c21a52c898..290bd1fd88 100644
+--- gdb/ppc-fbsd-tdep.c
++++ gdb/ppc-fbsd-tdep.c
+@@ -279,6 +279,39 @@ ppcfbsd_return_value (struct gdbarch *gdbarch, struct value *function,
+ regcache, readbuf, writebuf);
+ }
+
++/* Implement the "get_thread_local_address" gdbarch method. */
++
++static CORE_ADDR
++ppcfbsd_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid,
++ CORE_ADDR lm_addr, CORE_ADDR offset)
++{
++ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
++ struct regcache *regcache;
++ int tp_offset, tp_regnum;
++
++ regcache = get_thread_arch_regcache (ptid, gdbarch);
++
++ if (tdep->wordsize == 4)
++ {
++ tp_offset = 0x7008;
++ tp_regnum = PPC_R0_REGNUM + 2;
++ }
++ else
++ {
++ tp_offset = 0x7010;
++ tp_regnum = PPC_R0_REGNUM + 13;
++ }
++ target_fetch_registers (regcache, tp_regnum);
++
++ ULONGEST tp;
++ if (regcache->cooked_read (tp_regnum, &tp) != REG_VALID)
++ error (_("Unable to fetch tcb pointer"));
++
++ /* tp points to the end of the TCB block. The first member of the
++ TCB is the pointer to the DTV array. */
++ CORE_ADDR dtv_addr = tp - tp_offset;
++ return fbsd_get_thread_local_address (gdbarch, dtv_addr, lm_addr, offset);
++}
+
+ static void
+ ppcfbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+@@ -322,6 +355,8 @@ ppcfbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+
+ set_gdbarch_fetch_tls_load_module_address (gdbarch,
+ svr4_fetch_objfile_link_map);
++ set_gdbarch_get_thread_local_address (gdbarch,
++ ppcfbsd_get_thread_local_address);
+ }
+
+ void
Index: head/devel/gdb/files/commit-8aa0243d54
===================================================================
--- head/devel/gdb/files/commit-8aa0243d54
+++ head/devel/gdb/files/commit-8aa0243d54
@@ -1,197 +0,0 @@
-commit 739ab2e92e1840c9285f3cfce1f1236c0fa68730
-Author: Simon Ser <contact@emersion.fr>
-Date: Thu Sep 6 15:03:19 2018 -0700
-
- Generate NT_PROCSTAT_{AUXV,VMMAP,PS_STRINGS} in FreeBSD coredumps
-
- gcore generates NT_AUXV and NT_FILE notes for Linux targets. On
- FreeBSD auxv is stored in a NT_PROCSTAT_AUXV section, virtual memory
- mappings are stored in a NT_PROCSTAT_VMMAP, and both are prefixed with
- the struct size. In addition, store a NT_PROCSTAT_PS_STRINGS note
- saving the initial location of the argv[] and environment[] arrays.
-
- gdb/ChangeLog:
-
- PR gdb/23105
- * fbsd-nat.c (fbsd_nat_target::xfer_partial): Add support for
- TARGET_OBJECT_FREEBSD_VMMAP and TARGET_OBJECT_FREEBSD_PS_STRINGS.
- * fbsd-tdep.c (fbsd_make_note_desc): New.
- (fbsd_make_corefile_notes): Write NT_PROCSTAT_AUXV,
- NT_PROCSTAT_VMMAP and NT_PROCSTAT_PS_STRINGS notes.
- * target.h (enum target_object) Add FreeBSD-specific
- TARGET_OBJECT_FREEBSD_VMMAP and TARGET_OBJECT_FREEBSD_PS_STRINGS.
-
-diff --git gdb/ChangeLog gdb/ChangeLog
-index 410fbef920..e6f44a3ac2 100644
---- gdb/ChangeLog
-+++ gdb/ChangeLog
-@@ -1,3 +1,14 @@
-+2018-09-06 Simon Ser <contact@emersion.fr>
-+
-+ PR gdb/23105
-+ * fbsd-nat.c (fbsd_nat_target::xfer_partial): Add support for
-+ TARGET_OBJECT_FREEBSD_VMMAP and TARGET_OBJECT_FREEBSD_PS_STRINGS.
-+ * fbsd-tdep.c (fbsd_make_note_desc): New.
-+ (fbsd_make_corefile_notes): Write NT_PROCSTAT_AUXV,
-+ NT_PROCSTAT_VMMAP and NT_PROCSTAT_PS_STRINGS notes.
-+ * target.h (enum target_object) Add FreeBSD-specific
-+ TARGET_OBJECT_FREEBSD_VMMAP and TARGET_OBJECT_FREEBSD_PS_STRINGS.
-+
- 2018-09-06 Simon Marchi <simon.marchi@ericsson.com>
-
- * compile/compile-c.h (generate_c_for_variable_locations):
-diff --git gdb/fbsd-nat.c gdb/fbsd-nat.c
-index 115deac070..a255318d14 100644
---- gdb/fbsd-nat.c
-+++ gdb/fbsd-nat.c
-@@ -751,6 +751,61 @@ fbsd_nat_target::xfer_partial (enum target_object object,
- }
- return TARGET_XFER_E_IO;
- }
-+ case TARGET_OBJECT_FREEBSD_VMMAP:
-+ case TARGET_OBJECT_FREEBSD_PS_STRINGS:
-+ {
-+ gdb::byte_vector buf_storage;
-+ gdb_byte *buf;
-+ size_t buflen;
-+ int mib[4];
-+
-+ int proc_target;
-+ uint32_t struct_size;
-+ switch (object)
-+ {
-+ case TARGET_OBJECT_FREEBSD_VMMAP:
-+ proc_target = KERN_PROC_VMMAP;
-+ struct_size = sizeof (struct kinfo_vmentry);
-+ break;
-+ case TARGET_OBJECT_FREEBSD_PS_STRINGS:
-+ proc_target = KERN_PROC_PS_STRINGS;
-+ struct_size = sizeof (void *);
-+ break;
-+ }
-+
-+ if (writebuf != NULL)
-+ return TARGET_XFER_E_IO;
-+
-+ mib[0] = CTL_KERN;
-+ mib[1] = KERN_PROC;
-+ mib[2] = proc_target;
-+ mib[3] = pid;
-+
-+ if (sysctl (mib, 4, NULL, &buflen, NULL, 0) != 0)
-+ return TARGET_XFER_E_IO;
-+ buflen += sizeof (struct_size);
-+
-+ if (offset >= buflen)
-+ {
-+ *xfered_len = 0;
-+ return TARGET_XFER_EOF;
-+ }
-+
-+ buf_storage.resize (buflen);
-+ buf = buf_storage.data ();
-+
-+ memcpy (buf, &struct_size, sizeof (struct_size));
-+ buflen -= sizeof (struct_size);
-+ if (sysctl (mib, 4, buf + sizeof (struct_size), &buflen, NULL, 0) != 0)
-+ return TARGET_XFER_E_IO;
-+ buflen += sizeof (struct_size);
-+
-+ if (buflen - offset < len)
-+ len = buflen - offset;
-+ memcpy (readbuf, buf + offset, len);
-+ *xfered_len = len;
-+ return TARGET_XFER_OK;
-+ }
- default:
- return inf_ptrace_target::xfer_partial (object, annex,
- readbuf, writebuf, offset,
-diff --git gdb/fbsd-tdep.c gdb/fbsd-tdep.c
-index 78d0c3d830..ed43087169 100644
---- gdb/fbsd-tdep.c
-+++ gdb/fbsd-tdep.c
-@@ -512,6 +512,28 @@ fbsd_corefile_thread (struct thread_info *info,
- args->note_size, args->stop_signal);
- }
-
-+/* Return a byte_vector containing the contents of a core dump note
-+ for the target object of type OBJECT. If STRUCTSIZE is non-zero,
-+ the data is prefixed with a 32-bit integer size to match the format
-+ used in FreeBSD NT_PROCSTAT_* notes. */
-+
-+static gdb::optional<gdb::byte_vector>
-+fbsd_make_note_desc (enum target_object object, uint32_t structsize)
-+{
-+ gdb::optional<gdb::byte_vector> buf =
-+ target_read_alloc (current_top_target (), object, NULL);
-+ if (!buf || buf->empty ())
-+ return {};
-+
-+ if (structsize == 0)
-+ return buf;
-+
-+ gdb::byte_vector desc (sizeof (structsize) + buf->size ());
-+ memcpy (desc.data (), &structsize, sizeof (structsize));
-+ memcpy (desc.data () + sizeof (structsize), buf->data (), buf->size ());
-+ return desc;
-+}
-+
- /* Create appropriate note sections for a corefile, returning them in
- allocated memory. */
-
-@@ -586,6 +608,40 @@ fbsd_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
-
- note_data = thread_args.note_data;
-
-+ /* Auxiliary vector. */
-+ uint32_t structsize = gdbarch_ptr_bit (gdbarch) / 4; /* Elf_Auxinfo */
-+ gdb::optional<gdb::byte_vector> note_desc =
-+ fbsd_make_note_desc (TARGET_OBJECT_AUXV, structsize);
-+ if (note_desc && !note_desc->empty ())
-+ {
-+ note_data = elfcore_write_note (obfd, note_data, note_size, "FreeBSD",
-+ NT_FREEBSD_PROCSTAT_AUXV,
-+ note_desc->data (), note_desc->size ());
-+ if (!note_data)
-+ return NULL;
-+ }
-+
-+ /* Virtual memory mappings. */
-+ note_desc = fbsd_make_note_desc (TARGET_OBJECT_FREEBSD_VMMAP, 0);
-+ if (note_desc && !note_desc->empty ())
-+ {
-+ note_data = elfcore_write_note (obfd, note_data, note_size, "FreeBSD",
-+ NT_FREEBSD_PROCSTAT_VMMAP,
-+ note_desc->data (), note_desc->size ());
-+ if (!note_data)
-+ return NULL;
-+ }
-+
-+ note_desc = fbsd_make_note_desc (TARGET_OBJECT_FREEBSD_PS_STRINGS, 0);
-+ if (note_desc && !note_desc->empty ())
-+ {
-+ note_data = elfcore_write_note (obfd, note_data, note_size, "FreeBSD",
-+ NT_FREEBSD_PROCSTAT_PSSTRINGS,
-+ note_desc->data (), note_desc->size ());
-+ if (!note_data)
-+ return NULL;
-+ }
-+
- return note_data;
- }
-
-diff --git gdb/target.h gdb/target.h
-index 229b5d0551..a3000c80c6 100644
---- gdb/target.h
-+++ gdb/target.h
-@@ -202,6 +202,10 @@ enum target_object
- of the process ID of the process in question, in hexadecimal
- format. */
- TARGET_OBJECT_EXEC_FILE,
-+ /* FreeBSD virtual memory mappings. */
-+ TARGET_OBJECT_FREEBSD_VMMAP,
-+ /* FreeBSD process strings. */
-+ TARGET_OBJECT_FREEBSD_PS_STRINGS,
- /* Possible future objects: TARGET_OBJECT_FILE, ... */
- };
-
Index: head/devel/gdb/files/commit-93579f6f90
===================================================================
--- head/devel/gdb/files/commit-93579f6f90
+++ head/devel/gdb/files/commit-93579f6f90
@@ -1,57 +0,0 @@
-commit 93579f6f908fa6010b141fd5da2974d878869c80
-Author: John Baldwin <jhb@FreeBSD.org>
-Date: Fri Nov 30 15:14:18 2018 -0800
-
- Use kinfo_getfile to implement fdwalk on FreeBSD.
-
- kinfo_getfile() requires a couple of system calls to fetch the list of
- open file descriptors. This can be much cheaper than invoking fstat
- on all of the values from 0 to the open file resource limit maximum.
-
- gdb/ChangeLog:
-
- * common/filestuff.c [HAVE_KINFO_GETFILE]: Include headers.
- (fdwalk) [HAVE_KINFO_GETFILE]: Use kinfo_getfile.
-
-diff --git gdb/common/filestuff.c gdb/common/filestuff.c
-index 0db5c6936b..f4d5e38f07 100644
---- gdb/common/filestuff.c
-+++ gdb/common/filestuff.c
-@@ -36,6 +36,11 @@
- #define HAVE_SOCKETS 1
- #endif
-
-+#ifdef HAVE_KINFO_GETFILE
-+#include <sys/user.h>
-+#include <libutil.h>
-+#endif
-+
- #ifdef HAVE_SYS_RESOURCE_H
- #include <sys/resource.h>
- #endif /* HAVE_SYS_RESOURCE_H */
-@@ -108,6 +113,25 @@ fdwalk (int (*func) (void *, int), void *arg)
- }
- /* We may fall through to the next case. */
- #endif
-+#ifdef HAVE_KINFO_GETFILE
-+ int nfd;
-+ gdb::unique_xmalloc_ptr<struct kinfo_file[]> fdtbl
-+ (kinfo_getfile (getpid (), &nfd));
-+ if (fdtbl != NULL)
-+ {
-+ for (int i = 0; i < nfd; i++)
-+ {
-+ if (fdtbl[i].kf_fd >= 0)
-+ {
-+ int result = func (arg, fdtbl[i].kf_fd);
-+ if (result != 0)
-+ return result;
-+ }
-+ }
-+ return 0;
-+ }
-+ /* We may fall through to the next case. */
-+#endif
-
- {
- int max, fd;
Index: head/devel/gdb/files/commit-945f3901b5
===================================================================
--- head/devel/gdb/files/commit-945f3901b5
+++ head/devel/gdb/files/commit-945f3901b5
@@ -0,0 +1,224 @@
+commit 945f3901b5889e57edf5a2ee25acb51f0078a719
+Author: John Baldwin <jhb@FreeBSD.org>
+Date: Tue Mar 12 13:39:02 2019 -0700
+
+ Add a helper function to resolve TLS variable addresses for FreeBSD.
+
+ The fbsd_get_thread_local_address function accepts the base address of
+ a thread's DTV array and the base address of an object file's link map
+ and uses this to compute a TLS variable's address. FreeBSD
+ architectures use an architecture-specific method to determine the
+ address of the DTV array pointer and call this helper function to
+ perform the rest of the address calculation.
+
+ * fbsd-tdep.c (fbsd_pspace_data_handle): New variable.
+ (struct fbsd_pspace_data): New type.
+ (get_fbsd_pspace_data, fbsd_pspace_data_cleanup)
+ (fbsd_read_integer_by_name, fbsd_fetch_rtld_offsets)
+ (fbsd_get_tls_index, fbsd_get_thread_local_address): New function.
+ (_initialize_fbsd_tdep): Initialize 'fbsd_pspace_data_handle'.
+ * fbsd-tdep.c (fbsd_get_thread_local_address): New prototype.
+
+diff --git gdb/fbsd-tdep.c gdb/fbsd-tdep.c
+index d971d3a653..f06836216d 100644
+--- gdb/fbsd-tdep.c
++++ gdb/fbsd-tdep.c
+@@ -24,6 +24,7 @@
+ #include "regcache.h"
+ #include "regset.h"
+ #include "gdbthread.h"
++#include "objfiles.h"
+ #include "xml-syscall.h"
+ #include <sys/socket.h>
+ #include <arpa/inet.h>
+@@ -444,6 +445,41 @@ get_fbsd_gdbarch_data (struct gdbarch *gdbarch)
+ gdbarch_data (gdbarch, fbsd_gdbarch_data_handle));
+ }
+
++/* Per-program-space data for FreeBSD architectures. */
++static const struct program_space_data *fbsd_pspace_data_handle;
++
++struct fbsd_pspace_data
++{
++ /* Offsets in the runtime linker's 'Obj_Entry' structure. */
++ LONGEST off_linkmap;
++ LONGEST off_tlsindex;
++ bool rtld_offsets_valid;
++};
++
++static struct fbsd_pspace_data *
++get_fbsd_pspace_data (struct program_space *pspace)
++{
++ struct fbsd_pspace_data *data;
++
++ data = ((struct fbsd_pspace_data *)
++ program_space_data (pspace, fbsd_pspace_data_handle));
++ if (data == NULL)
++ {
++ data = XCNEW (struct fbsd_pspace_data);
++ set_program_space_data (pspace, fbsd_pspace_data_handle, data);
++ }
++
++ return data;
++}
++
++/* The cleanup callback for FreeBSD architecture per-program-space data. */
++
++static void
++fbsd_pspace_data_cleanup (struct program_space *pspace, void *data)
++{
++ xfree (data);
++}
++
+ /* This is how we want PTIDs from core files to be printed. */
+
+ static const char *
+@@ -1932,6 +1968,121 @@ fbsd_get_syscall_number (struct gdbarch *gdbarch, thread_info *thread)
+ internal_error (__FILE__, __LINE__, _("fbsd_get_sycall_number called"));
+ }
+
++/* Read an integer symbol value from the current target. */
++
++static LONGEST
++fbsd_read_integer_by_name (struct gdbarch *gdbarch, const char *name)
++{
++ bound_minimal_symbol ms = lookup_minimal_symbol (name, NULL, NULL);
++ if (ms.minsym == NULL)
++ error (_("Unable to resolve symbol '%s'"), name);
++
++ gdb_byte buf[4];
++ if (target_read_memory (BMSYMBOL_VALUE_ADDRESS (ms), buf, sizeof buf) != 0)
++ error (_("Unable to read value of '%s'"), name);
++
++ return extract_signed_integer (buf, sizeof buf, gdbarch_byte_order (gdbarch));
++}
++
++/* Lookup offsets of fields in the runtime linker's 'Obj_Entry'
++ structure needed to determine the TLS index of an object file. */
++
++static void
++fbsd_fetch_rtld_offsets (struct gdbarch *gdbarch, struct fbsd_pspace_data *data)
++{
++ TRY
++ {
++ /* Fetch offsets from debug symbols in rtld. */
++ struct symbol *obj_entry_sym
++ = lookup_symbol_in_language ("Struct_Obj_Entry", NULL, STRUCT_DOMAIN,
++ language_c, NULL).symbol;
++ if (obj_entry_sym == NULL)
++ error (_("Unable to find Struct_Obj_Entry symbol"));
++ data->off_linkmap = lookup_struct_elt (SYMBOL_TYPE(obj_entry_sym),
++ "linkmap", 0).offset / 8;
++ data->off_tlsindex = lookup_struct_elt (SYMBOL_TYPE(obj_entry_sym),
++ "tlsindex", 0).offset / 8;
++ data->rtld_offsets_valid = true;
++ return;
++ }
++ CATCH (e, RETURN_MASK_ERROR)
++ {
++ data->off_linkmap = -1;
++ }
++ END_CATCH
++
++ TRY
++ {
++ /* Fetch offsets from global variables in libthr. Note that
++ this does not work for single-threaded processes that are not
++ linked against libthr. */
++ data->off_linkmap = fbsd_read_integer_by_name (gdbarch,
++ "_thread_off_linkmap");
++ data->off_tlsindex = fbsd_read_integer_by_name (gdbarch,
++ "_thread_off_tlsindex");
++ data->rtld_offsets_valid = true;
++ return;
++ }
++ CATCH (e, RETURN_MASK_ERROR)
++ {
++ data->off_linkmap = -1;
++ }
++ END_CATCH
++}
++
++/* Helper function to read the TLS index of an object file associated
++ with a link map entry at LM_ADDR. */
++
++static LONGEST
++fbsd_get_tls_index (struct gdbarch *gdbarch, CORE_ADDR lm_addr)
++{
++ struct fbsd_pspace_data *data = get_fbsd_pspace_data (current_program_space);
++
++ if (!data->rtld_offsets_valid)
++ fbsd_fetch_rtld_offsets (gdbarch, data);
++
++ if (data->off_linkmap == -1)
++ throw_error (TLS_GENERIC_ERROR,
++ _("Cannot fetch runtime linker structure offsets"));
++
++ /* Simulate container_of to convert from LM_ADDR to the Obj_Entry
++ pointer and then compute the offset of the tlsindex member. */
++ CORE_ADDR tlsindex_addr = lm_addr - data->off_linkmap + data->off_tlsindex;
++
++ gdb_byte buf[4];
++ if (target_read_memory (tlsindex_addr, buf, sizeof buf) != 0)
++ throw_error (TLS_GENERIC_ERROR,
++ _("Cannot find thread-local variables on this target"));
++
++ return extract_signed_integer (buf, sizeof buf, gdbarch_byte_order (gdbarch));
++}
++
++/* See fbsd-tdep.h. */
++
++CORE_ADDR
++fbsd_get_thread_local_address (struct gdbarch *gdbarch, CORE_ADDR dtv_addr,
++ CORE_ADDR lm_addr, CORE_ADDR offset)
++{
++ LONGEST tls_index = fbsd_get_tls_index (gdbarch, lm_addr);
++
++ gdb_byte buf[gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT];
++ if (target_read_memory (dtv_addr, buf, sizeof buf) != 0)
++ throw_error (TLS_GENERIC_ERROR,
++ _("Cannot find thread-local variables on this target"));
++
++ const struct builtin_type *builtin = builtin_type (gdbarch);
++ CORE_ADDR addr = gdbarch_pointer_to_address (gdbarch,
++ builtin->builtin_data_ptr, buf);
++
++ addr += (tls_index + 1) * TYPE_LENGTH (builtin->builtin_data_ptr);
++ if (target_read_memory (addr, buf, sizeof buf) != 0)
++ throw_error (TLS_GENERIC_ERROR,
++ _("Cannot find thread-local variables on this target"));
++
++ addr = gdbarch_pointer_to_address (gdbarch, builtin->builtin_data_ptr, buf);
++ return addr + offset;
++}
++
+ /* To be called from GDB_OSABI_FREEBSD handlers. */
+
+ void
+@@ -1957,4 +2108,6 @@ _initialize_fbsd_tdep (void)
+ {
+ fbsd_gdbarch_data_handle =
+ gdbarch_data_register_post_init (init_fbsd_gdbarch_data);
++ fbsd_pspace_data_handle
++ = register_program_space_data_with_cleanup (NULL, fbsd_pspace_data_cleanup);
+ }
+diff --git gdb/fbsd-tdep.h gdb/fbsd-tdep.h
+index efd7c2c78f..0e29508c9f 100644
+--- gdb/fbsd-tdep.h
++++ gdb/fbsd-tdep.h
+@@ -60,4 +60,15 @@ extern void fbsd_info_proc_mappings_entry (int addr_bit, ULONGEST kve_start,
+ int kve_flags, int kve_protection,
+ const void *kve_path);
+
++/* Helper function to fetch the address of a thread-local variable.
++ DTV_ADDR is the base address of the thread's dtv array. LM_ADDR is
++ the address of the link_map structure for the associated object
++ file. OFFSET is the offset of the variable in the object file's
++ thread-local variable block. */
++
++extern CORE_ADDR fbsd_get_thread_local_address (struct gdbarch *gdbarch,
++ CORE_ADDR dtv_addr,
++ CORE_ADDR lm_addr,
++ CORE_ADDR offset);
++
+ #endif /* fbsd-tdep.h */
Index: head/devel/gdb/files/commit-b0f87ed032
===================================================================
--- head/devel/gdb/files/commit-b0f87ed032
+++ head/devel/gdb/files/commit-b0f87ed032
@@ -0,0 +1,60 @@
+commit b0f87ed032bb68a9965de81cbf9fd676a83b9174
+Author: John Baldwin <jhb@FreeBSD.org>
+Date: Tue Mar 12 13:39:02 2019 -0700
+
+ Support TLS variables on FreeBSD/riscv.
+
+ Derive the pointer to the DTV array from the tp register.
+
+ gdb/ChangeLog:
+
+ * riscv-fbsd-tdep.c (riscv_fbsd_get_thread_local_address): New.
+ (riscv_fbsd_init_abi): Install gdbarch
+ "fetch_tls_load_module_address" and "get_thread_local_address"
+ methods.
+
+diff --git gdb/riscv-fbsd-tdep.c gdb/riscv-fbsd-tdep.c
+index 97ad28f59a..3125a2285e 100644
+--- gdb/riscv-fbsd-tdep.c
++++ gdb/riscv-fbsd-tdep.c
+@@ -174,6 +174,28 @@ static const struct tramp_frame riscv_fbsd_sigframe =
+ riscv_fbsd_sigframe_init
+ };
+
++/* Implement the "get_thread_local_address" gdbarch method. */
++
++static CORE_ADDR
++riscv_fbsd_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid,
++ CORE_ADDR lm_addr, CORE_ADDR offset)
++{
++ struct regcache *regcache;
++
++ regcache = get_thread_arch_regcache (ptid, gdbarch);
++
++ target_fetch_registers (regcache, RISCV_TP_REGNUM);
++
++ ULONGEST tp;
++ if (regcache->cooked_read (RISCV_TP_REGNUM, &tp) != REG_VALID)
++ error (_("Unable to fetch %%tp"));
++
++ /* %tp points to the end of the TCB which contains two pointers.
++ The first pointer in the TCB points to the DTV array. */
++ CORE_ADDR dtv_addr = tp - (gdbarch_ptr_bit (gdbarch) / 8) * 2;
++ return fbsd_get_thread_local_address (gdbarch, dtv_addr, lm_addr, offset);
++}
++
+ /* Implement the 'init_osabi' method of struct gdb_osabi_handler. */
+
+ static void
+@@ -193,6 +215,11 @@ riscv_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+
+ set_gdbarch_iterate_over_regset_sections
+ (gdbarch, riscv_fbsd_iterate_over_regset_sections);
++
++ set_gdbarch_fetch_tls_load_module_address (gdbarch,
++ svr4_fetch_objfile_link_map);
++ set_gdbarch_get_thread_local_address (gdbarch,
++ riscv_fbsd_get_thread_local_address);
+ }
+
+ void
Index: head/devel/gdb/files/commit-cd250a1898
===================================================================
--- head/devel/gdb/files/commit-cd250a1898
+++ head/devel/gdb/files/commit-cd250a1898
@@ -0,0 +1,30 @@
+commit cd250a1898bb6fdb41f4a1063dbcfac04affcd11
+Author: John Baldwin <jhb@FreeBSD.org>
+Date: Tue Mar 12 13:39:02 2019 -0700
+
+ Update comment for target::get_thread_local_address.
+
+ There isn't an 'objfile' parameter, instead 'load_module_addr' is used
+ to indicate the executable or shared library. Also, the function
+ throws errors rather than returning error values.
+
+ gdb/ChangeLog:
+
+ * target.h (target::get_thread_local_address): Update comment.
+
+diff --git gdb/target.h gdb/target.h
+index c95151a404..5fe6aa74b0 100644
+--- gdb/target.h
++++ gdb/target.h
+@@ -718,9 +718,9 @@ struct target_ops
+ TARGET_DEFAULT_NORETURN (tcomplain ());
+ /* Return the thread-local address at OFFSET in the
+ thread-local storage for the thread PTID and the shared library
+- or executable file given by OBJFILE. If that block of
++ or executable file given by LOAD_MODULE_ADDR. If that block of
+ thread-local storage hasn't been allocated yet, this function
+- may return an error. LOAD_MODULE_ADDR may be zero for statically
++ may throw an error. LOAD_MODULE_ADDR may be zero for statically
+ linked multithreaded inferiors. */
+ virtual CORE_ADDR get_thread_local_address (ptid_t ptid,
+ CORE_ADDR load_module_addr,
Index: head/devel/gdb/files/commit-ce25aa57a3
===================================================================
--- head/devel/gdb/files/commit-ce25aa57a3
+++ head/devel/gdb/files/commit-ce25aa57a3
@@ -0,0 +1,64 @@
+commit ce25aa57a3cdd028be5868423e6e55506ccd1053
+Author: John Baldwin <jhb@FreeBSD.org>
+Date: Tue Mar 12 13:39:02 2019 -0700
+
+ Support TLS variables on FreeBSD/i386.
+
+ Derive the pointer to the DTV array from the gs_base register. As
+ with FreeBSD/amd64, gs_base is currently only available via the native
+ target.
+
+ gdb/ChangeLog:
+
+ * i386-fbsd-tdep.c (i386fbsd_get_thread_local_address): New.
+ (i386fbsd_init_abi): Install gdbarch
+ "fetch_tls_load_module_address" and "get_thread_local_address"
+ methods.
+
+diff --git gdb/i386-fbsd-tdep.c gdb/i386-fbsd-tdep.c
+index ac57e7383d..f274847174 100644
+--- gdb/i386-fbsd-tdep.c
++++ gdb/i386-fbsd-tdep.c
+@@ -320,6 +320,30 @@ i386fbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
+ "XSAVE extended state", cb_data);
+ }
+
++/* Implement the get_thread_local_address gdbarch method. */
++
++static CORE_ADDR
++i386fbsd_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid,
++ CORE_ADDR lm_addr, CORE_ADDR offset)
++{
++ struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
++ struct regcache *regcache;
++
++ if (tdep->fsbase_regnum == -1)
++ error (_("Unable to fetch %%gsbase"));
++
++ regcache = get_thread_arch_regcache (ptid, gdbarch);
++
++ target_fetch_registers (regcache, tdep->fsbase_regnum + 1);
++
++ ULONGEST gsbase;
++ if (regcache->cooked_read (tdep->fsbase_regnum + 1, &gsbase) != REG_VALID)
++ error (_("Unable to fetch %%gsbase"));
++
++ CORE_ADDR dtv_addr = gsbase + gdbarch_ptr_bit (gdbarch) / 8;
++ return fbsd_get_thread_local_address (gdbarch, dtv_addr, lm_addr, offset);
++}
++
+ static void
+ i386fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+ {
+@@ -418,6 +442,11 @@ i386fbsd4_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+
+ set_gdbarch_core_read_description (gdbarch,
+ i386fbsd_core_read_description);
++
++ set_gdbarch_fetch_tls_load_module_address (gdbarch,
++ svr4_fetch_objfile_link_map);
++ set_gdbarch_get_thread_local_address (gdbarch,
++ i386fbsd_get_thread_local_address);
+ }
+
+ void
Index: head/devel/gdb/files/commit-dd6876c91c
===================================================================
--- head/devel/gdb/files/commit-dd6876c91c
+++ head/devel/gdb/files/commit-dd6876c91c
@@ -0,0 +1,237 @@
+commit dd6876c91cd40cc105b1a91f418ca2c80683b314
+Author: John Baldwin <jhb@FreeBSD.org>
+Date: Tue Mar 12 13:39:02 2019 -0700
+
+ Support fs_base and gs_base on FreeBSD/i386.
+
+ The i386 BSD native target uses the same ptrace operations
+ (PT_[GS]ET[FG]SBASE) as the amd64 BSD native target to fetch and store
+ the registers.
+
+ The amd64 BSD native now uses 'tdep->fsbase_regnum' instead of
+ hardcoding AMD64_FSBASE_REGNUM and AMD64_GSBASE_REGNUM to support
+ 32-bit targets. In addition, the store operations explicitly zero the
+ new register value before fetching it from the register cache to
+ ensure 32-bit values are zero-extended.
+
+ gdb/ChangeLog:
+
+ * amd64-bsd-nat.c (amd64bsd_fetch_inferior_registers): Use
+ tdep->fsbase_regnum instead of constants for fs_base and gs_base.
+ (amd64bsd_store_inferior_registers): Likewise.
+ * amd64-fbsd-nat.c (amd64_fbsd_nat_target::read_description):
+ Enable segment base registers.
+ * i386-bsd-nat.c (i386bsd_fetch_inferior_registers): Use
+ PT_GETFSBASE and PT_GETGSBASE.
+ (i386bsd_store_inferior_registers): Use PT_SETFSBASE and
+ PT_SETGSBASE.
+ * i386-fbsd-nat.c (i386_fbsd_nat_target::read_description): Enable
+ segment base registers.
+ * i386-fbsd-tdep.c (i386fbsd_core_read_description): Likewise.
+
+diff --git gdb/amd64-bsd-nat.c gdb/amd64-bsd-nat.c
+index a2a91abb91..35763a5b95 100644
+--- gdb/amd64-bsd-nat.c
++++ gdb/amd64-bsd-nat.c
+@@ -43,6 +43,9 @@ amd64bsd_fetch_inferior_registers (struct regcache *regcache, int regnum)
+ {
+ struct gdbarch *gdbarch = regcache->arch ();
+ pid_t pid = get_ptrace_pid (regcache->ptid ());
++#if defined(PT_GETFSBASE) || defined(PT_GETGSBASE)
++ const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
++#endif
+
+ if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum))
+ {
+@@ -57,27 +60,27 @@ amd64bsd_fetch_inferior_registers (struct regcache *regcache, int regnum)
+ }
+
+ #ifdef PT_GETFSBASE
+- if (regnum == -1 || regnum == AMD64_FSBASE_REGNUM)
++ if (regnum == -1 || regnum == tdep->fsbase_regnum)
+ {
+ register_t base;
+
+ if (ptrace (PT_GETFSBASE, pid, (PTRACE_TYPE_ARG3) &base, 0) == -1)
+ perror_with_name (_("Couldn't get segment register fs_base"));
+
+- regcache->raw_supply (AMD64_FSBASE_REGNUM, &base);
++ regcache->raw_supply (tdep->fsbase_regnum, &base);
+ if (regnum != -1)
+ return;
+ }
+ #endif
+ #ifdef PT_GETGSBASE
+- if (regnum == -1 || regnum == AMD64_GSBASE_REGNUM)
++ if (regnum == -1 || regnum == tdep->fsbase_regnum + 1)
+ {
+ register_t base;
+
+ if (ptrace (PT_GETGSBASE, pid, (PTRACE_TYPE_ARG3) &base, 0) == -1)
+ perror_with_name (_("Couldn't get segment register gs_base"));
+
+- regcache->raw_supply (AMD64_GSBASE_REGNUM, &base);
++ regcache->raw_supply (tdep->fsbase_regnum + 1, &base);
+ if (regnum != -1)
+ return;
+ }
+@@ -116,6 +119,9 @@ amd64bsd_store_inferior_registers (struct regcache *regcache, int regnum)
+ {
+ struct gdbarch *gdbarch = regcache->arch ();
+ pid_t pid = get_ptrace_pid (regcache->ptid ());
++#if defined(PT_SETFSBASE) || defined(PT_SETGSBASE)
++ const struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
++#endif
+
+ if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum))
+ {
+@@ -134,11 +140,13 @@ amd64bsd_store_inferior_registers (struct regcache *regcache, int regnum)
+ }
+
+ #ifdef PT_SETFSBASE
+- if (regnum == -1 || regnum == AMD64_FSBASE_REGNUM)
++ if (regnum == -1 || regnum == tdep->fsbase_regnum)
+ {
+ register_t base;
+
+- regcache->raw_collect (AMD64_FSBASE_REGNUM, &base);
++ /* Clear the full base value to support 32-bit targets. */
++ base = 0;
++ regcache->raw_collect (tdep->fsbase_regnum, &base);
+
+ if (ptrace (PT_SETFSBASE, pid, (PTRACE_TYPE_ARG3) &base, 0) == -1)
+ perror_with_name (_("Couldn't write segment register fs_base"));
+@@ -147,11 +155,13 @@ amd64bsd_store_inferior_registers (struct regcache *regcache, int regnum)
+ }
+ #endif
+ #ifdef PT_SETGSBASE
+- if (regnum == -1 || regnum == AMD64_GSBASE_REGNUM)
++ if (regnum == -1 || regnum == tdep->fsbase_regnum + 1)
+ {
+ register_t base;
+
+- regcache->raw_collect (AMD64_GSBASE_REGNUM, &base);
++ /* Clear the full base value to support 32-bit targets. */
++ base = 0;
++ regcache->raw_collect (tdep->fsbase_regnum + 1, &base);
+
+ if (ptrace (PT_SETGSBASE, pid, (PTRACE_TYPE_ARG3) &base, 0) == -1)
+ perror_with_name (_("Couldn't write segment register gs_base"));
+diff --git gdb/amd64-fbsd-nat.c gdb/amd64-fbsd-nat.c
+index 9fff763dd3..cc676d3214 100644
+--- gdb/amd64-fbsd-nat.c
++++ gdb/amd64-fbsd-nat.c
+@@ -190,13 +190,13 @@ amd64_fbsd_nat_target::read_description ()
+ if (is64)
+ return amd64_target_description (xcr0, true);
+ else
+- return i386_target_description (xcr0, false);
++ return i386_target_description (xcr0, true);
+ }
+ #endif
+ if (is64)
+ return amd64_target_description (X86_XSTATE_SSE_MASK, true);
+ else
+- return i386_target_description (X86_XSTATE_SSE_MASK, false);
++ return i386_target_description (X86_XSTATE_SSE_MASK, true);
+ }
+
+ #if defined(HAVE_PT_GETDBREGS) && defined(USE_SIGTRAP_SIGINFO)
+diff --git gdb/i386-bsd-nat.c gdb/i386-bsd-nat.c
+index 009a8dc1b2..a10b496096 100644
+--- gdb/i386-bsd-nat.c
++++ gdb/i386-bsd-nat.c
+@@ -144,6 +144,33 @@ i386bsd_fetch_inferior_registers (struct regcache *regcache, int regnum)
+ return;
+ }
+
++#ifdef PT_GETFSBASE
++ if (regnum == -1 || regnum == I386_FSBASE_REGNUM)
++ {
++ register_t base;
++
++ if (ptrace (PT_GETFSBASE, pid, (PTRACE_TYPE_ARG3) &base, 0) == -1)
++ perror_with_name (_("Couldn't get segment register fs_base"));
++
++ regcache->raw_supply (I386_FSBASE_REGNUM, &base);
++ if (regnum != -1)
++ return;
++ }
++#endif
++#ifdef PT_GETGSBASE
++ if (regnum == -1 || regnum == I386_GSBASE_REGNUM)
++ {
++ register_t base;
++
++ if (ptrace (PT_GETGSBASE, pid, (PTRACE_TYPE_ARG3) &base, 0) == -1)
++ perror_with_name (_("Couldn't get segment register gs_base"));
++
++ regcache->raw_supply (I386_GSBASE_REGNUM, &base);
++ if (regnum != -1)
++ return;
++ }
++#endif
++
+ if (regnum == -1 || regnum >= I386_ST0_REGNUM)
+ {
+ struct fpreg fpregs;
+@@ -211,6 +238,33 @@ i386bsd_store_inferior_registers (struct regcache *regcache, int regnum)
+ return;
+ }
+
++#ifdef PT_SETFSBASE
++ if (regnum == -1 || regnum == I386_FSBASE_REGNUM)
++ {
++ register_t base;
++
++ regcache->raw_collect (I386_FSBASE_REGNUM, &base);
++
++ if (ptrace (PT_SETFSBASE, pid, (PTRACE_TYPE_ARG3) &base, 0) == -1)
++ perror_with_name (_("Couldn't write segment register fs_base"));
++ if (regnum != -1)
++ return;
++ }
++#endif
++#ifdef PT_SETGSBASE
++ if (regnum == -1 || regnum == I386_GSBASE_REGNUM)
++ {
++ register_t base;
++
++ regcache->raw_collect (I386_GSBASE_REGNUM, &base);
++
++ if (ptrace (PT_SETGSBASE, pid, (PTRACE_TYPE_ARG3) &base, 0) == -1)
++ perror_with_name (_("Couldn't write segment register gs_base"));
++ if (regnum != -1)
++ return;
++ }
++#endif
++
+ if (regnum == -1 || regnum >= I386_ST0_REGNUM)
+ {
+ struct fpreg fpregs;
+diff --git gdb/i386-fbsd-nat.c gdb/i386-fbsd-nat.c
+index 7106e90801..be5d4c67be 100644
+--- gdb/i386-fbsd-nat.c
++++ gdb/i386-fbsd-nat.c
+@@ -160,7 +160,7 @@ i386_fbsd_nat_target::read_description ()
+ if (x86bsd_xsave_len == 0)
+ xcr0 = X86_XSTATE_SSE_MASK;
+
+- return i386_target_description (xcr0, false);
++ return i386_target_description (xcr0, true);
+ }
+ #endif
+
+diff --git gdb/i386-fbsd-tdep.c gdb/i386-fbsd-tdep.c
+index 2f28bad728..ac57e7383d 100644
+--- gdb/i386-fbsd-tdep.c
++++ gdb/i386-fbsd-tdep.c
+@@ -267,7 +267,7 @@ i386fbsd_core_read_description (struct gdbarch *gdbarch,
+ struct target_ops *target,
+ bfd *abfd)
+ {
+- return i386_target_description (i386fbsd_core_read_xcr0 (abfd), false);
++ return i386_target_description (i386fbsd_core_read_xcr0 (abfd), true);
+ }
+
+ /* Similar to i386_supply_fpregset, but use XSAVE extended state. */
Index: head/devel/gdb/files/commit-df22c1e5d5
===================================================================
--- head/devel/gdb/files/commit-df22c1e5d5
+++ head/devel/gdb/files/commit-df22c1e5d5
@@ -0,0 +1,36 @@
+commit df22c1e5d53c38f38bce6072bb46de240f9e0e2b
+Author: John Baldwin <jhb@FreeBSD.org>
+Date: Tue Mar 12 13:39:02 2019 -0700
+
+ Handle an edge case for minisym TLS variable lookups.
+
+ If a TLS variable is provided by a minisym from a separate debug file,
+ the separate debug file is passed to
+ gdbarch_fetch_tls_load_module_address. However, the object files
+ stored in the shared object list are the original object files, not
+ the separate debug object files. In this case,
+ svr4_fetch_objfile_link_map was failing to find the link map entry
+ since the debug object file is not in its internal list, only the
+ original object file.
+
+ gdb/ChangeLog:
+
+ * solib-svr4.c (svr4_fetch_objfile_link_map): Look for
+ objfile->separate_debug_objfile_backlink if not NULL.
+
+diff --git gdb/solib-svr4.c gdb/solib-svr4.c
+index 84693c1766..14a471b6dc 100644
+--- gdb/solib-svr4.c
++++ gdb/solib-svr4.c
+@@ -1551,6 +1551,11 @@ svr4_fetch_objfile_link_map (struct objfile *objfile)
+ if (objfile == symfile_objfile)
+ return info->main_lm_addr;
+
++ /* If OBJFILE is a separate debug object file, look for the
++ original object file. */
++ if (objfile->separate_debug_objfile_backlink != NULL)
++ objfile = objfile->separate_debug_objfile_backlink;
++
+ /* The other link map addresses may be found by examining the list
+ of shared libraries. */
+ for (so = master_so_list (); so; so = so->next)
Index: head/devel/gdb/files/commit-ef0bd2046f
===================================================================
--- head/devel/gdb/files/commit-ef0bd2046f
+++ head/devel/gdb/files/commit-ef0bd2046f
@@ -0,0 +1,165 @@
+commit ef0bd2046f58fac69577892c2d3b44b20d027476
+Author: John Baldwin <jhb@FreeBSD.org>
+Date: Tue Mar 12 13:39:02 2019 -0700
+
+ Add a more general version of lookup_struct_elt_type.
+
+ lookup_struct_elt is a new function which returns a tuple of
+ information about a component of a structure or union. The returned
+ tuple contains a pointer to the struct field object for the component
+ as well as a bit offset of that field within the structure. If the
+ field names a field in an anonymous substructure, the offset is the
+ "global" offset relative to the original structure type. If noerr is
+ set, then the returned tuple will set the field pointer to NULL to
+ indicate a missing component rather than throwing an error.
+
+ lookup_struct_elt_type is now reimplemented in terms of this new
+ function. It simply returns the type of the returned field.
+
+ gdb/ChangeLog:
+
+ * gdbtypes.c (lookup_struct_elt): New function.
+ (lookup_struct_elt_type): Reimplement via lookup_struct_elt.
+ * gdbtypes.h (struct struct_elt): New type.
+ (lookup_struct_elt): New prototype.
+
+diff --git gdb/gdbtypes.c gdb/gdbtypes.c
+index 5924b15520..db470dafac 100644
+--- gdb/gdbtypes.c
++++ gdb/gdbtypes.c
+@@ -1644,19 +1644,10 @@ lookup_template_type (char *name, struct type *type,
+ return (SYMBOL_TYPE (sym));
+ }
+
+-/* Given a type TYPE, lookup the type of the component named NAME.
++/* See gdbtypes.h. */
+
+- TYPE can be either a struct or union, or a pointer or reference to
+- a struct or union. If it is a pointer or reference, its target
+- type is automatically used. Thus '.' and '->' are interchangable,
+- as specified for the definitions of the expression element types
+- STRUCTOP_STRUCT and STRUCTOP_PTR.
+-
+- If NOERR is nonzero, return NULL if there is no component named
+- NAME. */
+-
+-struct type *
+-lookup_struct_elt_type (struct type *type, const char *name, int noerr)
++struct_elt
++lookup_struct_elt (struct type *type, const char *name, int noerr)
+ {
+ int i;
+
+@@ -1683,39 +1674,47 @@ lookup_struct_elt_type (struct type *type, const char *name, int noerr)
+
+ if (t_field_name && (strcmp_iw (t_field_name, name) == 0))
+ {
+- return TYPE_FIELD_TYPE (type, i);
++ return {&TYPE_FIELD (type, i), TYPE_FIELD_BITPOS (type, i)};
+ }
+ else if (!t_field_name || *t_field_name == '\0')
+ {
+- struct type *subtype
+- = lookup_struct_elt_type (TYPE_FIELD_TYPE (type, i), name, 1);
+-
+- if (subtype != NULL)
+- return subtype;
++ struct_elt elt
++ = lookup_struct_elt (TYPE_FIELD_TYPE (type, i), name, 1);
++ if (elt.field != NULL)
++ {
++ elt.offset += TYPE_FIELD_BITPOS (type, i);
++ return elt;
++ }
+ }
+ }
+
+ /* OK, it's not in this class. Recursively check the baseclasses. */
+ for (i = TYPE_N_BASECLASSES (type) - 1; i >= 0; i--)
+ {
+- struct type *t;
+-
+- t = lookup_struct_elt_type (TYPE_BASECLASS (type, i), name, 1);
+- if (t != NULL)
+- {
+- return t;
+- }
++ struct_elt elt = lookup_struct_elt (TYPE_BASECLASS (type, i), name, 1);
++ if (elt.field != NULL)
++ return elt;
+ }
+
+ if (noerr)
+- {
+- return NULL;
+- }
++ return {nullptr, 0};
+
+ std::string type_name = type_to_string (type);
+ error (_("Type %s has no component named %s."), type_name.c_str (), name);
+ }
+
++/* See gdbtypes.h. */
++
++struct type *
++lookup_struct_elt_type (struct type *type, const char *name, int noerr)
++{
++ struct_elt elt = lookup_struct_elt (type, name, noerr);
++ if (elt.field != NULL)
++ return FIELD_TYPE (*elt.field);
++ else
++ return NULL;
++}
++
+ /* Store in *MAX the largest number representable by unsigned integer type
+ TYPE. */
+
+diff --git gdb/gdbtypes.h gdb/gdbtypes.h
+index a6d4f64e9b..66051cf02c 100644
+--- gdb/gdbtypes.h
++++ gdb/gdbtypes.h
+@@ -1873,6 +1873,44 @@ extern struct type *allocate_stub_method (struct type *);
+
+ extern const char *type_name_or_error (struct type *type);
+
++struct struct_elt
++{
++ /* The field of the element, or NULL if no element was found. */
++ struct field *field;
++
++ /* The bit offset of the element in the parent structure. */
++ LONGEST offset;
++};
++
++/* Given a type TYPE, lookup the field and offset of the component named
++ NAME.
++
++ TYPE can be either a struct or union, or a pointer or reference to
++ a struct or union. If it is a pointer or reference, its target
++ type is automatically used. Thus '.' and '->' are interchangable,
++ as specified for the definitions of the expression element types
++ STRUCTOP_STRUCT and STRUCTOP_PTR.
++
++ If NOERR is nonzero, the returned structure will have field set to
++ NULL if there is no component named NAME.
++
++ If the component NAME is a field in an anonymous substructure of
++ TYPE, the returned offset is a "global" offset relative to TYPE
++ rather than an offset within the substructure. */
++
++extern struct_elt lookup_struct_elt (struct type *, const char *, int);
++
++/* Given a type TYPE, lookup the type of the component named NAME.
++
++ TYPE can be either a struct or union, or a pointer or reference to
++ a struct or union. If it is a pointer or reference, its target
++ type is automatically used. Thus '.' and '->' are interchangable,
++ as specified for the definitions of the expression element types
++ STRUCTOP_STRUCT and STRUCTOP_PTR.
++
++ If NOERR is nonzero, return NULL if there is no component named
++ NAME. */
++
+ extern struct type *lookup_struct_elt_type (struct type *, const char *, int);
+
+ extern struct type *make_pointer_type (struct type *, struct type **);
Index: head/devel/gdb/files/commit-f5424cfa7e
===================================================================
--- head/devel/gdb/files/commit-f5424cfa7e
+++ head/devel/gdb/files/commit-f5424cfa7e
@@ -0,0 +1,63 @@
+commit f5424cfa7e9337a6cb02a1f83c9feea0995c5350
+Author: John Baldwin <jhb@FreeBSD.org>
+Date: Tue Mar 12 13:39:02 2019 -0700
+
+ Support TLS variables on FreeBSD/amd64.
+
+ Use the fs_base register to fetch the address of a thread's tcb and
+ calculate the address of the DTV array. This value is then passed to
+ fbsd_get_thread_local_address to compute the final variable address.
+
+ Note that fs_base is currently only available via the native target as
+ core dumps on FreeBSD do not store the value of fs_base.
+
+ gdb/ChangeLog:
+
+ * amd64-fbsd-tdep.c (amd64fbsd_get_thread_local_address): New.
+ (amd64fbsd_init_abi): Install gdbarch
+ "fetch_tls_load_module_address" and "get_thread_local_address"
+ methods.
+
+diff --git gdb/amd64-fbsd-tdep.c gdb/amd64-fbsd-tdep.c
+index 403e65022d..7e2e9edf21 100644
+--- gdb/amd64-fbsd-tdep.c
++++ gdb/amd64-fbsd-tdep.c
+@@ -204,6 +204,26 @@ amd64fbsd_iterate_over_regset_sections (struct gdbarch *gdbarch,
+ &amd64fbsd_xstateregset, "XSAVE extended state", cb_data);
+ }
+
++/* Implement the get_thread_local_address gdbarch method. */
++
++static CORE_ADDR
++amd64fbsd_get_thread_local_address (struct gdbarch *gdbarch, ptid_t ptid,
++ CORE_ADDR lm_addr, CORE_ADDR offset)
++{
++ struct regcache *regcache;
++
++ regcache = get_thread_arch_regcache (ptid, gdbarch);
++
++ target_fetch_registers (regcache, AMD64_FSBASE_REGNUM);
++
++ ULONGEST fsbase;
++ if (regcache->cooked_read (AMD64_FSBASE_REGNUM, &fsbase) != REG_VALID)
++ error (_("Unable to fetch %%fsbase"));
++
++ CORE_ADDR dtv_addr = fsbase + gdbarch_ptr_bit (gdbarch) / 8;
++ return fbsd_get_thread_local_address (gdbarch, dtv_addr, lm_addr, offset);
++}
++
+ static void
+ amd64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+ {
+@@ -241,6 +261,11 @@ amd64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+ /* FreeBSD uses SVR4-style shared libraries. */
+ set_solib_svr4_fetch_link_map_offsets
+ (gdbarch, svr4_lp64_fetch_link_map_offsets);
++
++ set_gdbarch_fetch_tls_load_module_address (gdbarch,
++ svr4_fetch_objfile_link_map);
++ set_gdbarch_get_thread_local_address (gdbarch,
++ amd64fbsd_get_thread_local_address);
+ }
+
+ void
Index: head/devel/gdb/files/extrapatch-kgdb
===================================================================
--- head/devel/gdb/files/extrapatch-kgdb
+++ head/devel/gdb/files/extrapatch-kgdb
@@ -1,8 +1,8 @@
diff --git gdb/Makefile.in gdb/Makefile.in
-index 13627e07e0..a72fd8fe0f 100644
+index 5614cc3386..b9acc63c3f 100644
--- gdb/Makefile.in
+++ gdb/Makefile.in
-@@ -236,7 +236,8 @@ INCGNU = -I$(srcdir)/gnulib/import -I$(GNULIB_BUILDDIR)/import
+@@ -230,7 +230,8 @@ INCGNU = -I$(srcdir)/gnulib/import -I$(GNULIB_BUILDDIR)/import
# Generated headers in the gnulib directory. These must be listed
# so that they are generated before other files are compiled.
@@ -12,7 +12,7 @@
#
# CLI sub directory definitons
-@@ -643,6 +644,7 @@ TARGET_OBS = @TARGET_OBS@
+@@ -632,6 +633,7 @@ TARGET_OBS = @TARGET_OBS@
# All target-dependent objects files that require 64-bit CORE_ADDR
# (used with --enable-targets=all --enable-64-bit-bfd).
ALL_64_TARGET_OBS = \
@@ -20,7 +20,7 @@
aarch64-fbsd-tdep.o \
aarch64-linux-tdep.o \
aarch64-newlib-tdep.o \
-@@ -656,6 +658,7 @@ ALL_64_TARGET_OBS = \
+@@ -646,6 +648,7 @@ ALL_64_TARGET_OBS = \
amd64-darwin-tdep.o \
amd64-dicos-tdep.o \
amd64-fbsd-tdep.o \
@@ -28,7 +28,7 @@
amd64-linux-tdep.o \
amd64-nbsd-tdep.o \
amd64-obsd-tdep.o \
-@@ -670,6 +673,7 @@ ALL_64_TARGET_OBS = \
+@@ -660,6 +663,7 @@ ALL_64_TARGET_OBS = \
ia64-vms-tdep.o \
mips64-obsd-tdep.o \
sparc64-fbsd-tdep.o \
@@ -36,24 +36,24 @@
sparc64-linux-tdep.o \
sparc64-nbsd-tdep.o \
sparc64-obsd-tdep.o \
-@@ -685,6 +689,7 @@ ALL_TARGET_OBS = \
- arch/i386.o \
+@@ -676,6 +680,7 @@ ALL_TARGET_OBS = \
arch/ppc-linux-common.o \
+ arch/riscv.o \
arm-bsd-tdep.o \
+ arm-fbsd-kern.o \
arm-fbsd-tdep.o \
arm-linux-tdep.o \
arm-nbsd-tdep.o \
-@@ -699,6 +704,8 @@ ALL_TARGET_OBS = \
- cris-linux-tdep.o \
- cris-tdep.o \
+@@ -693,6 +698,8 @@ ALL_TARGET_OBS = \
+ csky-linux-tdep.o \
+ csky-tdep.o \
dicos-tdep.o \
+ fbsd-kld.o \
+ fbsd-kthr.o \
fbsd-tdep.o \
frv-linux-tdep.o \
frv-tdep.o \
-@@ -715,6 +722,7 @@ ALL_TARGET_OBS = \
+@@ -709,6 +716,7 @@ ALL_TARGET_OBS = \
i386-darwin-tdep.o \
i386-dicos-tdep.o \
i386-fbsd-tdep.o \
@@ -61,7 +61,7 @@
i386-gnu-tdep.o \
i386-go32-tdep.o \
i386-linux-tdep.o \
-@@ -738,6 +746,7 @@ ALL_TARGET_OBS = \
+@@ -732,6 +740,7 @@ ALL_TARGET_OBS = \
mep-tdep.o \
microblaze-linux-tdep.o \
microblaze-tdep.o \
@@ -69,15 +69,23 @@
mips-fbsd-tdep.o \
mips-linux-tdep.o \
mips-nbsd-tdep.o \
-@@ -755,6 +764,7 @@ ALL_TARGET_OBS = \
- obsd-tdep.o \
+@@ -750,6 +759,7 @@ ALL_TARGET_OBS = \
+ or1k-linux-tdep.o \
or1k-tdep.o \
ppc-fbsd-tdep.o \
+ ppcfbsd-kern.o \
ppc-linux-tdep.o \
ppc-nbsd-tdep.o \
ppc-obsd-tdep.o \
-@@ -1611,7 +1621,7 @@ generated_files = \
+@@ -757,6 +767,7 @@ ALL_TARGET_OBS = \
+ ppc-sysv-tdep.o \
+ ppc64-tdep.o \
+ ravenscar-thread.o \
++ riscv-fbsd-kern.o \
+ riscv-fbsd-tdep.o \
+ riscv-linux-tdep.o \
+ riscv-tdep.o \
+@@ -1629,7 +1640,7 @@ generated_files = \
# Flags needed to compile Python code
PYTHON_CFLAGS = @PYTHON_CFLAGS@
@@ -86,37 +94,36 @@
@$(MAKE) $(FLAGS_TO_PASS) DO=all "DODIRS=`echo $(SUBDIRS) | sed 's/testsuite//'`" subdir_do
# Rule for compiling .c files in the top-level gdb directory.
-@@ -1924,6 +1934,12 @@ ifneq ($(CODESIGN_CERT),)
+@@ -1894,6 +1905,12 @@ ifneq ($(CODESIGN_CERT),)
$(ECHO_SIGN) $(CODESIGN) -s $(CODESIGN_CERT) gdb$(EXEEXT)
endif
+kgdb$(EXEEXT): kgdb-main.o $(LIBGDB_OBS) $(ADD_DEPS) $(CDEPS) $(TDEPLIBS)
-+ rm -f kgdb$(EXEEXT)
-+ $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) \
++ $(SILENCE) rm -f kgdb$(EXEEXT)
++ $(ECHO_CXXLD) $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) \
+ -o kgdb$(EXEEXT) kgdb-main.o $(LIBGDB_OBS) \
+ $(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES)
+
# Convenience rule to handle recursion.
$(LIBGNU) $(GNULIB_H): all-lib
all-lib: $(GNULIB_BUILDDIR)/Makefile
-@@ -1968,7 +1984,7 @@ clean mostlyclean: $(CONFIG_CLEAN)
- @$(MAKE) $(FLAGS_TO_PASS) DO=clean "DODIRS=$(CLEANDIRS)" subdir_do
- rm -f *.o *.a $(ADD_FILES) *~ init.c-tmp init.l-tmp version.c-tmp
- rm -f init.c version.c
-- rm -f gdb$(EXEEXT) core make.log
-+ rm -f gdb$(EXEEXT) core make.log kgdb$(EXEEXT)
+@@ -1940,6 +1957,7 @@ clean mostlyclean: $(CONFIG_CLEAN)
+ rm -f init.c stamp-init version.c stamp-version
+ rm -f gdb$(EXEEXT) core make.log
rm -f gdb[0-9]$(EXEEXT)
++ rm -f kgdb$(EXEEXT)
rm -f test-cp-name-parser$(EXEEXT)
rm -f xml-builtin.c stamp-xml
-@@ -2183,6 +2199,7 @@ MAKEOVERRIDES =
+ rm -f $(DEPDIR)/*
+@@ -2154,6 +2172,7 @@ force_update:
+ MAKEOVERRIDES =
ALLDEPFILES = \
- aarch64-fbsd-nat.c \
+ aarch64-fbsd-kern.c \
+ aarch64-fbsd-nat.c \
aarch64-fbsd-tdep.c \
aarch64-linux-nat.c \
- aarch64-linux-tdep.c \
-@@ -2200,6 +2217,7 @@ ALLDEPFILES = \
+@@ -2173,6 +2192,7 @@ ALLDEPFILES = \
amd64-bsd-nat.c \
amd64-darwin-tdep.c \
amd64-dicos-tdep.c \
@@ -124,7 +131,7 @@
amd64-fbsd-nat.c \
amd64-fbsd-tdep.c \
amd64-linux-nat.c \
-@@ -2214,6 +2232,7 @@ ALLDEPFILES = \
+@@ -2187,6 +2207,7 @@ ALLDEPFILES = \
arc-tdep.c \
arm.c \
arm-bsd-tdep.c \
@@ -132,17 +139,17 @@
arm-fbsd-nat.c \
arm-fbsd-tdep.c \
arm-get-next-pcs.c \
-@@ -2233,6 +2252,9 @@ ALLDEPFILES = \
+@@ -2207,6 +2228,9 @@ ALLDEPFILES = \
+ csky-tdep.c \
darwin-nat.c \
dicos-tdep.c \
- exec.c \
+ fbsd-kld.c \
+ fbsd-kthr.c \
+ fbsd-kvm.c \
fbsd-nat.c \
fbsd-tdep.c \
fork-child.c \
-@@ -2254,6 +2276,7 @@ ALLDEPFILES = \
+@@ -2228,6 +2252,7 @@ ALLDEPFILES = \
i386-darwin-nat.c \
i386-darwin-tdep.c \
i386-dicos-tdep.c \
@@ -150,15 +157,15 @@
i386-fbsd-nat.c \
i386-fbsd-tdep.c \
i386-gnu-nat.c \
-@@ -2293,6 +2316,7 @@ ALLDEPFILES = \
+@@ -2264,6 +2289,7 @@ ALLDEPFILES = \
+ microblaze-linux-tdep.c \
+ microblaze-tdep.c \
mingw-hdep.c \
++ mipsfbsd-kern.c \
mips-fbsd-nat.c \
mips-fbsd-tdep.c \
-+ mipsfbsd-kern.c \
mips-linux-nat.c \
- mips-linux-tdep.c \
- mips-nbsd-nat.c \
-@@ -2310,6 +2334,7 @@ ALLDEPFILES = \
+@@ -2283,6 +2309,7 @@ ALLDEPFILES = \
obsd-nat.c \
obsd-tdep.c \
posix-hdep.c \
@@ -166,7 +173,15 @@
ppc-fbsd-nat.c \
ppc-fbsd-tdep.c \
ppc-linux-nat.c \
-@@ -2355,6 +2380,7 @@ ALLDEPFILES = \
+@@ -2297,6 +2324,7 @@ ALLDEPFILES = \
+ procfs.c \
+ ravenscar-thread.c \
+ remote-sim.c \
++ riscv-fbsd-kern.c \
+ riscv-fbsd-nat.c \
+ riscv-fbsd-tdep.c \
+ riscv-linux-nat.c \
+@@ -2333,6 +2361,7 @@ ALLDEPFILES = \
sparc-sol2-nat.c \
sparc-sol2-tdep.c \
sparc-tdep.c \
@@ -174,7 +189,7 @@
sparc64-fbsd-nat.c \
sparc64-fbsd-tdep.c \
sparc64-linux-nat.c \
-@@ -2643,7 +2669,7 @@ endif
+@@ -2596,7 +2625,7 @@ endif
# A list of all the objects we might care about in this build, for
# dependency tracking.
@@ -184,10 +199,10 @@
# All the .deps files to include.
diff --git gdb/config.in gdb/config.in
-index 527290296e..8e0e90fd67 100644
+index ea907d2b56..ee9146fd4e 100644
--- gdb/config.in
+++ gdb/config.in
-@@ -228,6 +228,9 @@
+@@ -219,6 +219,9 @@
/* Define to 1 if your system has the kinfo_getvmmap function. */
#undef HAVE_KINFO_GETVMMAP
@@ -198,10 +213,10 @@
#undef HAVE_LANGINFO_CODESET
diff --git gdb/configure gdb/configure
-index 3849b9494f..18d2e363dc 100755
+index 854837c50a..1f2da364cf 100755
--- gdb/configure
+++ gdb/configure
-@@ -8082,6 +8082,66 @@ $as_echo "#define HAVE_KINFO_GETFILE 1" >>confdefs.h
+@@ -8107,6 +8107,66 @@ $as_echo "#define HAVE_KINFO_GETFILE 1" >>confdefs.h
fi
@@ -269,10 +284,10 @@
if test "X$prefix" = "XNONE"; then
acl_final_prefix="$ac_default_prefix"
diff --git gdb/configure.ac gdb/configure.ac
-index 4c20ea5178..df156b484f 100644
+index 1527585839..37e8ce54b0 100644
--- gdb/configure.ac
+++ gdb/configure.ac
-@@ -534,6 +534,11 @@ AC_SEARCH_LIBS(kinfo_getfile, util util-freebsd,
+@@ -511,6 +511,11 @@ AC_SEARCH_LIBS(kinfo_getfile, util util-freebsd,
[AC_DEFINE(HAVE_KINFO_GETFILE, 1,
[Define to 1 if your system has the kinfo_getfile function. ])])
@@ -285,24 +300,24 @@
# GDB may fork/exec the iconv program to get the list of supported character
diff --git gdb/configure.nat gdb/configure.nat
-index 7611266d86..8656015365 100644
+index 64ee101d83..f32e6328e0 100644
--- gdb/configure.nat
+++ gdb/configure.nat
-@@ -62,7 +62,8 @@ case ${gdb_host} in
+@@ -63,7 +63,8 @@ case ${gdb_host} in
LOADLIBES='-ldl $(RDYNAMIC)'
;;
fbsd*)
-- NATDEPFILES='fork-child.o fork-inferior.o inf-ptrace.o fbsd-nat.o'
-+ NATDEPFILES='fork-child.o fork-inferior.o inf-ptrace.o fbsd-nat.o \
+- NATDEPFILES='fork-child.o nat/fork-inferior.o inf-ptrace.o fbsd-nat.o'
++ NATDEPFILES='fork-child.o nat/fork-inferior.o inf-ptrace.o fbsd-nat.o \
+ fbsd-kvm.o'
HAVE_NATIVE_GCORE_HOST=1
LOADLIBES='-lkvm'
;;
diff --git gdb/configure.tgt gdb/configure.tgt
-index f197160896..ced1140328 100644
+index 27f122ad04..5fa0d0179e 100644
--- gdb/configure.tgt
+++ gdb/configure.tgt
-@@ -94,7 +94,7 @@ esac
+@@ -98,7 +98,7 @@ esac
case "${targ}" in
*-*-freebsd* | *-*-kfreebsd*-gnu)
@@ -311,7 +326,7 @@
*-*-netbsd* | *-*-knetbsd*-gnu)
os_obs="nbsd-tdep.o solib-svr4.o";;
*-*-openbsd*)
-@@ -111,7 +111,7 @@ aarch64*-*-elf | aarch64*-*-rtems*)
+@@ -115,7 +115,7 @@ aarch64*-*-elf | aarch64*-*-rtems*)
aarch64*-*-freebsd*)
# Target: FreeBSD/aarch64
@@ -320,7 +335,7 @@
;;
aarch64*-*-linux*)
-@@ -164,7 +164,7 @@ arm*-*-linux*)
+@@ -168,7 +168,7 @@ arm*-*-linux*)
;;
arm*-*-freebsd*)
# Target: FreeBSD/arm
@@ -329,7 +344,7 @@
;;
arm*-*-netbsd* | arm*-*-knetbsd*-gnu)
# Target: NetBSD/arm
-@@ -251,7 +251,11 @@ i[34567]86-*-dicos*)
+@@ -267,7 +267,11 @@ i[34567]86-*-dicos*)
;;
i[34567]86-*-freebsd* | i[34567]86-*-kfreebsd*-gnu)
# Target: FreeBSD/i386
@@ -342,7 +357,7 @@
;;
i[34567]86-*-netbsd* | i[34567]86-*-knetbsd*-gnu)
# Target: NetBSD/i386
-@@ -405,7 +409,7 @@ mips*-*-netbsd* | mips*-*-knetbsd*-gnu)
+@@ -421,7 +425,7 @@ mips*-*-netbsd* | mips*-*-knetbsd*-gnu)
;;
mips*-*-freebsd*)
# Target: MIPS running FreeBSD
@@ -351,7 +366,7 @@
gdb_sim=../sim/mips/libsim.a
;;
mips64*-*-openbsd*)
-@@ -464,7 +468,7 @@ or1k-*-* | or1knd-*-*)
+@@ -488,7 +492,7 @@ or1k-*-* | or1knd-*-*)
powerpc*-*-freebsd*)
# Target: FreeBSD/powerpc
gdb_target_obs="rs6000-tdep.o ppc-sysv-tdep.o ppc64-tdep.o \
@@ -360,7 +375,16 @@
ravenscar-thread.o ppc-ravenscar-thread.o"
;;
-@@ -587,6 +591,7 @@ sparc64-*-linux*)
+@@ -543,7 +547,7 @@ s390*-*-linux*)
+
+ riscv*-*-freebsd*)
+ # Target: FreeBSD/riscv
+- gdb_target_obs="riscv-fbsd-tdep.o"
++ gdb_target_obs="riscv-fbsd-tdep.o riscv-fbsd-kern.o"
+ ;;
+
+ riscv*-*-linux*)
+@@ -622,6 +626,7 @@ sparc64-*-linux*)
sparc*-*-freebsd* | sparc*-*-kfreebsd*-gnu)
# Target: FreeBSD/sparc64
gdb_target_obs="sparc-tdep.o sparc64-tdep.o sparc64-fbsd-tdep.o \
@@ -368,7 +392,7 @@
ravenscar-thread.o sparc-ravenscar-thread.o"
;;
sparc-*-netbsd* | sparc-*-knetbsd*-gnu)
-@@ -709,8 +714,8 @@ x86_64-*-linux*)
+@@ -749,8 +754,8 @@ x86_64-*-linux*)
;;
x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
# Target: FreeBSD/amd64
@@ -380,10 +404,10 @@
x86_64-*-mingw* | x86_64-*-cygwin*)
# Target: MingW/amd64
diff --git gdb/defs.h gdb/defs.h
-index fc4217005a..3d2eb6b1e9 100644
+index a44e186907..c4bfd42073 100644
--- gdb/defs.h
+++ gdb/defs.h
-@@ -481,6 +481,7 @@ enum gdb_osabi
+@@ -484,6 +484,7 @@ enum gdb_osabi
GDB_OSABI_SOLARIS,
GDB_OSABI_LINUX,
GDB_OSABI_FREEBSD,
@@ -392,10 +416,10 @@
GDB_OSABI_OPENBSD,
GDB_OSABI_WINCE,
diff --git gdb/gnulib/configure gdb/gnulib/configure
-index a152abcb76..140c4ad6a8 100644
+index 340c622cb3..bf0c4dd5d9 100644
--- gdb/gnulib/configure
+++ gdb/gnulib/configure
-@@ -17214,6 +17214,7 @@ else
+@@ -18579,6 +18579,7 @@ else
case "$host_os" in
# Guess all is fine on glibc systems.
*-gnu*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
@@ -404,7 +428,7 @@
*) gl_cv_func_gettimeofday_clobber="guessing yes" ;;
esac
diff --git gdb/osabi.c gdb/osabi.c
-index 7d0540b181..c61c518652 100644
+index 5d4bbcdff8..a982b22624 100644
--- gdb/osabi.c
+++ gdb/osabi.c
@@ -66,6 +66,7 @@ static const struct osabi_names gdb_osabi_names[] =
@@ -416,10 +440,10 @@
{ "OpenBSD", NULL },
{ "WindowsCE", NULL },
diff --git gdb/regcache.c gdb/regcache.c
-index f3f845aad6..7ca007a422 100644
+index 6e3eee9663..49ca1e1535 100644
--- gdb/regcache.c
+++ gdb/regcache.c
-@@ -1035,6 +1035,22 @@ reg_buffer::raw_supply_zeroed (int regnum)
+@@ -1003,6 +1003,22 @@ reg_buffer::raw_supply_zeroed (int regnum)
m_register_status[regnum] = REG_VALID;
}
@@ -443,10 +467,10 @@
void
diff --git gdb/regcache.h gdb/regcache.h
-index 4a45f33871..94f542c087 100644
+index 2b703ea4a4..d06e001957 100644
--- gdb/regcache.h
+++ gdb/regcache.h
-@@ -207,6 +207,8 @@ public:
+@@ -224,6 +224,8 @@ public:
only LEN, without editing the rest of the register. */
void raw_supply_part (int regnum, int offset, int len, const gdb_byte *in);
Index: head/devel/gdb/files/kgdb/aarch64-fbsd-kern.c
===================================================================
--- head/devel/gdb/files/kgdb/aarch64-fbsd-kern.c
+++ head/devel/gdb/files/kgdb/aarch64-fbsd-kern.c
@@ -73,7 +73,7 @@
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct trad_frame_cache *cache;
- CORE_ADDR addr, func, pc, sp;
+ CORE_ADDR func, pc, sp;
const char *name;
int i;
Index: head/devel/gdb/files/kgdb/amd64fbsd-kern.c
===================================================================
--- head/devel/gdb/files/kgdb/amd64fbsd-kern.c
+++ head/devel/gdb/files/kgdb/amd64fbsd-kern.c
@@ -37,7 +37,7 @@
#include "symtab.h"
#include "trad-frame.h"
#include "amd64-tdep.h"
-#include "x86-xstate.h"
+#include "common/x86-xstate.h"
#ifdef __amd64__
#include <machine/pcb.h>
Index: head/devel/gdb/files/kgdb/fbsd-kld.c
===================================================================
--- head/devel/gdb/files/kgdb/fbsd-kld.c
+++ head/devel/gdb/files/kgdb/fbsd-kld.c
@@ -138,7 +138,6 @@
find_kld_path (const char *filename, char *path, size_t path_size)
{
struct kld_info *info;
- struct cleanup *cleanup;
gdb::unique_xmalloc_ptr<char> module_path;
char *module_dir, *cp;
int error;
@@ -403,7 +402,7 @@
"&((struct linker_file *)0)->pathname");
info->off_next = parse_and_eval_address(
"&((struct linker_file *)0)->link.tqe_next");
- } CATCH(e, RETURN_MASK_ERROR) {
+ } CATCH(e2, RETURN_MASK_ERROR) {
return;
}
END_CATCH
Index: head/devel/gdb/files/kgdb/fbsd-kthr.c
===================================================================
--- head/devel/gdb/files/kgdb/fbsd-kthr.c
+++ head/devel/gdb/files/kgdb/fbsd-kthr.c
@@ -155,7 +155,6 @@
{
struct gdbarch *gdbarch = target_gdbarch ();
struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
- enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct kthr *kt;
CORE_ADDR addr, paddr;
@@ -230,7 +229,7 @@
"&((struct thread *)0)->td_plist");
thread_oncpu_size = parse_and_eval_long(
"sizeof(((struct thread *)0)->td_oncpu)");
- } CATCH(e, RETURN_MASK_ERROR) {
+ } CATCH(e2, RETURN_MASK_ERROR) {
proc_off_p_pid = offsetof(struct proc, p_pid);
proc_off_p_comm = offsetof(struct proc, p_comm);
proc_off_p_list = offsetof(struct proc, p_list);
Index: head/devel/gdb/files/kgdb/fbsd-kvm.c
===================================================================
--- head/devel/gdb/files/kgdb/fbsd-kvm.c
+++ head/devel/gdb/files/kgdb/fbsd-kvm.c
@@ -37,6 +37,7 @@
#include "inferior.h"
#include "objfiles.h"
#include "osabi.h"
+#include "process-stratum-target.h"
#include "solib.h"
#include "target.h"
#include "value.h"
@@ -192,6 +193,7 @@
break;
if (osabi != GDB_OSABI_FREEBSD)
return (GDB_OSABI_UNKNOWN);
+ break;
}
default:
return (GDB_OSABI_UNKNOWN);
@@ -218,11 +220,10 @@
target vmcore [-w] [filename]")
};
-class fbsd_kvm_target final : public target_ops
+class fbsd_kvm_target final : public process_stratum_target
{
public:
- fbsd_kvm_target ()
- { this->to_stratum = process_stratum; }
+ fbsd_kvm_target () = default;
const target_info &info () const override
{ return fbsd_kvm_target_info; }
@@ -243,9 +244,11 @@
const char *pid_to_str (ptid_t) override;
const char *extra_thread_info (thread_info *) override;
- bool has_memory () override { return true; }
- bool has_stack () override { return true; }
- bool has_registers () override { return true; }
+ bool has_all_memory () override { return false; }
+ bool has_memory () override;
+ bool has_stack () override;
+ bool has_registers () override;
+ bool has_execution (ptid_t) override { return false; }
};
/* Target ops for libkvm interface. */
@@ -273,12 +276,10 @@
char kvm_err[_POSIX2_LINE_MAX];
struct inferior *inf;
struct cleanup *old_chain;
- struct thread_info *ti;
struct kthr *kt;
kvm_t *nkvm;
char *temp, *kernel, *filename;
bool writeable;
- int ontop;
if (ops == NULL || ops->supply_pcb == NULL || ops->cpu_pcb_addr == NULL)
error ("ABI doesn't support a vmcore target");
@@ -384,7 +385,7 @@
init_thread_list();
kt = kgdb_thr_init(ops->cpu_pcb_addr);
while (kt != NULL) {
- ti = add_thread_silent(fbsd_vmcore_ptid(kt->tid));
+ add_thread_silent(fbsd_vmcore_ptid(kt->tid));
kt = kgdb_thr_next(kt);
}
if (curkthr != 0)
@@ -432,6 +433,24 @@
{
return (kgdb_thr_extra_thread_info(ti->ptid.tid()));
+}
+
+bool
+fbsd_kvm_target::has_memory ()
+{
+ return (kvm != NULL);
+}
+
+bool
+fbsd_kvm_target::has_stack ()
+{
+ return (kvm != NULL);
+}
+
+bool
+fbsd_kvm_target::has_registers ()
+{
+ return (kvm != NULL);
}
void
Index: head/devel/gdb/files/kgdb/mipsfbsd-kern.c
===================================================================
--- head/devel/gdb/files/kgdb/mipsfbsd-kern.c
+++ head/devel/gdb/files/kgdb/mipsfbsd-kern.c
@@ -132,10 +132,9 @@
mipsfbsd_trapframe_cache (struct frame_info *this_frame, void **this_cache)
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
- enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
size_t regsize = mips_isa_regsize (gdbarch);
struct trad_frame_cache *cache;
- CORE_ADDR addr, func, pc, sp;
+ CORE_ADDR addr, func, sp;
int regnum;
if (*this_cache != NULL)
Index: head/devel/gdb/files/kgdb/ppcfbsd-kern.c
===================================================================
--- head/devel/gdb/files/kgdb/ppcfbsd-kern.c
+++ head/devel/gdb/files/kgdb/ppcfbsd-kern.c
@@ -109,10 +109,9 @@
{
struct gdbarch *gdbarch = get_frame_arch (this_frame);
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
struct trad_frame_cache *cache;
CORE_ADDR base;
- int i, regnum;
+ int i;
if (*this_cache)
return (struct trad_frame_cache *)*this_cache;
Index: head/devel/gdb/files/kgdb/riscv-fbsd-kern.c
===================================================================
--- head/devel/gdb/files/kgdb/riscv-fbsd-kern.c
+++ head/devel/gdb/files/kgdb/riscv-fbsd-kern.c
@@ -0,0 +1,210 @@
+/*-
+ * Copyright (c) 2018 John Baldwin <jhb@FreeBSD.org>
+ * 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 AUTHORS ``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 AUTHORS 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.
+ *
+ * $FreeBSD$
+ */
+
+/* Target-dependent code for FreeBSD/riscv64 kernels. */
+
+#include "defs.h"
+
+#include "riscv-tdep.h"
+#include "frame-unwind.h"
+#include "gdbcore.h"
+#include "osabi.h"
+#include "regcache.h"
+#include "regset.h"
+#include "solib.h"
+#include "target.h"
+#include "trad-frame.h"
+
+#include "kgdb.h"
+
+static const struct regcache_map_entry riscv_fbsd_pcbmap[] =
+ {
+ { 1, RISCV_RA_REGNUM, 0 },
+ { 1, RISCV_SP_REGNUM, 0 },
+ { 1, RISCV_GP_REGNUM, 0 },
+ { 1, RISCV_TP_REGNUM, 0 },
+ { 3, 5, 0 }, /* t0 - t2 */
+ { 4, 28, 0 }, /* t3 - t6 */
+ { 2, RISCV_FP_REGNUM, 0 }, /* s0 - s1 */
+ { 10, 18, 0 }, /* s2 - s11 */
+ { 8, RISCV_A0_REGNUM, 0 }, /* a0 - a7 */
+ { 0 }
+ };
+
+static const struct regset riscv_fbsd_pcbregset =
+ {
+ riscv_fbsd_pcbmap,
+ regcache_supply_regset, regcache_collect_regset
+ };
+
+static void
+riscv_fbsd_supply_pcb(struct regcache *regcache, CORE_ADDR pcb_addr)
+{
+ gdb_byte buf[31 * 8];
+
+ /* Always give a value for PC in case the PCB isn't readable. */
+ regcache->raw_supply_zeroed (RISCV_PC_REGNUM);
+ regcache->raw_supply_zeroed (RISCV_ZERO_REGNUM);
+ if (target_read_memory (pcb_addr, buf, sizeof buf) == 0)
+ {
+ regcache->supply_regset (&riscv_fbsd_pcbregset, -1, buf,
+ sizeof (buf));
+
+ /* Supply the RA as PC as well to simulate the PC as if the
+ thread had just returned. */
+ regcache->raw_supply (RISCV_PC_REGNUM, buf);
+ }
+}
+
+static const struct regcache_map_entry riscv_fbsd_tfmap[] =
+ {
+ { 1, RISCV_RA_REGNUM, 0 },
+ { 1, RISCV_SP_REGNUM, 0 },
+ { 1, RISCV_GP_REGNUM, 0 },
+ { 1, RISCV_TP_REGNUM, 0 },
+ { 3, 5, 0 }, /* t0 - t2 */
+ { 4, 28, 0 }, /* t3 - t6 */
+ { 2, RISCV_FP_REGNUM, 0 }, /* s0 - s1 */
+ { 10, 18, 0 }, /* s2 - s11 */
+ { 8, RISCV_A0_REGNUM, 0 }, /* a0 - a7 */
+ { 1, RISCV_PC_REGNUM, 0 },
+ { 1, RISCV_CSR_SSTATUS_REGNUM, 0 },
+ { 1, RISCV_CSR_STVAL_REGNUM, 0 },
+ { 1, RISCV_CSR_SCAUSE_REGNUM, 0 },
+ { 0 }
+ };
+
+static struct trad_frame_cache *
+riscv_fbsd_trapframe_cache (struct frame_info *this_frame, void **this_cache)
+{
+ struct gdbarch *gdbarch = get_frame_arch (this_frame);
+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
+ struct trad_frame_cache *cache;
+ CORE_ADDR func, pc, sp;
+ const char *name;
+ int xlen;
+
+ if (*this_cache != NULL)
+ return ((struct trad_frame_cache *)*this_cache);
+
+ cache = trad_frame_cache_zalloc (this_frame);
+ *this_cache = cache;
+
+ sp = get_frame_register_unsigned (this_frame, RISCV_SP_REGNUM);
+
+ xlen = riscv_isa_xlen (gdbarch);
+ trad_frame_set_reg_regmap (cache, riscv_fbsd_tfmap, sp, 35 * xlen);
+
+ /* Read $PC from trap frame. */
+ func = get_frame_func (this_frame);
+ find_pc_partial_function (func, &name, NULL, NULL);
+ pc = read_memory_unsigned_integer (sp + 31 * xlen, xlen, byte_order);
+
+ if (pc == 0 && strcmp(name, "fork_trampoline") == 0)
+ {
+ /* Initial frame of a kthread; terminate backtrace. */
+ trad_frame_set_id (cache, outer_frame_id);
+ }
+ else
+ {
+ /* Construct the frame ID using the function start. */
+ trad_frame_set_id (cache, frame_id_build (sp + 35 * xlen, func));
+ }
+
+ return cache;
+}
+
+static void
+riscv_fbsd_trapframe_this_id (struct frame_info *this_frame,
+ void **this_cache, struct frame_id *this_id)
+{
+ struct trad_frame_cache *cache =
+ riscv_fbsd_trapframe_cache (this_frame, this_cache);
+
+ trad_frame_get_id (cache, this_id);
+}
+
+static struct value *
+riscv_fbsd_trapframe_prev_register (struct frame_info *this_frame,
+ void **this_cache, int regnum)
+{
+ struct trad_frame_cache *cache =
+ riscv_fbsd_trapframe_cache (this_frame, this_cache);
+
+ return trad_frame_get_register (cache, this_frame, regnum);
+}
+
+static int
+riscv_fbsd_trapframe_sniffer (const struct frame_unwind *self,
+ struct frame_info *this_frame,
+ void **this_prologue_cache)
+{
+ const char *name;
+
+ find_pc_partial_function (get_frame_func (this_frame), &name, NULL, NULL);
+ return (name != NULL
+ && ((strcmp (name, "cpu_exception_handler_user") == 0) ||
+ (strcmp (name, "cpu_exception_handler_supervisor") == 0)));
+}
+
+static const struct frame_unwind riscv_fbsd_trapframe_unwind = {
+ SIGTRAMP_FRAME,
+ default_frame_unwind_stop_reason,
+ riscv_fbsd_trapframe_this_id,
+ riscv_fbsd_trapframe_prev_register,
+ NULL,
+ riscv_fbsd_trapframe_sniffer
+};
+
+/* Implement the 'init_osabi' method of struct gdb_osabi_handler. */
+
+static void
+riscv_fbsd_kernel_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
+{
+ frame_unwind_prepend_unwinder (gdbarch, &riscv_fbsd_trapframe_unwind);
+
+ set_solib_ops (gdbarch, &kld_so_ops);
+
+ set_gdbarch_software_single_step (gdbarch, riscv_software_single_step);
+
+ fbsd_vmcore_set_supply_pcb (gdbarch, riscv_fbsd_supply_pcb);
+ fbsd_vmcore_set_cpu_pcb_addr (gdbarch, kgdb_trgt_stop_pcb);
+}
+
+/* Provide a prototype to silence -Wmissing-prototypes. */
+extern initialize_file_ftype _initialize_riscv_kgdb_tdep;
+
+void
+_initialize_riscv_kgdb_tdep (void)
+{
+ gdbarch_register_osabi_sniffer(bfd_arch_riscv,
+ bfd_target_elf_flavour,
+ fbsd_kernel_osabi_sniffer);
+ gdbarch_register_osabi (bfd_arch_riscv, 0, GDB_OSABI_FREEBSD_KERNEL,
+ riscv_fbsd_kernel_init_abi);
+}
Index: head/devel/gdb/files/patch-fixes
===================================================================
--- head/devel/gdb/files/patch-fixes
+++ head/devel/gdb/files/patch-fixes
@@ -1,10 +1,10 @@
---- 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,
+--- gdb/compile/compile-loc2c.c.orig 2019-02-26 20:51:50.000000000 -0800
++++ gdb/compile/compile-loc2c.c 2019-05-24 16:07:42.382379000 -0700
+@@ -657,6 +657,7 @@ do_compile_dwarf_expr_to_c (int indent, string_file *s
uint64_t uoffset, reg;
int64_t offset;
+ uoffset = 0;
- print_spaces (indent - 2, &stream);
+ print_spaces (indent - 2, stream);
if (info[op_ptr - base].label)
{
Index: head/devel/gdb/files/patch-gdb_aarch64-fbsd-tdep.c
===================================================================
--- head/devel/gdb/files/patch-gdb_aarch64-fbsd-tdep.c
+++ head/devel/gdb/files/patch-gdb_aarch64-fbsd-tdep.c
@@ -1,19 +0,0 @@
---- gdb/aarch64-fbsd-tdep.c.orig 2018-03-15 16:39:29.951492000 +0100
-+++ gdb/aarch64-fbsd-tdep.c 2018-03-15 16:40:31.553135000 +0100
-@@ -118,11 +118,11 @@
- 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}
-+ {0x910003e0, static_cast<ULONGEST>(-1)}, /* mov x0, sp */
-+ {0x91014000, static_cast<ULONGEST>(-1)}, /* add x0, x0, #SF_UC */
-+ {0xd2803428, static_cast<ULONGEST>(-1)}, /* mov x8, #SYS_sigreturn */
-+ {0xd4000001, static_cast<ULONGEST>(-1)}, /* svc 0x0 */
-+ {TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1)}
- },
- aarch64_fbsd_sigframe_init
- };
Index: head/devel/gdb/files/patch-gdb_aarch64-linux-tdep.c
===================================================================
--- head/devel/gdb/files/patch-gdb_aarch64-linux-tdep.c
+++ head/devel/gdb/files/patch-gdb_aarch64-linux-tdep.c
@@ -1,18 +0,0 @@
---- gdb/aarch64-linux-tdep.c.orig 2018-03-15 16:42:39.445907000 +0100
-+++ gdb/aarch64-linux-tdep.c 2018-03-15 16:43:15.167745000 +0100
-@@ -176,12 +176,12 @@
- {
- /* movz x8, 0x8b (S=1,o=10,h=0,i=0x8b,r=8)
- Soo1 0010 1hhi iiii iiii iiii iiir rrrr */
-- {0xd2801168, -1},
-+ {0xd2801168, static_cast<ULONGEST>(-1)},
-
- /* svc 0x0 (o=0, l=1)
- 1101 0100 oooi iiii iiii iiii iii0 00ll */
-- {0xd4000001, -1},
-- {TRAMP_SENTINEL_INSN, -1}
-+ {0xd4000001, static_cast<ULONGEST>(-1)},
-+ {TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1)}
- },
- aarch64_linux_sigframe_init
- };
Index: head/devel/gdb/files/patch-gdb_aarch64-tdep.c
===================================================================
--- head/devel/gdb/files/patch-gdb_aarch64-tdep.c
+++ head/devel/gdb/files/patch-gdb_aarch64-tdep.c
@@ -1,11 +0,0 @@
---- gdb/aarch64-tdep.c.orig 2018-03-15 16:44:16.746186000 +0100
-+++ gdb/aarch64-tdep.c 2018-03-15 16:44:52.315010000 +0100
-@@ -2412,7 +2412,7 @@
- const int insn_size = 4;
- const int atomic_sequence_length = 16; /* Instruction sequence length. */
- CORE_ADDR pc = regcache_read_pc (regcache);
-- CORE_ADDR breaks[2] = { -1, -1 };
-+ CORE_ADDR breaks[2] = { static_cast<CORE_ADDR>(-1), static_cast<CORE_ADDR>(-1) };
- CORE_ADDR loc = pc;
- CORE_ADDR closing_insn = 0;
- uint32_t insn = read_memory_unsigned_integer (loc, insn_size,
Index: head/devel/gdb/files/patch-gdb_alpha-tdep.c
===================================================================
--- head/devel/gdb/files/patch-gdb_alpha-tdep.c
+++ head/devel/gdb/files/patch-gdb_alpha-tdep.c
@@ -1,11 +0,0 @@
---- gdb/alpha-tdep.c.orig 2018-03-15 16:45:58.726244000 +0100
-+++ gdb/alpha-tdep.c 2018-03-15 16:46:30.051357000 +0100
-@@ -769,7 +769,7 @@
- static std::vector<CORE_ADDR>
- alpha_deal_with_atomic_sequence (struct gdbarch *gdbarch, CORE_ADDR pc)
- {
-- CORE_ADDR breaks[2] = {-1, -1};
-+ CORE_ADDR breaks[2] = {static_cast<CORE_ADDR>(-1), static_cast<CORE_ADDR>(-1)};
- CORE_ADDR loc = pc;
- CORE_ADDR closing_insn; /* Instruction that closes the atomic sequence. */
- unsigned int insn = alpha_read_insn (gdbarch, loc);
Index: head/devel/gdb/files/patch-gdb_arch_arm-get-next-pcs.c
===================================================================
--- head/devel/gdb/files/patch-gdb_arch_arm-get-next-pcs.c
+++ head/devel/gdb/files/patch-gdb_arch_arm-get-next-pcs.c
@@ -1,20 +0,0 @@
---- gdb/arch/arm-get-next-pcs.c.orig 2018-03-15 10:02:33.823447000 +0100
-+++ gdb/arch/arm-get-next-pcs.c 2018-03-15 10:29:48.532027000 +0100
-@@ -49,7 +49,7 @@
- thumb_deal_with_atomic_sequence_raw (struct arm_get_next_pcs *self)
- {
- int byte_order_for_code = self->byte_order_for_code;
-- CORE_ADDR breaks[2] = {-1, -1};
-+ CORE_ADDR breaks[2] = {static_cast<CORE_ADDR>(-1), static_cast<CORE_ADDR>(-1)};
- CORE_ADDR pc = regcache_read_pc (self->regcache);
- CORE_ADDR loc = pc;
- unsigned short insn1, insn2;
-@@ -187,7 +187,7 @@
- arm_deal_with_atomic_sequence_raw (struct arm_get_next_pcs *self)
- {
- int byte_order_for_code = self->byte_order_for_code;
-- CORE_ADDR breaks[2] = {-1, -1};
-+ CORE_ADDR breaks[2] = {static_cast<CORE_ADDR>(-1), static_cast<CORE_ADDR>(-1)};
- CORE_ADDR pc = regcache_read_pc (self->regcache);
- CORE_ADDR loc = pc;
- unsigned int insn;
Index: head/devel/gdb/files/patch-gdb_arm-fbsd-tdep.c
===================================================================
--- head/devel/gdb/files/patch-gdb_arm-fbsd-tdep.c
+++ head/devel/gdb/files/patch-gdb_arm-fbsd-tdep.c
@@ -1,19 +0,0 @@
---- gdb/arm-fbsd-tdep.c.orig 2018-03-15 10:31:28.468820000 +0100
-+++ gdb/arm-fbsd-tdep.c 2018-03-15 10:39:51.558505000 +0100
-@@ -123,11 +123,11 @@
- SIGTRAMP_FRAME,
- 4,
- {
-- {0xe1a0000d, -1}, /* mov r0, sp */
-- {0xe2800040, -1}, /* add r0, r0, #SIGF_UC */
-- {0xe59f700c, -1}, /* ldr r7, [pc, #12] */
-- {0xef0001a1, -1}, /* swi SYS_sigreturn */
-- {TRAMP_SENTINEL_INSN, -1}
-+ {0xe1a0000d, static_cast<ULONGEST>(-1)}, /* mov r0, sp */
-+ {0xe2800040, static_cast<ULONGEST>(-1)}, /* add r0, r0, #SIGF_UC */
-+ {0xe59f700c, static_cast<ULONGEST>(-1)}, /* ldr r7, [pc, #12] */
-+ {0xef0001a1, static_cast<ULONGEST>(-1)}, /* swi SYS_sigreturn */
-+ {TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1)}
- },
- arm_fbsd_sigframe_init
- };
Index: head/devel/gdb/files/patch-gdb_arm-linux-tdep.c
===================================================================
--- head/devel/gdb/files/patch-gdb_arm-linux-tdep.c
+++ head/devel/gdb/files/patch-gdb_arm-linux-tdep.c
@@ -1,90 +0,0 @@
---- gdb/arm-linux-tdep.c.orig 2018-03-15 10:36:38.853100000 +0100
-+++ gdb/arm-linux-tdep.c 2018-03-15 10:42:37.222568000 +0100
-@@ -385,7 +385,7 @@
- SIGTRAMP_FRAME,
- 4,
- {
-- { ARM_LINUX_SIGRETURN_INSTR, -1 },
-+ { ARM_LINUX_SIGRETURN_INSTR, static_cast<ULONGEST>(-1) },
- { TRAMP_SENTINEL_INSN }
- },
- arm_linux_sigreturn_init
-@@ -395,7 +395,7 @@
- SIGTRAMP_FRAME,
- 4,
- {
-- { ARM_LINUX_RT_SIGRETURN_INSTR, -1 },
-+ { ARM_LINUX_RT_SIGRETURN_INSTR, static_cast<ULONGEST>(-1) },
- { TRAMP_SENTINEL_INSN }
- },
- arm_linux_rt_sigreturn_init
-@@ -405,8 +405,8 @@
- SIGTRAMP_FRAME,
- 4,
- {
-- { ARM_SET_R7_SIGRETURN, -1 },
-- { ARM_EABI_SYSCALL, -1 },
-+ { ARM_SET_R7_SIGRETURN, static_cast<ULONGEST>(-1) },
-+ { ARM_EABI_SYSCALL, static_cast<ULONGEST>(-1) },
- { TRAMP_SENTINEL_INSN }
- },
- arm_linux_sigreturn_init
-@@ -416,8 +416,8 @@
- SIGTRAMP_FRAME,
- 4,
- {
-- { ARM_SET_R7_RT_SIGRETURN, -1 },
-- { ARM_EABI_SYSCALL, -1 },
-+ { ARM_SET_R7_RT_SIGRETURN, static_cast<ULONGEST>(-1) },
-+ { ARM_EABI_SYSCALL, static_cast<ULONGEST>(-1) },
- { TRAMP_SENTINEL_INSN }
- },
- arm_linux_rt_sigreturn_init
-@@ -427,9 +427,9 @@
- SIGTRAMP_FRAME,
- 2,
- {
-- { THUMB2_SET_R7_SIGRETURN1, -1 },
-- { THUMB2_SET_R7_SIGRETURN2, -1 },
-- { THUMB2_EABI_SYSCALL, -1 },
-+ { THUMB2_SET_R7_SIGRETURN1, static_cast<ULONGEST>(-1) },
-+ { THUMB2_SET_R7_SIGRETURN2, static_cast<ULONGEST>(-1) },
-+ { THUMB2_EABI_SYSCALL, static_cast<ULONGEST>(-1) },
- { TRAMP_SENTINEL_INSN }
- },
- arm_linux_sigreturn_init
-@@ -439,9 +439,9 @@
- SIGTRAMP_FRAME,
- 2,
- {
-- { THUMB2_SET_R7_RT_SIGRETURN1, -1 },
-- { THUMB2_SET_R7_RT_SIGRETURN2, -1 },
-- { THUMB2_EABI_SYSCALL, -1 },
-+ { THUMB2_SET_R7_RT_SIGRETURN1, static_cast<ULONGEST>(-1) },
-+ { THUMB2_SET_R7_RT_SIGRETURN2, static_cast<ULONGEST>(-1) },
-+ { THUMB2_EABI_SYSCALL, static_cast<ULONGEST>(-1) },
- { TRAMP_SENTINEL_INSN }
- },
- arm_linux_rt_sigreturn_init
-@@ -451,8 +451,8 @@
- NORMAL_FRAME,
- 4,
- {
-- { ARM_OABI_SYSCALL_RESTART_SYSCALL, -1 },
-- { ARM_LDR_PC_SP_12, -1 },
-+ { ARM_OABI_SYSCALL_RESTART_SYSCALL, static_cast<ULONGEST>(-1) },
-+ { ARM_LDR_PC_SP_12, static_cast<ULONGEST>(-1) },
- { TRAMP_SENTINEL_INSN }
- },
- arm_linux_restart_syscall_init
-@@ -462,8 +462,8 @@
- NORMAL_FRAME,
- 4,
- {
-- { ARM_OABI_SYSCALL_RESTART_SYSCALL, -1 },
-- { ARM_LDR_PC_SP_4, -1 },
-+ { ARM_OABI_SYSCALL_RESTART_SYSCALL, static_cast<ULONGEST>(-1) },
-+ { ARM_LDR_PC_SP_4, static_cast<ULONGEST>(-1) },
- { TRAMP_SENTINEL_INSN }
- },
- arm_linux_restart_syscall_init
Index: head/devel/gdb/files/patch-gdb_arm-obsd-tdep.c
===================================================================
--- head/devel/gdb/files/patch-gdb_arm-obsd-tdep.c
+++ head/devel/gdb/files/patch-gdb_arm-obsd-tdep.c
@@ -1,19 +0,0 @@
---- gdb/arm-obsd-tdep.c.orig 2018-03-15 10:43:44.244835000 +0100
-+++ gdb/arm-obsd-tdep.c 2018-03-15 10:44:36.608679000 +0100
-@@ -58,11 +58,11 @@
- SIGTRAMP_FRAME,
- 4,
- {
-- { 0xe28d0010, -1 }, /* add r0, sp, #16 */
-- { 0xef000067, -1 }, /* swi SYS_sigreturn */
-- { 0xef000001, -1 }, /* swi SYS_exit */
-- { 0xeafffffc, -1 }, /* b . - 8 */
-- { TRAMP_SENTINEL_INSN, -1 }
-+ { 0xe28d0010, static_cast<ULONGEST>(-1) }, /* add r0, sp, #16 */
-+ { 0xef000067, static_cast<ULONGEST>(-1) }, /* swi SYS_sigreturn */
-+ { 0xef000001, static_cast<ULONGEST>(-1) }, /* swi SYS_exit */
-+ { 0xeafffffc, static_cast<ULONGEST>(-1) }, /* b . - 8 */
-+ { TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1) }
- },
- armobsd_sigframe_init
- };
Index: head/devel/gdb/files/patch-gdb_bfin-linux-tdep.c
===================================================================
--- head/devel/gdb/files/patch-gdb_bfin-linux-tdep.c
+++ head/devel/gdb/files/patch-gdb_bfin-linux-tdep.c
@@ -1,11 +0,0 @@
---- gdb/bfin-linux-tdep.c.orig 2018-03-15 10:45:37.746477000 +0100
-+++ gdb/bfin-linux-tdep.c 2018-03-15 10:46:02.925435000 +0100
-@@ -121,7 +121,7 @@
- {
- { 0x00ADE128, 0xffffffff }, /* P0 = __NR_rt_sigreturn; */
- { 0x00A0, 0xffff }, /* EXCPT 0; */
-- { TRAMP_SENTINEL_INSN, -1 },
-+ { TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1) },
- },
- bfin_linux_sigframe_init,
- };
Index: head/devel/gdb/files/patch-gdb_completer.c
===================================================================
--- head/devel/gdb/files/patch-gdb_completer.c
+++ head/devel/gdb/files/patch-gdb_completer.c
@@ -1,11 +0,0 @@
---- gdb/completer.c.orig 2018-03-15 16:51:01.106677000 +0100
-+++ gdb/completer.c 2018-03-15 16:51:47.055214000 +0100
-@@ -2038,7 +2038,7 @@
- /* We don't rely on readline appending the quote char as
- delimiter as then readline wouldn't append the ' ' after the
- completion. */
-- char buf[2] = { quote_char () };
-+ char buf[2] = { static_cast<char> (quote_char ()) };
-
- match_list[0] = reconcat (match_list[0], match_list[0],
- buf, (char *) NULL);
Index: head/devel/gdb/files/patch-gdb_configure
===================================================================
--- head/devel/gdb/files/patch-gdb_configure
+++ head/devel/gdb/files/patch-gdb_configure
@@ -1,16 +1,16 @@
---- gdb/configure.orig 2017-09-14 09:28:17 UTC
-+++ gdb/configure
-@@ -15467,10 +15467,10 @@ fi
+--- gdb/configure.orig 2019-05-11 11:19:02.000000000 -0700
++++ gdb/configure 2019-05-24 16:21:50.559870000 -0700
+@@ -15511,10 +15511,10 @@ fi
# The options we'll try to enable.
build_warnings="-Wall -Wpointer-arith \
---Wno-unused -Wunused-value -Wunused-function \
-+-Wno-unused \
+--Wno-unused -Wunused-value -Wunused-variable -Wunused-function \
++-Wno-unused \
-Wno-switch -Wno-char-subscripts \
--Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable \
---Wno-sign-compare -Wno-narrowing -Wno-error=maybe-uninitialized \
+--Wno-sign-compare -Wno-error=maybe-uninitialized \
+-Wempty-body \
-+-Wno-sign-compare -Wno-narrowing \
++-Wno-sign-compare \
-Wno-mismatched-tags \
-Wno-error=deprecated-register \
-Wsuggest-override \
Index: head/devel/gdb/files/patch-gdb_fbsd-nat.c
===================================================================
--- head/devel/gdb/files/patch-gdb_fbsd-nat.c
+++ head/devel/gdb/files/patch-gdb_fbsd-nat.c
@@ -1,17 +1,17 @@
---- gdb/fbsd-nat.c.orig 2017-09-14 09:28:17 UTC
-+++ gdb/fbsd-nat.c
-@@ -1108,6 +1108,14 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum gdb_signal signo)
- struct thread_info *tp;
- int request;
+--- gdb/fbsd-nat.c.orig 2019-05-11 11:19:03.000000000 -0700
++++ gdb/fbsd-nat.c 2019-05-24 16:25:52.961523000 -0700
+@@ -1178,6 +1178,14 @@ fbsd_nat_target::resume (ptid_t ptid, int step, enum g
+ /* If ptid is a specific LWP, suspend all other LWPs in the process. */
+ inferior *inf = find_inferior_ptid (ptid);
+#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
++ 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));
++ fbsd_add_threads (ptid.pid ());
+#endif
- ALL_NON_EXITED_THREADS (tp)
+ for (thread_info *tp : inf->non_exited_threads ())
{
- if (tp->ptid.pid () != ptid.pid ())
+ int request;
Index: head/devel/gdb/files/patch-gdb_hppa-nbsd-tdep.c
===================================================================
--- head/devel/gdb/files/patch-gdb_hppa-nbsd-tdep.c
+++ head/devel/gdb/files/patch-gdb_hppa-nbsd-tdep.c
@@ -1,44 +0,0 @@
---- gdb/hppa-nbsd-tdep.c.orig 2018-03-15 15:58:14.876431000 +0100
-+++ gdb/hppa-nbsd-tdep.c 2018-03-15 16:00:44.247395000 +0100
-@@ -71,25 +71,25 @@
- SIGTRAMP_FRAME,
- 4,
- {
-- { 0xc7d7c012, -1 }, /* bb,>=,n %arg3, 30, 1f */
-- { 0xd6e01c1e, -1 }, /* depwi 0,31,2,%arg3 */
-- { 0x0ee81093, -1 }, /* ldw 4(%arg3), %r19 */
-- { 0x0ee01097, -1 }, /* ldw 0(%arg3), %arg3 */
-+ { 0xc7d7c012, static_cast<ULONGEST>(-1) }, /* bb,>=,n %arg3, 30, 1f */
-+ { 0xd6e01c1e, static_cast<ULONGEST>(-1) }, /* depwi 0,31,2,%arg3 */
-+ { 0x0ee81093, static_cast<ULONGEST>(-1) }, /* ldw 4(%arg3), %r19 */
-+ { 0x0ee01097, static_cast<ULONGEST>(-1) }, /* ldw 0(%arg3), %arg3 */
- /* 1: */
-- { 0xe8404000, -1 }, /* blr %r0, %rp */
-- { 0xeae0c002, -1 }, /* bv,n %r0(%arg3) */
-- { 0x08000240, -1 }, /* nop */
-+ { 0xe8404000, static_cast<ULONGEST>(-1) }, /* blr %r0, %rp */
-+ { 0xeae0c002, static_cast<ULONGEST>(-1) }, /* bv,n %r0(%arg3) */
-+ { 0x08000240, static_cast<ULONGEST>(-1) }, /* nop */
-
-- { 0x0803025a, -1 }, /* copy %r3, %arg0 */
-- { 0x20200801, -1 }, /* ldil -40000000, %r1 */
-- { 0xe420e008, -1 }, /* be,l 4(%sr7, %r1), %sr0, %r31 */
-- { 0x34160268, -1 }, /* ldi 134, %t1 ; SYS_setcontext */
-+ { 0x0803025a, static_cast<ULONGEST>(-1) }, /* copy %r3, %arg0 */
-+ { 0x20200801, static_cast<ULONGEST>(-1) }, /* ldil -40000000, %r1 */
-+ { 0xe420e008, static_cast<ULONGEST>(-1) }, /* be,l 4(%sr7, %r1), %sr0, %r31 */
-+ { 0x34160268, static_cast<ULONGEST>(-1) }, /* ldi 134, %t1 ; SYS_setcontext */
-
-- { 0x081c025a, -1 }, /* copy ret0, %arg0 */
-- { 0x20200801, -1 }, /* ldil -40000000, %r1 */
-- { 0xe420e008, -1 }, /* be,l 4(%sr7, %r1), %sr0, %r31 */
-- { 0x34160002, -1 }, /* ldi 1, %t1 ; SYS_exit */
-- { TRAMP_SENTINEL_INSN, -1 }
-+ { 0x081c025a, static_cast<ULONGEST>(-1) }, /* copy ret0, %arg0 */
-+ { 0x20200801, static_cast<ULONGEST>(-1) }, /* ldil -40000000, %r1 */
-+ { 0xe420e008, static_cast<ULONGEST>(-1) }, /* be,l 4(%sr7, %r1), %sr0, %r31 */
-+ { 0x34160002, static_cast<ULONGEST>(-1) }, /* ldi 1, %t1 ; SYS_exit */
-+ { TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1) }
- },
- hppanbsd_sigtramp_cache_init
- };
Index: head/devel/gdb/files/patch-gdb_i386-nbsd-tdep.c
===================================================================
--- head/devel/gdb/files/patch-gdb_i386-nbsd-tdep.c
+++ head/devel/gdb/files/patch-gdb_i386-nbsd-tdep.c
@@ -1,157 +0,0 @@
---- gdb/i386-nbsd-tdep.c.orig 2018-03-15 10:50:06.446434000 +0100
-+++ gdb/i386-nbsd-tdep.c 2018-03-15 11:04:42.700720000 +0100
-@@ -106,19 +106,19 @@
- SIGTRAMP_FRAME,
- 1,
- {
-- { 0x8d, -1 }, { 0x44, -1 }, { 0x24, -1 }, { 0x10, -1 },
-+ { 0x8d, static_cast<ULONGEST>(-1) }, { 0x44, static_cast<ULONGEST>(-1) }, { 0x24, static_cast<ULONGEST>(-1) }, { 0x10, static_cast<ULONGEST>(-1) },
- /* leal 0x10(%esp), %eax */
-- { 0x50, -1 }, /* pushl %eax */
-- { 0x50, -1 }, /* pushl %eax */
-- { 0xb8, -1 }, { 0x27, -1 }, {0x01, -1 }, {0x00, -1 }, {0x00, -1 },
-+ { 0x50, static_cast<ULONGEST>(-1) }, /* pushl %eax */
-+ { 0x50, static_cast<ULONGEST>(-1) }, /* pushl %eax */
-+ { 0xb8, static_cast<ULONGEST>(-1) }, { 0x27, static_cast<ULONGEST>(-1) }, {0x01, static_cast<ULONGEST>(-1) }, {0x00, static_cast<ULONGEST>(-1) }, {0x00, static_cast<ULONGEST>(-1) },
- /* movl $0x127, %eax # __sigreturn14 */
-- { 0xcd, -1 }, { 0x80, -1},
-+ { 0xcd, static_cast<ULONGEST>(-1) }, { 0x80, static_cast<ULONGEST>(-1)},
- /* int $0x80 */
-- { 0xb8, -1 }, { 0x01, -1 }, {0x00, -1 }, {0x00, -1 }, {0x00, -1 },
-+ { 0xb8, static_cast<ULONGEST>(-1) }, { 0x01, static_cast<ULONGEST>(-1) }, {0x00, static_cast<ULONGEST>(-1) }, {0x00, static_cast<ULONGEST>(-1) }, {0x00, static_cast<ULONGEST>(-1) },
- /* movl $0x1, %eax # exit */
-- { 0xcd, -1 }, { 0x80, -1},
-+ { 0xcd, static_cast<ULONGEST>(-1) }, { 0x80, static_cast<ULONGEST>(-1)},
- /* int $0x80 */
-- { TRAMP_SENTINEL_INSN, -1 }
-+ { TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1) }
- },
- i386nbsd_sigtramp_cache_init
- };
-@@ -128,21 +128,21 @@
- SIGTRAMP_FRAME,
- 1,
- {
-- { 0x8d, -1 }, { 0x44, -1 }, { 0x24, -1 }, { 0x0c, -1 },
-+ { 0x8d, static_cast<ULONGEST>(-1) }, { 0x44, static_cast<ULONGEST>(-1) }, { 0x24, static_cast<ULONGEST>(-1) }, { 0x0c, static_cast<ULONGEST>(-1) },
- /* leal 0x0c(%esp), %eax */
-- { 0x89, -1 }, { 0x44, -1 }, { 0x24, -1 }, { 0x04, -1 },
-+ { 0x89, static_cast<ULONGEST>(-1) }, { 0x44, static_cast<ULONGEST>(-1) }, { 0x24, static_cast<ULONGEST>(-1) }, { 0x04, static_cast<ULONGEST>(-1) },
- /* movl %eax, 0x4(%esp) */
-- { 0xb8, -1 }, { 0x27, -1 }, {0x01, -1 }, {0x00, -1 }, {0x00, -1 },
-+ { 0xb8, static_cast<ULONGEST>(-1) }, { 0x27, static_cast<ULONGEST>(-1) }, {0x01, static_cast<ULONGEST>(-1) }, {0x00, static_cast<ULONGEST>(-1) }, {0x00, static_cast<ULONGEST>(-1) },
- /* movl $0x127, %eax # __sigreturn14 */
-- { 0xcd, -1 }, { 0x80, -1},
-+ { 0xcd, static_cast<ULONGEST>(-1) }, { 0x80, static_cast<ULONGEST>(-1)},
- /* int $0x80 */
-- { 0x89, -1 }, { 0x44, -1 }, { 0x24, -1 }, { 0x04, -1 },
-+ { 0x89, static_cast<ULONGEST>(-1) }, { 0x44, static_cast<ULONGEST>(-1) }, { 0x24, static_cast<ULONGEST>(-1) }, { 0x04, static_cast<ULONGEST>(-1) },
- /* movl %eax, 0x4(%esp) */
-- { 0xb8, -1 }, { 0x01, -1 }, {0x00, -1 }, {0x00, -1 }, {0x00, -1 },
-+ { 0xb8, static_cast<ULONGEST>(-1) }, { 0x01, static_cast<ULONGEST>(-1) }, {0x00, static_cast<ULONGEST>(-1) }, {0x00, static_cast<ULONGEST>(-1) }, {0x00, static_cast<ULONGEST>(-1) },
- /* movl $0x1, %eax */
-- { 0xcd, -1 }, { 0x80, -1},
-+ { 0xcd, static_cast<ULONGEST>(-1) }, { 0x80, static_cast<ULONGEST>(-1)},
- /* int $0x80 */
-- { TRAMP_SENTINEL_INSN, -1 }
-+ { TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1) }
- },
- i386nbsd_sigtramp_cache_init
- };
-@@ -152,21 +152,22 @@
- SIGTRAMP_FRAME,
- 1,
- {
-- { 0x8b, -1 }, { 0x44, -1 }, { 0x24, -1 }, { 0x08, -1 },
-+ { 0x8b, static_cast<ULONGEST>(-1) }, { 0x44, static_cast<ULONGEST>(-1) }, { 0x24, static_cast<ULONGEST>(-1) }, { 0x08, static_cast<ULONGEST>(-1) },
- /* movl 8(%esp),%eax */
-- { 0x89, -1 }, { 0x44, -1 }, { 0x24, -1 }, { 0x04, -1 },
-+ { 0x89, static_cast<ULONGEST>(-1) }, { 0x44, static_cast<ULONGEST>(-1) }, { 0x24, static_cast<ULONGEST>(-1) }, { 0x04, static_cast<ULONGEST>(-1) },
- /* movl %eax, 0x4(%esp) */
-- { 0xb8, -1 }, { 0x34, -1 }, { 0x01, -1 }, { 0x00, -1 }, { 0x00, -1 },
-+ { 0xb8, static_cast<ULONGEST>(-1) }, { 0x34, static_cast<ULONGEST>(-1) }, { 0x01, static_cast<ULONGEST>(-1) }, { 0x00, static_cast<ULONGEST>(-1) }, { 0x00, static_cast<ULONGEST>(-1) },
- /* movl $0x134, %eax # setcontext */
-- { 0xcd, -1 }, { 0x80, -1 },
-+ { 0xcd, static_cast<ULONGEST>(-1) }, { 0x80, static_cast<ULONGEST>(-1) },
- /* int $0x80 */
-- { 0x89, -1 }, { 0x44, -1 }, { 0x24, -1 }, { 0x04, -1 },
-+ { 0x89, static_cast<ULONGEST>(-1) }, { 0x44, static_cast<ULONGEST>(-1) }, { 0x24, static_cast<ULONGEST>(-1) }, { 0x04, static_cast<ULONGEST>(-1) },
-+ { 0x89, static_cast<ULONGEST>(-1) }, { 0x44, static_cast<ULONGEST>(-1) }, { 0x24, static_cast<ULONGEST>(-1) }, { 0x04, static_cast<ULONGEST>(-1) },
- /* movl %eax, 0x4(%esp) */
-- { 0xb8, -1 }, { 0x01, -1 }, { 0x00, -1 }, { 0x00, -1 }, { 0x00, -1 },
-+ { 0xb8, static_cast<ULONGEST>(-1) }, { 0x01, static_cast<ULONGEST>(-1) }, {0x00, static_cast<ULONGEST>(-1) }, {0x00, static_cast<ULONGEST>(-1) }, {0x00, static_cast<ULONGEST>(-1) },
- /* movl $0x1, %eax */
-- { 0xcd, -1 }, { 0x80, -1 },
-+ { 0xcd, static_cast<ULONGEST>(-1) }, { 0x80, static_cast<ULONGEST>(-1)},
- /* int $0x80 */
-- { TRAMP_SENTINEL_INSN, -1 }
-+ { TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1) }
- },
- i386nbsd_sigtramp_cache_init
- };
-@@ -176,22 +177,22 @@
- SIGTRAMP_FRAME,
- 1,
- {
-- { 0x8d, -1 }, { 0x84, -1 }, { 0x24, -1 },
-- { 0x8c, -1 }, { 0x00, -1 }, { 0x00, -1 }, { 0x00, -1 },
-+ { 0x8d, static_cast<ULONGEST>(-1) }, { 0x84, static_cast<ULONGEST>(-1) }, { 0x24, static_cast<ULONGEST>(-1) },
-+ { 0x8c, static_cast<ULONGEST>(-1) }, { 0x00, static_cast<ULONGEST>(-1) }, { 0x00, static_cast<ULONGEST>(-1) }, { 0x00, static_cast<ULONGEST>(-1) },
- /* leal 0x8c(%esp), %eax */
-- { 0x89, -1 }, { 0x44, -1 }, { 0x24, -1 }, { 0x04, -1 },
-+ { 0x89, static_cast<ULONGEST>(-1) }, { 0x44, static_cast<ULONGEST>(-1) }, { 0x24, static_cast<ULONGEST>(-1) }, { 0x04, static_cast<ULONGEST>(-1) },
- /* movl %eax, 0x4(%esp) */
-- { 0xb8, -1 }, { 0x34, -1 }, { 0x01, -1 }, { 0x00, -1 }, { 0x00, -1 },
-+ { 0xb8, static_cast<ULONGEST>(-1) }, { 0x34, static_cast<ULONGEST>(-1) }, { 0x01, static_cast<ULONGEST>(-1) }, { 0x00, static_cast<ULONGEST>(-1) }, { 0x00, static_cast<ULONGEST>(-1) },
- /* movl $0x134, %eax # setcontext */
-- { 0xcd, -1 }, { 0x80, -1},
-+ { 0xcd, static_cast<ULONGEST>(-1) }, { 0x80, static_cast<ULONGEST>(-1)},
- /* int $0x80 */
-- { 0x89, -1 }, { 0x44, -1 }, { 0x24, -1 }, { 0x04, -1 },
-+ { 0x89, static_cast<ULONGEST>(-1) }, { 0x44, static_cast<ULONGEST>(-1) }, { 0x24, static_cast<ULONGEST>(-1) }, { 0x04, static_cast<ULONGEST>(-1) },
- /* movl %eax, 0x4(%esp) */
-- { 0xb8, -1 }, { 0x01, -1 }, {0x00, -1 }, {0x00, -1 }, {0x00, -1 },
-+ { 0xb8, static_cast<ULONGEST>(-1) }, { 0x01, static_cast<ULONGEST>(-1) }, {0x00, static_cast<ULONGEST>(-1) }, {0x00, static_cast<ULONGEST>(-1) }, {0x00, static_cast<ULONGEST>(-1) },
- /* movl $0x1, %eax */
-- { 0xcd, -1 }, { 0x80, -1},
-+ { 0xcd, static_cast<ULONGEST>(-1) }, { 0x80, static_cast<ULONGEST>(-1)},
- /* int $0x80 */
-- { TRAMP_SENTINEL_INSN, -1 }
-+ { TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1) }
- },
- i386nbsd_sigtramp_cache_init
- };
-@@ -201,23 +202,23 @@
- SIGTRAMP_FRAME,
- 1,
- {
-- { 0x8d, -1 }, { 0x84, -1 }, { 0x24, -1 },
-- { 0x8c, -1 }, { 0x00, -1 }, { 0x00, -1 }, { 0x00, -1 },
-+ { 0x8d, static_cast<ULONGEST>(-1) }, { 0x84, static_cast<ULONGEST>(-1) }, { 0x24, static_cast<ULONGEST>(-1) },
-+ { 0x8c, static_cast<ULONGEST>(-1) }, { 0x00, static_cast<ULONGEST>(-1) }, { 0x00, static_cast<ULONGEST>(-1) }, { 0x00, static_cast<ULONGEST>(-1) },
- /* leal 0x8c(%esp), %eax */
-- { 0x89, -1 }, { 0x44, -1 }, { 0x24, -1 }, { 0x04, -1 },
-+ { 0x89, static_cast<ULONGEST>(-1) }, { 0x44, static_cast<ULONGEST>(-1) }, { 0x24, static_cast<ULONGEST>(-1) }, { 0x04, static_cast<ULONGEST>(-1) },
- /* movl %eax, 0x4(%esp) */
-- { 0xb8, -1 }, { 0x34, -1 }, { 0x01, -1 }, { 0x00, -1 }, { 0x00, -1 },
-+ { 0xb8, static_cast<ULONGEST>(-1) }, { 0x34, static_cast<ULONGEST>(-1) }, { 0x01, static_cast<ULONGEST>(-1) }, { 0x00, static_cast<ULONGEST>(-1) }, { 0x00, static_cast<ULONGEST>(-1) },
- /* movl $0x134, %eax # setcontext */
-- { 0xcd, -1 }, { 0x80, -1},
-+ { 0xcd, static_cast<ULONGEST>(-1) }, { 0x80, static_cast<ULONGEST>(-1)},
- /* int $0x80 */
-- { 0xc7, -1 }, { 0x44, -1 }, { 0x24, -1 }, { 0x04, -1 },
-- { 0xff, -1 }, { 0xff, -1 }, { 0xff, -1 }, { 0xff, -1 },
-+ { 0xc7, static_cast<ULONGEST>(-1) }, { 0x44, static_cast<ULONGEST>(-1) }, { 0x24, static_cast<ULONGEST>(-1) }, { 0x04, static_cast<ULONGEST>(-1) },
-+ { 0xff, static_cast<ULONGEST>(-1) }, { 0xff, static_cast<ULONGEST>(-1) }, { 0xff, static_cast<ULONGEST>(-1) }, { 0xff, static_cast<ULONGEST>(-1) },
- /* movl $0xffffffff,0x4(%esp) */
-- { 0xb8, -1 }, { 0x01, -1 }, {0x00, -1 }, {0x00, -1 }, {0x00, -1 },
-+ { 0xb8, static_cast<ULONGEST>(-1) }, { 0x01, static_cast<ULONGEST>(-1) }, {0x00, static_cast<ULONGEST>(-1) }, {0x00, static_cast<ULONGEST>(-1) }, {0x00, static_cast<ULONGEST>(-1) },
- /* movl $0x1, %eax */
-- { 0xcd, -1 }, { 0x80, -1},
-+ { 0xcd, static_cast<ULONGEST>(-1) }, { 0x80, static_cast<ULONGEST>(-1)},
- /* int $0x80 */
-- { TRAMP_SENTINEL_INSN, -1 }
-+ { TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1) }
- },
- i386nbsd_sigtramp_cache_init
- };
Index: head/devel/gdb/files/patch-gdb_linespec.c
===================================================================
--- head/devel/gdb/files/patch-gdb_linespec.c
+++ head/devel/gdb/files/patch-gdb_linespec.c
@@ -1,11 +0,0 @@
---- gdb/linespec.c.orig 2018-03-15 16:52:46.342610000 +0100
-+++ gdb/linespec.c 2018-03-15 16:53:18.324077000 +0100
-@@ -2912,7 +2912,7 @@
- new "quote" char. */
- if (tracker.quote_char ())
- {
-- char quote_char_str[2] = { tracker.quote_char () };
-+ char quote_char_str[2] = { static_cast<char>(tracker.quote_char () )};
-
- fn = reconcat (fn, fn, quote_char_str, (char *) NULL);
- tracker.set_quote_char (':');
Index: head/devel/gdb/files/patch-gdb_microblaze-linux-tdep.c
===================================================================
--- head/devel/gdb/files/patch-gdb_microblaze-linux-tdep.c
+++ head/devel/gdb/files/patch-gdb_microblaze-linux-tdep.c
@@ -1,13 +0,0 @@
---- gdb/microblaze-linux-tdep.c.orig 2018-03-15 11:06:05.114101000 +0100
-+++ gdb/microblaze-linux-tdep.c 2018-03-15 11:06:36.384643000 +0100
-@@ -107,8 +107,8 @@
- SIGTRAMP_FRAME,
- 4,
- {
-- { 0x31800077, -1 }, /* addik R12,R0,119. */
-- { 0xb9cc0008, -1 }, /* brki R14,8. */
-+ { 0x31800077, static_cast<ULONGEST>(-1) }, /* addik R12,R0,119. */
-+ { 0xb9cc0008, static_cast<ULONGEST>(-1) }, /* brki R14,8. */
- { TRAMP_SENTINEL_INSN },
- },
- microblaze_linux_sighandler_cache_init
Index: head/devel/gdb/files/patch-gdb_mips-fbsd-tdep.c
===================================================================
--- head/devel/gdb/files/patch-gdb_mips-fbsd-tdep.c
+++ head/devel/gdb/files/patch-gdb_mips-fbsd-tdep.c
@@ -1,53 +0,0 @@
---- gdb/mips-fbsd-tdep.c.orig 2018-03-15 11:11:08.892968000 +0100
-+++ gdb/mips-fbsd-tdep.c 2018-03-15 11:14:38.323126000 +0100
-@@ -342,11 +342,11 @@
- SIGTRAMP_FRAME,
- MIPS_INSN32_SIZE,
- {
-- { MIPS_INST_ADDIU_A0_SP_O32, -1 }, /* addiu a0, sp, SIGF_UC */
-- { MIPS_INST_LI_V0_SIGRETURN, -1 }, /* li v0, SYS_sigreturn */
-- { MIPS_INST_SYSCALL, -1 }, /* syscall */
-- { MIPS_INST_BREAK, -1 }, /* break */
-- { TRAMP_SENTINEL_INSN, -1 }
-+ { MIPS_INST_ADDIU_A0_SP_O32, static_cast<ULONGEST>(-1) }, /* addiu a0, sp, SIGF_UC */
-+ { MIPS_INST_LI_V0_SIGRETURN, static_cast<ULONGEST>(-1) }, /* li v0, SYS_sigreturn */
-+ { MIPS_INST_SYSCALL, static_cast<ULONGEST>(-1) }, /* syscall */
-+ { MIPS_INST_BREAK, static_cast<ULONGEST>(-1) }, /* break */
-+ { TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1) }
- },
- mips_fbsd_sigframe_init
- };
-@@ -434,11 +434,11 @@
- SIGTRAMP_FRAME,
- MIPS_INSN32_SIZE,
- {
-- { MIPS_INST_ADDIU_A0_SP_N32, -1 }, /* addiu a0, sp, SIGF_UC */
-- { MIPS_INST_LI_V0_SIGRETURN, -1 }, /* li v0, SYS_sigreturn */
-- { MIPS_INST_SYSCALL, -1 }, /* syscall */
-- { MIPS_INST_BREAK, -1 }, /* break */
-- { TRAMP_SENTINEL_INSN, -1 }
-+ { MIPS_INST_ADDIU_A0_SP_N32, static_cast<ULONGEST>(-1) }, /* addiu a0, sp, SIGF_UC */
-+ { MIPS_INST_LI_V0_SIGRETURN, static_cast<ULONGEST>(-1) }, /* li v0, SYS_sigreturn */
-+ { MIPS_INST_SYSCALL, static_cast<ULONGEST>(-1) }, /* syscall */
-+ { MIPS_INST_BREAK, static_cast<ULONGEST>(-1) }, /* break */
-+ { TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1) }
- },
- mips64_fbsd_sigframe_init
- };
-@@ -451,11 +451,11 @@
- SIGTRAMP_FRAME,
- MIPS_INSN32_SIZE,
- {
-- { MIPS_INST_DADDIU_A0_SP_N64, -1 }, /* daddiu a0, sp, SIGF_UC */
-- { MIPS_INST_LI_V0_SIGRETURN, -1 }, /* li v0, SYS_sigreturn */
-- { MIPS_INST_SYSCALL, -1 }, /* syscall */
-- { MIPS_INST_BREAK, -1 }, /* break */
-- { TRAMP_SENTINEL_INSN, -1 }
-+ { MIPS_INST_DADDIU_A0_SP_N64, static_cast<ULONGEST>(-1) }, /* daddiu a0, sp, SIGF_UC */
-+ { MIPS_INST_LI_V0_SIGRETURN, static_cast<ULONGEST>(-1) }, /* li v0, SYS_sigreturn */
-+ { MIPS_INST_SYSCALL, static_cast<ULONGEST>(-1) }, /* syscall */
-+ { MIPS_INST_BREAK, static_cast<ULONGEST>(-1) }, /* break */
-+ { TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1) }
- },
- mips64_fbsd_sigframe_init
- };
Index: head/devel/gdb/files/patch-gdb_mips-linux-tdep.c
===================================================================
--- head/devel/gdb/files/patch-gdb_mips-linux-tdep.c
+++ head/devel/gdb/files/patch-gdb_mips-linux-tdep.c
@@ -1,122 +0,0 @@
---- gdb/mips-linux-tdep.c.orig 2018-03-15 11:07:40.749034000 +0100
-+++ gdb/mips-linux-tdep.c 2018-03-15 11:09:52.878504000 +0100
-@@ -831,9 +831,9 @@
- SIGTRAMP_FRAME,
- 4,
- {
-- { MIPS_INST_LI_V0_SIGRETURN, -1 },
-- { MIPS_INST_SYSCALL, -1 },
-- { TRAMP_SENTINEL_INSN, -1 }
-+ { MIPS_INST_LI_V0_SIGRETURN, static_cast<ULONGEST>(-1) },
-+ { MIPS_INST_SYSCALL, static_cast<ULONGEST>(-1) },
-+ { TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1) }
- },
- mips_linux_o32_sigframe_init,
- mips_linux_sigframe_validate
-@@ -843,9 +843,9 @@
- SIGTRAMP_FRAME,
- 4,
- {
-- { MIPS_INST_LI_V0_RT_SIGRETURN, -1 },
-- { MIPS_INST_SYSCALL, -1 },
-- { TRAMP_SENTINEL_INSN, -1 } },
-+ { MIPS_INST_LI_V0_RT_SIGRETURN, static_cast<ULONGEST>(-1) },
-+ { MIPS_INST_SYSCALL, static_cast<ULONGEST>(-1) },
-+ { TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1) } },
- mips_linux_o32_sigframe_init,
- mips_linux_sigframe_validate
- };
-@@ -854,9 +854,9 @@
- SIGTRAMP_FRAME,
- 4,
- {
-- { MIPS_INST_LI_V0_N32_RT_SIGRETURN, -1 },
-- { MIPS_INST_SYSCALL, -1 },
-- { TRAMP_SENTINEL_INSN, -1 }
-+ { MIPS_INST_LI_V0_N32_RT_SIGRETURN, static_cast<ULONGEST>(-1) },
-+ { MIPS_INST_SYSCALL, static_cast<ULONGEST>(-1) },
-+ { TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1) }
- },
- mips_linux_n32n64_sigframe_init,
- mips_linux_sigframe_validate
-@@ -866,9 +866,9 @@
- SIGTRAMP_FRAME,
- 4,
- {
-- { MIPS_INST_LI_V0_N64_RT_SIGRETURN, -1 },
-- { MIPS_INST_SYSCALL, -1 },
-- { TRAMP_SENTINEL_INSN, -1 }
-+ { MIPS_INST_LI_V0_N64_RT_SIGRETURN, static_cast<ULONGEST>(-1) },
-+ { MIPS_INST_SYSCALL, static_cast<ULONGEST>(-1) },
-+ { TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1) }
- },
- mips_linux_n32n64_sigframe_init,
- mips_linux_sigframe_validate
-@@ -878,11 +878,11 @@
- SIGTRAMP_FRAME,
- 2,
- {
-- { MICROMIPS_INST_LI_V0, -1 },
-- { MIPS_NR_sigreturn, -1 },
-- { MICROMIPS_INST_POOL32A, -1 },
-- { MICROMIPS_INST_SYSCALL, -1 },
-- { TRAMP_SENTINEL_INSN, -1 }
-+ { MICROMIPS_INST_LI_V0, static_cast<ULONGEST>(-1) },
-+ { MIPS_NR_sigreturn, static_cast<ULONGEST>(-1) },
-+ { MICROMIPS_INST_POOL32A, static_cast<ULONGEST>(-1) },
-+ { MICROMIPS_INST_SYSCALL, static_cast<ULONGEST>(-1) },
-+ { TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1) }
- },
- mips_linux_o32_sigframe_init,
- micromips_linux_sigframe_validate
-@@ -892,11 +892,11 @@
- SIGTRAMP_FRAME,
- 2,
- {
-- { MICROMIPS_INST_LI_V0, -1 },
-- { MIPS_NR_rt_sigreturn, -1 },
-- { MICROMIPS_INST_POOL32A, -1 },
-- { MICROMIPS_INST_SYSCALL, -1 },
-- { TRAMP_SENTINEL_INSN, -1 }
-+ { MICROMIPS_INST_LI_V0, static_cast<ULONGEST>(-1) },
-+ { MIPS_NR_rt_sigreturn, static_cast<ULONGEST>(-1) },
-+ { MICROMIPS_INST_POOL32A, static_cast<ULONGEST>(-1) },
-+ { MICROMIPS_INST_SYSCALL, static_cast<ULONGEST>(-1) },
-+ { TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1) }
- },
- mips_linux_o32_sigframe_init,
- micromips_linux_sigframe_validate
-@@ -906,11 +906,11 @@
- SIGTRAMP_FRAME,
- 2,
- {
-- { MICROMIPS_INST_LI_V0, -1 },
-- { MIPS_NR_N32_rt_sigreturn, -1 },
-- { MICROMIPS_INST_POOL32A, -1 },
-- { MICROMIPS_INST_SYSCALL, -1 },
-- { TRAMP_SENTINEL_INSN, -1 }
-+ { MICROMIPS_INST_LI_V0, static_cast<ULONGEST>(-1) },
-+ { MIPS_NR_N32_rt_sigreturn, static_cast<ULONGEST>(-1) },
-+ { MICROMIPS_INST_POOL32A, static_cast<ULONGEST>(-1) },
-+ { MICROMIPS_INST_SYSCALL, static_cast<ULONGEST>(-1) },
-+ { TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1) }
- },
- mips_linux_n32n64_sigframe_init,
- micromips_linux_sigframe_validate
-@@ -920,11 +920,11 @@
- SIGTRAMP_FRAME,
- 2,
- {
-- { MICROMIPS_INST_LI_V0, -1 },
-- { MIPS_NR_N64_rt_sigreturn, -1 },
-- { MICROMIPS_INST_POOL32A, -1 },
-- { MICROMIPS_INST_SYSCALL, -1 },
-- { TRAMP_SENTINEL_INSN, -1 }
-+ { MICROMIPS_INST_LI_V0, static_cast<ULONGEST>(-1) },
-+ { MIPS_NR_N64_rt_sigreturn, static_cast<ULONGEST>(-1) },
-+ { MICROMIPS_INST_POOL32A, static_cast<ULONGEST>(-1) },
-+ { MICROMIPS_INST_SYSCALL, static_cast<ULONGEST>(-1) },
-+ { TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1) }
- },
- mips_linux_n32n64_sigframe_init,
- micromips_linux_sigframe_validate
Index: head/devel/gdb/files/patch-gdb_mips-tdep.c
===================================================================
--- head/devel/gdb/files/patch-gdb_mips-tdep.c
+++ head/devel/gdb/files/patch-gdb_mips-tdep.c
@@ -1,20 +0,0 @@
---- gdb/mips-tdep.c.orig 2018-03-15 11:15:08.500010000 +0100
-+++ gdb/mips-tdep.c 2018-03-15 11:16:05.745083000 +0100
-@@ -3882,7 +3882,7 @@
- static std::vector<CORE_ADDR>
- mips_deal_with_atomic_sequence (struct gdbarch *gdbarch, CORE_ADDR pc)
- {
-- CORE_ADDR breaks[2] = {-1, -1};
-+ CORE_ADDR breaks[2] = {static_cast<CORE_ADDR>(-1), static_cast<CORE_ADDR>(-1)};
- CORE_ADDR loc = pc;
- CORE_ADDR branch_bp; /* Breakpoint at branch instruction's destination. */
- ULONGEST insn;
-@@ -3985,7 +3985,7 @@
- {
- const int atomic_sequence_length = 16; /* Instruction sequence length. */
- int last_breakpoint = 0; /* Defaults to 0 (no breakpoints placed). */
-- CORE_ADDR breaks[2] = {-1, -1};
-+ CORE_ADDR breaks[2] = {static_cast<CORE_ADDR>(-1), static_cast<CORE_ADDR>(-1)};
- CORE_ADDR branch_bp = 0; /* Breakpoint at branch instruction's
- destination. */
- CORE_ADDR loc = pc;
Index: head/devel/gdb/files/patch-gdb_mips64-obsd-tdep.c
===================================================================
--- head/devel/gdb/files/patch-gdb_mips64-obsd-tdep.c
+++ head/devel/gdb/files/patch-gdb_mips64-obsd-tdep.c
@@ -1,19 +0,0 @@
---- gdb/mips64-obsd-tdep.c.orig 2018-03-15 16:47:34.626536000 +0100
-+++ gdb/mips64-obsd-tdep.c 2018-03-15 16:48:17.150853000 +0100
-@@ -127,11 +127,11 @@
- SIGTRAMP_FRAME,
- MIPS_INSN32_SIZE,
- {
-- { 0x67a40020, -1 }, /* daddiu a0,sp,32 */
-- { 0x24020067, -1 }, /* li v0,103 */
-- { 0x0000000c, -1 }, /* syscall */
-- { 0x0000000d, -1 }, /* break */
-- { TRAMP_SENTINEL_INSN, -1 }
-+ { 0x67a40020, static_cast<ULONGEST>(-1) }, /* daddiu a0,sp,32 */
-+ { 0x24020067, static_cast<ULONGEST>(-1) }, /* li v0,103 */
-+ { 0x0000000c, static_cast<ULONGEST>(-1) }, /* syscall */
-+ { 0x0000000d, static_cast<ULONGEST>(-1) }, /* break */
-+ { TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1) }
- },
- mips64obsd_sigframe_init
- };
Index: head/devel/gdb/files/patch-gdb_mn10300-linux-tdep.c
===================================================================
--- head/devel/gdb/files/patch-gdb_mn10300-linux-tdep.c
+++ head/devel/gdb/files/patch-gdb_mn10300-linux-tdep.c
@@ -1,42 +0,0 @@
---- gdb/mn10300-linux-tdep.c.orig 2018-03-15 11:17:21.462824000 +0100
-+++ gdb/mn10300-linux-tdep.c 2018-03-15 11:20:05.266582000 +0100
-@@ -476,13 +476,13 @@
- 1,
- {
- /* mov 119,d0 */
-- { 0x2c, -1 },
-- { 0x77, -1 },
-- { 0x00, -1 },
-+ { 0x2c, static_cast<ULONGEST>(-1) },
-+ { 0x77, static_cast<ULONGEST>(-1) },
-+ { 0x00, static_cast<ULONGEST>(-1) },
- /* syscall 0 */
-- { 0xf0, -1 },
-- { 0xe0, -1 },
-- { TRAMP_SENTINEL_INSN, -1 }
-+ { 0xf0, static_cast<ULONGEST>(-1) },
-+ { 0xe0, static_cast<ULONGEST>(-1) },
-+ { TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1) }
- },
- am33_linux_sigframe_cache_init
- };
-@@ -492,13 +492,13 @@
- 1,
- {
- /* mov 173,d0 */
-- { 0x2c, -1 },
-- { 0xad, -1 },
-- { 0x00, -1 },
-+ { 0x2c, static_cast<ULONGEST>(-1) },
-+ { 0xad, static_cast<ULONGEST>(-1) },
-+ { 0x00, static_cast<ULONGEST>(-1) },
- /* syscall 0 */
-- { 0xf0, -1 },
-- { 0xe0, -1 },
-- { TRAMP_SENTINEL_INSN, -1 }
-+ { 0xf0, static_cast<ULONGEST>(-1) },
-+ { 0xe0, static_cast<ULONGEST>(-1) },
-+ { TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1) }
- },
- am33_linux_sigframe_cache_init
- };
Index: head/devel/gdb/files/patch-gdb_nios2-linux-tdep.c
===================================================================
--- head/devel/gdb/files/patch-gdb_nios2-linux-tdep.c
+++ head/devel/gdb/files/patch-gdb_nios2-linux-tdep.c
@@ -1,24 +0,0 @@
---- gdb/nios2-linux-tdep.c.orig 2018-03-15 11:23:52.815692000 +0100
-+++ gdb/nios2-linux-tdep.c 2018-03-15 11:55:44.876122000 +0100
-@@ -164,8 +164,8 @@
- SIGTRAMP_FRAME,
- 4,
- {
-- { MATCH_R1_MOVI | SET_IW_I_B (2) | SET_IW_I_IMM16 (139), -1 },
-- { MATCH_R1_TRAP | SET_IW_R_IMM5 (0), -1},
-+ { MATCH_R1_MOVI | SET_IW_I_B (2) | SET_IW_I_IMM16 (139), static_cast<ULONGEST>(-1) },
-+ { MATCH_R1_TRAP | SET_IW_R_IMM5 (0), static_cast<ULONGEST>(-1)},
- { TRAMP_SENTINEL_INSN }
- },
- nios2_linux_rt_sigreturn_init
-@@ -176,8 +176,8 @@
- SIGTRAMP_FRAME,
- 4,
- {
-- { MATCH_R2_MOVI | SET_IW_F2I16_B (2) | SET_IW_F2I16_IMM16 (139), -1 },
-- { MATCH_R2_TRAP | SET_IW_X2L5_IMM5 (0), -1},
-+ { MATCH_R2_MOVI | SET_IW_F2I16_B (2) | SET_IW_F2I16_IMM16 (139), static_cast<ULONGEST>(-1) },
-+ { MATCH_R2_TRAP | SET_IW_X2L5_IMM5 (0), static_cast<ULONGEST>(-1)},
- { TRAMP_SENTINEL_INSN }
- },
- nios2_linux_rt_sigreturn_init
Index: head/devel/gdb/files/patch-gdb_ppc-linux-tdep.c
===================================================================
--- head/devel/gdb/files/patch-gdb_ppc-linux-tdep.c
+++ head/devel/gdb/files/patch-gdb_ppc-linux-tdep.c
@@ -1,50 +0,0 @@
---- gdb/ppc-linux-tdep.c.orig 2018-03-15 11:56:24.120083000 +0100
-+++ gdb/ppc-linux-tdep.c 2018-03-15 11:57:57.568381000 +0100
-@@ -663,8 +663,8 @@
- SIGTRAMP_FRAME,
- 4,
- {
-- { 0x380000ac, -1 }, /* li r0, 172 */
-- { 0x44000002, -1 }, /* sc */
-+ { 0x380000ac, static_cast<ULONGEST>(-1) }, /* li r0, 172 */
-+ { 0x44000002, static_cast<ULONGEST>(-1) }, /* sc */
- { TRAMP_SENTINEL_INSN },
- },
- ppc32_linux_sigaction_cache_init
-@@ -673,9 +673,9 @@
- SIGTRAMP_FRAME,
- 4,
- {
-- { 0x38210080, -1 }, /* addi r1,r1,128 */
-- { 0x380000ac, -1 }, /* li r0, 172 */
-- { 0x44000002, -1 }, /* sc */
-+ { 0x38210080, static_cast<ULONGEST>(-1) }, /* addi r1,r1,128 */
-+ { 0x380000ac, static_cast<ULONGEST>(-1) }, /* li r0, 172 */
-+ { 0x44000002, static_cast<ULONGEST>(-1) }, /* sc */
- { TRAMP_SENTINEL_INSN },
- },
- ppc64_linux_sigaction_cache_init
-@@ -684,8 +684,8 @@
- SIGTRAMP_FRAME,
- 4,
- {
-- { 0x38000077, -1 }, /* li r0,119 */
-- { 0x44000002, -1 }, /* sc */
-+ { 0x38000077, static_cast<ULONGEST>(-1) }, /* li r0,119 */
-+ { 0x44000002, static_cast<ULONGEST>(-1) }, /* sc */
- { TRAMP_SENTINEL_INSN },
- },
- ppc32_linux_sighandler_cache_init
-@@ -694,9 +694,9 @@
- SIGTRAMP_FRAME,
- 4,
- {
-- { 0x38210080, -1 }, /* addi r1,r1,128 */
-- { 0x38000077, -1 }, /* li r0,119 */
-- { 0x44000002, -1 }, /* sc */
-+ { 0x38210080, static_cast<ULONGEST>(-1) }, /* addi r1,r1,128 */
-+ { 0x38000077, static_cast<ULONGEST>(-1) }, /* li r0,119 */
-+ { 0x44000002, static_cast<ULONGEST>(-1) }, /* sc */
- { TRAMP_SENTINEL_INSN },
- },
- ppc64_linux_sighandler_cache_init
Index: head/devel/gdb/files/patch-gdb_ppc-nbsd-tdep.c
===================================================================
--- head/devel/gdb/files/patch-gdb_ppc-nbsd-tdep.c
+++ head/devel/gdb/files/patch-gdb_ppc-nbsd-tdep.c
@@ -1,48 +0,0 @@
---- gdb/ppc-nbsd-tdep.c.orig 2018-03-15 13:48:32.041494000 +0100
-+++ gdb/ppc-nbsd-tdep.c 2018-03-15 13:50:31.332926000 +0100
-@@ -137,14 +137,14 @@
- SIGTRAMP_FRAME,
- 4,
- {
-- { 0x3821fff0, -1 }, /* add r1,r1,-16 */
-- { 0x4e800021, -1 }, /* blrl */
-- { 0x38610018, -1 }, /* addi r3,r1,24 */
-- { 0x38000127, -1 }, /* li r0,295 */
-- { 0x44000002, -1 }, /* sc */
-- { 0x38000001, -1 }, /* li r0,1 */
-- { 0x44000002, -1 }, /* sc */
-- { TRAMP_SENTINEL_INSN, -1 }
-+ { 0x3821fff0, static_cast<ULONGEST>(-1) }, /* add r1,r1,-16 */
-+ { 0x4e800021, static_cast<ULONGEST>(-1) }, /* blrl */
-+ { 0x38610018, static_cast<ULONGEST>(-1) }, /* addi r3,r1,24 */
-+ { 0x38000127, static_cast<ULONGEST>(-1) }, /* li r0,295 */
-+ { 0x44000002, static_cast<ULONGEST>(-1) }, /* sc */
-+ { 0x38000001, static_cast<ULONGEST>(-1) }, /* li r0,1 */
-+ { 0x44000002, static_cast<ULONGEST>(-1) }, /* sc */
-+ { TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1) }
- },
- ppcnbsd_sigtramp_cache_init
- };
-@@ -156,14 +156,14 @@
- SIGTRAMP_FRAME,
- 4,
- {
-- { 0x3821fff0, -1 }, /* add r1,r1,-16 */
-- { 0x4e800021, -1 }, /* blrl */
-- { 0x38610010, -1 }, /* addi r3,r1,16 */
-- { 0x38000127, -1 }, /* li r0,295 */
-- { 0x44000002, -1 }, /* sc */
-- { 0x38000001, -1 }, /* li r0,1 */
-- { 0x44000002, -1 }, /* sc */
-- { TRAMP_SENTINEL_INSN, -1 }
-+ { 0x3821fff0, static_cast<ULONGEST>(-1) }, /* add r1,r1,-16 */
-+ { 0x4e800021, static_cast<ULONGEST>(-1) }, /* blrl */
-+ { 0x38610010, static_cast<ULONGEST>(-1) }, /* addi r3,r1,16 */
-+ { 0x38000127, static_cast<ULONGEST>(-1) }, /* li r0,295 */
-+ { 0x44000002, static_cast<ULONGEST>(-1) }, /* sc */
-+ { 0x38000001, static_cast<ULONGEST>(-1) }, /* li r0,1 */
-+ { 0x44000002, static_cast<ULONGEST>(-1) }, /* sc */
-+ { TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1) }
- },
- ppcnbsd_sigtramp_cache_init
- };
Index: head/devel/gdb/files/patch-gdb_ppc64-tdep.c
===================================================================
--- head/devel/gdb/files/patch-gdb_ppc64-tdep.c
+++ head/devel/gdb/files/patch-gdb_ppc64-tdep.c
@@ -1,252 +0,0 @@
---- gdb/ppc64-tdep.c.orig 2018-03-15 16:02:11.651610000 +0100
-+++ gdb/ppc64-tdep.c 2018-03-15 16:10:27.958608000 +0100
-@@ -30,24 +30,27 @@
- you can use -1 to make masks. */
-
- #define insn_d(opcd, rts, ra, d) \
-+ static_cast<unsigned int>( \
- ((((opcd) & 0x3f) << 26) \
- | (((rts) & 0x1f) << 21) \
- | (((ra) & 0x1f) << 16) \
-- | ((d) & 0xffff))
-+ | ((d) & 0xffff)))
-
- #define insn_ds(opcd, rts, ra, d, xo) \
-+ static_cast<unsigned int>( \
- ((((opcd) & 0x3f) << 26) \
- | (((rts) & 0x1f) << 21) \
- | (((ra) & 0x1f) << 16) \
- | ((d) & 0xfffc) \
-- | ((xo) & 0x3))
-+ | ((xo) & 0x3)))
-
- #define insn_xfx(opcd, rts, spr, xo) \
-+ static_cast<unsigned int>( \
- ((((opcd) & 0x3f) << 26) \
- | (((rts) & 0x1f) << 21) \
- | (((spr) & 0x1f) << 16) \
- | (((spr) & 0x3e0) << 6) \
-- | (((xo) & 0x3ff) << 1))
-+ | (((xo) & 0x3ff) << 1)))
-
- /* PLT_OFF is the TOC-relative offset of a 64-bit PowerPC PLT entry.
- Return the function's entry point. */
-@@ -86,7 +89,7 @@
- { insn_d (-1, -1, -1, 0), insn_d (15, 12, 2, 0), 0 },
-
- /* std r2, 40(r1) */
-- { -1, insn_ds (62, 2, 1, 40, 0), 0 },
-+ { static_cast<unsigned int>(-1), insn_ds (62, 2, 1, 40, 0), 0 },
-
- /* ld r11, <any>(r12) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 0 },
-@@ -107,7 +110,7 @@
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 1 },
-
- /* bctr */
-- { -1, 0x4e800420, 0 },
-+ { static_cast<unsigned int>(-1), 0x4e800420, 0 },
-
- { 0, 0, 0 }
- };
-@@ -122,13 +125,13 @@
- static struct ppc_insn_pattern ppc64_standard_linkage2[] =
- {
- /* std r2, 40(r1) <optional> */
-- { -1, insn_ds (62, 2, 1, 40, 0), 1 },
-+ { static_cast<unsigned int>(-1), insn_ds (62, 2, 1, 40, 0), 1 },
-
- /* addis r12, r2, <any> */
- { insn_d (-1, -1, -1, 0), insn_d (15, 12, 2, 0), 0 },
-
- /* std r2, 40(r1) <optional> */
-- { -1, insn_ds (62, 2, 1, 40, 0), 1 },
-+ { static_cast<unsigned int>(-1), insn_ds (62, 2, 1, 40, 0), 1 },
-
- /* ld r11, <any>(r12) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 0 },
-@@ -140,10 +143,10 @@
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 11, 9, 467), 0 },
-
- /* xor r11, r11, r11 <optional> */
-- { -1, 0x7d6b5a78, 1 },
-+ { static_cast<unsigned int>(-1), 0x7d6b5a78, 1 },
-
- /* add r12, r12, r11 <optional> */
-- { -1, 0x7d8c5a14, 1 },
-+ { static_cast<unsigned int>(-1), 0x7d8c5a14, 1 },
-
- /* ld r2, <any>(r12) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 12, 0, 0), 0 },
-@@ -152,10 +155,10 @@
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 1 },
-
- /* bctr <optional> */
-- { -1, 0x4e800420, 1 },
-+ { static_cast<unsigned int>(-1), 0x4e800420, 1 },
-
- /* cmpldi r2, 0 <optional> */
-- { -1, 0x28220000, 1 },
-+ { static_cast<unsigned int>(-1), 0x28220000, 1 },
-
- { 0, 0, 0 }
- };
-@@ -165,7 +168,7 @@
- static struct ppc_insn_pattern ppc64_standard_linkage3[] =
- {
- /* std r2, 40(r1) <optional> */
-- { -1, insn_ds (62, 2, 1, 40, 0), 1 },
-+ { static_cast<unsigned int>(-1), insn_ds (62, 2, 1, 40, 0), 1 },
-
- /* ld r11, <any>(r2) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 2, 0, 0), 0 },
-@@ -177,10 +180,10 @@
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 11, 9, 467), 0 },
-
- /* xor r11, r11, r11 <optional> */
-- { -1, 0x7d6b5a78, 1 },
-+ { static_cast<unsigned int>(-1), 0x7d6b5a78, 1 },
-
- /* add r2, r2, r11 <optional> */
-- { -1, 0x7c425a14, 1 },
-+ { static_cast<unsigned int>(-1), 0x7c425a14, 1 },
-
- /* ld r11, <any>(r2) <optional> */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 2, 0, 0), 1 },
-@@ -189,10 +192,10 @@
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 2, 0, 0), 0 },
-
- /* bctr <optional> */
-- { -1, 0x4e800420, 1 },
-+ { static_cast<unsigned int>(-1), 0x4e800420, 1 },
-
- /* cmpldi r2, 0 <optional> */
-- { -1, 0x28220000, 1 },
-+ { static_cast<unsigned int>(-1), 0x28220000, 1 },
-
- { 0, 0, 0 }
- };
-@@ -204,7 +207,7 @@
- static struct ppc_insn_pattern ppc64_standard_linkage4[] =
- {
- /* std r2, 40(r1) <optional> */
-- { -1, insn_ds (62, 2, 1, 40, 0), 1 },
-+ { static_cast<unsigned int>(-1), insn_ds (62, 2, 1, 40, 0), 1 },
-
- /* addis r11, r2, <any> */
- { insn_d (-1, -1, -1, 0), insn_d (15, 11, 2, 0), 0 },
-@@ -219,10 +222,10 @@
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
-
- /* xor r2, r12, r12 <optional> */
-- { -1, 0x7d826278, 1 },
-+ { static_cast<unsigned int>(-1), 0x7d826278, 1 },
-
- /* add r11, r11, r2 <optional> */
-- { -1, 0x7d6b1214, 1 },
-+ { static_cast<unsigned int>(-1), 0x7d6b1214, 1 },
-
- /* ld r2, <any>(r11) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 11, 0, 0), 0 },
-@@ -231,10 +234,10 @@
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 11, 0, 0), 1 },
-
- /* bctr <optional> */
-- { -1, 0x4e800420, 1 },
-+ { static_cast<unsigned int>(-1), 0x4e800420, 1 },
-
- /* cmpldi r2, 0 <optional> */
-- { -1, 0x28220000, 1 },
-+ { static_cast<unsigned int>(-1), 0x28220000, 1 },
-
- { 0, 0, 0 }
- };
-@@ -246,7 +249,7 @@
- static struct ppc_insn_pattern ppc64_standard_linkage5[] =
- {
- /* std r2, 40(r1) <optional> */
-- { -1, insn_ds (62, 2, 1, 40, 0), 1 },
-+ { static_cast<unsigned int>(-1), insn_ds (62, 2, 1, 40, 0), 1 },
-
- /* ld r12, <any>(r2) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 12, 2, 0, 0), 0 },
-@@ -258,10 +261,10 @@
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
-
- /* xor r11, r12, r12 <optional> */
-- { -1, 0x7d8b6278, 1 },
-+ { static_cast<unsigned int>(-1), 0x7d8b6278, 1 },
-
- /* add r2, r2, r11 <optional> */
-- { -1, 0x7c425a14, 1 },
-+ { static_cast<unsigned int>(-1), 0x7c425a14, 1 },
-
- /* ld r11, <any>(r2) <optional> */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 2, 0, 0), 1 },
-@@ -270,10 +273,10 @@
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 2, 0, 0), 0 },
-
- /* bctr <optional> */
-- { -1, 0x4e800420, 1 },
-+ { static_cast<unsigned int>(-1), 0x4e800420, 1 },
-
- /* cmpldi r2, 0 <optional> */
-- { -1, 0x28220000, 1 },
-+ { static_cast<unsigned int>(-1), 0x28220000, 1 },
-
- { 0, 0, 0 }
- };
-@@ -283,7 +286,7 @@
- static struct ppc_insn_pattern ppc64_standard_linkage6[] =
- {
- /* std r2, 24(r1) <optional> */
-- { -1, insn_ds (62, 2, 1, 24, 0), 1 },
-+ { static_cast<unsigned int>(-1), insn_ds (62, 2, 1, 24, 0), 1 },
-
- /* addis r11, r2, <any> */
- { insn_d (-1, -1, -1, 0), insn_d (15, 11, 2, 0), 0 },
-@@ -295,7 +298,7 @@
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
-
- /* bctr */
-- { -1, 0x4e800420, 0 },
-+ { static_cast<unsigned int>(-1), 0x4e800420, 0 },
-
- { 0, 0, 0 }
- };
-@@ -305,7 +308,7 @@
- static struct ppc_insn_pattern ppc64_standard_linkage7[] =
- {
- /* std r2, 24(r1) <optional> */
-- { -1, insn_ds (62, 2, 1, 24, 0), 1 },
-+ { static_cast<unsigned int>(-1), insn_ds (62, 2, 1, 24, 0), 1 },
-
- /* ld r12, <any>(r2) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 12, 2, 0, 0), 0 },
-@@ -314,7 +317,7 @@
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
-
- /* bctr */
-- { -1, 0x4e800420, 0 },
-+ { static_cast<unsigned int>(-1), 0x4e800420, 0 },
-
- { 0, 0, 0 }
- };
-@@ -325,7 +328,7 @@
- static struct ppc_insn_pattern ppc64_standard_linkage8[] =
- {
- /* std r2, 24(r1) <optional> */
-- { -1, insn_ds (62, 2, 1, 24, 0), 1 },
-+ { static_cast<unsigned int>(-1), insn_ds (62, 2, 1, 24, 0), 1 },
-
- /* addis r12, r2, <any> */
- { insn_d (-1, -1, -1, 0), insn_d (15, 12, 2, 0), 0 },
-@@ -337,7 +340,7 @@
- { insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
-
- /* bctr */
-- { -1, 0x4e800420, 0 },
-+ { static_cast<unsigned int>(-1), 0x4e800420, 0 },
-
- { 0, 0, 0 }
- };
Index: head/devel/gdb/files/patch-gdb_rs6000-tdep.c
===================================================================
--- head/devel/gdb/files/patch-gdb_rs6000-tdep.c
+++ head/devel/gdb/files/patch-gdb_rs6000-tdep.c
@@ -1,11 +0,0 @@
---- gdb/rs6000-tdep.c.orig 2018-03-15 16:11:47.189448000 +0100
-+++ gdb/rs6000-tdep.c 2018-03-15 16:12:36.114973000 +0100
-@@ -1173,7 +1173,7 @@
- struct gdbarch *gdbarch = regcache->arch ();
- enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- CORE_ADDR pc = regcache_read_pc (regcache);
-- CORE_ADDR breaks[2] = {-1, -1};
-+ CORE_ADDR breaks[2] = {static_cast<CORE_ADDR>(-1),static_cast<CORE_ADDR>(-1)};
- CORE_ADDR loc = pc;
- CORE_ADDR closing_insn; /* Instruction that closes the atomic sequence. */
- int insn = read_memory_integer (loc, PPC_INSN_SIZE, byte_order);
Index: head/devel/gdb/files/patch-gdb_sparc-linux-tdep.c
===================================================================
--- head/devel/gdb/files/patch-gdb_sparc-linux-tdep.c
+++ head/devel/gdb/files/patch-gdb_sparc-linux-tdep.c
@@ -1,28 +0,0 @@
---- gdb/sparc-linux-tdep.c.orig 2018-03-15 16:27:40.393176000 +0100
-+++ gdb/sparc-linux-tdep.c 2018-03-15 16:29:00.339581000 +0100
-@@ -68,9 +68,9 @@
- SIGTRAMP_FRAME,
- 4,
- {
-- { 0x821020d8, -1 }, /* mov __NR_sugreturn, %g1 */
-- { 0x91d02010, -1 }, /* ta 0x10 */
-- { TRAMP_SENTINEL_INSN, -1 }
-+ { 0x821020d8, static_cast<ULONGEST>(-1) }, /* mov __NR_sugreturn, %g1 */
-+ { 0x91d02010, static_cast<ULONGEST>(-1) }, /* ta 0x10 */
-+ { TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1) }
- },
- sparc32_linux_sigframe_init
- };
-@@ -83,9 +83,9 @@
- SIGTRAMP_FRAME,
- 4,
- {
-- { 0x82102065, -1 }, /* mov __NR_rt_sigreturn, %g1 */
-- { 0x91d02010, -1 }, /* ta 0x10 */
-- { TRAMP_SENTINEL_INSN, -1 }
-+ { 0x82102065, static_cast<ULONGEST>(-1) }, /* mov __NR_rt_sigreturn, %g1 */
-+ { 0x91d02010, static_cast<ULONGEST>(-1) }, /* ta 0x10 */
-+ { TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1) }
- },
- sparc32_linux_sigframe_init
- };
Index: head/devel/gdb/files/patch-gdb_sparc64-linux-tdep.c
===================================================================
--- head/devel/gdb/files/patch-gdb_sparc64-linux-tdep.c
+++ head/devel/gdb/files/patch-gdb_sparc64-linux-tdep.c
@@ -1,15 +0,0 @@
---- gdb/sparc64-linux-tdep.c.orig 2018-03-15 16:48:31.376247000 +0100
-+++ gdb/sparc64-linux-tdep.c 2018-03-15 16:49:05.405119000 +0100
-@@ -64,9 +64,9 @@
- SIGTRAMP_FRAME,
- 4,
- {
-- { 0x82102065, -1 }, /* mov __NR_rt_sigreturn, %g1 */
-- { 0x91d0206d, -1 }, /* ta 0x6d */
-- { TRAMP_SENTINEL_INSN, -1 }
-+ { 0x82102065, static_cast<ULONGEST>(-1) }, /* mov __NR_rt_sigreturn, %g1 */
-+ { 0x91d0206d, static_cast<ULONGEST>(-1) }, /* ta 0x6d */
-+ { TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1) }
- },
- sparc64_linux_sigframe_init
- };
Index: head/devel/gdb/files/patch-gdb_tick6x-linux-tdep.c
===================================================================
--- head/devel/gdb/files/patch-gdb_tick6x-linux-tdep.c
+++ head/devel/gdb/files/patch-gdb_tick6x-linux-tdep.c
@@ -1,11 +0,0 @@
---- gdb/tic6x-linux-tdep.c.orig 2018-03-15 16:29:54.131451000 +0100
-+++ gdb/tic6x-linux-tdep.c 2018-03-15 16:30:19.640674000 +0100
-@@ -137,7 +137,7 @@
- 4,
- {
- {0x000045aa, 0x0fffffff}, /* mvk .S2 139,b0 */
-- {0x10000000, -1}, /* swe */
-+ {0x10000000, static_cast<ULONGEST>(-1)}, /* swe */
- {TRAMP_SENTINEL_INSN}
- },
- tic6x_linux_rt_sigreturn_init
Index: head/devel/gdb/files/patch-gdb_tilegx-linux-tdep.c
===================================================================
--- head/devel/gdb/files/patch-gdb_tilegx-linux-tdep.c
+++ head/devel/gdb/files/patch-gdb_tilegx-linux-tdep.c
@@ -1,15 +0,0 @@
---- gdb/tilegx-linux-tdep.c.orig 2018-03-15 16:31:44.623131000 +0100
-+++ gdb/tilegx-linux-tdep.c 2018-03-15 16:32:29.603585000 +0100
-@@ -65,9 +65,9 @@
- SIGTRAMP_FRAME,
- 8,
- {
-- { 0x00045fe551483000ULL, -1 }, /* { moveli r10, 139 } */
-- { 0x286b180051485000ULL, -1 }, /* { swint1 } */
-- { TRAMP_SENTINEL_INSN, -1 }
-+ { 0x00045fe551483000ULL, static_cast<ULONGEST>(-1) }, /* { moveli r10, 139 } */
-+ { 0x286b180051485000ULL, static_cast<ULONGEST>(-1) }, /* { swint1 } */
-+ { TRAMP_SENTINEL_INSN, static_cast<ULONGEST>(-1) }
- },
- tilegx_linux_sigframe_init
- };
Index: head/devel/gdb/files/patch-gdb_tramp-frame.h
===================================================================
--- head/devel/gdb/files/patch-gdb_tramp-frame.h
+++ head/devel/gdb/files/patch-gdb_tramp-frame.h
@@ -1,11 +0,0 @@
---- gdb/tramp-frame.h.orig 2018-03-15 10:38:21.385046000 +0100
-+++ gdb/tramp-frame.h 2018-03-15 10:38:49.942224000 +0100
-@@ -41,7 +41,7 @@
-
- /* Magic instruction that to mark the end of the signal trampoline
- instruction sequence. */
--#define TRAMP_SENTINEL_INSN ((LONGEST) -1)
-+#define TRAMP_SENTINEL_INSN ((ULONGEST) -1)
-
- struct tramp_frame
- {
Index: head/devel/gdb/files/patch-gdb_xtensa-tdep.h
===================================================================
--- head/devel/gdb/files/patch-gdb_xtensa-tdep.h
+++ head/devel/gdb/files/patch-gdb_xtensa-tdep.h
@@ -1,20 +0,0 @@
---- gdb/xtensa-tdep.h.orig 2018-03-15 16:33:53.194056000 +0100
-+++ gdb/xtensa-tdep.h 2018-03-15 16:37:44.151472000 +0100
-@@ -130,7 +130,7 @@
- ct, bsz, sz, al, tnum, flg, cp, mas, fet, sto},
- #define XTREG_END \
- {0, 0, (xtensa_register_type_t) 0, (xtensa_register_group_t) 0, \
-- 0, 0, 0, 0, -1, 0, 0, 0, 0, 0},
-+ 0, 0, 0, 0, static_cast<unsigned int>(-1), 0, 0, 0, 0, 0},
-
- #define XTENSA_REGISTER_FLAGS_PRIVILEGED 0x0001
- #define XTENSA_REGISTER_FLAGS_READABLE 0x0002
-@@ -228,7 +228,7 @@
- #define XTENSA_GDBARCH_TDEP_INSTANTIATE(rmap,spillsz) \
- { \
- 0, /* target_flags */ \
-- -1, /* spill_location */ \
-+ static_cast<unsigned int>(-1), /* spill_location */ \
- (spillsz), /* spill_size */ \
- 0, /* unused */ \
- (XSHAL_ABI == XTHAL_ABI_CALL0 \

File Metadata

Mime Type
text/plain
Expires
Tue, Jan 21, 4:29 AM (19 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15999259
Default Alt Text
D20403.diff (159 KB)

Event Timeline