Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfc] msymbol.size
@ 2003-11-07 19:47 Michael Elizabeth Chastain
  2003-11-07 20:06 ` Elena Zannoni
  0 siblings, 1 reply; 13+ messages in thread
From: Michael Elizabeth Chastain @ 2003-11-07 19:47 UTC (permalink / raw)
  To: gdb-patches

This is a cleanup patch for MSYMBOL_SIZE.  But I need help from
someone with a Solaris machine to test it.

struct minimal_symbol has this icky field:

  struct minimal_symbol
  {
    ...

    /* The info field is available for caching machine-specific information
       so it doesn't have to rederive the info constantly (over a serial line).
       It is initialized to zero and stays that way until target-dependent code
       sets it.  Storage for any data pointed to by this field should be allo-
       cated on the symbol_obstack for the associated objfile.  
       The type would be "void *" except for reasons of compatibility with older
       compilers.  This field is optional.

       Currently, the AMD 29000 tdep.c uses it to remember things it has decoded
       from the instructions in the function header, and the MIPS-16 code uses
       it to identify 16-bit procedures.  */

    char *info;

    ...
  };

The comment is disconnected from reality.  In reality, there are two
uses for msym.info:

(A) The elf reader stores the size of each minimal symbol into this
    field.  Later on, the stabs reader reads this size to calculate
    the 'texthigh' of a partial symbol table from the address of the
    last symbol plus the size of the last symbol.

(B) Several targets store flag bits into msym.info for their own
    internal purposes.

This patch cleans up (A) by adding a new msym.size field with the
proper data type of unsigned long.

msym's are not space critical so it's okay to add fields to them.

In the long run it might be better to calculate psymbol->texthigh
some other way entirely.  This patch makes that job easier.

Another benefit of this patch is that there was only one caller
of prim_record_minimal_symbol_and_info with a non-NULL 'info'.
After this patch there are no such callers.

Testing: I am testing the *-tdep.c patches just by running gdb_mbuild.sh
(in progress).  If you grep on MSYMBOL_SIZE you will see that *-tdep.c
never use these values.  So if gdb builds, it ought to be fine.

For the elfread.c and dbxread.c changes, I ran the test suite on
native i686-pc-linux-gnu with gcc 2 and gcc 3, dwarf-2 and stabs+.
Unfortunately, this is not good test coverage, because on this
platform finish_psymtab does not need the logic "address + size
of last symbol".

Is there anyone with a Solaris machine who can help me?

Michael C

===

2003-11-07  Michael Chastain  <mec@shout.net>

	* symtab.h (struct minimal_symbol): Add size.
	* dbxread.c: Use it.
	* elfread.c: (record_minimal_symbol_and_info): Do not use info.
	Rename to record_minimal_symbol.
	(elf_symtab_read): Set MSYMBOL_SIZE explicitly.
	* minsyms.c (prim_record_minimal_symbol_and_info): Initialize MSYMBOL_SIZE.
	(install_minimal_symbols): Ditto.
	* objfiles.c (terminate_minimal_symbol_table): Ditto.
	* arm-tdep.c: Delete unused MSYMBOL_SIZE.
	* m68hc11-tdep.c: Ditto.
	* mips-tdep.c: Ditto.
	* sh64-tdep.c: Ditto.

Index: symtab.h
===================================================================
RCS file: /cvs/src/src/gdb/symtab.h,v
retrieving revision 1.82
diff -c -3 -p -r1.82 symtab.h
*** symtab.h	4 Nov 2003 22:22:31 -0000	1.82
--- symtab.h	7 Nov 2003 17:45:07 -0000
*************** struct minimal_symbol
*** 325,330 ****
--- 325,336 ----
  
    char *info;
  
+   /* Size of this symbol.  end_psymtab in dbxread.c uses this
+      information to calculate the end of the partial symtab based on the
+      address of the last symbol plus the size of the last symbol.  */
+ 
+   unsigned long size;
+ 
  #ifdef SOFUN_ADDRESS_MAYBE_MISSING
    /* Which source file is this symbol in?  Only relevant for mst_file_*.  */
    char *filename;
*************** struct minimal_symbol
*** 346,351 ****
--- 352,358 ----
  };
  
  #define MSYMBOL_INFO(msymbol)		(msymbol)->info
+ #define MSYMBOL_SIZE(msymbol)		(msymbol)->size
  #define MSYMBOL_TYPE(msymbol)		(msymbol)->type
  
  \f
Index: dbxread.c
===================================================================
RCS file: /cvs/src/src/gdb/dbxread.c,v
retrieving revision 1.58
diff -c -3 -p -r1.58 dbxread.c
*** dbxread.c	6 Nov 2003 22:54:01 -0000	1.58
--- dbxread.c	7 Nov 2003 17:45:08 -0000
***************
*** 64,77 ****
  #include "aout/stab_gnu.h"	/* We always use GNU stabs, not native, now */
  \f
  
- /* This macro returns the size field of a minimal symbol, which is normally
-    stored in the "info" field.  The macro can be overridden for specific
-    targets (e.g. MIPS16) that use the info field for other purposes.  */
- #ifndef MSYMBOL_SIZE
- #define MSYMBOL_SIZE(msym) ((long) MSYMBOL_INFO (msym))
- #endif
- 
- 
  /* We put a pointer to this structure in the read_symtab_private field
     of the psymtab.  */
  
--- 64,69 ----
Index: elfread.c
===================================================================
RCS file: /cvs/src/src/gdb/elfread.c,v
retrieving revision 1.37
diff -c -3 -p -r1.37 elfread.c
*** elfread.c	6 Nov 2003 02:52:27 -0000	1.37
--- elfread.c	7 Nov 2003 17:45:08 -0000
*************** elf_locate_sections (bfd *ignore_abfd, a
*** 105,119 ****
  }
  
  static struct minimal_symbol *
! record_minimal_symbol_and_info (char *name, CORE_ADDR address,
! 				enum minimal_symbol_type ms_type, char *info,	/* FIXME, is this really char *? */
! 				asection *bfd_section, struct objfile *objfile)
  {
    if (ms_type == mst_text || ms_type == mst_file_text)
      address = SMASH_TEXT_ADDRESS (address);
  
    return prim_record_minimal_symbol_and_info
!     (name, address, ms_type, info, bfd_section->index, bfd_section, objfile);
  }
  
  /*
--- 105,119 ----
  }
  
  static struct minimal_symbol *
! record_minimal_symbol (char *name, CORE_ADDR address,
! 		       enum minimal_symbol_type ms_type,
! 		       asection *bfd_section, struct objfile *objfile)
  {
    if (ms_type == mst_text || ms_type == mst_file_text)
      address = SMASH_TEXT_ADDRESS (address);
  
    return prim_record_minimal_symbol_and_info
!     (name, address, ms_type, NULL, bfd_section->index, bfd_section, objfile);
  }
  
  /*
*************** elf_symtab_read (struct objfile *objfile
*** 163,169 ****
    char *filesymname = obsavestring ("", 0, &objfile->symbol_obstack);
  #endif
    struct dbx_symfile_info *dbx = objfile->sym_stab_info;
-   unsigned long size;
    int stripped = (bfd_get_symcount (objfile->obfd) == 0);
  
    if (dynamic)
--- 163,168 ----
*************** elf_symtab_read (struct objfile *objfile
*** 223,231 ****
  	      if (symaddr == 0)
  		continue;
  	      symaddr += offset;
! 	      msym = record_minimal_symbol_and_info
  		((char *) sym->name, symaddr,
! 		 mst_solib_trampoline, NULL, sym->section, objfile);
  #ifdef SOFUN_ADDRESS_MAYBE_MISSING
  	      if (msym != NULL)
  		msym->filename = filesymname;
--- 222,230 ----
  	      if (symaddr == 0)
  		continue;
  	      symaddr += offset;
! 	      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;
*************** elf_symtab_read (struct objfile *objfile
*** 436,446 ****
  		  /* ms_type = mst_unknown; */
  		  continue;	/* Skip this symbol. */
  		}
! 	      /* Pass symbol size field in via BFD.  FIXME!!!  */
! 	      size = ((elf_symbol_type *) sym)->internal_elf_sym.st_size;
! 	      msym = record_minimal_symbol_and_info
  		((char *) sym->name, symaddr,
! 		 ms_type, (void *) size, sym->section, objfile);
  #ifdef SOFUN_ADDRESS_MAYBE_MISSING
  	      if (msym != NULL)
  		msym->filename = filesymname;
--- 435,449 ----
  		  /* ms_type = mst_unknown; */
  		  continue;	/* Skip this symbol. */
  		}
! 	      msym = record_minimal_symbol
  		((char *) sym->name, symaddr,
! 		 ms_type, sym->section, objfile);
! 	      if (msym)
! 	      {
! 		/* Pass symbol size field in via BFD.  FIXME!!!  */
! 		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;
Index: minsyms.c
===================================================================
RCS file: /cvs/src/src/gdb/minsyms.c,v
retrieving revision 1.37
diff -c -3 -p -r1.37 minsyms.c
*** minsyms.c	6 Nov 2003 22:54:01 -0000	1.37
--- minsyms.c	7 Nov 2003 18:04:01 -0000
*************** prim_record_minimal_symbol_and_info (con
*** 610,615 ****
--- 610,616 ----
    MSYMBOL_TYPE (msymbol) = ms_type;
    /* FIXME:  This info, if it remains, needs its own field.  */
    MSYMBOL_INFO (msymbol) = info;	/* FIXME! */
+   MSYMBOL_SIZE (msymbol) = 0;
  
    /* The hash pointers must be cleared! If they're not,
       add_minsym_to_hash_table will NOT add this msymbol to the hash table. */
*************** install_minimal_symbols (struct objfile 
*** 889,894 ****
--- 890,896 ----
        SYMBOL_LINKAGE_NAME (&msymbols[mcount]) = NULL;
        SYMBOL_VALUE_ADDRESS (&msymbols[mcount]) = 0;
        MSYMBOL_INFO (&msymbols[mcount]) = NULL;
+       MSYMBOL_SIZE (&msymbols[mcount]) = 0;
        MSYMBOL_TYPE (&msymbols[mcount]) = mst_unknown;
        SYMBOL_INIT_LANGUAGE_SPECIFIC (&msymbols[mcount], language_unknown);
  
Index: objfiles.c
===================================================================
RCS file: /cvs/src/src/gdb/objfiles.c,v
retrieving revision 1.40
diff -c -3 -p -r1.40 objfiles.c
*** objfiles.c	6 Nov 2003 02:52:27 -0000	1.40
--- objfiles.c	7 Nov 2003 17:45:09 -0000
*************** terminate_minimal_symbol_table (struct o
*** 386,391 ****
--- 386,392 ----
      DEPRECATED_SYMBOL_NAME (m) = NULL;
      SYMBOL_VALUE_ADDRESS (m) = 0;
      MSYMBOL_INFO (m) = NULL;
+     MSYMBOL_SIZE (m) = 0;
      MSYMBOL_TYPE (m) = mst_unknown;
      SYMBOL_INIT_LANGUAGE_SPECIFIC (m, language_unknown);
    }
Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.154
diff -c -3 -p -r1.154 arm-tdep.c
*** arm-tdep.c	31 Oct 2003 23:47:17 -0000	1.154
--- arm-tdep.c	7 Nov 2003 17:45:10 -0000
*************** static int arm_debug;
*** 81,95 ****
  
  /* Macros for setting and testing a bit in a minimal symbol that marks
     it as Thumb function.  The MSB of the minimal symbol's "info" field
!    is used for this purpose. This field is already being used to store
!    the symbol size, so the assumption is that the symbol size cannot
!    exceed 2^31.
  
     MSYMBOL_SET_SPECIAL	Actually sets the "special" bit.
!    MSYMBOL_IS_SPECIAL   Tests the "special" bit in a minimal symbol.
!    MSYMBOL_SIZE         Returns the size of the minimal symbol,
!    			i.e. the "info" field with the "special" bit
!    			masked out.  */
  
  #define MSYMBOL_SET_SPECIAL(msym)					\
  	MSYMBOL_INFO (msym) = (char *) (((long) MSYMBOL_INFO (msym))	\
--- 81,90 ----
  
  /* Macros for setting and testing a bit in a minimal symbol that marks
     it as Thumb function.  The MSB of the minimal symbol's "info" field
!    is used for this purpose.
  
     MSYMBOL_SET_SPECIAL	Actually sets the "special" bit.
!    MSYMBOL_IS_SPECIAL   Tests the "special" bit in a minimal symbol.  */
  
  #define MSYMBOL_SET_SPECIAL(msym)					\
  	MSYMBOL_INFO (msym) = (char *) (((long) MSYMBOL_INFO (msym))	\
*************** static int arm_debug;
*** 97,105 ****
  
  #define MSYMBOL_IS_SPECIAL(msym)				\
  	(((long) MSYMBOL_INFO (msym) & 0x80000000) != 0)
- 
- #define MSYMBOL_SIZE(msym)				\
- 	((long) MSYMBOL_INFO (msym) & 0x7fffffff)
  
  /* The list of available "set arm ..." and "show arm ..." commands.  */
  static struct cmd_list_element *setarmcmdlist = NULL;
--- 92,97 ----
Index: m68hc11-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/m68hc11-tdep.c,v
retrieving revision 1.92
diff -c -3 -p -r1.92 m68hc11-tdep.c
*** m68hc11-tdep.c	31 Oct 2003 23:47:17 -0000	1.92
--- m68hc11-tdep.c	7 Nov 2003 17:45:10 -0000
*************** Foundation, Inc., 59 Temple Place - Suit
*** 50,65 ****
     analysis to compute correct stack frame layout.
     
     The MSB of the minimal symbol's "info" field is used for this purpose.
-    This field is already being used to store the symbol size, so the
-    assumption is that the symbol size cannot exceed 2^30.
  
     MSYMBOL_SET_RTC	Actually sets the "RTC" bit.
     MSYMBOL_SET_RTI	Actually sets the "RTI" bit.
     MSYMBOL_IS_RTC       Tests the "RTC" bit in a minimal symbol.
!    MSYMBOL_IS_RTI       Tests the "RTC" bit in a minimal symbol.
!    MSYMBOL_SIZE         Returns the size of the minimal symbol,
!    			i.e. the "info" field with the "special" bit
!    			masked out.  */
  
  #define MSYMBOL_SET_RTC(msym)                                           \
          MSYMBOL_INFO (msym) = (char *) (((long) MSYMBOL_INFO (msym))	\
--- 50,60 ----
     analysis to compute correct stack frame layout.
     
     The MSB of the minimal symbol's "info" field is used for this purpose.
  
     MSYMBOL_SET_RTC	Actually sets the "RTC" bit.
     MSYMBOL_SET_RTI	Actually sets the "RTI" bit.
     MSYMBOL_IS_RTC       Tests the "RTC" bit in a minimal symbol.
!    MSYMBOL_IS_RTI       Tests the "RTC" bit in a minimal symbol.  */
  
  #define MSYMBOL_SET_RTC(msym)                                           \
          MSYMBOL_INFO (msym) = (char *) (((long) MSYMBOL_INFO (msym))	\
*************** Foundation, Inc., 59 Temple Place - Suit
*** 74,82 ****
  
  #define MSYMBOL_IS_RTI(msym)				\
  	(((long) MSYMBOL_INFO (msym) & 0x40000000) != 0)
- 
- #define MSYMBOL_SIZE(msym)				\
- 	((long) MSYMBOL_INFO (msym) & 0x3fffffff)
  
  enum insn_return_kind {
    RETURN_RTS,
--- 69,74 ----
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.243
diff -c -3 -p -r1.243 mips-tdep.c
*** mips-tdep.c	6 Nov 2003 02:52:27 -0000	1.243
--- mips-tdep.c	7 Nov 2003 17:45:11 -0000
*************** mips_saved_regsize (void)
*** 226,242 ****
  
  /* Functions for setting and testing a bit in a minimal symbol that
     marks it as 16-bit function.  The MSB of the minimal symbol's
!    "info" field is used for this purpose. This field is already
!    being used to store the symbol size, so the assumption is
!    that the symbol size cannot exceed 2^31.
  
     ELF_MAKE_MSYMBOL_SPECIAL tests whether an ELF symbol is "special",
     i.e. refers to a 16-bit function, and sets a "special" bit in a
     minimal symbol to mark it as a 16-bit function
  
!    MSYMBOL_IS_SPECIAL   tests the "special" bit in a minimal symbol
!    MSYMBOL_SIZE         returns the size of the minimal symbol, i.e.
!    the "info" field with the "special" bit masked out */
  
  static void
  mips_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym)
--- 226,238 ----
  
  /* Functions for setting and testing a bit in a minimal symbol that
     marks it as 16-bit function.  The MSB of the minimal symbol's
!    "info" field is used for this purpose.
  
     ELF_MAKE_MSYMBOL_SPECIAL tests whether an ELF symbol is "special",
     i.e. refers to a 16-bit function, and sets a "special" bit in a
     minimal symbol to mark it as a 16-bit function
  
!    MSYMBOL_IS_SPECIAL   tests the "special" bit in a minimal symbol  */
  
  static void
  mips_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym)
Index: sh64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sh64-tdep.c,v
retrieving revision 1.11
diff -c -3 -p -r1.11 sh64-tdep.c
*** sh64-tdep.c	10 Oct 2003 07:13:11 -0000	1.11
--- sh64-tdep.c	7 Nov 2003 17:45:11 -0000
*************** sh_sh64_register_name (int reg_nr)
*** 197,213 ****
  
  /* Macros and functions for setting and testing a bit in a minimal
     symbol that marks it as 32-bit function.  The MSB of the minimal
!    symbol's "info" field is used for this purpose. This field is
!    already being used to store the symbol size, so the assumption is
!    that the symbol size cannot exceed 2^31.
  
     ELF_MAKE_MSYMBOL_SPECIAL
     tests whether an ELF symbol is "special", i.e. refers
     to a 32-bit function, and sets a "special" bit in a 
     minimal symbol to mark it as a 32-bit function
!    MSYMBOL_IS_SPECIAL   tests the "special" bit in a minimal symbol
!    MSYMBOL_SIZE         returns the size of the minimal symbol, i.e.
!    the "info" field with the "special" bit masked out */
  
  #define MSYMBOL_IS_SPECIAL(msym) \
    (((long) MSYMBOL_INFO (msym) & 0x80000000) != 0)
--- 197,209 ----
  
  /* Macros and functions for setting and testing a bit in a minimal
     symbol that marks it as 32-bit function.  The MSB of the minimal
!    symbol's "info" field is used for this purpose.
  
     ELF_MAKE_MSYMBOL_SPECIAL
     tests whether an ELF symbol is "special", i.e. refers
     to a 32-bit function, and sets a "special" bit in a 
     minimal symbol to mark it as a 32-bit function
!    MSYMBOL_IS_SPECIAL   tests the "special" bit in a minimal symbol  */
  
  #define MSYMBOL_IS_SPECIAL(msym) \
    (((long) MSYMBOL_INFO (msym) & 0x80000000) != 0)


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [rfc] msymbol.size
  2003-11-07 19:47 [rfc] msymbol.size Michael Elizabeth Chastain
@ 2003-11-07 20:06 ` Elena Zannoni
  2003-11-08 23:54   ` Joel Brobecker
  0 siblings, 1 reply; 13+ messages in thread
From: Elena Zannoni @ 2003-11-07 20:06 UTC (permalink / raw)
  To: Michael Elizabeth Chastain; +Cc: gdb-patches

Michael Elizabeth Chastain writes:
 > This is a cleanup patch for MSYMBOL_SIZE.  But I need help from
 > someone with a Solaris machine to test it.
 > 
 > struct minimal_symbol has this icky field:
 > 
 >   struct minimal_symbol
 >   {
 >     ...
 > 
 >     /* The info field is available for caching machine-specific information
 >        so it doesn't have to rederive the info constantly (over a serial line).
 >        It is initialized to zero and stays that way until target-dependent code
 >        sets it.  Storage for any data pointed to by this field should be allo-
 >        cated on the symbol_obstack for the associated objfile.  
 >        The type would be "void *" except for reasons of compatibility with older
 >        compilers.  This field is optional.
 > 
 >        Currently, the AMD 29000 tdep.c uses it to remember things it has decoded
 >        from the instructions in the function header, and the MIPS-16 code uses
 >        it to identify 16-bit procedures.  */
 > 
 >     char *info;
 > 
 >     ...
 >   };
 > 
 > The comment is disconnected from reality.  In reality, there are two
 > uses for msym.info:
 > 
 > (A) The elf reader stores the size of each minimal symbol into this
 >     field.  Later on, the stabs reader reads this size to calculate
 >     the 'texthigh' of a partial symbol table from the address of the
 >     last symbol plus the size of the last symbol.
 > 
 > (B) Several targets store flag bits into msym.info for their own
 >     internal purposes.
 > 
 > This patch cleans up (A) by adding a new msym.size field with the
 > proper data type of unsigned long.
 > 
 > msym's are not space critical so it's okay to add fields to them.
 > 
 > In the long run it might be better to calculate psymbol->texthigh
 > some other way entirely.  This patch makes that job easier.
 > 
 > Another benefit of this patch is that there was only one caller
 > of prim_record_minimal_symbol_and_info with a non-NULL 'info'.
 > After this patch there are no such callers.
 > 

yeah. I was going to do this today, too!

 > Testing: I am testing the *-tdep.c patches just by running gdb_mbuild.sh
 > (in progress).  If you grep on MSYMBOL_SIZE you will see that *-tdep.c
 > never use these values.  So if gdb builds, it ought to be fine.
 > 
 > For the elfread.c and dbxread.c changes, I ran the test suite on
 > native i686-pc-linux-gnu with gcc 2 and gcc 3, dwarf-2 and stabs+.
 > Unfortunately, this is not good test coverage, because on this
 > platform finish_psymtab does not need the logic "address + size
 > of last symbol".
 > 
 > Is there anyone with a Solaris machine who can help me?
 > 


let me see if I can get at one.

elena


 > Michael C
 > 
 > ===
 > 
 > 2003-11-07  Michael Chastain  <mec@shout.net>
 > 
 > 	* symtab.h (struct minimal_symbol): Add size.
 > 	* dbxread.c: Use it.
 > 	* elfread.c: (record_minimal_symbol_and_info): Do not use info.
 > 	Rename to record_minimal_symbol.
 > 	(elf_symtab_read): Set MSYMBOL_SIZE explicitly.
 > 	* minsyms.c (prim_record_minimal_symbol_and_info): Initialize MSYMBOL_SIZE.
 > 	(install_minimal_symbols): Ditto.
 > 	* objfiles.c (terminate_minimal_symbol_table): Ditto.
 > 	* arm-tdep.c: Delete unused MSYMBOL_SIZE.
 > 	* m68hc11-tdep.c: Ditto.
 > 	* mips-tdep.c: Ditto.
 > 	* sh64-tdep.c: Ditto.
 > 
 > Index: symtab.h
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/symtab.h,v
 > retrieving revision 1.82
 > diff -c -3 -p -r1.82 symtab.h
 > *** symtab.h	4 Nov 2003 22:22:31 -0000	1.82
 > --- symtab.h	7 Nov 2003 17:45:07 -0000
 > *************** struct minimal_symbol
 > *** 325,330 ****
 > --- 325,336 ----
 >   
 >     char *info;
 >   
 > +   /* Size of this symbol.  end_psymtab in dbxread.c uses this
 > +      information to calculate the end of the partial symtab based on the
 > +      address of the last symbol plus the size of the last symbol.  */
 > + 
 > +   unsigned long size;
 > + 
 >   #ifdef SOFUN_ADDRESS_MAYBE_MISSING
 >     /* Which source file is this symbol in?  Only relevant for mst_file_*.  */
 >     char *filename;
 > *************** struct minimal_symbol
 > *** 346,351 ****
 > --- 352,358 ----
 >   };
 >   
 >   #define MSYMBOL_INFO(msymbol)		(msymbol)->info
 > + #define MSYMBOL_SIZE(msymbol)		(msymbol)->size
 >   #define MSYMBOL_TYPE(msymbol)		(msymbol)->type
 >   
 >   \f
 > Index: dbxread.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/dbxread.c,v
 > retrieving revision 1.58
 > diff -c -3 -p -r1.58 dbxread.c
 > *** dbxread.c	6 Nov 2003 22:54:01 -0000	1.58
 > --- dbxread.c	7 Nov 2003 17:45:08 -0000
 > ***************
 > *** 64,77 ****
 >   #include "aout/stab_gnu.h"	/* We always use GNU stabs, not native, now */
 >   \f
 >   
 > - /* This macro returns the size field of a minimal symbol, which is normally
 > -    stored in the "info" field.  The macro can be overridden for specific
 > -    targets (e.g. MIPS16) that use the info field for other purposes.  */
 > - #ifndef MSYMBOL_SIZE
 > - #define MSYMBOL_SIZE(msym) ((long) MSYMBOL_INFO (msym))
 > - #endif
 > - 
 > - 
 >   /* We put a pointer to this structure in the read_symtab_private field
 >      of the psymtab.  */
 >   
 > --- 64,69 ----
 > Index: elfread.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/elfread.c,v
 > retrieving revision 1.37
 > diff -c -3 -p -r1.37 elfread.c
 > *** elfread.c	6 Nov 2003 02:52:27 -0000	1.37
 > --- elfread.c	7 Nov 2003 17:45:08 -0000
 > *************** elf_locate_sections (bfd *ignore_abfd, a
 > *** 105,119 ****
 >   }
 >   
 >   static struct minimal_symbol *
 > ! record_minimal_symbol_and_info (char *name, CORE_ADDR address,
 > ! 				enum minimal_symbol_type ms_type, char *info,	/* FIXME, is this really char *? */
 > ! 				asection *bfd_section, struct objfile *objfile)
 >   {
 >     if (ms_type == mst_text || ms_type == mst_file_text)
 >       address = SMASH_TEXT_ADDRESS (address);
 >   
 >     return prim_record_minimal_symbol_and_info
 > !     (name, address, ms_type, info, bfd_section->index, bfd_section, objfile);
 >   }
 >   
 >   /*
 > --- 105,119 ----
 >   }
 >   
 >   static struct minimal_symbol *
 > ! record_minimal_symbol (char *name, CORE_ADDR address,
 > ! 		       enum minimal_symbol_type ms_type,
 > ! 		       asection *bfd_section, struct objfile *objfile)
 >   {
 >     if (ms_type == mst_text || ms_type == mst_file_text)
 >       address = SMASH_TEXT_ADDRESS (address);
 >   
 >     return prim_record_minimal_symbol_and_info
 > !     (name, address, ms_type, NULL, bfd_section->index, bfd_section, objfile);
 >   }
 >   
 >   /*
 > *************** elf_symtab_read (struct objfile *objfile
 > *** 163,169 ****
 >     char *filesymname = obsavestring ("", 0, &objfile->symbol_obstack);
 >   #endif
 >     struct dbx_symfile_info *dbx = objfile->sym_stab_info;
 > -   unsigned long size;
 >     int stripped = (bfd_get_symcount (objfile->obfd) == 0);
 >   
 >     if (dynamic)
 > --- 163,168 ----
 > *************** elf_symtab_read (struct objfile *objfile
 > *** 223,231 ****
 >   	      if (symaddr == 0)
 >   		continue;
 >   	      symaddr += offset;
 > ! 	      msym = record_minimal_symbol_and_info
 >   		((char *) sym->name, symaddr,
 > ! 		 mst_solib_trampoline, NULL, sym->section, objfile);
 >   #ifdef SOFUN_ADDRESS_MAYBE_MISSING
 >   	      if (msym != NULL)
 >   		msym->filename = filesymname;
 > --- 222,230 ----
 >   	      if (symaddr == 0)
 >   		continue;
 >   	      symaddr += offset;
 > ! 	      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;
 > *************** elf_symtab_read (struct objfile *objfile
 > *** 436,446 ****
 >   		  /* ms_type = mst_unknown; */
 >   		  continue;	/* Skip this symbol. */
 >   		}
 > ! 	      /* Pass symbol size field in via BFD.  FIXME!!!  */
 > ! 	      size = ((elf_symbol_type *) sym)->internal_elf_sym.st_size;
 > ! 	      msym = record_minimal_symbol_and_info
 >   		((char *) sym->name, symaddr,
 > ! 		 ms_type, (void *) size, sym->section, objfile);
 >   #ifdef SOFUN_ADDRESS_MAYBE_MISSING
 >   	      if (msym != NULL)
 >   		msym->filename = filesymname;
 > --- 435,449 ----
 >   		  /* ms_type = mst_unknown; */
 >   		  continue;	/* Skip this symbol. */
 >   		}
 > ! 	      msym = record_minimal_symbol
 >   		((char *) sym->name, symaddr,
 > ! 		 ms_type, sym->section, objfile);
 > ! 	      if (msym)
 > ! 	      {
 > ! 		/* Pass symbol size field in via BFD.  FIXME!!!  */
 > ! 		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;
 > Index: minsyms.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/minsyms.c,v
 > retrieving revision 1.37
 > diff -c -3 -p -r1.37 minsyms.c
 > *** minsyms.c	6 Nov 2003 22:54:01 -0000	1.37
 > --- minsyms.c	7 Nov 2003 18:04:01 -0000
 > *************** prim_record_minimal_symbol_and_info (con
 > *** 610,615 ****
 > --- 610,616 ----
 >     MSYMBOL_TYPE (msymbol) = ms_type;
 >     /* FIXME:  This info, if it remains, needs its own field.  */
 >     MSYMBOL_INFO (msymbol) = info;	/* FIXME! */
 > +   MSYMBOL_SIZE (msymbol) = 0;
 >   
 >     /* The hash pointers must be cleared! If they're not,
 >        add_minsym_to_hash_table will NOT add this msymbol to the hash table. */
 > *************** install_minimal_symbols (struct objfile 
 > *** 889,894 ****
 > --- 890,896 ----
 >         SYMBOL_LINKAGE_NAME (&msymbols[mcount]) = NULL;
 >         SYMBOL_VALUE_ADDRESS (&msymbols[mcount]) = 0;
 >         MSYMBOL_INFO (&msymbols[mcount]) = NULL;
 > +       MSYMBOL_SIZE (&msymbols[mcount]) = 0;
 >         MSYMBOL_TYPE (&msymbols[mcount]) = mst_unknown;
 >         SYMBOL_INIT_LANGUAGE_SPECIFIC (&msymbols[mcount], language_unknown);
 >   
 > Index: objfiles.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/objfiles.c,v
 > retrieving revision 1.40
 > diff -c -3 -p -r1.40 objfiles.c
 > *** objfiles.c	6 Nov 2003 02:52:27 -0000	1.40
 > --- objfiles.c	7 Nov 2003 17:45:09 -0000
 > *************** terminate_minimal_symbol_table (struct o
 > *** 386,391 ****
 > --- 386,392 ----
 >       DEPRECATED_SYMBOL_NAME (m) = NULL;
 >       SYMBOL_VALUE_ADDRESS (m) = 0;
 >       MSYMBOL_INFO (m) = NULL;
 > +     MSYMBOL_SIZE (m) = 0;
 >       MSYMBOL_TYPE (m) = mst_unknown;
 >       SYMBOL_INIT_LANGUAGE_SPECIFIC (m, language_unknown);
 >     }
 > Index: arm-tdep.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/arm-tdep.c,v
 > retrieving revision 1.154
 > diff -c -3 -p -r1.154 arm-tdep.c
 > *** arm-tdep.c	31 Oct 2003 23:47:17 -0000	1.154
 > --- arm-tdep.c	7 Nov 2003 17:45:10 -0000
 > *************** static int arm_debug;
 > *** 81,95 ****
 >   
 >   /* Macros for setting and testing a bit in a minimal symbol that marks
 >      it as Thumb function.  The MSB of the minimal symbol's "info" field
 > !    is used for this purpose. This field is already being used to store
 > !    the symbol size, so the assumption is that the symbol size cannot
 > !    exceed 2^31.
 >   
 >      MSYMBOL_SET_SPECIAL	Actually sets the "special" bit.
 > !    MSYMBOL_IS_SPECIAL   Tests the "special" bit in a minimal symbol.
 > !    MSYMBOL_SIZE         Returns the size of the minimal symbol,
 > !    			i.e. the "info" field with the "special" bit
 > !    			masked out.  */
 >   
 >   #define MSYMBOL_SET_SPECIAL(msym)					\
 >   	MSYMBOL_INFO (msym) = (char *) (((long) MSYMBOL_INFO (msym))	\
 > --- 81,90 ----
 >   
 >   /* Macros for setting and testing a bit in a minimal symbol that marks
 >      it as Thumb function.  The MSB of the minimal symbol's "info" field
 > !    is used for this purpose.
 >   
 >      MSYMBOL_SET_SPECIAL	Actually sets the "special" bit.
 > !    MSYMBOL_IS_SPECIAL   Tests the "special" bit in a minimal symbol.  */
 >   
 >   #define MSYMBOL_SET_SPECIAL(msym)					\
 >   	MSYMBOL_INFO (msym) = (char *) (((long) MSYMBOL_INFO (msym))	\
 > *************** static int arm_debug;
 > *** 97,105 ****
 >   
 >   #define MSYMBOL_IS_SPECIAL(msym)				\
 >   	(((long) MSYMBOL_INFO (msym) & 0x80000000) != 0)
 > - 
 > - #define MSYMBOL_SIZE(msym)				\
 > - 	((long) MSYMBOL_INFO (msym) & 0x7fffffff)
 >   
 >   /* The list of available "set arm ..." and "show arm ..." commands.  */
 >   static struct cmd_list_element *setarmcmdlist = NULL;
 > --- 92,97 ----
 > Index: m68hc11-tdep.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/m68hc11-tdep.c,v
 > retrieving revision 1.92
 > diff -c -3 -p -r1.92 m68hc11-tdep.c
 > *** m68hc11-tdep.c	31 Oct 2003 23:47:17 -0000	1.92
 > --- m68hc11-tdep.c	7 Nov 2003 17:45:10 -0000
 > *************** Foundation, Inc., 59 Temple Place - Suit
 > *** 50,65 ****
 >      analysis to compute correct stack frame layout.
 >      
 >      The MSB of the minimal symbol's "info" field is used for this purpose.
 > -    This field is already being used to store the symbol size, so the
 > -    assumption is that the symbol size cannot exceed 2^30.
 >   
 >      MSYMBOL_SET_RTC	Actually sets the "RTC" bit.
 >      MSYMBOL_SET_RTI	Actually sets the "RTI" bit.
 >      MSYMBOL_IS_RTC       Tests the "RTC" bit in a minimal symbol.
 > !    MSYMBOL_IS_RTI       Tests the "RTC" bit in a minimal symbol.
 > !    MSYMBOL_SIZE         Returns the size of the minimal symbol,
 > !    			i.e. the "info" field with the "special" bit
 > !    			masked out.  */
 >   
 >   #define MSYMBOL_SET_RTC(msym)                                           \
 >           MSYMBOL_INFO (msym) = (char *) (((long) MSYMBOL_INFO (msym))	\
 > --- 50,60 ----
 >      analysis to compute correct stack frame layout.
 >      
 >      The MSB of the minimal symbol's "info" field is used for this purpose.
 >   
 >      MSYMBOL_SET_RTC	Actually sets the "RTC" bit.
 >      MSYMBOL_SET_RTI	Actually sets the "RTI" bit.
 >      MSYMBOL_IS_RTC       Tests the "RTC" bit in a minimal symbol.
 > !    MSYMBOL_IS_RTI       Tests the "RTC" bit in a minimal symbol.  */
 >   
 >   #define MSYMBOL_SET_RTC(msym)                                           \
 >           MSYMBOL_INFO (msym) = (char *) (((long) MSYMBOL_INFO (msym))	\
 > *************** Foundation, Inc., 59 Temple Place - Suit
 > *** 74,82 ****
 >   
 >   #define MSYMBOL_IS_RTI(msym)				\
 >   	(((long) MSYMBOL_INFO (msym) & 0x40000000) != 0)
 > - 
 > - #define MSYMBOL_SIZE(msym)				\
 > - 	((long) MSYMBOL_INFO (msym) & 0x3fffffff)
 >   
 >   enum insn_return_kind {
 >     RETURN_RTS,
 > --- 69,74 ----
 > Index: mips-tdep.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/mips-tdep.c,v
 > retrieving revision 1.243
 > diff -c -3 -p -r1.243 mips-tdep.c
 > *** mips-tdep.c	6 Nov 2003 02:52:27 -0000	1.243
 > --- mips-tdep.c	7 Nov 2003 17:45:11 -0000
 > *************** mips_saved_regsize (void)
 > *** 226,242 ****
 >   
 >   /* Functions for setting and testing a bit in a minimal symbol that
 >      marks it as 16-bit function.  The MSB of the minimal symbol's
 > !    "info" field is used for this purpose. This field is already
 > !    being used to store the symbol size, so the assumption is
 > !    that the symbol size cannot exceed 2^31.
 >   
 >      ELF_MAKE_MSYMBOL_SPECIAL tests whether an ELF symbol is "special",
 >      i.e. refers to a 16-bit function, and sets a "special" bit in a
 >      minimal symbol to mark it as a 16-bit function
 >   
 > !    MSYMBOL_IS_SPECIAL   tests the "special" bit in a minimal symbol
 > !    MSYMBOL_SIZE         returns the size of the minimal symbol, i.e.
 > !    the "info" field with the "special" bit masked out */
 >   
 >   static void
 >   mips_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym)
 > --- 226,238 ----
 >   
 >   /* Functions for setting and testing a bit in a minimal symbol that
 >      marks it as 16-bit function.  The MSB of the minimal symbol's
 > !    "info" field is used for this purpose.
 >   
 >      ELF_MAKE_MSYMBOL_SPECIAL tests whether an ELF symbol is "special",
 >      i.e. refers to a 16-bit function, and sets a "special" bit in a
 >      minimal symbol to mark it as a 16-bit function
 >   
 > !    MSYMBOL_IS_SPECIAL   tests the "special" bit in a minimal symbol  */
 >   
 >   static void
 >   mips_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym)
 > Index: sh64-tdep.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/sh64-tdep.c,v
 > retrieving revision 1.11
 > diff -c -3 -p -r1.11 sh64-tdep.c
 > *** sh64-tdep.c	10 Oct 2003 07:13:11 -0000	1.11
 > --- sh64-tdep.c	7 Nov 2003 17:45:11 -0000
 > *************** sh_sh64_register_name (int reg_nr)
 > *** 197,213 ****
 >   
 >   /* Macros and functions for setting and testing a bit in a minimal
 >      symbol that marks it as 32-bit function.  The MSB of the minimal
 > !    symbol's "info" field is used for this purpose. This field is
 > !    already being used to store the symbol size, so the assumption is
 > !    that the symbol size cannot exceed 2^31.
 >   
 >      ELF_MAKE_MSYMBOL_SPECIAL
 >      tests whether an ELF symbol is "special", i.e. refers
 >      to a 32-bit function, and sets a "special" bit in a 
 >      minimal symbol to mark it as a 32-bit function
 > !    MSYMBOL_IS_SPECIAL   tests the "special" bit in a minimal symbol
 > !    MSYMBOL_SIZE         returns the size of the minimal symbol, i.e.
 > !    the "info" field with the "special" bit masked out */
 >   
 >   #define MSYMBOL_IS_SPECIAL(msym) \
 >     (((long) MSYMBOL_INFO (msym) & 0x80000000) != 0)
 > --- 197,209 ----
 >   
 >   /* Macros and functions for setting and testing a bit in a minimal
 >      symbol that marks it as 32-bit function.  The MSB of the minimal
 > !    symbol's "info" field is used for this purpose.
 >   
 >      ELF_MAKE_MSYMBOL_SPECIAL
 >      tests whether an ELF symbol is "special", i.e. refers
 >      to a 32-bit function, and sets a "special" bit in a 
 >      minimal symbol to mark it as a 32-bit function
 > !    MSYMBOL_IS_SPECIAL   tests the "special" bit in a minimal symbol  */
 >   
 >   #define MSYMBOL_IS_SPECIAL(msym) \
 >     (((long) MSYMBOL_INFO (msym) & 0x80000000) != 0)


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [rfc] msymbol.size
  2003-11-07 20:06 ` Elena Zannoni
