From owner-svn-src-all@FreeBSD.ORG Wed Apr 14 20:31:06 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 678FB1065672; Wed, 14 Apr 2010 20:31:06 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 548558FC1A; Wed, 14 Apr 2010 20:31:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3EKV636078980; Wed, 14 Apr 2010 20:31:06 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3EKV6hR078975; Wed, 14 Apr 2010 20:31:06 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <201004142031.o3EKV6hR078975@svn.freebsd.org> From: Warner Losh Date: Wed, 14 Apr 2010 20:31:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r206624 - head/gnu/usr.bin/gdb/gdbserver X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Apr 2010 20:31:06 -0000 Author: imp Date: Wed Apr 14 20:31:06 2010 New Revision: 206624 URL: http://svn.freebsd.org/changeset/base/206624 Log: Make this directory more regular. Since it is one we control, use the freebsd-based names for filenames. This allows us to eliminate almost all of the uses of ${MACHINE_ARCH} here to do special things, and instead we use it to include filenames. This makes new architectures easier to support. Added: head/gnu/usr.bin/gdb/gdbserver/fbsd-powerpc-low.c - copied unchanged from r206623, head/gnu/usr.bin/gdb/gdbserver/fbsd-ppc-low.c head/gnu/usr.bin/gdb/gdbserver/reg-amd64.c - copied unchanged from r206623, head/gnu/usr.bin/gdb/gdbserver/reg-x86-64.c head/gnu/usr.bin/gdb/gdbserver/reg-powerpc.c - copied unchanged from r206623, head/gnu/usr.bin/gdb/gdbserver/reg-ppc.c Deleted: head/gnu/usr.bin/gdb/gdbserver/fbsd-ppc-low.c head/gnu/usr.bin/gdb/gdbserver/reg-ppc.c head/gnu/usr.bin/gdb/gdbserver/reg-x86-64.c Modified: head/gnu/usr.bin/gdb/gdbserver/Makefile Modified: head/gnu/usr.bin/gdb/gdbserver/Makefile ============================================================================== --- head/gnu/usr.bin/gdb/gdbserver/Makefile Wed Apr 14 20:04:55 2010 (r206623) +++ head/gnu/usr.bin/gdb/gdbserver/Makefile Wed Apr 14 20:31:06 2010 (r206624) @@ -14,20 +14,9 @@ SRCS= inferiors.c mem-break.c regcache.c server.c signals.c target.c utils.c SRCS+= fbsd-low.c -.if ${MACHINE_ARCH} == "amd64" -SRCS+= fbsd-amd64-low.c i387-fp.c reg-x86-64.c -.endif - -.if ${MACHINE_ARCH} == "arm" -SRCS+= fbsd-arm-low.c reg-arm.c -.endif - -.if ${MACHINE_ARCH} == "i386" -SRCS+= fbsd-i386-low.c i387-fp.c reg-i386.c -.endif - -.if ${MACHINE_ARCH} == "powerpc" -SRCS+= fbsd-ppc-low.c reg-ppc.c +SRCS+= fbsd-${MACHINE_ARCH}-low.c reg-${MACHINE_ARCH}.c +.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386" +SRCS+= i387-fp.c .endif #CFLAGS+= -I${.CURDIR}/../arch/${MACHINE_ARCH} Copied: head/gnu/usr.bin/gdb/gdbserver/fbsd-powerpc-low.c (from r206623, head/gnu/usr.bin/gdb/gdbserver/fbsd-ppc-low.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/gnu/usr.bin/gdb/gdbserver/fbsd-powerpc-low.c Wed Apr 14 20:31:06 2010 (r206624, copy of r206623, head/gnu/usr.bin/gdb/gdbserver/fbsd-ppc-low.c) @@ -0,0 +1,156 @@ +/* FreeBSD/PowerPC specific low level interface, for the remote server for + GDB. + Copyright 1995, 1996, 1998, 1999, 2000, 2001, 2002 + 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 2 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, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +#include +__FBSDID("$FreeBSD$"); + +#include "server.h" +#include "fbsd-low.h" + +#include +#include + +#define ppc_num_regs 71 + +/* Currently, don't check/send MQ. */ +static int ppc_regmap[] = + { 0, 4, 8, 12, 16, 20, 24, 28, + 32, 36, 40, 44, 48, 52, 56, 60, + 64, 68, 72, 76, 80, 84, 88, 92, + 96, 100, 104, 108, 112, 116, 120, 124, +#if 0 + /* + * XXX on FreeBSD the gdbserver for PowerPC was only tested with FPU-less + * cores i.e. e500. Let's leave the original FPR references around in case + * someone picks up and brings support for AIM-like FPU machines. + */ + PT_FPR0*4, PT_FPR0*4 + 8, PT_FPR0*4+16, PT_FPR0*4+24, + PT_FPR0*4+32, PT_FPR0*4+40, PT_FPR0*4+48, PT_FPR0*4+56, + PT_FPR0*4+64, PT_FPR0*4+72, PT_FPR0*4+80, PT_FPR0*4+88, + PT_FPR0*4+96, PT_FPR0*4+104, PT_FPR0*4+112, PT_FPR0*4+120, + PT_FPR0*4+128, PT_FPR0*4+136, PT_FPR0*4+144, PT_FPR0*4+152, + PT_FPR0*4+160, PT_FPR0*4+168, PT_FPR0*4+176, PT_FPR0*4+184, + PT_FPR0*4+192, PT_FPR0*4+200, PT_FPR0*4+208, PT_FPR0*4+216, + PT_FPR0*4+224, PT_FPR0*4+232, PT_FPR0*4+240, PT_FPR0*4+248, +#endif + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + 144, -1, 132, 128, 140, 136, -1 + }; + +static int +ppc_cannot_store_register (int regno) +{ + /* Some kernels do not allow us to store fpscr. */ + if (regno == find_regno ("fpscr")) + return 2; + + return 0; +} + +static int +ppc_cannot_fetch_register (int regno) +{ + return 0; +} + +static CORE_ADDR +ppc_get_pc (void) +{ + unsigned long pc; + + collect_register_by_name ("pc", &pc); + return (CORE_ADDR) pc; +} + +static void +ppc_set_pc (CORE_ADDR pc) +{ + unsigned long newpc = pc; + + supply_register_by_name ("pc", &newpc); +} + +/* Correct in either endianness. Note that this file is + for PowerPC only, not PowerPC64. + This instruction is "twge r2, r2", which GDB uses as a software + breakpoint. */ +static const unsigned long ppc_breakpoint = 0x7d821008; +#define ppc_breakpoint_len 4 + +static int +ppc_breakpoint_at (CORE_ADDR where) +{ + unsigned long insn; + + (*the_target->read_memory) (where, (char *) &insn, 4); + if (insn == ppc_breakpoint) + return 1; + /* If necessary, recognize more trap instructions here. GDB only uses the + one. */ + return 0; +} + +static void +ppc_fill_gregset (void *buf) +{ + int i; + + for (i = 0; i < ppc_num_regs; i++) + if (ppc_regmap[i] != -1) + collect_register (i, ((char *) buf) + ppc_regmap[i]); + +} + +static void +ppc_store_gregset (const void *buf) +{ + int i; + + for (i = 0; i < ppc_num_regs; i++) + if (ppc_regmap[i] != -1) + supply_register (i, ((char *) buf) + ppc_regmap[i]); + +} + +struct regset_info target_regsets[] = { + { PT_GETREGS, PT_SETREGS, sizeof (struct reg), + GENERAL_REGS, + ppc_fill_gregset, ppc_store_gregset }, + { 0, 0, -1, -1, NULL, NULL } +}; + +struct fbsd_target_ops the_low_target = { + ppc_num_regs, + ppc_regmap, + ppc_cannot_fetch_register, + ppc_cannot_store_register, + ppc_get_pc, + ppc_set_pc, + (const char *) &ppc_breakpoint, + ppc_breakpoint_len, + NULL, + 0, + ppc_breakpoint_at, +}; Copied: head/gnu/usr.bin/gdb/gdbserver/reg-amd64.c (from r206623, head/gnu/usr.bin/gdb/gdbserver/reg-x86-64.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/gnu/usr.bin/gdb/gdbserver/reg-amd64.c Wed Apr 14 20:31:06 2010 (r206624, copy of r206623, head/gnu/usr.bin/gdb/gdbserver/reg-x86-64.c) @@ -0,0 +1,99 @@ +/* *INDENT-OFF* */ /* THIS FILE IS GENERATED */ + +/* A register protocol for GDB, the GNU debugger. + Copyright 2001, 2002 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 2 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, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* This file was created with the aid of ``regdat.sh'' and ``../../../../contrib/gdb/gdb/regformats/reg-x86-64.dat''. */ + +#include +__FBSDID("$FreeBSD$"); + +#include "regdef.h" +#include "regcache.h" + +struct reg regs_x86_64[] = { + { "rax", 0, 64 }, + { "rbx", 64, 64 }, + { "rcx", 128, 64 }, + { "rdx", 192, 64 }, + { "rsi", 256, 64 }, + { "rdi", 320, 64 }, + { "rbp", 384, 64 }, + { "rsp", 448, 64 }, + { "r8", 512, 64 }, + { "r9", 576, 64 }, + { "r10", 640, 64 }, + { "r11", 704, 64 }, + { "r12", 768, 64 }, + { "r13", 832, 64 }, + { "r14", 896, 64 }, + { "r15", 960, 64 }, + { "rip", 1024, 64 }, + { "eflags", 1088, 32 }, + { "cs", 1120, 32 }, + { "ss", 1152, 32 }, + { "ds", 1184, 32 }, + { "es", 1216, 32 }, + { "fs", 1248, 32 }, + { "gs", 1280, 32 }, + { "st0", 1312, 80 }, + { "st1", 1392, 80 }, + { "st2", 1472, 80 }, + { "st3", 1552, 80 }, + { "st4", 1632, 80 }, + { "st5", 1712, 80 }, + { "st6", 1792, 80 }, + { "st7", 1872, 80 }, + { "fctrl", 1952, 32 }, + { "fstat", 1984, 32 }, + { "ftag", 2016, 32 }, + { "fiseg", 2048, 32 }, + { "fioff", 2080, 32 }, + { "foseg", 2112, 32 }, + { "fooff", 2144, 32 }, + { "fop", 2176, 32 }, + { "xmm0", 2208, 128 }, + { "xmm1", 2336, 128 }, + { "xmm2", 2464, 128 }, + { "xmm3", 2592, 128 }, + { "xmm4", 2720, 128 }, + { "xmm5", 2848, 128 }, + { "xmm6", 2976, 128 }, + { "xmm7", 3104, 128 }, + { "xmm8", 3232, 128 }, + { "xmm9", 3360, 128 }, + { "xmm10", 3488, 128 }, + { "xmm11", 3616, 128 }, + { "xmm12", 3744, 128 }, + { "xmm13", 3872, 128 }, + { "xmm14", 4000, 128 }, + { "xmm15", 4128, 128 }, + { "mxcsr", 4256, 32 }, +}; + +const char *expedite_regs_x86_64[] = { "rbp", "rsp", "rip", 0 }; + +void +init_registers () +{ + set_register_cache (regs_x86_64, + sizeof (regs_x86_64) / sizeof (regs_x86_64[0])); + gdbserver_expedite_regs = expedite_regs_x86_64; +} Copied: head/gnu/usr.bin/gdb/gdbserver/reg-powerpc.c (from r206623, head/gnu/usr.bin/gdb/gdbserver/reg-ppc.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/gnu/usr.bin/gdb/gdbserver/reg-powerpc.c Wed Apr 14 20:31:06 2010 (r206624, copy of r206623, head/gnu/usr.bin/gdb/gdbserver/reg-ppc.c) @@ -0,0 +1,113 @@ +/* *INDENT-OFF* */ /* THIS FILE IS GENERATED */ + +/* A register protocol for GDB, the GNU debugger. + Copyright 2001, 2002 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 2 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, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* This file was created with the aid of ``regdat.sh'' and ``../../../../contrib/gdb/gdb/regformats/reg-ppc.dat''. */ + +#include +__FBSDID("$FreeBSD$"); + +#include "regdef.h" +#include "regcache.h" + +struct reg regs_ppc[] = { + { "r0", 0, 32 }, + { "r1", 32, 32 }, + { "r2", 64, 32 }, + { "r3", 96, 32 }, + { "r4", 128, 32 }, + { "r5", 160, 32 }, + { "r6", 192, 32 }, + { "r7", 224, 32 }, + { "r8", 256, 32 }, + { "r9", 288, 32 }, + { "r10", 320, 32 }, + { "r11", 352, 32 }, + { "r12", 384, 32 }, + { "r13", 416, 32 }, + { "r14", 448, 32 }, + { "r15", 480, 32 }, + { "r16", 512, 32 }, + { "r17", 544, 32 }, + { "r18", 576, 32 }, + { "r19", 608, 32 }, + { "r20", 640, 32 }, + { "r21", 672, 32 }, + { "r22", 704, 32 }, + { "r23", 736, 32 }, + { "r24", 768, 32 }, + { "r25", 800, 32 }, + { "r26", 832, 32 }, + { "r27", 864, 32 }, + { "r28", 896, 32 }, + { "r29", 928, 32 }, + { "r30", 960, 32 }, + { "r31", 992, 32 }, + { "f0", 1024, 64 }, + { "f1", 1088, 64 }, + { "f2", 1152, 64 }, + { "f3", 1216, 64 }, + { "f4", 1280, 64 }, + { "f5", 1344, 64 }, + { "f6", 1408, 64 }, + { "f7", 1472, 64 }, + { "f8", 1536, 64 }, + { "f9", 1600, 64 }, + { "f10", 1664, 64 }, + { "f11", 1728, 64 }, + { "f12", 1792, 64 }, + { "f13", 1856, 64 }, + { "f14", 1920, 64 }, + { "f15", 1984, 64 }, + { "f16", 2048, 64 }, + { "f17", 2112, 64 }, + { "f18", 2176, 64 }, + { "f19", 2240, 64 }, + { "f20", 2304, 64 }, + { "f21", 2368, 64 }, + { "f22", 2432, 64 }, + { "f23", 2496, 64 }, + { "f24", 2560, 64 }, + { "f25", 2624, 64 }, + { "f26", 2688, 64 }, + { "f27", 2752, 64 }, + { "f28", 2816, 64 }, + { "f29", 2880, 64 }, + { "f30", 2944, 64 }, + { "f31", 3008, 64 }, + { "pc", 3072, 32 }, + { "ps", 3104, 32 }, + { "cr", 3136, 32 }, + { "lr", 3168, 32 }, + { "ctr", 3200, 32 }, + { "xer", 3232, 32 }, + { "fpscr", 3264, 32 }, +}; + +const char *expedite_regs_ppc[] = { "r1", "pc", 0 }; + +void +init_registers () +{ + set_register_cache (regs_ppc, + sizeof (regs_ppc) / sizeof (regs_ppc[0])); + gdbserver_expedite_regs = expedite_regs_ppc; +}