From: Mark Kettenis Date: Sun, 15 Jan 2006 18:28:58 +0000 (+0000) Subject: * arm-linux-tdep.c (arm_linux_svr4_fetch_link_map_offsets): X-Git-Tag: gdb-csl-20060226-branchpoint~318 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=76a9d10f5261cea3442e1b9e7239f1eef27959a8;p=external%2Fbinutils.git * arm-linux-tdep.c (arm_linux_svr4_fetch_link_map_offsets): Remove. (arm_linux_init_abi): Set solib_svr4_fetch_link_map_offsets to svr4_ilp32_fetch_link_map_offsets. * cris-tdep.c (cris_linux_svr4_fetch_link_map_offsets): Remove function. (cris_gdbarch_init): Set solib_svr4_fetch_link_map_offsets to svr4_ilp32_fetch_link_map_offsets. * mips-linux-tdep.c (mips_linux_svr4_fetch_link_map_offsets) (mips64_linux_svr4_fetch_link_map_offsets): Remove functions. (mips_linux_init_abi): Set solib_svr4_fetch_link_map_offsets to svr4_ilp32_fetch_link_map_offsets or svr4_lp64_fetch_link_map_offsets where appropriate. * nbsd-tdep.c (nbsd_ilp32_solib_svr4_fetch_link_map_offsets): Simply call svr4_ilp32_fetch_link_map_offsets. (nbsd_lp64_solib_svr4_fetch_link_map_offsets): Simply call svr4_lp64_fetch_link_map_offsets. * ppc-linux-tdep.c (ppc_linux_svr4_fetch_link_map_offsets): Remove function. (ppc_linux_init_abi): Set solib_svr4_fetch_link_map_offsets to svr4_ilp32_fetch_link_map_offsets. * s390-tdep.c (s390_svr4_fetch_link_map_offsets) (s390x_svr4_fetch_link_map_offsets): Remove functions. (s390_gdbarch_init): Set solib_svr4_fetch_link_map_offsets to svr4_ilp32_fetch_link_map_offsets or svr4_lp64_fetch_link_map_offsets where appropriate. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c0a1f38..62efdc0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,34 @@ 2006-01-15 Mark Kettenis + * arm-linux-tdep.c (arm_linux_svr4_fetch_link_map_offsets): + Remove. + (arm_linux_init_abi): Set solib_svr4_fetch_link_map_offsets to + svr4_ilp32_fetch_link_map_offsets. + * cris-tdep.c (cris_linux_svr4_fetch_link_map_offsets): Remove + function. + (cris_gdbarch_init): Set solib_svr4_fetch_link_map_offsets to + svr4_ilp32_fetch_link_map_offsets. + * mips-linux-tdep.c (mips_linux_svr4_fetch_link_map_offsets) + (mips64_linux_svr4_fetch_link_map_offsets): Remove functions. + (mips_linux_init_abi): Set solib_svr4_fetch_link_map_offsets to + svr4_ilp32_fetch_link_map_offsets or svr4_lp64_fetch_link_map_offsets + where appropriate. + * nbsd-tdep.c (nbsd_ilp32_solib_svr4_fetch_link_map_offsets): + Simply call svr4_ilp32_fetch_link_map_offsets. + (nbsd_lp64_solib_svr4_fetch_link_map_offsets): Simply call + svr4_lp64_fetch_link_map_offsets. + * ppc-linux-tdep.c (ppc_linux_svr4_fetch_link_map_offsets): Remove + function. + (ppc_linux_init_abi): Set solib_svr4_fetch_link_map_offsets to + svr4_ilp32_fetch_link_map_offsets. + * s390-tdep.c (s390_svr4_fetch_link_map_offsets) + (s390x_svr4_fetch_link_map_offsets): Remove functions. + (s390_gdbarch_init): Set solib_svr4_fetch_link_map_offsets to + svr4_ilp32_fetch_link_map_offsets or svr4_lp64_fetch_link_map_offsets + where appropriate. + +2006-01-15 Mark Kettenis + * arm-tdep.c (arm_return_value): Change type of readbuf and writebuf arguments to `gdb_byte *'. diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index 93db35b..b8c0d25 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -1,6 +1,6 @@ /* GNU/Linux on ARM target support. - Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 + Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GDB. @@ -212,49 +212,6 @@ arm_linux_extract_return_value (struct type *type, with. Before the fixup/resolver code returns, it actually calls the requested function and repairs &GOT[n+3]. */ -/* Fetch, and possibly build, an appropriate link_map_offsets structure - for ARM linux targets using the struct offsets defined in . - Note, however, that link.h is not actually referred to in this file. - Instead, the relevant structs offsets were obtained from examining - link.h. (We can't refer to link.h from this file because the host - system won't necessarily have it, or if it does, the structs which - it defines will refer to the host system, not the target). */ - -static struct link_map_offsets * -arm_linux_svr4_fetch_link_map_offsets (void) -{ - static struct link_map_offsets lmo; - static struct link_map_offsets *lmp = 0; - - if (lmp == 0) - { - lmp = &lmo; - - lmo.r_debug_size = 8; /* Actual size is 20, but this is all we - need. */ - - lmo.r_map_offset = 4; - lmo.r_map_size = 4; - - lmo.link_map_size = 20; /* Actual size is 552, but this is all we - need. */ - - lmo.l_addr_offset = 0; - lmo.l_addr_size = 4; - - lmo.l_name_offset = 4; - lmo.l_name_size = 4; - - lmo.l_next_offset = 12; - lmo.l_next_size = 4; - - lmo.l_prev_offset = 16; - lmo.l_prev_size = 4; - } - - return lmp; -} - /* The constants below were determined by examining the following files in the linux kernel sources: @@ -391,7 +348,7 @@ arm_linux_init_abi (struct gdbarch_info info, tdep->jb_elt_size = ARM_LINUX_JB_ELEMENT_SIZE; set_solib_svr4_fetch_link_map_offsets - (gdbarch, arm_linux_svr4_fetch_link_map_offsets); + (gdbarch, svr4_ilp32_fetch_link_map_offsets); /* The following override shouldn't be needed. */ set_gdbarch_deprecated_extract_return_value (gdbarch, arm_linux_extract_return_value); diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index 53e9cc8..0664318 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -1,7 +1,7 @@ /* Target dependent code for CRIS, for GDB, the GNU debugger. - Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, - Inc. + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. Contributed by Axis Communications AB. Written by Hendrik Ruijter, Stefan Andersson, and Orjan Friberg. @@ -45,7 +45,7 @@ Boston, MA 02110-1301, USA. */ #include "objfiles.h" #include "solib.h" /* Support for shared libraries. */ -#include "solib-svr4.h" /* For struct link_map_offsets. */ +#include "solib-svr4.h" #include "gdb_string.h" #include "dis-asm.h" @@ -3941,50 +3941,6 @@ static struct core_fns cris_elf_core_fns = NULL /* next */ }; -/* Fetch (and possibly build) an appropriate link_map_offsets - structure for native GNU/Linux CRIS targets using the struct - offsets defined in link.h (but without actual reference to that - file). - - This makes it possible to access GNU/Linux CRIS shared libraries - from a GDB that was not built on an GNU/Linux CRIS host (for cross - debugging). - - See gdb/solib-svr4.h for an explanation of these fields. */ - -static struct link_map_offsets * -cris_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 = 8; /* The actual size is 20 bytes, but - this is all we need. */ - lmo.r_map_offset = 4; - lmo.r_map_size = 4; - - lmo.link_map_size = 20; - - lmo.l_addr_offset = 0; - lmo.l_addr_size = 4; - - lmo.l_name_offset = 4; - lmo.l_name_size = 4; - - lmo.l_next_offset = 12; - lmo.l_next_size = 4; - - lmo.l_prev_offset = 16; - lmo.l_prev_size = 4; - } - - return lmp; -} - extern initialize_file_ftype _initialize_cris_tdep; /* -Wmissing-prototypes */ void @@ -4259,9 +4215,8 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) frame_unwind_append_sniffer (gdbarch, cris_frame_sniffer); frame_base_set_default (gdbarch, &cris_frame_base); - /* Use target_specific function to define link map offsets. */ - set_solib_svr4_fetch_link_map_offsets - (gdbarch, cris_linux_svr4_fetch_link_map_offsets); + set_solib_svr4_fetch_link_map_offsets + (gdbarch, svr4_ilp32_fetch_link_map_offsets); /* FIXME: cagney/2003-08-27: It should be possible to select a CRIS disassembler, even when there is no BFD. Does something like diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c index 9ce4717..021edc7 100644 --- a/gdb/mips-linux-tdep.c +++ b/gdb/mips-linux-tdep.c @@ -1,6 +1,7 @@ /* Target-dependent code for GNU/Linux on MIPS processors. - Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2004, 2005, 2006 + Free Software Foundation, Inc. This file is part of GDB. @@ -280,49 +281,6 @@ mips_linux_register_addr (int regno, CORE_ADDR blockend) return regaddr; } - -/* Fetch (and possibly build) an appropriate link_map_offsets - structure for native GNU/Linux MIPS targets using the struct - offsets defined in link.h (but without actual reference to that - file). - - This makes it possible to access GNU/Linux MIPS shared libraries - from a GDB that was built on a different host platform (for cross - debugging). */ - -static struct link_map_offsets * -mips_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 = 8; /* The actual size is 20 bytes, but - this is all we need. */ - lmo.r_map_offset = 4; - lmo.r_map_size = 4; - - lmo.link_map_size = 20; - - lmo.l_addr_offset = 0; - lmo.l_addr_size = 4; - - lmo.l_name_offset = 4; - lmo.l_name_size = 4; - - lmo.l_next_offset = 12; - lmo.l_next_size = 4; - - lmo.l_prev_offset = 16; - lmo.l_prev_size = 4; - } - - return lmp; -} - /* Support for 64-bit ABIs. */ /* Copied from . */ @@ -632,48 +590,6 @@ static struct core_fns regset_core_fns = NULL /* next */ }; -/* Fetch (and possibly build) an appropriate link_map_offsets - structure for native GNU/Linux MIPS targets using the struct - offsets defined in link.h (but without actual reference to that - file). - - This makes it possible to access GNU/Linux MIPS shared libraries - from a GDB that was built on a different host platform (for cross - debugging). */ - -static struct link_map_offsets * -mips64_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 40 bytes, but - this is all we need. */ - lmo.r_map_offset = 8; - lmo.r_map_size = 8; - - lmo.link_map_size = 40; - - 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; -} - /* Handle for obtaining pointer to the current register_addr() function for a given architecture. */ static struct gdbarch_data *register_addr_data; @@ -1183,7 +1099,7 @@ mips_linux_init_abi (struct gdbarch_info info, set_gdbarch_get_longjmp_target (gdbarch, mips_linux_get_longjmp_target); set_solib_svr4_fetch_link_map_offsets - (gdbarch, mips_linux_svr4_fetch_link_map_offsets); + (gdbarch, svr4_ilp32_fetch_link_map_offsets); set_mips_linux_register_addr (gdbarch, mips_linux_register_addr); tramp_frame_prepend_unwinder (gdbarch, &mips_linux_o32_sigframe); tramp_frame_prepend_unwinder (gdbarch, &mips_linux_o32_rt_sigframe); @@ -1192,7 +1108,7 @@ mips_linux_init_abi (struct gdbarch_info info, set_gdbarch_get_longjmp_target (gdbarch, mips_linux_get_longjmp_target); set_solib_svr4_fetch_link_map_offsets - (gdbarch, mips_linux_svr4_fetch_link_map_offsets); + (gdbarch, svr4_ilp32_fetch_link_map_offsets); set_mips_linux_register_addr (gdbarch, mips64_linux_register_addr); tramp_frame_prepend_unwinder (gdbarch, &mips_linux_n32_rt_sigframe); break; @@ -1200,7 +1116,7 @@ mips_linux_init_abi (struct gdbarch_info info, set_gdbarch_get_longjmp_target (gdbarch, mips64_linux_get_longjmp_target); set_solib_svr4_fetch_link_map_offsets - (gdbarch, mips64_linux_svr4_fetch_link_map_offsets); + (gdbarch, svr4_lp64_fetch_link_map_offsets); set_mips_linux_register_addr (gdbarch, mips64_linux_register_addr); tramp_frame_prepend_unwinder (gdbarch, &mips_linux_n64_rt_sigframe); break; diff --git a/gdb/nbsd-tdep.c b/gdb/nbsd-tdep.c index 5548d40..8894fcb 100644 --- a/gdb/nbsd-tdep.c +++ b/gdb/nbsd-tdep.c @@ -1,5 +1,7 @@ /* Common target-dependent code for NetBSD systems. - Copyright (C) 2002 Free Software Foundation, Inc. + + Copyright (C) 2002, 2006 Free Software Foundation, Inc. + Contributed by Wasabi Systems, Inc. This file is part of GDB. @@ -23,79 +25,19 @@ #include "gdb_string.h" #include "solib-svr4.h" -/* Fetch (and possibly build) an appropriate link_map_offsets - structure for NetBSD targets using the struct offsets defined - in (but without actual reference to that file). - - This makes it possible to access NetBSD shared libraries from a - GDB that was not built on the same platform (for cross debugging). +/* FIXME: kettenis/20060115: We should really eliminate the next two + functions completely. */ - We provide versions for ILP32 and LP64 NetBSD targets here. */ - struct link_map_offsets * nbsd_ilp32_solib_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; - - lmo.r_map_offset = 4; - lmo.r_map_size = 4; - - lmo.link_map_size = 20; - - lmo.l_addr_offset = 0; - lmo.l_addr_size = 4; - - lmo.l_name_offset = 4; - lmo.l_name_size = 4; - - lmo.l_next_offset = 12; - lmo.l_next_size = 4; - - lmo.l_prev_offset = 16; - lmo.l_prev_size = 4; - } - - return lmp; + return svr4_ilp32_fetch_link_map_offsets (); } struct link_map_offsets * nbsd_lp64_solib_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 = 32; - - lmo.r_map_offset = 8; - lmo.r_map_size = 8; - - lmo.link_map_size = 40; - - 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; + return svr4_lp64_fetch_link_map_offsets (); } int diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index d38aa3f..0452084 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -1,7 +1,8 @@ /* Target-dependent code for GDB, the GNU debugger. Copyright (C) 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, - 1997, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + 1997, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + Free Software Foundation, Inc. This file is part of GDB. @@ -500,48 +501,6 @@ ppc_linux_return_value (struct gdbarch *gdbarch, struct type *valtype, writebuf); } -/* 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). */ - -struct link_map_offsets * -ppc_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 = 8; /* The actual size is 20 bytes, but - this is all we need. */ - lmo.r_map_offset = 4; - lmo.r_map_size = 4; - - lmo.link_map_size = 20; /* The actual size is 560 bytes, but - this is all we need. */ - lmo.l_addr_offset = 0; - lmo.l_addr_size = 4; - - lmo.l_name_offset = 4; - lmo.l_name_size = 4; - - lmo.l_next_offset = 12; - lmo.l_next_size = 4; - - lmo.l_prev_offset = 16; - lmo.l_prev_size = 4; - } - - return lmp; -} - - /* Macros for matching instructions. Note that, since all the operands are masked off before they're or-ed into the instruction, you can use -1 to make masks. */ @@ -1093,7 +1052,7 @@ ppc_linux_init_abi (struct gdbarch_info info, set_gdbarch_skip_trampoline_code (gdbarch, ppc_linux_skip_trampoline_code); set_solib_svr4_fetch_link_map_offsets - (gdbarch, ppc_linux_svr4_fetch_link_map_offsets); + (gdbarch, svr4_ilp32_fetch_link_map_offsets); /* Trampolines. */ tramp_frame_prepend_unwinder (gdbarch, &ppc32_linux_sigaction_tramp_frame); diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index b5a92ca..dddef7a 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -43,7 +43,7 @@ #include "value.h" #include "gdb_assert.h" #include "dis-asm.h" -#include "solib-svr4.h" /* For struct link_map_offsets. */ +#include "solib-svr4.h" #include "s390-tdep.h" @@ -2864,76 +2864,6 @@ s390_address_class_name_to_type_flags (struct gdbarch *gdbarch, const char *name return 0; } - -/* Link map offsets. */ - -static struct link_map_offsets * -s390_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 = 8; - - lmo.r_map_offset = 4; - lmo.r_map_size = 4; - - lmo.link_map_size = 20; - - lmo.l_addr_offset = 0; - lmo.l_addr_size = 4; - - lmo.l_name_offset = 4; - lmo.l_name_size = 4; - - lmo.l_next_offset = 12; - lmo.l_next_size = 4; - - lmo.l_prev_offset = 16; - lmo.l_prev_size = 4; - } - - return lmp; -} - -static struct link_map_offsets * -s390x_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; /* All we need. */ - - lmo.r_map_offset = 8; - lmo.r_map_size = 8; - - lmo.link_map_size = 40; /* 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; -} - - /* Set up gdbarch struct. */ static struct gdbarch * @@ -3015,8 +2945,8 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_addr_bits_remove (gdbarch, s390_addr_bits_remove); set_gdbarch_pseudo_register_read (gdbarch, s390_pseudo_register_read); set_gdbarch_pseudo_register_write (gdbarch, s390_pseudo_register_write); - set_solib_svr4_fetch_link_map_offsets (gdbarch, - s390_svr4_fetch_link_map_offsets); + set_solib_svr4_fetch_link_map_offsets + (gdbarch, svr4_ilp32_fetch_link_map_offsets); break; case bfd_mach_s390_64: @@ -3032,8 +2962,8 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_ptr_bit (gdbarch, 64); set_gdbarch_pseudo_register_read (gdbarch, s390x_pseudo_register_read); set_gdbarch_pseudo_register_write (gdbarch, s390x_pseudo_register_write); - set_solib_svr4_fetch_link_map_offsets (gdbarch, - s390x_svr4_fetch_link_map_offsets); + set_solib_svr4_fetch_link_map_offsets + (gdbarch, svr4_lp64_fetch_link_map_offsets); set_gdbarch_address_class_type_flags (gdbarch, s390_address_class_type_flags); set_gdbarch_address_class_type_flags_to_name (gdbarch,