@ 2003-11-08 23:54   ` Joel Brobecker
  0 siblings, 0 replies; 13+ messages in thread
From: Joel Brobecker @ 2003-11-08 23:54 UTC (permalink / raw)
  To: Elena Zannoni; +Cc: Michael Elizabeth Chastain, gdb-patches

On Fri, Nov 07, 2003 at 03:06:52PM -0500, Elena Zannoni wrote:
> let me see if I can get at one.

We also have a few sparc-solaris machines (running Solaris 2.6, 2.8 and
2.9), so we'll be glad to help if needed.

-- 
Joel


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [rfc] msymbol.size
@ 2003-11-11 20:14 Michael Elizabeth Chastain
  0 siblings, 0 replies; 13+ messages in thread
From: Michael Elizabeth Chastain @ 2003-11-11 20:14 UTC (permalink / raw)
  To: gdb-patches

Committed.

Whoops, I put my old e-mail address into the ChangeLog.
No big deal.  I'm not even going to edit it (the old address
will still reach me for a long time).

Michael C

===

	2003-11-07  Michael Chastain  <mec@shout.net>
	
	* symtab.h (struct minimal_symbol): Add size.
	* dbxread.c: Use it.
	* elfread.c: (record_minimal_symbol_and_info): Do not use info.
	Rename to record_minimal_symbol.
	(elf_symtab_read): Set MSYMBOL_SIZE explicitly.
	* minsyms.c (prim_record_minimal_symbol_and_info): Initialize MSYMBOL_SIZE.
	(install_minimal_symbols): Ditto.
	* objfiles.c (terminate_minimal_symbol_table): Ditto.
	* arm-tdep.c: Delete unused MSYMBOL_SIZE.
	* m68hc11-tdep.c: Ditto.
	* mips-tdep.c: Ditto.
	* sh64-tdep.c: Ditto.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [rfc] msymbol.size
  2003-11-11 18:45 Michael Elizabeth Chastain
@ 2003-11-11 19:11 ` Elena Zannoni
  0 siblings, 0 replies; 13+ messages in thread
