Index: gdb/Makefile =================================================================== --- gdb/Makefile +++ gdb/Makefile @@ -2,8 +2,7 @@ # $FreeBSD$ PORTNAME= gdb -PORTVERSION= 7.12.1 -PORTREVISION= 1 +PORTVERSION= 8.0 CATEGORIES= devel MASTER_SITES= GNU @@ -31,8 +30,6 @@ CFLAGS+= -DRL_NO_COMPAT -Wno-unused-function -Wno-unused-variable EXCLUDE= dejagnu expect sim texinfo intl EXTRACT_AFTER_ARGS= ${EXCLUDE:S/^/--exclude /} -EXTRA_PATCHES= ${FILESDIR}/commit-387360daf9 \ - ${FILESDIR}/commit-b268007c68 LIB_DEPENDS+= libexpat.so:textproc/expat2 VER= ${PORTVERSION:S/.//g} Index: gdb/distinfo =================================================================== --- gdb/distinfo +++ gdb/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1485162707 -SHA256 (gdb-7.12.1.tar.xz) = 4607680b973d3ec92c30ad029f1b7dbde3876869e6b3a117d8a7e90081113186 -SIZE (gdb-7.12.1.tar.xz) = 19225392 +TIMESTAMP = 1496736376 +SHA256 (gdb-8.0.tar.xz) = f6a24ffe4917e67014ef9273eb8b547cb96a13e5ca74895b06d683b391f3f4ee +SIZE (gdb-8.0.tar.xz) = 19588616 Index: devel/gdb/files/commit-387360daf9 =================================================================== --- devel/gdb/files/commit-387360daf9 +++ /dev/null @@ -1,680 +0,0 @@ -commit 9978d70207d8a6bc7ff3c570814053c68e78b913 -Author: John Baldwin -Date: Wed Jan 4 09:41:58 2017 -0800 - - Add FreeBSD/mips architecture. - - This has been tested for the n64 and o32 ABIs. Signal frame unwinders for - both ABIs are provided. FreeBSD/mips requires custom linkmap offsets since - it contains an additional l_off member in 'struct link_map' that other - FreeBSD platforms do not have. Support for collecting and supplying - general purpose and floating point register sets are provided. Common - routines for working with native format register sets are exported for - use by the native target. - - gdb/ChangeLog: - - * Makefile.in (ALL_TARGET_OBS): Add mips-fbsd-tdep.o. - (ALLDEPFILES): Add mips-fbsd-tdep.c. - * NEWS: Mention new FreeBSD/mips target. - * configure.tgt: Add mips*-*-freebsd*. - * mips-fbsd-tdep.c: New file. - * mips-fbsd-tdep.h: New file. - - gdb/doc/ChangeLog: - - * gdb.texinfo (Contributors): Add SRI International and University - of Cambridge for FreeBSD/mips. - -diff --git gdb/Makefile.in gdb/Makefile.in -index 7b2df86878..300c2cb702 100644 ---- gdb/Makefile.in -+++ gdb/Makefile.in -@@ -685,6 +685,7 @@ ALL_TARGET_OBS = \ - m88k-tdep.o \ - mep-tdep.o \ - microblaze-tdep.o microblaze-linux-tdep.o \ -+ mips-fbsd-tdep.o \ - mips-linux-tdep.o mips-sde-tdep.o \ - mipsnbsd-tdep.o mips-tdep.o \ - mn10300-linux-tdep.o mn10300-tdep.o \ -@@ -1724,6 +1725,7 @@ ALLDEPFILES = \ - m88k-tdep.c m88kbsd-nat.c \ - microblaze-tdep.c microblaze-linux-tdep.c \ - mingw-hdep.c common/mingw-strerror.c \ -+ mips-fbsd-tdep.c \ - mips-linux-nat.c mips-linux-tdep.c \ - mips-sde-tdep.c \ - mips-tdep.c \ -diff --git gdb/configure.tgt gdb/configure.tgt -index 7f1aac3742..9ee9f7a799 100644 ---- gdb/configure.tgt -+++ gdb/configure.tgt -@@ -358,6 +358,11 @@ mips*-*-netbsd* | mips*-*-knetbsd*-gnu) - gdb_target_obs="mips-tdep.o mipsnbsd-tdep.o solib-svr4.o nbsd-tdep.o" - gdb_sim=../sim/mips/libsim.a - ;; -+mips*-*-freebsd*) -+ # Target: MIPS running FreeBSD -+ gdb_target_obs="mips-tdep.o mips-fbsd-tdep.o solib-svr4.o fbsd-tdep.o" -+ gdb_sim=../sim/mips/libsim.a -+ ;; - mips64*-*-openbsd*) - # Target: OpenBSD/mips64 - gdb_target_obs="mips-tdep.o mips64obsd-tdep.o obsd-tdep.o solib-svr4.o" -diff --git gdb/doc/gdb.texinfo gdb/doc/gdb.texinfo -index 067a45b2de..179da5cdb3 100644 ---- gdb/doc/gdb.texinfo -+++ gdb/doc/gdb.texinfo -@@ -541,6 +541,11 @@ Steve Tjiang, John Newlin, and Scott Foehner. - Michael Eager and staff of Xilinx, Inc., contributed support for the - Xilinx MicroBlaze architecture. - -+Initial support for the FreeBSD/mips target and native configuration -+was developed by SRI International and the University of Cambridge -+Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 -+("CTSRD"), as part of the DARPA CRASH research programme. -+ - @node Sample Session - @chapter A Sample @value{GDBN} Session - -diff --git gdb/mips-fbsd-tdep.c gdb/mips-fbsd-tdep.c -new file mode 100644 -index 0000000000..733534ddac ---- /dev/null -+++ gdb/mips-fbsd-tdep.c -@@ -0,0 +1,560 @@ -+/* Target-dependent code for FreeBSD/mips. -+ -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include "defs.h" -+#include "osabi.h" -+#include "regset.h" -+#include "trad-frame.h" -+#include "tramp-frame.h" -+ -+#include "fbsd-tdep.h" -+#include "mips-tdep.h" -+#include "mips-fbsd-tdep.h" -+ -+#include "solib-svr4.h" -+ -+/* Shorthand for some register numbers used below. */ -+#define MIPS_PC_REGNUM MIPS_EMBED_PC_REGNUM -+#define MIPS_FP0_REGNUM MIPS_EMBED_FP0_REGNUM -+#define MIPS_FSR_REGNUM MIPS_EMBED_FP0_REGNUM + 32 -+ -+/* Core file support. */ -+ -+/* Number of registers in `struct reg' from . The -+ first 38 follow the standard MIPS layout. The 39th holds -+ IC_INT_REG on RM7K and RM9K processors. The 40th is a dummy for -+ padding. */ -+#define MIPS_FBSD_NUM_GREGS 40 -+ -+/* Number of registers in `struct fpreg' from . The -+ first 32 hold floating point registers. 33 holds the FSR. The -+ 34th is a dummy for padding. */ -+#define MIPS_FBSD_NUM_FPREGS 34 -+ -+/* Supply a single register. If the source register size matches the -+ size the regcache expects, this can use regcache_raw_supply(). If -+ they are different, this copies the source register into a buffer -+ that can be passed to regcache_raw_supply(). */ -+ -+static void -+mips_fbsd_supply_reg (struct regcache *regcache, int regnum, const void *addr, -+ size_t len) -+{ -+ struct gdbarch *gdbarch = get_regcache_arch (regcache); -+ -+ if (register_size (gdbarch, regnum) == len) -+ regcache_raw_supply (regcache, regnum, addr); -+ else -+ { -+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); -+ gdb_byte buf[MAX_REGISTER_SIZE]; -+ LONGEST val; -+ -+ val = extract_signed_integer ((const gdb_byte *) addr, len, byte_order); -+ store_signed_integer (buf, register_size (gdbarch, regnum), byte_order, -+ val); -+ regcache_raw_supply (regcache, regnum, buf); -+ } -+} -+ -+/* Collect a single register. If the destination register size -+ matches the size the regcache expects, this can use -+ regcache_raw_supply(). If they are different, this fetches the -+ register via regcache_raw_supply() into a buffer and then copies it -+ into the final destination. */ -+ -+static void -+mips_fbsd_collect_reg (const struct regcache *regcache, int regnum, void *addr, -+ size_t len) -+{ -+ struct gdbarch *gdbarch = get_regcache_arch (regcache); -+ -+ if (register_size (gdbarch, regnum) == len) -+ regcache_raw_collect (regcache, regnum, addr); -+ else -+ { -+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); -+ gdb_byte buf[MAX_REGISTER_SIZE]; -+ LONGEST val; -+ -+ regcache_raw_collect (regcache, regnum, buf); -+ val = extract_signed_integer (buf, register_size (gdbarch, regnum), -+ byte_order); -+ store_signed_integer ((gdb_byte *) addr, len, byte_order, val); -+ } -+} -+ -+/* Supply the floating-point registers stored in FPREGS to REGCACHE. -+ Each floating-point register in FPREGS is REGSIZE bytes in -+ length. */ -+ -+void -+mips_fbsd_supply_fpregs (struct regcache *regcache, int regnum, -+ const void *fpregs, size_t regsize) -+{ -+ const gdb_byte *regs = (const gdb_byte *) fpregs; -+ int i; -+ -+ for (i = MIPS_FP0_REGNUM; i <= MIPS_FSR_REGNUM; i++) -+ if (regnum == i || regnum == -1) -+ mips_fbsd_supply_reg (regcache, i, -+ regs + (i - MIPS_FP0_REGNUM) * regsize, regsize); -+} -+ -+/* Supply the general-purpose registers stored in GREGS to REGCACHE. -+ Each general-purpose register in GREGS is REGSIZE bytes in -+ length. */ -+ -+void -+mips_fbsd_supply_gregs (struct regcache *regcache, int regnum, -+ const void *gregs, size_t regsize) -+{ -+ const gdb_byte *regs = (const gdb_byte *) gregs; -+ int i; -+ -+ for (i = 0; i <= MIPS_PC_REGNUM; i++) -+ if (regnum == i || regnum == -1) -+ mips_fbsd_supply_reg (regcache, i, regs + i * regsize, regsize); -+} -+ -+/* Collect the floating-point registers from REGCACHE and store them -+ in FPREGS. Each floating-point register in FPREGS is REGSIZE bytes -+ in length. */ -+ -+void -+mips_fbsd_collect_fpregs (const struct regcache *regcache, int regnum, -+ void *fpregs, size_t regsize) -+{ -+ gdb_byte *regs = (gdb_byte *) fpregs; -+ int i; -+ -+ for (i = MIPS_FP0_REGNUM; i <= MIPS_FSR_REGNUM; i++) -+ if (regnum == i || regnum == -1) -+ mips_fbsd_collect_reg (regcache, i, -+ regs + (i - MIPS_FP0_REGNUM) * regsize, regsize); -+} -+ -+/* Collect the general-purpose registers from REGCACHE and store them -+ in GREGS. Each general-purpose register in GREGS is REGSIZE bytes -+ in length. */ -+ -+void -+mips_fbsd_collect_gregs (const struct regcache *regcache, int regnum, -+ void *gregs, size_t regsize) -+{ -+ gdb_byte *regs = (gdb_byte *) gregs; -+ int i; -+ -+ for (i = 0; i <= MIPS_PC_REGNUM; i++) -+ if (regnum == i || regnum == -1) -+ mips_fbsd_collect_reg (regcache, i, regs + i * regsize, regsize); -+} -+ -+/* Supply register REGNUM from the buffer specified by FPREGS and LEN -+ in the floating-point register set REGSET to register cache -+ REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */ -+ -+static void -+mips_fbsd_supply_fpregset (const struct regset *regset, -+ struct regcache *regcache, -+ int regnum, const void *fpregs, size_t len) -+{ -+ size_t regsize = mips_abi_regsize (get_regcache_arch (regcache)); -+ -+ gdb_assert (len >= MIPS_FBSD_NUM_FPREGS * regsize); -+ -+ mips_fbsd_supply_fpregs (regcache, regnum, fpregs, regsize); -+} -+ -+/* Collect register REGNUM from the register cache REGCACHE and store -+ it in the buffer specified by FPREGS and LEN in the floating-point -+ register set REGSET. If REGNUM is -1, do this for all registers in -+ REGSET. */ -+ -+static void -+mips_fbsd_collect_fpregset (const struct regset *regset, -+ const struct regcache *regcache, -+ int regnum, void *fpregs, size_t len) -+{ -+ size_t regsize = mips_abi_regsize (get_regcache_arch (regcache)); -+ -+ gdb_assert (len >= MIPS_FBSD_NUM_FPREGS * regsize); -+ -+ mips_fbsd_collect_fpregs (regcache, regnum, fpregs, regsize); -+} -+ -+/* Supply register REGNUM from the buffer specified by GREGS and LEN -+ in the general-purpose register set REGSET to register cache -+ REGCACHE. If REGNUM is -1, do this for all registers in REGSET. */ -+ -+static void -+mips_fbsd_supply_gregset (const struct regset *regset, -+ struct regcache *regcache, int regnum, -+ const void *gregs, size_t len) -+{ -+ size_t regsize = mips_abi_regsize (get_regcache_arch (regcache)); -+ -+ gdb_assert (len >= MIPS_FBSD_NUM_GREGS * regsize); -+ -+ mips_fbsd_supply_gregs (regcache, regnum, gregs, regsize); -+} -+ -+/* Collect register REGNUM from the register cache REGCACHE and store -+ it in the buffer specified by GREGS and LEN in the general-purpose -+ register set REGSET. If REGNUM is -1, do this for all registers in -+ REGSET. */ -+ -+static void -+mips_fbsd_collect_gregset (const struct regset *regset, -+ const struct regcache *regcache, -+ int regnum, void *gregs, size_t len) -+{ -+ size_t regsize = mips_abi_regsize (get_regcache_arch (regcache)); -+ -+ gdb_assert (len >= MIPS_FBSD_NUM_GREGS * regsize); -+ -+ mips_fbsd_collect_gregs (regcache, regnum, gregs, regsize); -+} -+ -+/* FreeBSD/mips register sets. */ -+ -+static const struct regset mips_fbsd_gregset = -+{ -+ NULL, -+ mips_fbsd_supply_gregset, -+ mips_fbsd_collect_gregset, -+}; -+ -+static const struct regset mips_fbsd_fpregset = -+{ -+ NULL, -+ mips_fbsd_supply_fpregset, -+ mips_fbsd_collect_fpregset, -+}; -+ -+/* Iterate over core file register note sections. */ -+ -+static void -+mips_fbsd_iterate_over_regset_sections (struct gdbarch *gdbarch, -+ iterate_over_regset_sections_cb *cb, -+ void *cb_data, -+ const struct regcache *regcache) -+{ -+ size_t regsize = mips_abi_regsize (gdbarch); -+ -+ cb (".reg", MIPS_FBSD_NUM_GREGS * regsize, &mips_fbsd_gregset, -+ NULL, cb_data); -+ cb (".reg2", MIPS_FBSD_NUM_FPREGS * regsize, &mips_fbsd_fpregset, -+ NULL, cb_data); -+} -+ -+/* Signal trampoline support. */ -+ -+#define FBSD_SYS_sigreturn 417 -+ -+#define MIPS_INST_LI_V0_SIGRETURN 0x24020000 + FBSD_SYS_sigreturn -+#define MIPS_INST_SYSCALL 0x0000000c -+#define MIPS_INST_BREAK 0x0000000d -+ -+#define O32_SIGFRAME_UCONTEXT_OFFSET (16) -+#define O32_SIGSET_T_SIZE (16) -+ -+#define O32_UCONTEXT_ONSTACK (O32_SIGSET_T_SIZE) -+#define O32_UCONTEXT_PC (O32_UCONTEXT_ONSTACK + 4) -+#define O32_UCONTEXT_REGS (O32_UCONTEXT_PC + 4) -+#define O32_UCONTEXT_SR (O32_UCONTEXT_REGS + 4 * 32) -+#define O32_UCONTEXT_LO (O32_UCONTEXT_SR + 4) -+#define O32_UCONTEXT_HI (O32_UCONTEXT_LO + 4) -+#define O32_UCONTEXT_FPUSED (O32_UCONTEXT_HI + 4) -+#define O32_UCONTEXT_FPREGS (O32_UCONTEXT_FPUSED + 4) -+ -+#define O32_UCONTEXT_REG_SIZE 4 -+ -+static void -+mips_fbsd_sigframe_init (const struct tramp_frame *self, -+ struct frame_info *this_frame, -+ struct trad_frame_cache *cache, -+ CORE_ADDR func) -+{ -+ struct gdbarch *gdbarch = get_frame_arch (this_frame); -+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); -+ CORE_ADDR sp, ucontext_addr, addr; -+ int regnum; -+ gdb_byte buf[4]; -+ -+ /* We find the appropriate instance of `ucontext_t' at a -+ fixed offset in the signal frame. */ -+ sp = get_frame_register_signed (this_frame, -+ MIPS_SP_REGNUM + gdbarch_num_regs (gdbarch)); -+ ucontext_addr = sp + O32_SIGFRAME_UCONTEXT_OFFSET; -+ -+ /* PC. */ -+ regnum = mips_regnum (gdbarch)->pc; -+ trad_frame_set_reg_addr (cache, -+ regnum + gdbarch_num_regs (gdbarch), -+ ucontext_addr + O32_UCONTEXT_PC); -+ -+ /* GPRs. */ -+ for (regnum = MIPS_ZERO_REGNUM, addr = ucontext_addr + O32_UCONTEXT_REGS; -+ regnum <= MIPS_RA_REGNUM; regnum++, addr += O32_UCONTEXT_REG_SIZE) -+ trad_frame_set_reg_addr (cache, -+ regnum + gdbarch_num_regs (gdbarch), -+ addr); -+ -+ regnum = MIPS_PS_REGNUM; -+ trad_frame_set_reg_addr (cache, -+ regnum + gdbarch_num_regs (gdbarch), -+ ucontext_addr + O32_UCONTEXT_SR); -+ -+ /* HI and LO. */ -+ regnum = mips_regnum (gdbarch)->lo; -+ trad_frame_set_reg_addr (cache, -+ regnum + gdbarch_num_regs (gdbarch), -+ ucontext_addr + O32_UCONTEXT_LO); -+ regnum = mips_regnum (gdbarch)->hi; -+ trad_frame_set_reg_addr (cache, -+ regnum + gdbarch_num_regs (gdbarch), -+ ucontext_addr + O32_UCONTEXT_HI); -+ -+ if (target_read_memory (ucontext_addr + O32_UCONTEXT_FPUSED, buf, 4) == 0 && -+ extract_unsigned_integer (buf, 4, byte_order) != 0) -+ { -+ for (regnum = 0, addr = ucontext_addr + O32_UCONTEXT_FPREGS; -+ regnum < 32; regnum++, addr += O32_UCONTEXT_REG_SIZE) -+ trad_frame_set_reg_addr (cache, -+ regnum + gdbarch_fp0_regnum (gdbarch), -+ addr); -+ trad_frame_set_reg_addr (cache, mips_regnum (gdbarch)->fp_control_status, -+ addr); -+ } -+ -+ trad_frame_set_id (cache, frame_id_build (sp, func)); -+} -+ -+#define MIPS_INST_ADDIU_A0_SP_O32 (0x27a40000 \ -+ + O32_SIGFRAME_UCONTEXT_OFFSET) -+ -+static const struct tramp_frame mips_fbsd_sigframe = -+{ -+ 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_fbsd_sigframe_init -+}; -+ -+#define N64_SIGFRAME_UCONTEXT_OFFSET (32) -+#define N64_SIGSET_T_SIZE (16) -+ -+#define N64_UCONTEXT_ONSTACK (N64_SIGSET_T_SIZE) -+#define N64_UCONTEXT_PC (N64_UCONTEXT_ONSTACK + 8) -+#define N64_UCONTEXT_REGS (N64_UCONTEXT_PC + 8) -+#define N64_UCONTEXT_SR (N64_UCONTEXT_REGS + 8 * 32) -+#define N64_UCONTEXT_LO (N64_UCONTEXT_SR + 8) -+#define N64_UCONTEXT_HI (N64_UCONTEXT_LO + 8) -+#define N64_UCONTEXT_FPUSED (N64_UCONTEXT_HI + 8) -+#define N64_UCONTEXT_FPREGS (N64_UCONTEXT_FPUSED + 8) -+ -+#define N64_UCONTEXT_REG_SIZE 8 -+ -+static void -+mips64_fbsd_sigframe_init (const struct tramp_frame *self, -+ struct frame_info *this_frame, -+ struct trad_frame_cache *cache, -+ CORE_ADDR func) -+{ -+ struct gdbarch *gdbarch = get_frame_arch (this_frame); -+ enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); -+ CORE_ADDR sp, ucontext_addr, addr; -+ int regnum; -+ gdb_byte buf[4]; -+ -+ /* We find the appropriate instance of `ucontext_t' at a -+ fixed offset in the signal frame. */ -+ sp = get_frame_register_signed (this_frame, -+ MIPS_SP_REGNUM + gdbarch_num_regs (gdbarch)); -+ ucontext_addr = sp + N64_SIGFRAME_UCONTEXT_OFFSET; -+ -+ /* PC. */ -+ regnum = mips_regnum (gdbarch)->pc; -+ trad_frame_set_reg_addr (cache, -+ regnum + gdbarch_num_regs (gdbarch), -+ ucontext_addr + N64_UCONTEXT_PC); -+ -+ /* GPRs. */ -+ for (regnum = MIPS_ZERO_REGNUM, addr = ucontext_addr + N64_UCONTEXT_REGS; -+ regnum <= MIPS_RA_REGNUM; regnum++, addr += N64_UCONTEXT_REG_SIZE) -+ trad_frame_set_reg_addr (cache, -+ regnum + gdbarch_num_regs (gdbarch), -+ addr); -+ -+ regnum = MIPS_PS_REGNUM; -+ trad_frame_set_reg_addr (cache, -+ regnum + gdbarch_num_regs (gdbarch), -+ ucontext_addr + N64_UCONTEXT_SR); -+ -+ /* HI and LO. */ -+ regnum = mips_regnum (gdbarch)->lo; -+ trad_frame_set_reg_addr (cache, -+ regnum + gdbarch_num_regs (gdbarch), -+ ucontext_addr + N64_UCONTEXT_LO); -+ regnum = mips_regnum (gdbarch)->hi; -+ trad_frame_set_reg_addr (cache, -+ regnum + gdbarch_num_regs (gdbarch), -+ ucontext_addr + N64_UCONTEXT_HI); -+ -+ if (target_read_memory (ucontext_addr + N64_UCONTEXT_FPUSED, buf, 4) == 0 && -+ extract_unsigned_integer (buf, 4, byte_order) != 0) -+ { -+ for (regnum = 0, addr = ucontext_addr + N64_UCONTEXT_FPREGS; -+ regnum < 32; regnum++, addr += N64_UCONTEXT_REG_SIZE) -+ trad_frame_set_reg_addr (cache, -+ regnum + gdbarch_fp0_regnum (gdbarch), -+ addr); -+ trad_frame_set_reg_addr (cache, mips_regnum (gdbarch)->fp_control_status, -+ addr); -+ } -+ -+ trad_frame_set_id (cache, frame_id_build (sp, func)); -+} -+ -+#define MIPS_INST_DADDIU_A0_SP_N64 (0x67a40000 \ -+ + N64_SIGFRAME_UCONTEXT_OFFSET) -+ -+static const struct tramp_frame mips64_fbsd_sigframe = -+{ -+ 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 } -+ }, -+ mips64_fbsd_sigframe_init -+}; -+ -+/* Shared library support. */ -+ -+/* FreeBSD/mips uses a slightly different `struct link_map' than the -+ other FreeBSD platforms as it includes an additional `l_off' -+ member. */ -+ -+static struct link_map_offsets * -+mips_fbsd_ilp32_fetch_link_map_offsets (void) -+{ -+ static struct link_map_offsets lmo; -+ static struct link_map_offsets *lmp = NULL; -+ -+ if (lmp == NULL) -+ { -+ lmp = &lmo; -+ -+ lmo.r_version_offset = 0; -+ lmo.r_version_size = 4; -+ lmo.r_map_offset = 4; -+ lmo.r_brk_offset = 8; -+ lmo.r_ldsomap_offset = -1; -+ -+ lmo.link_map_size = 24; -+ lmo.l_addr_offset = 0; -+ lmo.l_name_offset = 8; -+ lmo.l_ld_offset = 12; -+ lmo.l_next_offset = 16; -+ lmo.l_prev_offset = 20; -+ } -+ -+ return lmp; -+} -+ -+static struct link_map_offsets * -+mips_fbsd_lp64_fetch_link_map_offsets (void) -+{ -+ static struct link_map_offsets lmo; -+ static struct link_map_offsets *lmp = NULL; -+ -+ if (lmp == NULL) -+ { -+ lmp = &lmo; -+ -+ lmo.r_version_offset = 0; -+ lmo.r_version_size = 4; -+ lmo.r_map_offset = 8; -+ lmo.r_brk_offset = 16; -+ lmo.r_ldsomap_offset = -1; -+ -+ lmo.link_map_size = 48; -+ lmo.l_addr_offset = 0; -+ lmo.l_name_offset = 16; -+ lmo.l_ld_offset = 24; -+ lmo.l_next_offset = 32; -+ lmo.l_prev_offset = 40; -+ } -+ -+ return lmp; -+} -+ -+static void -+mips_fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) -+{ -+ enum mips_abi abi = mips_abi (gdbarch); -+ -+ /* Generic FreeBSD support. */ -+ fbsd_init_abi (info, gdbarch); -+ -+ set_gdbarch_software_single_step (gdbarch, mips_software_single_step); -+ -+ switch (abi) -+ { -+ case MIPS_ABI_O32: -+ tramp_frame_prepend_unwinder (gdbarch, &mips_fbsd_sigframe); -+ break; -+ case MIPS_ABI_N32: -+ break; -+ case MIPS_ABI_N64: -+ tramp_frame_prepend_unwinder (gdbarch, &mips64_fbsd_sigframe); -+ break; -+ } -+ -+ set_gdbarch_iterate_over_regset_sections -+ (gdbarch, mips_fbsd_iterate_over_regset_sections); -+ -+ /* FreeBSD/mips has SVR4-style shared libraries. */ -+ set_solib_svr4_fetch_link_map_offsets -+ (gdbarch, (gdbarch_ptr_bit (gdbarch) == 32 ? -+ mips_fbsd_ilp32_fetch_link_map_offsets : -+ mips_fbsd_lp64_fetch_link_map_offsets)); -+} -+ -+ -+/* Provide a prototype to silence -Wmissing-prototypes. */ -+void _initialize_mips_fbsd_tdep (void); -+ -+void -+_initialize_mips_fbsd_tdep (void) -+{ -+ gdbarch_register_osabi (bfd_arch_mips, 0, GDB_OSABI_FREEBSD_ELF, -+ mips_fbsd_init_abi); -+} -diff --git gdb/mips-fbsd-tdep.h gdb/mips-fbsd-tdep.h -new file mode 100644 -index 0000000000..8a197e6325 ---- /dev/null -+++ gdb/mips-fbsd-tdep.h -@@ -0,0 +1,28 @@ -+/* Common target dependent code for GDB on MIPS systems running FreeBSD. -+ -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#ifndef MIPS_FBSD_TDEP_H -+#define MIPS_FBSD_TDEP_H -+ -+void mips_fbsd_supply_fpregs (struct regcache *, int, const void *, size_t); -+void mips_fbsd_supply_gregs (struct regcache *, int, const void *, size_t); -+void mips_fbsd_collect_fpregs (const struct regcache *, int, void *, size_t); -+void mips_fbsd_collect_gregs (const struct regcache *, int, void *, size_t); -+ -+#endif /* MIPS_FBSD_TDEP_H */ Index: devel/gdb/files/commit-b268007c68 =================================================================== --- devel/gdb/files/commit-b268007c68 +++ /dev/null @@ -1,191 +0,0 @@ -commit acde9e8dc95a053909e137c1fcda94c719eb8cc1 -Author: John Baldwin -Date: Wed Jan 4 09:41:58 2017 -0800 - - Add native target for FreeBSD/mips. - - This supports the o32 and n64 ABIs. - - gdb/ChangeLog: - - * Makefile.in (ALLDEPFILES): Add mips-fbsd-nat.c. - * NEWS: Mention new FreeBSD/mips native configuration. - * config/mips/fbsd.mh: New file. - * configure.host: Add mips*-*-freebsd*. - * mips-fbsd-nat.c: New file. - -diff --git gdb/Makefile.in gdb/Makefile.in -index 300c2cb702..433dd1203a 100644 ---- gdb/Makefile.in -+++ gdb/Makefile.in -@@ -1725,6 +1725,7 @@ ALLDEPFILES = \ - m88k-tdep.c m88kbsd-nat.c \ - microblaze-tdep.c microblaze-linux-tdep.c \ - mingw-hdep.c common/mingw-strerror.c \ -+ mips-fbsd-nat.c \ - mips-fbsd-tdep.c \ - mips-linux-nat.c mips-linux-tdep.c \ - mips-sde-tdep.c \ -diff --git gdb/config/mips/fbsd.mh gdb/config/mips/fbsd.mh -new file mode 100644 -index 0000000000..f433347a20 ---- /dev/null -+++ gdb/config/mips/fbsd.mh -@@ -0,0 +1,3 @@ -+# Host: FreeBSD/mips -+NATDEPFILES= fork-child.o inf-ptrace.o fbsd-nat.o mips-fbsd-nat.o -+HAVE_NATIVE_GCORE_HOST = 1 -diff --git gdb/configure.host gdb/configure.host -index ef265ebe29..c45f61dbba 100644 ---- gdb/configure.host -+++ gdb/configure.host -@@ -129,6 +129,7 @@ m88*-*-openbsd*) gdb_host=obsd ;; - mips*-*-linux*) gdb_host=linux ;; - mips*-*-netbsd* | mips*-*-knetbsd*-gnu) - gdb_host=nbsd ;; -+mips*-*-freebsd*) gdb_host=fbsd ;; - mips64*-*-openbsd*) gdb_host=obsd64 ;; - - powerpc-*-aix* | rs6000-*-* | powerpc64-*-aix*) -diff --git gdb/mips-fbsd-nat.c gdb/mips-fbsd-nat.c -new file mode 100644 -index 0000000000..0472df88f4 ---- /dev/null -+++ gdb/mips-fbsd-nat.c -@@ -0,0 +1,136 @@ -+/* Native-dependent code for FreeBSD/mips. -+ -+ Copyright (C) 2017 Free Software Foundation, Inc. -+ -+ This file is part of GDB. -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 3 of the License, or -+ (at your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+ -+ You should have received a copy of the GNU General Public License -+ along with this program. If not, see . */ -+ -+#include "defs.h" -+#include "inferior.h" -+#include "regcache.h" -+#include "target.h" -+ -+#include -+#include -+#include -+ -+#include "fbsd-nat.h" -+#include "mips-tdep.h" -+#include "mips-fbsd-tdep.h" -+#include "inf-ptrace.h" -+ -+/* Determine if PT_GETREGS fetches this register. */ -+ -+static bool -+getregs_supplies (struct gdbarch *gdbarch, int regnum) -+{ -+ return (regnum >= MIPS_ZERO_REGNUM -+ && regnum <= gdbarch_pc_regnum (gdbarch)); -+} -+ -+/* Fetch register REGNUM from the inferior. If REGNUM is -1, do this -+ for all registers. */ -+ -+static void -+mips_fbsd_fetch_inferior_registers (struct target_ops *ops, -+ struct regcache *regcache, int regnum) -+{ -+ struct gdbarch *gdbarch = get_regcache_arch (regcache); -+ if (regnum == -1 || getregs_supplies (gdbarch, regnum)) -+ { -+ struct reg regs; -+ -+ if (ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid), -+ (PTRACE_TYPE_ARG3) ®s, 0) == -1) -+ perror_with_name (_("Couldn't get registers")); -+ -+ mips_fbsd_supply_gregs (regcache, regnum, ®s, sizeof (register_t)); -+ if (regnum != -1) -+ return; -+ } -+ -+ if (regnum == -1 -+ || regnum >= gdbarch_fp0_regnum (get_regcache_arch (regcache))) -+ { -+ struct fpreg fpregs; -+ -+ if (ptrace (PT_GETFPREGS, get_ptrace_pid (inferior_ptid), -+ (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) -+ perror_with_name (_("Couldn't get floating point status")); -+ -+ mips_fbsd_supply_fpregs (regcache, regnum, &fpregs, -+ sizeof (f_register_t)); -+ } -+} -+ -+/* Store register REGNUM back into the inferior. If REGNUM is -1, do -+ this for all registers. */ -+ -+static void -+mips_fbsd_store_inferior_registers (struct target_ops *ops, -+ struct regcache *regcache, int regnum) -+{ -+ struct gdbarch *gdbarch = get_regcache_arch (regcache); -+ if (regnum == -1 || getregs_supplies (gdbarch, regnum)) -+ { -+ struct reg regs; -+ -+ if (ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid), -+ (PTRACE_TYPE_ARG3) ®s, 0) == -1) -+ perror_with_name (_("Couldn't get registers")); -+ -+ mips_fbsd_collect_gregs (regcache, regnum, (char *) ®s, -+ sizeof (register_t)); -+ -+ if (ptrace (PT_SETREGS, get_ptrace_pid (inferior_ptid), -+ (PTRACE_TYPE_ARG3) ®s, 0) == -1) -+ perror_with_name (_("Couldn't write registers")); -+ -+ if (regnum != -1) -+ return; -+ } -+ -+ if (regnum == -1 -+ || regnum >= gdbarch_fp0_regnum (get_regcache_arch (regcache))) -+ { -+ struct fpreg fpregs; -+ -+ if (ptrace (PT_GETFPREGS, get_ptrace_pid (inferior_ptid), -+ (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) -+ perror_with_name (_("Couldn't get floating point status")); -+ -+ mips_fbsd_collect_fpregs (regcache, regnum, (char *) &fpregs, -+ sizeof (f_register_t)); -+ -+ if (ptrace (PT_SETFPREGS, get_ptrace_pid (inferior_ptid), -+ (PTRACE_TYPE_ARG3) &fpregs, 0) == -1) -+ perror_with_name (_("Couldn't write floating point status")); -+ } -+} -+ -+ -+/* Provide a prototype to silence -Wmissing-prototypes. */ -+void _initialize_mips_fbsd_nat (void); -+ -+void -+_initialize_mips_fbsd_nat (void) -+{ -+ struct target_ops *t; -+ -+ t = inf_ptrace_target (); -+ t->to_fetch_registers = mips_fbsd_fetch_inferior_registers; -+ t->to_store_registers = mips_fbsd_store_inferior_registers; -+ fbsd_nat_add_target (t); -+} Index: gdb/files/extrapatch-kgdb =================================================================== --- gdb/files/extrapatch-kgdb +++ gdb/files/extrapatch-kgdb @@ -12,25 +12,30 @@ # # CLI sub directory definitons -@@ -653,7 +654,8 @@ ALL_64_TARGET_OBS = \ - ia64-linux-tdep.o ia64-vms-tdep.o ia64-tdep.o \ - mips64obsd-tdep.o \ - sparc64fbsd-tdep.o sparc64-linux-tdep.o sparc64nbsd-tdep.o \ -- sparc64obsd-tdep.o sparc64-sol2-tdep.o sparc64-tdep.o -+ sparc64obsd-tdep.o sparc64-sol2-tdep.o sparc64-tdep.o \ -+ amd64fbsd-kern.o sparc64fbsd-kern.o +@@ -773,7 +774,9 @@ + sparc64-nbsd-tdep.o \ + sparc64-obsd-tdep.o \ + sparc64-sol2-tdep.o \ +- sparc64-tdep.o ++ sparc64-tdep.o \ ++ amd64fbsd-kern.o \ ++ sparc64fbsd-kern.o # All other target-dependent objects files (used with --enable-targets=all). ALL_TARGET_OBS = \ -@@ -676,6 +678,8 @@ ALL_TARGET_OBS = \ - i386-sol2-tdep.o i386-tdep.o i387-tdep.o \ - i386-dicos-tdep.o i386-darwin-tdep.o \ - iq2000-tdep.o \ -+ fbsd-kld.o fbsd-kthr.o fbsd-kvm.o i386fbsd-kern.o ppcfbsd-kern.o \ +@@ -797,6 +800,12 @@ + cris-tdep.o \ + dicos-tdep.o \ + fbsd-tdep.o \ ++ fbsd-kld.o \ ++ fbsd-kthr.o \ ++ fbsd-kvm.o \ ++ i386fbsd-kern.o \ ++ ppcfbsd-kern.o \ + mipsfbsd-kern.o \ - linux-tdep.o \ - lm32-tdep.o \ - m32c-tdep.o \ + frv-linux-tdep.o \ + frv-tdep.o \ + ft32-tdep.o \ @@ -1133,7 +1137,7 @@ generated_files = config.h observer.h observer.inc ada-lex.c jit-reader.h \ $(COMPILE) $< $(POSTCOMPILE) @@ -199,9 +204,9 @@ @@ -190,7 +190,13 @@ i[34567]86-*-dicos*) i[34567]86-*-freebsd* | i[34567]86-*-kfreebsd*-gnu) # Target: FreeBSD/i386 - gdb_target_obs="i386-tdep.o i387-tdep.o i386bsd-tdep.o i386fbsd-tdep.o \ -- bsd-uthread.o fbsd-tdep.o solib-svr4.o" -+ bsd-uthread.o fbsd-tdep.o solib-svr4.o \ + gdb_target_obs="i386-tdep.o i387-tdep.o i386-bsd-tdep.o i386-fbsd-tdep.o \ +- fbsd-tdep.o solib-svr4.o" ++ fbsd-tdep.o solib-svr4.o \ + fbsd-kld.o fbsd-kthr.o fbsd-kvm.o i386fbsd-kern.o" + if test "x$enable_64_bit_bfd" = "xyes"; then + # Target: FreeBSD amd64 @@ -224,7 +229,7 @@ @@ -419,7 +426,8 @@ powerpc*-*-freebsd*) # Target: FreeBSD/powerpc gdb_target_obs="rs6000-tdep.o ppc-sysv-tdep.o ppc64-tdep.o \ - ppcfbsd-tdep.o fbsd-tdep.o solib-svr4.o \ + ppc-fbsd-tdep.o fbsd-tdep.o solib-svr4.o \ - ravenscar-thread.o ppc-ravenscar-thread.o" + ravenscar-thread.o ppc-ravenscar-thread.o \ + fbsd-kld.o fbsd-kthr.o fbsd-kvm.o ppcfbsd-kern.o" @@ -243,10 +248,10 @@ # Target: NetBSD/sparc @@ -674,7 +683,9 @@ x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu) # Target: FreeBSD/amd64 - gdb_target_obs="amd64-tdep.o amd64fbsd-tdep.o i386-tdep.o \ - i387-tdep.o i386bsd-tdep.o i386fbsd-tdep.o \ -- bsd-uthread.o fbsd-tdep.o solib-svr4.o" -+ bsd-uthread.o fbsd-tdep.o solib-svr4.o \ + gdb_target_obs="amd64-tdep.o amd64-fbsd-tdep.o i386-tdep.o \ + i387-tdep.o i386-bsd-tdep.o i386-fbsd-tdep.o \ +- fbsd-tdep.o solib-svr4.o" ++ fbsd-tdep.o solib-svr4.o \ + fbsd-kld.o fbsd-kthr.o fbsd-kvm.o amd64fbsd-kern.o \ + i386fbsd-kern.o" ;; @@ -257,25 +262,25 @@ --- gdb/defs.h +++ gdb/defs.h @@ -598,6 +598,7 @@ enum gdb_osabi + GDB_OSABI_SOLARIS, GDB_OSABI_LINUX, - GDB_OSABI_FREEBSD_AOUT, - GDB_OSABI_FREEBSD_ELF, + GDB_OSABI_FREEBSD, + GDB_OSABI_FREEBSD_ELF_KERNEL, - GDB_OSABI_NETBSD_AOUT, - GDB_OSABI_NETBSD_ELF, - GDB_OSABI_OPENBSD_ELF, + GDB_OSABI_NETBSD, + GDB_OSABI_OPENBSD, + GDB_OSABI_WINCE, diff --git gdb/osabi.c gdb/osabi.c index f7d4e74239..130ffef37e 100644 --- gdb/osabi.c +++ gdb/osabi.c @@ -66,6 +66,7 @@ static const struct osabi_names gdb_osabi_names[] = + { "Solaris", NULL }, { "GNU/Linux", "linux(-gnu)?" }, - { "FreeBSD/a.out", NULL }, - { "FreeBSD/ELF", NULL }, + { "FreeBSD", NULL }, + { "FreeBSD/kernel", NULL }, - { "NetBSD/a.out", NULL }, - { "NetBSD/ELF", NULL }, - { "OpenBSD/ELF", NULL }, + { "NetBSD", NULL }, + { "OpenBSD", NULL }, + { "WindowsCE", NULL }, diff --git gdb/regcache.c gdb/regcache.c index a5c90a6314..05044e5293 100644 --- gdb/regcache.c Index: gdb/files/kgdb/fbsd-kld.c =================================================================== --- gdb/files/kgdb/fbsd-kld.c +++ gdb/files/kgdb/fbsd-kld.c @@ -140,19 +140,20 @@ * in the various paths in the module path. */ static int -find_kld_path (char *filename, char *path, size_t path_size) +find_kld_path (const char *filename, char *path, size_t path_size) { struct kld_info *info; struct cleanup *cleanup; char *module_path; - char *kernel_dir, *module_dir, *cp; + char *module_dir, *cp; + const char *kernel_dir; int error; info = get_kld_info(); if (exec_bfd) { - kernel_dir = ldirname(bfd_get_filename(exec_bfd)); + kernel_dir = ldirname(bfd_get_filename(exec_bfd)).c_str(); if (kernel_dir != NULL) { - cleanup = make_cleanup(xfree, kernel_dir); + cleanup = make_cleanup(xfree, (void *)kernel_dir); snprintf(path, path_size, "%s/%s", kernel_dir, filename); if (check_kld_path(path, path_size)) { @@ -270,17 +271,18 @@ { struct section_addr_info *sap; struct target_section *sections = NULL, *sections_end = NULL, *s; - struct cleanup *cleanup; +// struct cleanup *cleanup; bfd *bfd; CORE_ADDR curr_addr; - int add_flags, i; + int i; + symfile_add_flags add_flags; /* Open the kld. */ bfd = bfd_openr(path, gnutarget); if (bfd == NULL) error("\"%s\": can't open: %s", path, bfd_errmsg(bfd_get_error())); - cleanup = make_cleanup_bfd_unref(bfd); +// cleanup = make_cleanup_bfd_unref(bfd); if (!bfd_check_format(bfd, bfd_object)) error("\%s\": not an object file", path); @@ -315,7 +317,7 @@ add_flags |= SYMFILE_VERBOSE; symbol_file_add(path, add_flags, sap, OBJF_USERLOADED); - do_cleanups(cleanup); +// do_cleanups(cleanup); } static void @@ -431,12 +433,7 @@ } END_CATCH - solib_add(NULL, 1, ¤t_target, auto_solib_add); -} - -static void -kld_special_symbol_handling (void) -{ + solib_add(NULL, 1, auto_solib_add); } static struct so_list * @@ -547,7 +544,7 @@ } static int -kld_find_and_open_solib (char *solib, unsigned o_flags, char **temp_pathname) +kld_find_and_open_solib (const char *solib, unsigned o_flags, char **temp_pathname) { char path[PATH_MAX]; int fd; @@ -575,7 +572,6 @@ kld_so_ops.clear_so = kld_clear_so; kld_so_ops.clear_solib = kld_clear_solib; kld_so_ops.solib_create_inferior_hook = kld_solib_create_inferior_hook; - kld_so_ops.special_symbol_handling = kld_special_symbol_handling; kld_so_ops.current_sos = kld_current_sos; kld_so_ops.open_symbol_file_object = kld_open_symbol_file_object; kld_so_ops.in_dynsym_resolve_code = kld_in_dynsym_resolve_code; Index: gdb/files/kgdb/fbsd-kvm.c =================================================================== --- gdb/files/kgdb/fbsd-kvm.c +++ gdb/files/kgdb/fbsd-kvm.c @@ -362,7 +362,7 @@ printf_filtered("No vmcore file now.\n"); } -static char * +static const char * kgdb_trgt_extra_thread_info(struct target_ops *ops, struct thread_info *ti) { @@ -402,7 +402,7 @@ #endif } -static char * +static const char * kgdb_trgt_pid_to_str(struct target_ops *ops, ptid_t ptid) { static char buf[33]; Index: gdb/files/patch-armfbsd =================================================================== --- gdb/files/patch-armfbsd +++ gdb/files/patch-armfbsd @@ -331,7 +331,7 @@ +_initialize_armfbsd_tdep (void) +{ + -+ gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_FREEBSD_ELF, ++ gdbarch_register_osabi (bfd_arch_arm, 0, GDB_OSABI_FREEBSD, + arm_freebsd_elf_init_abi); +} diff --git gdb/config/arm/fbsd.mh gdb/config/arm/fbsd.mh @@ -347,21 +347,19 @@ index dfaa8a3..ddad28d 100644 --- gdb/Makefile.in +++ gdb/Makefile.in -@@ -659,7 +659,7 @@ - ALL_TARGET_OBS = \ - armbsd-tdep.o arm.o arm-linux.o arm-linux-tdep.o \ - arm-get-next-pcs.o arm-symbian-tdep.o \ -- armnbsd-tdep.o armobsd-tdep.o \ -+ armnbsd-tdep.o armobsd-tdep.o armfbsd-tdep.o \ - arm-tdep.o arm-wince-tdep.o \ - avr-tdep.o \ - bfin-linux-tdep.o bfin-tdep.o \ -@@ -1666,7 +1666,7 @@ - arm.c arm-get-next-pcs.c \ - arm-linux.c arm-linux-nat.c arm-linux-tdep.c \ - arm-symbian-tdep.c arm-tdep.c \ -- armnbsd-nat.c armbsd-tdep.c armnbsd-tdep.c armobsd-tdep.c \ -+ armnbsd-nat.c armbsd-tdep.c armnbsd-tdep.c armobsd-tdep.c armfbsd-tdep.c \ +@@ -785,6 +785,7 @@ + arm-linux-tdep.o \ + arm-nbsd-tdep.o \ + arm-obsd-tdep.o \ ++ armfbsd-tdep.o \ + arm-symbian-tdep.o \ + arm-tdep.o \ + arm-wince-tdep.o \ +@@ -2495,6 +2496,7 @@ + arm-nbsd-nat.c \ + arm-nbsd-tdep.c \ + arm-obsd-tdep.c \ ++ armfbsd-tdep.c \ + arm-symbian-tdep.c \ + arm-tdep.c \ avr-tdep.c \ - bfin-linux-tdep.c bfin-tdep.c \ - bsd-uthread.c bsd-kvm.c \ Index: devel/gdb/files/patch-fixes =================================================================== --- devel/gdb/files/patch-fixes +++ /dev/null @@ -1,11 +0,0 @@ ---- gdb/compile/compile-loc2c.c.orig 2016-07-05 12:30:44.811467295 +0200 -+++ gdb/compile/compile-loc2c.c 2016-07-05 12:38:46.432434206 +0200 -@@ -670,7 +670,7 @@ - enum dwarf_location_atom op = (enum dwarf_location_atom) *op_ptr; - uint64_t uoffset, reg; - int64_t offset; -- -+ uoffset = 0; - print_spaces (indent - 2, stream); - if (info[op_ptr - base].label) - { Index: gdb/files/patch-gdb-amd64bsd-nat.c =================================================================== --- gdb/files/patch-gdb-amd64bsd-nat.c +++ gdb/files/patch-gdb-amd64bsd-nat.c @@ -1,5 +1,5 @@ ---- gdb/amd64bsd-nat.c.orig 2016-02-10 04:19:39.000000000 +0100 -+++ gdb/amd64bsd-nat.c 2016-03-04 11:17:58.581638025 +0100 +--- gdb/amd64-bsd-nat.c.orig 2016-02-10 04:19:39.000000000 +0100 ++++ gdb/amd64-bsd-nat.c 2016-03-04 11:17:58.581638025 +0100 @@ -28,6 +28,7 @@ #include #include @@ -8,7 +8,7 @@ #include "amd64-tdep.h" #include "amd64-nat.h" -@@ -98,14 +99,25 @@ +@@ -94,13 +95,22 @@ if (regnum == -1 || amd64_native_gregset_supplies_p (gdbarch, regnum)) { @@ -17,21 +17,18 @@ + memset( ®s, 0, sizeof(struct reg)); + memset( &oldregs, 0, sizeof(struct reg)); - if (ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) ®s, 0) == -1) + if (ptrace (PT_GETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1) perror_with_name (_("Couldn't get registers")); + ptrace (PT_GETREGS, get_ptrace_pid (inferior_ptid), -+ (PTRACE_TYPE_ARG3) &oldregs, 0); ++ (PTRACE_TYPE_ARG3) &oldregs, 0); amd64_collect_native_gregset (regcache, ®s, regnum); ++ /* This is a workaround about the PSL_USERCHANGE posix limitation */ + if( (regs.r_rflags ^ oldregs.r_rflags ) & ~PSL_USERCHANGE) + { -+ //printf("regs.r_rflags = 0x%8.8lX\n", regs.r_rflags ); -+ //printf("oldregs.r_rflags = 0x%8.8lX\n", oldregs.r_rflags ); + regs.r_rflags ^= (regs.r_rflags ^ oldregs.r_rflags ) & ~PSL_USERCHANGE; -+ //printf(" allowed regs.r_rflags = 0x%8.8X\n", regs.r_rflags ); + } - if (ptrace (PT_SETREGS, get_ptrace_pid (inferior_ptid), - (PTRACE_TYPE_ARG3) ®s, 0) == -1) + if (ptrace (PT_SETREGS, pid, (PTRACE_TYPE_ARG3) ®s, 0) == -1) perror_with_name (_("Couldn't write registers")); + Index: gdb/files/patch-gdb-configure =================================================================== --- gdb/files/patch-gdb-configure +++ gdb/files/patch-gdb-configure @@ -1,24 +1,15 @@ --- gdb/configure.orig 2016-10-07 19:09:21.000000000 +0200 +++ gdb/configure 2016-10-18 11:11:30.452542000 +0200 -@@ -14256,9 +14256,8 @@ +@@ -15105,10 +15105,8 @@ - # These options work in either C or C++ modes. + # The options we'll try to enable. build_warnings="-Wall -Wpointer-arith \ --Wno-unused -Wunused-value -Wunused-function \ --Wno-switch -Wno-char-subscripts \ ---Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable" +--Wempty-body -Wunused-but-set-parameter -Wunused-but-set-variable \ +--Wno-sign-compare -Wno-narrowing" +-Wno-unused -Wno-switch -Wno-char-subscripts \ -+-Wempty-body" - - # Now add in C and C++ specific options, depending on mode. - if test "$enable_build_with_cxx" = "yes"; then -@@ -14266,8 +14265,7 @@ - -Wno-narrowing" - else - build_warnings="$build_warnings -Wpointer-sign -Wmissing-prototypes \ ---Wdeclaration-after-statement -Wmissing-parameter-type \ ---Wold-style-declaration -Wold-style-definition" -+-Wdeclaration-after-statement -Wold-style-definition" - fi ++-Wempty-body -Wno-sign-compare -Wno-narrowing" # Enable -Wno-format by default when using gcc on mingw since many + # GCC versions complain about %I64. Index: devel/gdb/files/patch-gdb-corelow.c =================================================================== --- devel/gdb/files/patch-gdb-corelow.c +++ /dev/null @@ -1,12 +0,0 @@ ---- gdb/corelow.c.orig 2017-01-16 10:40:23.118428000 +0100 -+++ gdb/corelow.c 2017-01-17 22:39:10.524216000 +0100 -@@ -541,7 +541,8 @@ - warning (_("Section `%s' in core file too small."), section_name); - return; - } -- if (size != min_size && !(regset->flags & REGSET_VARIABLE_SIZE)) -+ if (size != min_size && regset != NULL && -+ !(regset->flags & REGSET_VARIABLE_SIZE)) - { - warning (_("Unexpected size of section `%s' in core file."), - section_name); Index: gdb/files/patch-gdb-fbsd-nat.c =================================================================== --- gdb/files/patch-gdb-fbsd-nat.c +++ gdb/files/patch-gdb-fbsd-nat.c @@ -1,16 +1,6 @@ --- gdb/fbsd-nat.c.orig 2016-08-01 17:50:20.000000000 +0200 +++ gdb/fbsd-nat.c 2016-12-14 23:23:39.467449000 +0100 -@@ -680,6 +680,9 @@ - if (!ptid_match (tp->ptid, *filter)) - return 0; - -+ if (tp->state == THREAD_EXITED) { -+ return 0; -+ } - if (ptrace (PT_RESUME, ptid_get_lwp (tp->ptid), NULL, 0) == -1) - perror_with_name (("ptrace")); - return 0; -@@ -710,6 +713,14 @@ +@@ -678,6 +678,14 @@ ptid_get_tid (ptid)); if (ptid_lwp_p (ptid)) { @@ -23,5 +13,15 @@ + fbsd_add_threads (ptid_get_pid (ptid)); +#endif /* If ptid is a specific LWP, suspend all other LWPs in the process. */ - iterate_over_threads (resume_one_thread_cb, &ptid); - } + struct thread_info *tp; + int request; +@@ -707,6 +715,9 @@ + if (!ptid_match (tp->ptid, ptid)) + continue; + ++ if (tp->state == THREAD_EXITED) { ++ return; ++ } + if (ptrace (PT_RESUME, ptid_get_lwp (tp->ptid), NULL, 0) == -1) + perror_with_name (("ptrace")); + } Index: gdb/files/patch-gdb-gnulib-import-stddef.in.h =================================================================== --- gdb/files/patch-gdb-gnulib-import-stddef.in.h +++ gdb/files/patch-gdb-gnulib-import-stddef.in.h @@ -1,10 +1,10 @@ --- gdb/gnulib/import/stddef.in.h.orig 2016-10-07 23:33:10.529558000 -0700 +++ gdb/gnulib/import/stddef.in.h 2016-10-07 23:33:23.824676000 -0700 @@ -82,7 +82,7 @@ - #endif - - /* Some platforms lack max_align_t. */ --#if !@HAVE_MAX_ALIGN_T@ + /* Some platforms lack max_align_t. The check for _GCC_MAX_ALIGN_T is + a hack in case the configure-time test was done with g++ even though + we are currently compiling with gcc. */ +-#if ! (@HAVE_MAX_ALIGN_T@ || defined _GCC_MAX_ALIGN_T) +#if 0 /* On the x86, the maximum storage alignment of double, long, etc. is 4, but GCC's C11 ABI for x86 says that max_align_t has an alignment of 8, Index: gdb/files/patch-gdb-i386fbsd-nat.c =================================================================== --- gdb/files/patch-gdb-i386fbsd-nat.c +++ gdb/files/patch-gdb-i386fbsd-nat.c @@ -1,7 +1,7 @@ -diff --git gdb/i386fbsd-nat.c gdb/i386fbsd-nat.c +diff --git gdb/i386-fbsd-nat.c gdb/i386-fbsd-nat.c index 6c43f2c..a205a26 100644 ---- gdb/i386fbsd-nat.c -+++ gdb/i386fbsd-nat.c +--- gdb/i386-fbsd-nat.c ++++ gdb/i386-fbsd-nat.c @@ -175,7 +175,6 @@ _initialize_i386fbsd_nat (void) t->to_read_description = i386fbsd_read_description; #endif Index: gdb/files/patch-gdb-x86bsd-nat.c =================================================================== --- gdb/files/patch-gdb-x86bsd-nat.c +++ gdb/files/patch-gdb-x86bsd-nat.c @@ -1,5 +1,5 @@ ---- gdb/x86bsd-nat.c.orig 2016-10-18 13:27:55.820837000 +0200 -+++ gdb/x86bsd-nat.c 2016-10-18 13:29:02.518927000 +0200 +--- gdb/x86-bsd-nat.c.orig 2016-10-18 13:27:55.820837000 +0200 ++++ gdb/x86-bsd-nat.c 2016-10-18 13:29:02.518927000 +0200 @@ -82,7 +82,11 @@ /* For some mysterious reason, some of the reserved bits in the debug control register get set. Mask these off, otherwise the