From 203c3895a5003367e77494ca9428446417fce1bc Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Fri, 19 Oct 2007 12:26:35 +0000 Subject: [PATCH] * gdbarch.sh (sofun_address_maybe_missing): New gdbarch variable. * gdbarch.c, gdbarch.h: Regenerate. * dbxread.c (find_stab_function_addr): Define unconditionally. (read_dbx_symtab): Use gdbarch_sofun_address_maybe_missing instead of SOFUN_ADDRESS_MAYBE_MISSING. (end_psymtab): Likewise. (process_one_symbol): Likewise. * mdebugread.c (parse_partial_symbols): Likewise. * symtab.h (struct minimal_symbol): Always define "filename" member. * elfread.c (elf_symtab_read): Use msym->filename unconditionally. * minsyms.c (lookup_minimal_symbol): Likewise. * symmisc.c (dump_msymbols): Likewise. * config/i386/i386sol2.mt (DEPRECATED_TM_FILE): Remove. * config/i386/linux.mt (DEPRECATED_TM_FILE): Remove. * config/i386/tm-i386sol2.h: Remove file. * config/i386/tm-linux.h: Remove file. * i386-linux-tdep.c (i386_linux_init_abi): Add call to set_gdbarch_sofun_address_maybe_missing. * i386-sol2-tdep.c (i386_sol2_init_abi): Likewise. * config/powerpc/linux.mt (DEPRECATED_TM_FILE): Remove. * config/powerpc/nbsd.mt (DEPRECATED_TM_FILE): Remove. * config/powerpc/obsd.mt (DEPRECATED_TM_FILE): Remove. * config/powerpc/ppc-eabi.mt (DEPRECATED_TM_FILE): Remove. * config/powerpc/ppc-sim.mt (DEPRECATED_TM_FILE): Remove. * config/powerpc/tm-ppc-eabi.h: Remove file. * rs6000-tdep.c (rs6000_gdbarch_init): Add call to set_gdbarch_sofun_address_maybe_missing. * config/sparc/sol2-64.mt (DEPRECATED_TM_FILE): Remove. * config/sparc/sol2.mt (DEPRECATED_TM_FILE): Remove. * config/sparc/tm-sol2.h: Remove file. * sparc64-sol2-tdep.c (sparc64_sol2_init_abi): Add call to set_gdbarch_sofun_address_maybe_missing. * sparc-sol2-tdep.c (sparc32_sol2_init_abi): Likewise. doc/ChangeLog: * gdbarch.texi (Target Conditionals): Remove documentation of SOFUN_ADDRESS_MAYBE_MISSING, replaced by ... (Compiler Characteristics): ... documentation of set_gdbarch_sofun_address_maybe_missing. --- gdb/ChangeLog | 40 +++++++++++++++++++++++++ gdb/config/i386/i386sol2.mt | 1 - gdb/config/i386/linux.mt | 1 - gdb/config/i386/tm-i386sol2.h | 27 ----------------- gdb/config/i386/tm-linux.h | 28 ------------------ gdb/config/powerpc/linux.mt | 1 - gdb/config/powerpc/nbsd.mt | 1 - gdb/config/powerpc/obsd.mt | 1 - gdb/config/powerpc/ppc-eabi.mt | 1 - gdb/config/powerpc/ppc-sim.mt | 1 - gdb/config/powerpc/tm-ppc-eabi.h | 27 ----------------- gdb/config/sparc/sol2-64.mt | 1 - gdb/config/sparc/sol2.mt | 1 - gdb/config/sparc/tm-sol2.h | 29 ------------------ gdb/dbxread.c | 44 ++++++++++++--------------- gdb/doc/ChangeLog | 7 +++++ gdb/doc/gdbint.texinfo | 64 ++++++++++++++++++++-------------------- gdb/elfread.c | 8 ----- gdb/gdbarch.c | 23 +++++++++++++++ gdb/gdbarch.h | 5 ++++ gdb/gdbarch.sh | 2 ++ gdb/i386-linux-tdep.c | 4 +++ gdb/i386-sol2-tdep.c | 4 +++ gdb/mdebugread.c | 15 +++++----- gdb/minsyms.c | 11 ------- gdb/rs6000-tdep.c | 4 +++ gdb/sparc-sol2-tdep.c | 5 ++++ gdb/sparc64-sol2-tdep.c | 5 ++++ gdb/symmisc.c | 2 -- gdb/symtab.h | 2 -- 30 files changed, 157 insertions(+), 208 deletions(-) delete mode 100644 gdb/config/i386/tm-i386sol2.h delete mode 100644 gdb/config/i386/tm-linux.h delete mode 100644 gdb/config/powerpc/tm-ppc-eabi.h delete mode 100644 gdb/config/sparc/tm-sol2.h diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 69491a2..1081ea7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,45 @@ 2007-10-19 Ulrich Weigand + * gdbarch.sh (sofun_address_maybe_missing): New gdbarch variable. + * gdbarch.c, gdbarch.h: Regenerate. + * dbxread.c (find_stab_function_addr): Define unconditionally. + (read_dbx_symtab): Use gdbarch_sofun_address_maybe_missing + instead of SOFUN_ADDRESS_MAYBE_MISSING. + (end_psymtab): Likewise. + (process_one_symbol): Likewise. + * mdebugread.c (parse_partial_symbols): Likewise. + + * symtab.h (struct minimal_symbol): Always define "filename" member. + * elfread.c (elf_symtab_read): Use msym->filename unconditionally. + * minsyms.c (lookup_minimal_symbol): Likewise. + * symmisc.c (dump_msymbols): Likewise. + + * config/i386/i386sol2.mt (DEPRECATED_TM_FILE): Remove. + * config/i386/linux.mt (DEPRECATED_TM_FILE): Remove. + * config/i386/tm-i386sol2.h: Remove file. + * config/i386/tm-linux.h: Remove file. + * i386-linux-tdep.c (i386_linux_init_abi): Add call to + set_gdbarch_sofun_address_maybe_missing. + * i386-sol2-tdep.c (i386_sol2_init_abi): Likewise. + + * config/powerpc/linux.mt (DEPRECATED_TM_FILE): Remove. + * config/powerpc/nbsd.mt (DEPRECATED_TM_FILE): Remove. + * config/powerpc/obsd.mt (DEPRECATED_TM_FILE): Remove. + * config/powerpc/ppc-eabi.mt (DEPRECATED_TM_FILE): Remove. + * config/powerpc/ppc-sim.mt (DEPRECATED_TM_FILE): Remove. + * config/powerpc/tm-ppc-eabi.h: Remove file. + * rs6000-tdep.c (rs6000_gdbarch_init): Add call to + set_gdbarch_sofun_address_maybe_missing. + + * config/sparc/sol2-64.mt (DEPRECATED_TM_FILE): Remove. + * config/sparc/sol2.mt (DEPRECATED_TM_FILE): Remove. + * config/sparc/tm-sol2.h: Remove file. + * sparc64-sol2-tdep.c (sparc64_sol2_init_abi): Add call to + set_gdbarch_sofun_address_maybe_missing. + * sparc-sol2-tdep.c (sparc32_sol2_init_abi): Likewise. + +2007-10-19 Ulrich Weigand + * gdbarch.sh (static_transform_name): New gdbarch callback. * gdbarch.c, gdbarch.h: Regenerate. * dbxread.c (read_dbx_symtab): Use gdbarch_static_transform_name diff --git a/gdb/config/i386/i386sol2.mt b/gdb/config/i386/i386sol2.mt index 30360d2..8e24723 100644 --- a/gdb/config/i386/i386sol2.mt +++ b/gdb/config/i386/i386sol2.mt @@ -1,4 +1,3 @@ # Target: Solaris x86 TDEPFILES= i386-tdep.o i387-tdep.o i386-sol2-tdep.o sol2-tdep.o \ corelow.o solib.o solib-svr4.o -DEPRECATED_TM_FILE= tm-i386sol2.h diff --git a/gdb/config/i386/linux.mt b/gdb/config/i386/linux.mt index 2874f0c..17eeab1 100644 --- a/gdb/config/i386/linux.mt +++ b/gdb/config/i386/linux.mt @@ -1,4 +1,3 @@ # Target: Intel 386 running GNU/Linux TDEPFILES= i386-tdep.o i386-linux-tdep.o glibc-tdep.o i387-tdep.o \ solib.o solib-svr4.o symfile-mem.o corelow.o -DEPRECATED_TM_FILE= tm-linux.h diff --git a/gdb/config/i386/tm-i386sol2.h b/gdb/config/i386/tm-i386sol2.h deleted file mode 100644 index 02f299d..0000000 --- a/gdb/config/i386/tm-i386sol2.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Macro definitions for GDB on an Intel i386 running Solaris 2. - - Copyright 1998, 1999, 2000, 2004, 2007 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 TM_I386SOL2_H -#define TM_I386SOL2_H 1 - -/* The SunPRO compiler puts out 0 instead of the address in N_SO symbols, - and for SunPRO 3.0, N_FUN symbols too. */ -#define SOFUN_ADDRESS_MAYBE_MISSING - -#endif /* tm-i386sol2.h */ diff --git a/gdb/config/i386/tm-linux.h b/gdb/config/i386/tm-linux.h deleted file mode 100644 index 6ba682a..0000000 --- a/gdb/config/i386/tm-linux.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Definitions to target GDB to GNU/Linux on 386. - - Copyright 1992, 1993, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2004, 2007 - 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 TM_LINUX_H -#define TM_LINUX_H - -/* N_FUN symbols in shared libaries have 0 for their values and need - to be relocated. */ -#define SOFUN_ADDRESS_MAYBE_MISSING - -#endif /* #ifndef TM_LINUX_H */ diff --git a/gdb/config/powerpc/linux.mt b/gdb/config/powerpc/linux.mt index 752a937..846f8c3 100644 --- a/gdb/config/powerpc/linux.mt +++ b/gdb/config/powerpc/linux.mt @@ -1,7 +1,6 @@ # Target: Motorola PPC on Linux TDEPFILES= rs6000-tdep.o ppc-linux-tdep.o ppc-sysv-tdep.o solib.o \ solib-svr4.o solib-legacy.o corelow.o symfile-mem.o -DEPRECATED_TM_FILE= tm-ppc-eabi.h SIM_OBS = remote-sim.o SIM = ../sim/ppc/libsim.a diff --git a/gdb/config/powerpc/nbsd.mt b/gdb/config/powerpc/nbsd.mt index 8cdd39d..6aa2970 100644 --- a/gdb/config/powerpc/nbsd.mt +++ b/gdb/config/powerpc/nbsd.mt @@ -1,7 +1,6 @@ # Target: NetBSD/powerpc TDEPFILES= rs6000-tdep.o ppc-sysv-tdep.o ppcnbsd-tdep.o \ corelow.o solib.o solib-svr4.o -DEPRECATED_TM_FILE= tm-ppc-eabi.h SIM_OBS = remote-sim.o SIM = ../sim/ppc/libsim.a diff --git a/gdb/config/powerpc/obsd.mt b/gdb/config/powerpc/obsd.mt index fbe61d4..58640f2 100644 --- a/gdb/config/powerpc/obsd.mt +++ b/gdb/config/powerpc/obsd.mt @@ -1,4 +1,3 @@ # Target: OpenBSD/powerpc TDEPFILES= rs6000-tdep.o ppc-sysv-tdep.o ppcobsd-tdep.o \ corelow.o solib.o solib-svr4.o -DEPRECATED_TM_FILE= tm-ppc-eabi.h diff --git a/gdb/config/powerpc/ppc-eabi.mt b/gdb/config/powerpc/ppc-eabi.mt index 25f8cba..85de062 100644 --- a/gdb/config/powerpc/ppc-eabi.mt +++ b/gdb/config/powerpc/ppc-eabi.mt @@ -1,3 +1,2 @@ # Target: PowerPC running eabi TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o dink32-rom.o ppc-sysv-tdep.o solib.o solib-svr4.o -DEPRECATED_TM_FILE= tm-ppc-eabi.h diff --git a/gdb/config/powerpc/ppc-sim.mt b/gdb/config/powerpc/ppc-sim.mt index e78a64d..c331345 100644 --- a/gdb/config/powerpc/ppc-sim.mt +++ b/gdb/config/powerpc/ppc-sim.mt @@ -1,6 +1,5 @@ # Target: PowerPC running eabi and including the simulator TDEPFILES= rs6000-tdep.o monitor.o dsrec.o ppcbug-rom.o dink32-rom.o ppc-sysv-tdep.o solib.o solib-svr4.o -DEPRECATED_TM_FILE= tm-ppc-eabi.h SIM_OBS = remote-sim.o SIM = ../sim/ppc/libsim.a diff --git a/gdb/config/powerpc/tm-ppc-eabi.h b/gdb/config/powerpc/tm-ppc-eabi.h deleted file mode 100644 index 214b010..0000000 --- a/gdb/config/powerpc/tm-ppc-eabi.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Macro definitions for Power PC running embedded ABI. - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2007 - 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 TM_PPC_EABI_H -#define TM_PPC_EABI_H - -/* The value of symbols of type N_SO and N_FUN maybe null when - it shouldn't be. */ -#define SOFUN_ADDRESS_MAYBE_MISSING - -#endif /* TM_PPC_EABI_H */ diff --git a/gdb/config/sparc/sol2-64.mt b/gdb/config/sparc/sol2-64.mt index ced0d2c..d5fa1ef 100644 --- a/gdb/config/sparc/sol2-64.mt +++ b/gdb/config/sparc/sol2-64.mt @@ -1,4 +1,3 @@ # Target: Solaris UltraSPARC TDEPFILES= sparc64-tdep.o sparc64-sol2-tdep.o sparc-tdep.o sparc-sol2-tdep.o \ sol2-tdep.o solib.o solib-svr4.o -DEPRECATED_TM_FILE= tm-sol2.h diff --git a/gdb/config/sparc/sol2.mt b/gdb/config/sparc/sol2.mt index b6cd168..4382c50 100644 --- a/gdb/config/sparc/sol2.mt +++ b/gdb/config/sparc/sol2.mt @@ -1,3 +1,2 @@ # Target: Solaris SPARC TDEPFILES= sparc-tdep.o sparc-sol2-tdep.o sol2-tdep.o solib.o solib-svr4.o -DEPRECATED_TM_FILE= tm-sol2.h diff --git a/gdb/config/sparc/tm-sol2.h b/gdb/config/sparc/tm-sol2.h deleted file mode 100644 index 28746af..0000000 --- a/gdb/config/sparc/tm-sol2.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Target-dependent definitions for Solaris SPARC. - - Copyright 2003, 2004, 2007 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 TM_SOL2_H -#define TM_SOL2_H - -/* The Sun compilers (Sun ONE Studio, Forte Developer, Sun WorkShop, - SunPRO) compiler puts out 0 instead of the address in N_SO stabs. - Starting with SunPRO 3.0, the compiler does this for N_FUN stabs - too. */ -#define SOFUN_ADDRESS_MAYBE_MISSING - -#endif /* tm-sol2.h */ diff --git a/gdb/dbxread.c b/gdb/dbxread.c index a51fe9d..d94922e 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -1116,7 +1116,6 @@ read_dbx_dynamic_symtab (struct objfile *objfile) do_cleanups (back_to); } -#ifdef SOFUN_ADDRESS_MAYBE_MISSING static CORE_ADDR find_stab_function_addr (char *namestring, char *filename, struct objfile *objfile) @@ -1160,7 +1159,6 @@ find_stab_function_addr (char *namestring, char *filename, return msym == NULL ? 0 : SYMBOL_VALUE_ADDRESS (msym); } -#endif /* SOFUN_ADDRESS_MAYBE_MISSING */ static void function_outside_compilation_unit_complaint (const char *arg1) @@ -1463,21 +1461,19 @@ read_dbx_symtab (struct objfile *objfile) prev_textlow_not_set = textlow_not_set; -#ifdef SOFUN_ADDRESS_MAYBE_MISSING /* A zero value is probably an indication for the SunPRO 3.0 compiler. end_psymtab explicitly tests for zero, so don't relocate it. */ - if (nlist.n_value == 0) + if (nlist.n_value == 0 + && gdbarch_sofun_address_maybe_missing (current_gdbarch)) { textlow_not_set = 1; valu = 0; } else textlow_not_set = 0; -#else - textlow_not_set = 0; -#endif + past_first_source_file = 1; if (prev_so_symnum != symnum - 1) @@ -1832,11 +1828,11 @@ read_dbx_symtab (struct objfile *objfile) SECT_OFF_TEXT (objfile)); /* Kludges for ELF/STABS with Sun ACC */ last_function_name = namestring; -#ifdef SOFUN_ADDRESS_MAYBE_MISSING /* Do not fix textlow==0 for .o or NLM files, as 0 is a legit value for the bottom of the text seg in those cases. */ if (nlist.n_value == ANOFFSET (objfile->section_offsets, - SECT_OFF_TEXT (objfile))) + SECT_OFF_TEXT (objfile)) + && gdbarch_sofun_address_maybe_missing (current_gdbarch)) { CORE_ADDR minsym_valu = find_stab_function_addr (namestring, @@ -1850,12 +1846,12 @@ read_dbx_symtab (struct objfile *objfile) if (minsym_valu != 0) nlist.n_value = minsym_valu; } - if (pst && textlow_not_set) + if (pst && textlow_not_set + && gdbarch_sofun_address_maybe_missing (current_gdbarch)) { pst->textlow = nlist.n_value; textlow_not_set = 0; } -#endif /* End kludge. */ /* Keep track of the start of the last function so we @@ -1900,11 +1896,11 @@ read_dbx_symtab (struct objfile *objfile) SECT_OFF_TEXT (objfile)); /* Kludges for ELF/STABS with Sun ACC */ last_function_name = namestring; -#ifdef SOFUN_ADDRESS_MAYBE_MISSING /* Do not fix textlow==0 for .o or NLM files, as 0 is a legit value for the bottom of the text seg in those cases. */ if (nlist.n_value == ANOFFSET (objfile->section_offsets, - SECT_OFF_TEXT (objfile))) + SECT_OFF_TEXT (objfile)) + && gdbarch_sofun_address_maybe_missing (current_gdbarch)) { CORE_ADDR minsym_valu = find_stab_function_addr (namestring, @@ -1918,12 +1914,12 @@ read_dbx_symtab (struct objfile *objfile) if (minsym_valu != 0) nlist.n_value = minsym_valu; } - if (pst && textlow_not_set) + if (pst && textlow_not_set + && gdbarch_sofun_address_maybe_missing (current_gdbarch)) { pst->textlow = nlist.n_value; textlow_not_set = 0; } -#endif /* End kludge. */ /* Keep track of the start of the last function so we @@ -2049,12 +2045,11 @@ read_dbx_symtab (struct objfile *objfile) continue; case N_ENDM: -#ifdef SOFUN_ADDRESS_MAYBE_MISSING /* Solaris 2 end of module, finish current partial symbol table. end_psymtab will set pst->texthigh to the proper value, which is necessary if a module compiled without debugging info follows this module. */ - if (pst) + if (pst && gdbarch_sofun_address_maybe_missing (current_gdbarch)) { end_psymtab (pst, psymtab_include_list, includes_used, symnum * symbol_size, @@ -2064,7 +2059,6 @@ read_dbx_symtab (struct objfile *objfile) includes_used = 0; dependencies_used = 0; } -#endif continue; case N_RBRAC: @@ -2186,7 +2180,6 @@ end_psymtab (struct partial_symtab *pst, char **include_list, int num_includes, LDSYMLEN (pst) = capping_symbol_offset - LDSYMOFF (pst); pst->texthigh = capping_text; -#ifdef SOFUN_ADDRESS_MAYBE_MISSING /* Under Solaris, the N_SO symbols always have a value of 0, instead of the usual address of the .o file. Therefore, we have to do some tricks to fill in texthigh and textlow. @@ -2202,7 +2195,8 @@ end_psymtab (struct partial_symtab *pst, char **include_list, int num_includes, a reliable texthigh by taking the address plus size of the last function in the file. */ - if (pst->texthigh == 0 && last_function_name) + if (pst->texthigh == 0 && last_function_name + && gdbarch_sofun_address_maybe_missing (current_gdbarch)) { char *p; int n; @@ -2233,8 +2227,10 @@ end_psymtab (struct partial_symtab *pst, char **include_list, int num_includes, last_function_name = NULL; } + if (!gdbarch_sofun_address_maybe_missing (current_gdbarch)) + ; /* this test will be true if the last .o file is only data */ - if (textlow_not_set) + else if (textlow_not_set) pst->textlow = pst->texthigh; else { @@ -2259,7 +2255,6 @@ end_psymtab (struct partial_symtab *pst, char **include_list, int num_includes, } /* End of kludge for patching Solaris textlow and texthigh. */ -#endif /* SOFUN_ADDRESS_MAYBE_MISSING. */ pst->n_global_syms = objfile->global_psymbols.next - (objfile->global_psymbols.list + pst->globals_offset); @@ -3081,12 +3076,12 @@ no enclosing block")); case 'F': function_stab_type = type; -#ifdef SOFUN_ADDRESS_MAYBE_MISSING /* Deal with the SunPRO 3.0 compiler which omits the address from N_FUN symbols. */ if (type == N_FUN && valu == ANOFFSET (section_offsets, - SECT_OFF_TEXT (objfile))) + SECT_OFF_TEXT (objfile)) + && gdbarch_sofun_address_maybe_missing (current_gdbarch)) { CORE_ADDR minsym_valu = find_stab_function_addr (name, last_source_file, objfile); @@ -3100,7 +3095,6 @@ no enclosing block")); if (minsym_valu != 0) valu = minsym_valu; } -#endif if (block_address_function_relative) /* For Solaris 2 compilers, the block addresses and diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index daa3f2e..a209e28 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,10 @@ +2007-10-19 Ulrich Weigand + + * gdbarch.texi (Target Conditionals): Remove documentation of + SOFUN_ADDRESS_MAYBE_MISSING, replaced by ... + (Compiler Characteristics): ... documentation of + set_gdbarch_sofun_address_maybe_missing. + 2007-10-17 Daniel Jacobowitz * gdbint.texinfo (Target Conditionals): Use diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index 7c9b519..24e9e4f 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -3264,6 +3264,38 @@ See @file{mips-tdep.c}. It does not do what you want. @node Compiler Characteristics @section Compiler Characteristics +@item set_gdbarch_sofun_address_maybe_missing (@var{gdbarch}, @var{set}) +@findex set_gdbarch_sofun_address_maybe_missing +Somebody clever observed that, the more actual addresses you have in the +debug information, the more time the linker has to spend relocating +them. So whenever there's some other way the debugger could find the +address it needs, you should omit it from the debug info, to make +linking faster. + +Calling @code{set_gdbarch_sofun_address_maybe_missing} with a non-zero +argument @var{set} indicates that a particular set of hacks of this sort +are in use, affecting @code{N_SO} and @code{N_FUN} entries in stabs-format +debugging information. @code{N_SO} stabs mark the beginning and ending +addresses of compilation units in the text segment. @code{N_FUN} stabs +mark the starts and ends of functions. + +In this case, @value{GDBN} assumes two things: + +@itemize @bullet +@item +@code{N_FUN} stabs have an address of zero. Instead of using those +addresses, you should find the address where the function starts by +taking the function name from the stab, and then looking that up in the +minsyms (the linker/assembler symbol table). In other words, the stab +has the name, and the linker/assembler symbol table is the only place +that carries the address. + +@item +@code{N_SO} stabs have an address of zero, too. You just look at the +@code{N_FUN} stabs that appear before and after the @code{N_SO} stab, and +guess the starting and ending addresses of the compilation unit from them. +@end itemize + @node Target Conditionals @section Target Conditionals @@ -3825,38 +3857,6 @@ A function that inserts or removes (depending on the next instruction. See @file{sparc-tdep.c} and @file{rs6000-tdep.c} for examples. -@item SOFUN_ADDRESS_MAYBE_MISSING -@findex SOFUN_ADDRESS_MAYBE_MISSING -Somebody clever observed that, the more actual addresses you have in the -debug information, the more time the linker has to spend relocating -them. So whenever there's some other way the debugger could find the -address it needs, you should omit it from the debug info, to make -linking faster. - -@code{SOFUN_ADDRESS_MAYBE_MISSING} indicates that a particular set of -hacks of this sort are in use, affecting @code{N_SO} and @code{N_FUN} -entries in stabs-format debugging information. @code{N_SO} stabs mark -the beginning and ending addresses of compilation units in the text -segment. @code{N_FUN} stabs mark the starts and ends of functions. - -@code{SOFUN_ADDRESS_MAYBE_MISSING} means two things: - -@itemize @bullet -@item -@code{N_FUN} stabs have an address of zero. Instead, you should find the -addresses where the function starts by taking the function name from -the stab, and then looking that up in the minsyms (the -linker/assembler symbol table). In other words, the stab has the -name, and the linker/assembler symbol table is the only place that carries -the address. - -@item -@code{N_SO} stabs have an address of zero, too. You just look at the -@code{N_FUN} stabs that appear before and after the @code{N_SO} stab, -and guess the starting and ending addresses of the compilation unit from -them. -@end itemize - @item int gdbarch_pc_regnum (@var{gdbarch}) @findex gdbarch_pc_regnum If the program counter is kept in a register, then let this function return diff --git a/gdb/elfread.c b/gdb/elfread.c index 9e3ed6c..7b317b8 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -213,10 +213,8 @@ elf_symtab_read (struct objfile *objfile, int dynamic, /* If filesym is nonzero, it points to a file symbol, but we haven't seen any section info for it yet. */ asymbol *filesym = 0; -#ifdef SOFUN_ADDRESS_MAYBE_MISSING /* Name of filesym, as saved on the objfile_obstack. */ char *filesymname = obsavestring ("", 0, &objfile->objfile_obstack); -#endif struct dbx_symfile_info *dbx = objfile->deprecated_sym_stab_info; int stripped = (bfd_get_symcount (objfile->obfd) == 0); @@ -258,10 +256,8 @@ elf_symtab_read (struct objfile *objfile, int dynamic, msym = record_minimal_symbol ((char *) sym->name, symaddr, mst_solib_trampoline, sym->section, objfile); -#ifdef SOFUN_ADDRESS_MAYBE_MISSING if (msym != NULL) msym->filename = filesymname; -#endif continue; } @@ -281,11 +277,9 @@ elf_symtab_read (struct objfile *objfile, int dynamic, sectinfo = NULL; } filesym = sym; -#ifdef SOFUN_ADDRESS_MAYBE_MISSING filesymname = obsavestring ((char *) filesym->name, strlen (filesym->name), &objfile->objfile_obstack); -#endif } else if (sym->flags & BSF_SECTION_SYM) continue; @@ -476,10 +470,8 @@ elf_symtab_read (struct objfile *objfile, int dynamic, unsigned long size = ((elf_symbol_type *) sym)->internal_elf_sym.st_size; MSYMBOL_SIZE(msym) = size; } -#ifdef SOFUN_ADDRESS_MAYBE_MISSING if (msym != NULL) msym->filename = filesymname; -#endif gdbarch_elf_make_msymbol_special (current_gdbarch, sym, msym); } } diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 818e055..4759236 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -228,6 +228,7 @@ struct gdbarch gdbarch_overlay_update_ftype *overlay_update; gdbarch_core_read_description_ftype *core_read_description; gdbarch_static_transform_name_ftype *static_transform_name; + int sofun_address_maybe_missing; }; @@ -348,6 +349,7 @@ struct gdbarch startup_gdbarch = 0, /* overlay_update */ 0, /* core_read_description */ 0, /* static_transform_name */ + 0, /* sofun_address_maybe_missing */ /* startup_gdbarch() */ }; @@ -593,6 +595,7 @@ verify_gdbarch (struct gdbarch *current_gdbarch) /* Skip verify of overlay_update, has predicate */ /* Skip verify of core_read_description, has predicate */ /* Skip verify of static_transform_name, has predicate */ + /* Skip verify of sofun_address_maybe_missing, invalid_p == 0 */ buf = ui_file_xstrdup (log, &dummy); make_cleanup (xfree, buf); if (strlen (buf) > 0) @@ -978,6 +981,9 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) "gdbarch_dump: software_single_step = <0x%lx>\n", (long) current_gdbarch->software_single_step); fprintf_unfiltered (file, + "gdbarch_dump: sofun_address_maybe_missing = %s\n", + paddr_d (current_gdbarch->sofun_address_maybe_missing)); + fprintf_unfiltered (file, "gdbarch_dump: sp_regnum = %s\n", paddr_d (current_gdbarch->sp_regnum)); fprintf_unfiltered (file, @@ -2964,6 +2970,23 @@ set_gdbarch_static_transform_name (struct gdbarch *gdbarch, gdbarch->static_transform_name = static_transform_name; } +int +gdbarch_sofun_address_maybe_missing (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Skip verify of sofun_address_maybe_missing, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_sofun_address_maybe_missing called\n"); + return gdbarch->sofun_address_maybe_missing; +} + +void +set_gdbarch_sofun_address_maybe_missing (struct gdbarch *gdbarch, + int sofun_address_maybe_missing) +{ + gdbarch->sofun_address_maybe_missing = sofun_address_maybe_missing; +} + /* Keep a registry of per-architecture data-pointers required by GDB modules. */ diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 412e74f..f207a50 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -672,6 +672,11 @@ typedef char * (gdbarch_static_transform_name_ftype) (char *name); extern char * gdbarch_static_transform_name (struct gdbarch *gdbarch, char *name); extern void set_gdbarch_static_transform_name (struct gdbarch *gdbarch, gdbarch_static_transform_name_ftype *static_transform_name); +/* Set if the address in N_SO or N_FUN stabs may be zero. */ + +extern int gdbarch_sofun_address_maybe_missing (struct gdbarch *gdbarch); +extern void set_gdbarch_sofun_address_maybe_missing (struct gdbarch *gdbarch, int sofun_address_maybe_missing); + extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 965bd9b..bcf9f77 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -641,6 +641,8 @@ M::const struct target_desc *:core_read_description:struct target_ops *target, b # Handle special encoding of static variables in stabs debug info. F::char *:static_transform_name:char *name:name +# Set if the address in N_SO or N_FUN stabs may be zero. +v::int:sofun_address_maybe_missing:::0:0::0 EOF } diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index 296a35d..aacc74c 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -429,6 +429,10 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) tdep->sc_reg_offset = i386_linux_sc_reg_offset; tdep->sc_num_regs = ARRAY_SIZE (i386_linux_sc_reg_offset); + /* N_FUN symbols in shared libaries have 0 for their values and need + to be relocated. */ + set_gdbarch_sofun_address_maybe_missing (gdbarch, 1); + /* GNU/Linux uses SVR4-style shared libraries. */ set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target); set_solib_svr4_fetch_link_map_offsets diff --git a/gdb/i386-sol2-tdep.c b/gdb/i386-sol2-tdep.c index 586ca96..38d6414 100644 --- a/gdb/i386-sol2-tdep.c +++ b/gdb/i386-sol2-tdep.c @@ -109,6 +109,10 @@ i386_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) /* Solaris is SVR4-based. */ i386_svr4_init_abi (info, gdbarch); + /* The SunPRO compiler puts out 0 instead of the address in N_SO symbols, + and for SunPRO 3.0, N_FUN symbols too. */ + set_gdbarch_sofun_address_maybe_missing (gdbarch, 1); + /* Handle SunPRO encoding of static symbols. */ set_gdbarch_static_transform_name (gdbarch, i386_sol2_static_transform_name); diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 3797287..07f9846 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -2844,21 +2844,20 @@ parse_partial_symbols (struct objfile *objfile) prev_textlow_not_set = textlow_not_set; -#ifdef SOFUN_ADDRESS_MAYBE_MISSING /* A zero value is probably an indication for the SunPRO 3.0 compiler. end_psymtab explicitly tests for zero, so don't relocate it. */ - if (sh.value == 0) + if (sh.value == 0 + && gdbarch_sofun_address_maybe_missing + (current_gdbarch)) { textlow_not_set = 1; valu = 0; } else textlow_not_set = 0; -#else - textlow_not_set = 0; -#endif + past_first_source_file = 1; if (prev_so_symnum != symnum - 1) @@ -3225,19 +3224,19 @@ parse_partial_symbols (struct objfile *objfile) continue; case N_ENDM: -#ifdef SOFUN_ADDRESS_MAYBE_MISSING /* Solaris 2 end of module, finish current partial symbol table. END_PSYMTAB will set pst->texthigh to the proper value, which is necessary if a module compiled without debugging info follows this module. */ - if (pst) + if (pst + && gdbarch_sofun_address_maybe_missing + (current_gdbarch)) { pst = (struct partial_symtab *) 0; includes_used = 0; dependencies_used = 0; } -#endif continue; case N_RBRAC: diff --git a/gdb/minsyms.c b/gdb/minsyms.c index 0798426..4850797 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -165,14 +165,12 @@ lookup_minimal_symbol (const char *name, const char *sfile, unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE; unsigned int dem_hash = msymbol_hash_iw (name) % MINIMAL_SYMBOL_HASH_SIZE; -#ifdef SOFUN_ADDRESS_MAYBE_MISSING if (sfile != NULL) { char *p = strrchr (sfile, '/'); if (p != NULL) sfile = p + 1; } -#endif for (objfile = object_files; objfile != NULL && found_symbol == NULL; @@ -209,18 +207,9 @@ lookup_minimal_symbol (const char *name, const char *sfile, case mst_file_text: case mst_file_data: case mst_file_bss: -#ifdef SOFUN_ADDRESS_MAYBE_MISSING if (sfile == NULL || strcmp (msymbol->filename, sfile) == 0) found_file_symbol = msymbol; -#else - /* We have neither the ability nor the need to - deal with the SFILE parameter. If we find - more than one symbol, just return the latest - one (the user can't expect useful behavior in - that case). */ - found_file_symbol = msymbol; -#endif break; case mst_solib_trampoline: diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 379272a..48c8e4c 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -3371,6 +3371,10 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) set_gdbarch_inner_than (gdbarch, core_addr_lessthan); set_gdbarch_breakpoint_from_pc (gdbarch, rs6000_breakpoint_from_pc); + /* The value of symbols of type N_SO and N_FUN maybe null when + it shouldn't be. */ + set_gdbarch_sofun_address_maybe_missing (gdbarch, 1); + /* Handles single stepping of atomic sequences. */ set_gdbarch_software_single_step (gdbarch, deal_with_atomic_sequence); diff --git a/gdb/sparc-sol2-tdep.c b/gdb/sparc-sol2-tdep.c index bb04fd5..50434f6 100644 --- a/gdb/sparc-sol2-tdep.c +++ b/gdb/sparc-sol2-tdep.c @@ -206,6 +206,11 @@ sparc32_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + /* The Sun compilers (Sun ONE Studio, Forte Developer, Sun WorkShop, SunPRO) + compiler puts out 0 instead of the address in N_SO stabs. Starting with + SunPRO 3.0, the compiler does this for N_FUN stabs too. */ + set_gdbarch_sofun_address_maybe_missing (gdbarch, 1); + /* The Sun compilers also do "globalization"; see the comment in sparc_sol2_static_transform_name for more information. */ set_gdbarch_static_transform_name diff --git a/gdb/sparc64-sol2-tdep.c b/gdb/sparc64-sol2-tdep.c index 5411b9bd..ab9a461 100644 --- a/gdb/sparc64-sol2-tdep.c +++ b/gdb/sparc64-sol2-tdep.c @@ -157,6 +157,11 @@ sparc64_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) sparc64_init_abi (info, gdbarch); + /* The Sun compilers (Sun ONE Studio, Forte Developer, Sun WorkShop, SunPRO) + compiler puts out 0 instead of the address in N_SO stabs. Starting with + SunPRO 3.0, the compiler does this for N_FUN stabs too. */ + set_gdbarch_sofun_address_maybe_missing (gdbarch, 1); + /* The Sun compilers also do "globalization"; see the comment in sparc_sol2_static_transform_name for more information. */ set_gdbarch_static_transform_name diff --git a/gdb/symmisc.c b/gdb/symmisc.c index c49ab1f..f5fe4ab 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -356,10 +356,8 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile) { fprintf_filtered (outfile, " %s", SYMBOL_DEMANGLED_NAME (msymbol)); } -#ifdef SOFUN_ADDRESS_MAYBE_MISSING if (msymbol->filename) fprintf_filtered (outfile, " %s", msymbol->filename); -#endif fputs_filtered ("\n", outfile); } if (objfile->minimal_symbol_count != index) diff --git a/gdb/symtab.h b/gdb/symtab.h index c50f087..da35b29 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -345,10 +345,8 @@ struct minimal_symbol unsigned long size; -#ifdef SOFUN_ADDRESS_MAYBE_MISSING /* Which source file is this symbol in? Only relevant for mst_file_*. */ char *filename; -#endif /* Classification type for this minimal symbol. */ -- 2.7.4