From: Elena Zannoni @ 2003-11-11 19:11 UTC (permalink / raw)
  To: Michael Elizabeth Chastain; +Cc: ezannoni, brobecker, gdb-patches

Michael Elizabeth Chastain writes:
 > So, can I commit the msymbol.size patch?
 > 

yes!

elena


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [rfc] msymbol.size
@ 2003-11-11 18:45 Michael Elizabeth Chastain
  2003-11-11 19:11 ` Elena Zannoni
  0 siblings, 1 reply; 13+ messages in thread
From: Michael Elizabeth Chastain @ 2003-11-11 18:45 UTC (permalink / raw)
  To: ezannoni; +Cc: brobecker, gdb-patches

Okay, I whacked dbxread.c with this kludge.  This prints trace
lines with the value of SYMBOL_VALUE_ADDRESS and MSYMBOL_SIZE
every time end_psymtab is called, whether they are used or not.

Then I ran before-and-after test runs of my msymbol.size patch.  I
tested on native i686-pc-linux-gnu with gcc 2.95.3 -gstabs+ and gcc
3.3.2 -gstabs+.  I extracted the trace lines from gdb.log and compared.
The trace lines were identical before and after, with the same
values of SYMBOL_VALUE_ADDRESS and MSYMBOL_SIZE on all lines
(357 lines with gcc 2.95.3, 285 lines with gcc 3.3.2).

Based on this evidence, I'm confident that my msymbol.size patch
stores the same sizes as the current code.

So, can I commit the msymbol.size patch?

(Obviously I don't want to commit this nasty little trace kludge).

Michael C

===

Index: dbxread.c
===================================================================
RCS file: /cvs/src/src/gdb/dbxread.c,v
retrieving revision 1.59
diff -c -3 -p -r1.59 dbxread.c
*** dbxread.c	8 Nov 2003 00:13:02 -0000	1.59
--- dbxread.c	11 Nov 2003 17:20:33 -0000
*************** end_psymtab (struct partial_symtab *pst,
*** 2208,2214 ****
       a reliable texthigh by taking the address plus size of the
       last function in the file.  */
  
!   if (pst->texthigh == 0 && last_function_name)
      {
        char *p;
        int n;
--- 2208,2214 ----
       a reliable texthigh by taking the address plus size of the
       last function in the file.  */
  
!   if (last_function_name)
      {
        char *p;
        int n;
*************** end_psymtab (struct partial_symtab *pst,
*** 2234,2240 ****
  	}
  
        if (minsym)
! 	pst->texthigh = SYMBOL_VALUE_ADDRESS (minsym) + MSYMBOL_SIZE (minsym);
  
        last_function_name = NULL;
      }
--- 2234,2245 ----
  	}
  
        if (minsym)
! 	{
! 	  fprintf_unfiltered (gdb_stderr, "\nend_psymtab: %x %x\n",
! 	    SYMBOL_VALUE_ADDRESS (minsym), MSYMBOL_SIZE (minsym));
! 	  if (pst->texthigh == 0)
! 	    pst->texthigh = SYMBOL_VALUE_ADDRESS (minsym) + MSYMBOL_SIZE (minsym);
! 	}
  
        last_function_name = NULL;
      }


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [rfc] msymbol.size
@ 2003-11-11 17:10 Michael Elizabeth Chastain
  0 siblings, 0 replies; 13+ messages in thread
From: Michael Elizabeth Chastain @ 2003-11-11 17:10 UTC (permalink / raw)
  To: ezannoni; +Cc: brobecker, gdb-patches

I have an idea.  I'm going to try this:

  end_psymtab ()
  {
    printf_unfiltered (MSYMBOL_SIZE(...));
    if (... stuff that never happens for us ...)
    {
      ... whatever ...;
    }
  }

I can check that MSYMBOL_SIZE is the same before and after my patch.
I don't actually need to execute the code path that *uses*
MSYMBOL_SIZE.

See you in a couple of hours or tomorrow.

eza> I hope this was clear, on Solaris I got no differences in the pthreads
eza> tests before and after the patch. There were failures in the
eza> backtraces, but they were failing the same way in both runs. But Joel
eza> did.

Right.

Michael C


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [rfc] msymbol.size
  2003-11-11 16:31 Michael Elizabeth Chastain
@ 2003-11-11 16:50 ` Elena Zannoni
  0 siblings, 0 replies; 13+ messages in thread
