diff options
author | Jim Blandy <jimb@codesourcery.com> | 2003-05-13 00:08:58 +0000 |
---|---|---|
committer | Jim Blandy <jimb@codesourcery.com> | 2003-05-13 00:08:58 +0000 |
commit | ad20141640f390ddb988537bf7d93316e5388e4b (patch) | |
tree | c1645477648a946f3973c701fb89b76e295e5bcc /gdb/ppc-linux-tdep.c | |
parent | ea1c83e1893b74392032336333d19c00a414611d (diff) | |
download | gdb-ad20141640f390ddb988537bf7d93316e5388e4b.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/ppc-linux-tdep.c')
-rw-r--r-- | gdb/ppc-linux-tdep.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index 9284751fd0c..59930396c0b 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -63,6 +63,8 @@ offsetof(struct sigcontext_struct, handler) == 0x14 */ #define PPC_LINUX_HANDLER_PTR_OFFSET (PPC_LINUX_SIGNAL_FRAMESIZE + 0x14) +#define TDEP gdbarch_tdep (current_gdbarch) + /* From <asm/ptrace.h>, values for PT_NIP, PT_R1, and PT_LNK */ #define PPC_LINUX_PT_R0 0 #define PPC_LINUX_PT_R1 1 @@ -755,3 +757,64 @@ _initialize_ppc_linux_tdep (void) ppc_linux_init_abi); add_core_fns (&ppc_linux_regset_core_fns); } + +struct link_map_offsets * + ppc64_linux_svr4_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_debug_size = 16;/* The actual size is xx bytes, but + this is all we need. */ + lmo.r_map_offset = 8; + lmo.r_map_size = 8; + lmo.link_map_size = 40; /* The actual size is xxx bytes, but + this is all we need. */ + lmo.l_addr_offset = 0; + lmo.l_addr_size = 8; + lmo.l_name_offset = 8; + lmo.l_name_size = 8; + lmo.l_next_offset = 24; + lmo.l_next_size = 8; + lmo.l_prev_offset = 32; + lmo.l_prev_size = 8; + } + + return lmp; +} + + +/* Support for CONVERT_FROM_FUNC_PTR_ADDR(ADDR). + Duplicate of RS6000 function, except ppc64_linux requires relocated address. */ +static CORE_ADDR +read_memory_addr (CORE_ADDR memaddr, int len) +{ + return read_memory_unsigned_integer (memaddr, len); +} + + +CORE_ADDR +ppc64_linux_convert_from_func_ptr_addr (CORE_ADDR addr) +{ + long long my_adder; + struct obj_section *s; + CORE_ADDR retval; + extern struct obj_section *find_pc_section(CORE_ADDR); + + /* this should be the base address that the object (containing the func_ptr_addr) is loaded at. */ + my_adder = 0x7fe0000000; + + s = find_pc_section (my_adder + addr); + if (s && s->the_bfd_section->flags & SEC_CODE) + return addr; + + /* ADDR is in the data space, so it's a special function pointer. */ + retval = read_memory_addr (my_adder + addr, TDEP->wordsize); + /* printf("reading 0x%lx ",my_adder+addr); */ + /* printf("ppc64...convert_func_ptr addr:0x%lx new:0x%lx\n",addr,retval); */ + return retval; +} |