summaryrefslogtreecommitdiff
path: root/gdb/ppc64-linux-tdep.c
diff options
context:
space:
mode:
authorJim Blandy <jimb@codesourcery.com>2003-05-13 00:08:58 +0000
committerJim Blandy <jimb@codesourcery.com>2003-05-13 00:08:58 +0000
commitad20141640f390ddb988537bf7d93316e5388e4b (patch)
treec1645477648a946f3973c701fb89b76e295e5bcc /gdb/ppc64-linux-tdep.c
parentea1c83e1893b74392032336333d19c00a414611d (diff)
downloadgdb-jimb-ppc64-linux-20030509-branch.tar.gz
Patch from Will Schmidt <willschm@us.ibm.com>:jimb-ppc64-linux-20030509-branchcvs/jimb-ppc64-linux-20030509-branch
These changes enable support of PPC64 architecture. * config/powerpc/ppc64linux.mh: New file. * config/powerpc/ppc64linux.mt: New file. * config/powerpc/tm-ppc64linux.h: New file. * ppc64-linux-tdep.c: New file. * configure.host: Add clause for powerpc64-*-linux* * configure.tgt: Add clause for powerpc64-*-linux* * elfread.c (record_minimal_symbol_and_info): If DROP_TEXT_NAME_PREFIX_CHAR is #defined, then drop a leading instance of that char from the names of text symbols. (elf_symtab_read): If SKIP_DATA_IN_OPD is #defined, ignore data symbols in the .opd section. * ppc-linux-nat.c (PTRACE_XFER_TYPE): Change the default for this to 'long'. (PPC_PTRACE_POKEUSR_3264, PPC_PTRACE_PEEKUSR_3264, PPC_PTRACE_POKEDATA_3264, PPC_PTRACE_PEEKDATA_3264): Provide default definitions for these. (ARCH64): New macro. (ppc_wordsize_pid): New function. (kernel_u_size): Handle 64-bit case. (ppc_register_u_addr): Same. (fetch_register): Use the *_3264 requests when debugging a 64-bit process from a 32-bit GDB. (store_register): Same. (GDB_MAX_ALLOCA, child_xfer_memory, udot_info): Copied from infptrace.c. (_initialize_ppc_linux_nat): New function, to register our copy of the udot_info command. * ppc-linux-tdep.c (TDEP): New macro. (ppc64_linux_svr4_fetch_link_map_offsets): New function. (read_memory_addr): Copied from rs6000-tdep.c. (ppc64_linux_convert_from_func_ptr_addr): New function. * rs6000-tdep.c (skip_prologue): Recognize more instructions for saving the 'lr' and 'cr' registers; don't just pre-emptively mask in the 'st' opcode as soon as we see an 'mflr' or 'mfcr' opcode. Recognize more instructions for updating the stack pointer, and loading the TOC pointer. (registers_powerpc64, registers_a35): New register tables. (rs6000_gdbarch_init): Register the 64-bit solib functions. * solib-svr4.c (solib_break_names): If SOLIB_BREAK_NAME is #defined, include an entry for it. (enable_break): Call CONVERT_FROM_FUNC_PTR_ADDR when trying to guess the linker's base address. * config/powerpc/tm-linux.h (ppc64_linux_svr4_fetch_link_map_offsets, ppc64_linux_convert_from_func_ptr_addr): New declarations.
Diffstat (limited to 'gdb/ppc64-linux-tdep.c')
-rw-r--r--gdb/ppc64-linux-tdep.c80
1 files changed, 80 insertions, 0 deletions
diff --git a/gdb/ppc64-linux-tdep.c b/gdb/ppc64-linux-tdep.c
new file mode 100644
index 00000000000..f7e0a2aa4bb
--- /dev/null
+++ b/gdb/ppc64-linux-tdep.c
@@ -0,0 +1,80 @@
+/* Target-dependent code for GDB, the GNU debugger.
+
+ Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
+ 2000, 2001 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 "defs.h"
+
+
+/* These elfcore fuctions are defined in libbfd.a but only when host
+ == target, once we can convince the bfd to supply it these can go */
+#define _SYSCALL32
+#include "bfd.h"
+#include "sysdep.h"
+#include "bfdlink.h"
+#include "libbfd.h"
+#define ARCH_SIZE 0
+#include "elf-bfd.h"
+#include "libiberty.h"
+#include <sys/procfs.h>
+
+
+/*
+ * Initialization
+ */
+void
+_initialize_ppc64_linux_tdep (void)
+{
+ /* hardware/kernel supports single stepping */
+ set_gdbarch_software_single_step (current_gdbarch, NULL);
+}
+
+/* the start_address stored in the bfd is a function descriptor */
+#include "gdb/target.h"
+CORE_ADDR
+ppc64_bfd_get_start_address (bfd *abfd)
+{
+ extern struct target_ops exec_ops;
+ CORE_ADDR myaddr;
+ xfer_memory(abfd->start_address, (char *)&myaddr, 8, 0, 0, &exec_ops);
+ return myaddr;
+}
+
+/* Fetch (and possibly build) an appropriate link_map_offsets
+ structure for GNU/Linux PPC targets using the struct offsets
+ defined in link.h (but without actual reference to that file).
+
+ This makes it possible to access GNU/Linux PPC shared libraries
+ from a GDB that was not built on an GNU/Linux PPC host (for cross
+ debugging).
+
+*/
+#include "gdbcore.h"
+#include "symfile.h"
+#include "objfiles.h"
+
+#include "ppc-tdep.h"
+#define TDEP gdbarch_tdep (current_gdbarch)
+
+static CORE_ADDR
+read_memory_addr (CORE_ADDR memaddr, int len)
+{
+ return read_memory_unsigned_integer (memaddr, len);
+}