From: Elena Zannoni @ 2003-11-11 16:50 UTC (permalink / raw)
  To: Michael Elizabeth Chastain; +Cc: ezannoni, brobecker, gdb-patches

Michael Elizabeth Chastain writes:
 > [I added gdb.patches back because we aren't attaching huge files,
 >  so might as well share and enjoy].
 > 
 > eza> I did a build w/o your patch but w/ the fprintf. No output :-(
 > eza> A build w/ your patch : still no output from the printf.
 > 
 > Okay.  This means that gdb does not use the "texthigh hack" with
 > gcc and /usr/ccs/bin/as.  So, we could do anything we want to
 > msymbol.size and there would be no effect on gdb, as long as gcc
 > is the compiler and /usr/ccs/bin/as is the assembler.
 > 
 > Any chance of running the gdb test suite with Sun's compiler?
 > Or even just debugging a 'hello world' program built with Sun's
 > compiler and seeing if the texthigh hack is still used at all.
 > Or even ... running gdb on random Solaris utilities like /usr/bin/ls
 > and seeing what happens.

I don't think I have any machines around here with SUN's compiler on
them. :-( I tried a break main - run on ls and /usr/bin/ccs/help, and
saw no end_symtab printed either. But there is no symbol info there, I
think.

 > 
 > eza> So I think that the diff in pthreads.exp could be a fluctuation.
 > eza> Given the roblems with that test.
 > 
 > I have run into into similar problems on x86 two or three times.
 > What happens is: pthreads.exp fluctuates because it is a thread test.
 > Sometimes some of the threads are in states that are deterministically
 > bad for gdb.  That is:
 > 
 >   when a thread is in state S0, gdb always prints a good backtrace
 >   when a thread is in state S1, gdb always prints a bad backtrace
 >   the thread is in S0 on some runs and S1 on some runs
 > 

I've seen that too on Linux.

 > But it is a little dangerous to extrapolate from x86-linux to
 > sparc-solaris so I am hoping to see the gdb.log for the FAIL result
 > in that test.
 > 

I hope this was clear, on Solaris I got no differences in the pthreads
tests before and after the patch. There were failures in the
backtraces, but they were failing the same way in both runs. But Joel
did.

elena

 > Michael C


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [rfc] msymbol.size
@ 2003-11-11 16:31 Michael Elizabeth Chastain
  2003-11-11 16:50 ` Elena Zannoni
  0 siblings, 1 reply; 13+ messages in thread
From: Michael Elizabeth Chastain @ 2003-11-11 16:31 UTC (permalink / raw)
  To: ezannoni, mec.gnu; +Cc: brobecker, gdb-patches

[I added gdb.patches back because we aren't attaching huge files,
 so might as well share and enjoy].

eza> I did a build w/o your patch but w/ the fprintf. No output :-(
eza> A build w/ your patch : still no output from the printf.

Okay.  This means that gdb does not use the "texthigh hack" with
gcc and /usr/ccs/bin/as.  So, we could do anything we want to
msymbol.size and there would be no effect on gdb, as long as gcc
is the compiler and /usr/ccs/bin/as is the assembler.

Any chance of running the gdb test suite with Sun's compiler?
Or even just debugging a 'hello world' program built with Sun's
compiler and seeing if the texthigh hack is still used at all.
Or even ... running gdb on random Solaris utilities like /usr/bin/ls
and seeing what happens.

eza> So I think that the diff in pthreads.exp could be a fluctuation.
eza> Given the roblems with that test.

I have run into into similar problems on x86 two or three times.
What happens is: pthreads.exp fluctuates because it is a thread test.
Sometimes some of the threads are in states that are deterministically
bad for gdb.  That is:

  when a thread is in state S0, gdb always prints a good backtrace
  when a thread is in state S1, gdb always prints a bad backtrace
  the thread is in S0 on some runs and S1 on some runs

But it is a little dangerous to extrapolate from x86-linux to
sparc-solaris so I am hoping to see the gdb.log for the FAIL result
in that test.

Michael C


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [rfc] msymbol.size
  2003-11-09 23:30 Michael Elizabeth Chastain
@ 2003-11-10 18:16 ` Joel Brobecker
  0 siblings, 0 replies; 13+ messages in thread
From: Joel Brobecker @ 2003-11-10 18:16 UTC (permalink / raw)
  To: Michael Elizabeth Chastain; +Cc: ezannoni, gdb-patches

Michael,

> That would help.
> 
> Can you run the gdb test suite on one of these machines,
> preferably with a C compiler from Sun?

I will run your test, but unfortunately I don't think we have the Sun
C compiler installed on our machine. So I will use our GNAT compiler,
which is based on GCC 3.2.3. And we don't have a C++ compiler either.
I hope the results from the testing will still be relevant...

-- 
Joel


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [rfc] msymbol.size
@ 2003-11-09 23:30 Michael Elizabeth Chastain
  2003-11-10 18:16 ` Joel Brobecker
  0 siblings, 1 reply; 13+ messages in thread
From: Michael Elizabeth Chastain @ 2003-11-09 23:30 UTC (permalink / raw)
  To: brobecker, ezannoni; +Cc: gdb-patches

joel> We also have a few sparc-solaris machines (running Solaris 2.6, 2.8
joel> and 2.9), so we'll be glad to help if needed.

That would help.

Can you run the gdb test suite on one of these machines,
preferably with a C compiler from Sun?

Michael C


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [rfc] msymbol.size
  2003-11-07 20:19 Michael Elizabeth Chastain
@ 2003-11-07 20:31 ` Elena Zannoni
  0 siblings, 0 replies; 13+ messages in thread
From: Elena Zannoni @ 2003-11-07 20:31 UTC (permalink / raw)
  To: Michael Elizabeth Chastain; +Cc: ezannoni, gdb-patches

Michael Elizabeth Chastain writes:
 > eza> let me see if I can get at one.
 > 
 > The critical code is:
 > 
 >   /* dbxread.c */
 >   end_symtab (...)
 >   {
 >     ...
 >     if (pst->texthigh == 0 && last_function_name)
 >       {
 >       ...
 > 
 >       if (minsym)
 > 	pst->texthigh = SYMBOL_VALUE_ADDRESS (minsym) + MSYMBOL_SIZE (minsym);
 > 
 >       ...
 >       }
 >     ...
 >   }
 > 
 > If that assignment executes, and the address and size have the same
 > value before and after my patch, then the patch is okay.
 > 
 > A before-and-after test run on such a platform would be perfect.
 > 

ok, build proceeding now...

elena


 > Michael C


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [rfc] msymbol.size
@ 2003-11-07 20:19 Michael Elizabeth Chastain
  2003-11-07 20:31 ` Elena Zannoni
  0 siblings, 1 reply; 13+ messages in thread
From: Michael Elizabeth Chastain @ 2003-11-07 20:19 UTC (permalink / raw)
  To: ezannoni; +Cc: gdb-patches

eza> let me see if I can get at one.

The critical code is:

  /* dbxread.c */
  end_symtab (...)
  {
    ...
    if (pst->texthigh == 0 && last_function_name)
      {
      ...

      if (minsym)
	pst->texthigh = SYMBOL_VALUE_ADDRESS (minsym) + MSYMBOL_SIZE (minsym);

      ...
      }
    ...
  }

If that assignment executes, and the address and size have the same
value before and after my patch, then the patch is okay.

A before-and-after test run on such a platform would be perfect.

Michael C


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2003-11-11 20:14 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-07 19:47 [rfc] msymbol.size Michael Elizabeth Chastain
2003-11-07 20:06 ` Elena Zannoni
2003-11-08 23:54   ` Joel Brobecker
2003-11-07 20:19 Michael Elizabeth Chastain
2003-11-07 20:31 ` Elena Zannoni
2003-11-09 23:30 Michael Elizabeth Chastain
2003-11-10 18:16 ` Joel Brobecker
2003-11-11 16:31 Michael Elizabeth Chastain
2003-11-11 16:50 ` Elena Zannoni
2003-11-11 17:10 Michael Elizabeth Chastain
2003-11-11 18:45 Michael Elizabeth Chastain
2003-11-11 19:11 ` Elena Zannoni
2003-11-11 20:14 Michael Elizabeth Chastain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox