Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Re: [rfa] ENUM BITFIELD, here it comes again
@ 2003-08-21 18:57 Michael Elizabeth Chastain
  2003-08-21 19:19 ` Andrew Cagney
  0 siblings, 1 reply; 11+ messages in thread
From: Michael Elizabeth Chastain @ 2003-08-21 18:57 UTC (permalink / raw)
  To: ac131313; +Cc: gdb-patches

Andrew C asks:

  What effect does it have without -readnow but with say:
	$ gdb gdb
	(gdb) break internal_error
	(gdb) run
	(gdb) maint internal-error
	(gdb) backtrace

gdb gdb_6_0-branch:  space used: 8896512
gdb HEAD 2003-08-19: space used: 8904704
gdb HEAD now:        space used: 8265728

That's with both symtab.h and gdbtypes.h improvements in gdb HEAD.

Michael C


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

* Re: [rfa] ENUM BITFIELD, here it comes again
  2003-08-21 18:57 [rfa] ENUM BITFIELD, here it comes again Michael Elizabeth Chastain
@ 2003-08-21 19:19 ` Andrew Cagney
  0 siblings, 0 replies; 11+ messages in thread
From: Andrew Cagney @ 2003-08-21 19:19 UTC (permalink / raw)
  To: Michael Elizabeth Chastain; +Cc: gdb-patches

> Andrew C asks:
> 
>   What effect does it have without -readnow but with say:
> 	$ gdb gdb
> 	(gdb) break internal_error
> 	(gdb) run
> 	(gdb) maint internal-error
> 	(gdb) backtrace
> 
> gdb gdb_6_0-branch:  space used: 8896512
> gdb HEAD 2003-08-19: space used: 8904704
> gdb HEAD now:        space used: 8265728
> 
> That's with both symtab.h and gdbtypes.h improvements in gdb HEAD.

Can you add this info (with the split sizes?) as well to the commentary 
(and commit).

	Andrew



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

* Re: [rfa] ENUM BITFIELD, here it comes again
@ 2003-08-21 19:49 Michael Elizabeth Chastain
  0 siblings, 0 replies; 11+ messages in thread
From: Michael Elizabeth Chastain @ 2003-08-21 19:49 UTC (permalink / raw)
  To: ac131313; +Cc: gdb-patches

> Can you add this info (with the split sizes?) as well to the commentary 
> (and commit).

You got it.  I am adding this to the comment in symtab.h:

   gdb gdb_6_0_branch  2003-08-19  space used: 8896512
   gdb HEAD            2003-08-19  space used: 8904704
   gdb HEAD            2003-08-21  space used: 8396800 (+symtab.h)
   gdb HEAD            2003-08-21  space used: 8265728 (+gdbtypes.h)

   The third line shows the savings from the optimizations in symtab.h.
   The fourth line shows the savings from the optimizations in
   gdbtypes.h.  Both optimizations are in gdb HEAD now.

I rebuilt gdb with the old gdbtypes.h in order to get the number
in the third line.

Michael C


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

* Re: [rfa] ENUM BITFIELD, here it comes again
  2003-08-21 17:42 Michael Elizabeth Chastain
@ 2003-08-21 18:46 ` Andrew Cagney
  0 siblings, 0 replies; 11+ messages in thread
From: Andrew Cagney @ 2003-08-21 18:46 UTC (permalink / raw)
  To: Michael Elizabeth Chastain; +Cc: gdb-patches

> + /* Rearranged: used ENUM_BITFIELD and rearranged field order in
> +    all the space critical structures (plus struct minimal_symbol).
> +    Memory usage dropped from 99360768 bytes to 90001408 bytes.
> +    I measured this with before-and-after tests of
> +    "HEAD-old-gdb -readnow HEAD-old-gdb" and
> +    "HEAD-new-gdb -readnow HEAD-old-gdb" on native i686-pc-linux-gnu,
> +    red hat linux 8, with LD_LIBRARY_PATH=/usr/lib/debug,
> +    typing "maint space 1" at the first command prompt.
> +    --chastain 2003-08-21  */

What effect does it have without -readnow but with say:

	$ gdb gdb
	(gdb) break internal_error
	(gdb) run
	(gdb) maint internal-error
	(gdb) backtrace

which is kind of closer to the typical users:

	$ gdb foo
	(gdb) run
	Segmentation fault
	(gdb) bt
	(gdb) list
	(gdb) print pointer
	$1 = 0
	<bugger>
	(gdb)^D

i.e., very few symbols are really loaded.

Andrew



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

* Re: [rfa] ENUM BITFIELD, here it comes again
@ 2003-08-21 17:42 Michael Elizabeth Chastain
  2003-08-21 18:46 ` Andrew Cagney
  0 siblings, 1 reply; 11+ messages in thread
From: Michael Elizabeth Chastain @ 2003-08-21 17:42 UTC (permalink / raw)
  To: ac131313; +Cc: gdb-patches

Okay.  Andrew, how is this?

Michael C

2003-08-21  Micahel Chastain  <mec@shout.net>

	* symtab.h: Add comments about space usage.  Identify
	the space-critical structures.

Index: symtab.h
===================================================================
RCS file: /cvs/src/src/gdb/symtab.h,v
retrieving revision 1.78
diff -c -3 -p -r1.78 symtab.h
*** symtab.h	20 Aug 2003 17:39:18 -0000	1.78
--- symtab.h	21 Aug 2003 17:40:00 -0000
*************** struct blockvector;
*** 35,47 ****
  struct axs_value;
  struct agent_expr;
  
  /* Define a structure for the information that is common to all symbol types,
     including minimal symbols, partial symbols, and full symbols.  In a
     multilanguage environment, some language specific information may need to
!    be recorded along with each symbol.
  
!    These fields are ordered to encourage good packing, since we frequently
!    have tens or hundreds of thousands of these.  */
  
  struct general_symbol_info
  {
--- 35,70 ----
  struct axs_value;
  struct agent_expr;
  
+ /* Some of the structures in this file are space critical.
+    The space-critical structures are:
+ 
+      struct general_symbol_info
+      struct symbol
+      struct partial_symbol
+ 
+    These structures are layed out to encourage good packing.
+    They use ENUM_BITFIELD and short int fields, and they order the
+    structure members so that fields less than a word are next
+    to each other so they can be packed together. */
+ 
+ /* Rearranged: used ENUM_BITFIELD and rearranged field order in
+    all the space critical structures (plus struct minimal_symbol).
+    Memory usage dropped from 99360768 bytes to 90001408 bytes.
+    I measured this with before-and-after tests of
+    "HEAD-old-gdb -readnow HEAD-old-gdb" and
+    "HEAD-new-gdb -readnow HEAD-old-gdb" on native i686-pc-linux-gnu,
+    red hat linux 8, with LD_LIBRARY_PATH=/usr/lib/debug,
+    typing "maint space 1" at the first command prompt.
+    --chastain 2003-08-21  */
+ 
+ 
+ 
  /* Define a structure for the information that is common to all symbol types,
     including minimal symbols, partial symbols, and full symbols.  In a
     multilanguage environment, some language specific information may need to
!    be recorded along with each symbol. */
  
! /* This structure is space critical.  See space comments at the top. */
  
  struct general_symbol_info
  {
*************** struct alias_list
*** 557,562 ****
--- 580,587 ----
    struct alias_list *next;
  };
  
+ /* This structure is space critical.  See space comments at the top. */
+ 
  struct symbol
  {
  
*************** struct symbol
*** 637,642 ****
--- 662,669 ----
     Each partial_symbol sits in a partial_symtab, all of which are chained
     on a  partial symtab list and which points to the corresponding 
     normal symtab once the partial_symtab has been referenced.  */
+ 
+ /* This structure is space critical.  See space comments at the top. */
  
  struct partial_symbol
  {


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

* Re: [rfa] ENUM BITFIELD, here it comes again
  2003-08-20 16:49 [rfa] ENUM BITFIELD, " Michael Elizabeth Chastain
@ 2003-08-21 13:48 ` Andrew Cagney
  0 siblings, 0 replies; 11+ messages in thread
From: Andrew Cagney @ 2003-08-21 13:48 UTC (permalink / raw)
  To: Michael Elizabeth Chastain; +Cc: gdb-patches

Michael, one request here.  Can you add a commentary to each packed 
struct that documents exactly what the saving was, and exactly how that 
saving was computed.

Otherwize, the benefits of the change will pass into folk law - instead 
of treating them as a tradeoff - the packing has a performance const, 
people will come to believe that they are unconditionally good.

Andrew


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

* Re: [rfa] ENUM BITFIELD, here it comes again
@ 2003-08-20 17:42 Michael Elizabeth Chastain
  0 siblings, 0 replies; 11+ messages in thread
From: Michael Elizabeth Chastain @ 2003-08-20 17:42 UTC (permalink / raw)
  To: gdb-patches

Committed.

Michael C

===

  2003-08-20  Michael Chastain  <mec@shout.net>

	  * defs.h (ENUM_BITFIELD): New macro.
	  * symtab.h (ENUM_BITFIELD): Use it.
	  (BYTE_BITFIELD): Remove old macro, which was already disabled.


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

* Re: [rfa] ENUM_BITFIELD, here it comes again
       [not found] <200308201639.h7KGd6BX008220@duracef.shout.net>
@ 2003-08-20 17:36 ` Jim Blandy
  0 siblings, 0 replies; 11+ messages in thread
From: Jim Blandy @ 2003-08-20 17:36 UTC (permalink / raw)
  To: gdb-patches


Michael Elizabeth Chastain <mec@shout.net> writes:

> Okay, here is the next round, with the commments edited in symtab.h.
> 
> Testing: I rebuilt gdb and it compiles.  Since it's just a comment
> change, I didn't run the test suite again.
> 
> Okay to commit?
> 
> If there are more issues in symtab.h, can I commit the defs.h part,
> at least?

I think it all looks okay.


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

* Re: [rfa] ENUM BITFIELD, here it comes again
@ 2003-08-20 16:49 Michael Elizabeth Chastain
  2003-08-21 13:48 ` Andrew Cagney
  0 siblings, 1 reply; 11+ messages in thread
From: Michael Elizabeth Chastain @ 2003-08-20 16:49 UTC (permalink / raw)
  To: gdb-patches

[Argh, I keep sending to gdb-patches@redhat.com instead of
 gdb-patches@sources.redhat.com.  My mistake.]

Okay, here is the next round, with the commments edited in symtab.h.

Testing: I rebuilt gdb and it compiles.  Since it's just a comment
change, I didn't run the test suite again.

Okay to commit?

If there are more issues in symtab.h, can I commit the defs.h part,
at least?

Michael C

===

2003-08-20  Michael Chastain  <mec@shout.net>

	* defs.h (ENUM_BITFIELD): New macro.
	* symtab.h (ENUM_BITFIELD): Use it.
	(BYTE_BITFIELD): Remove old macro, which was already disabled.

Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.127
diff -u -r1.127 defs.h
--- defs.h	9 Aug 2003 14:57:30 -0000	1.127
+++ defs.h	19 Aug 2003 18:34:31 -0000
@@ -285,6 +285,15 @@
 #endif
 #endif
 
+/* Be conservative and use enum bitfields only with GCC.
+   This is copied from gcc 3.3.1, system.h.  */
+
+#if defined(__GNUC__) && (__GNUC__ >= 2)
+#define ENUM_BITFIELD(TYPE) enum TYPE
+#else
+#define ENUM_BITFIELD(TYPE) unsigned int
+#endif
+
 /* Needed for various prototypes */
 
 struct symtab;
Index: symtab.h
===================================================================
RCS file: /cvs/src/src/gdb/symtab.h,v
retrieving revision 1.77
diff -c -3 -p -r1.77 symtab.h
*** symtab.h	22 Jul 2003 15:41:59 -0000	1.77
--- symtab.h	20 Aug 2003 16:34:31 -0000
*************** struct blockvector;
*** 35,51 ****
  struct axs_value;
  struct agent_expr;
  
- /* Don't do this; it means that if some .o's are compiled with GNU C
-    and some are not (easy to do accidentally the way we configure
-    things; also it is a pain to have to "make clean" every time you
-    want to switch compilers), then GDB dies a horrible death.  */
- /* GNU C supports enums that are bitfields.  Some compilers don't. */
- #if 0 && defined(__GNUC__) && !defined(BYTE_BITFIELD)
- #define	BYTE_BITFIELD	:8;
- #else
- #define	BYTE_BITFIELD		/*nothing */
- #endif
- 
  /* Define a structure for the information that is common to all symbol types,
     including minimal symbols, partial symbols, and full symbols.  In a
     multilanguage environment, some language specific information may need to
--- 35,40 ----
*************** struct general_symbol_info
*** 107,113 ****
       This is used to select one of the fields from the language specific
       union above. */
  
!   enum language language BYTE_BITFIELD;
  
    /* Which section is this symbol in?  This is an index into
       section_offsets for this objfile.  Negative means that the symbol
--- 96,102 ----
       This is used to select one of the fields from the language specific
       union above. */
  
!   ENUM_BITFIELD(language) language : 8;
  
    /* Which section is this symbol in?  This is an index into
       section_offsets for this objfile.  Negative means that the symbol
*************** extern char *symbol_demangled_name (stru
*** 227,232 ****
--- 216,252 ----
  #define SYMBOL_MATCHES_NATURAL_NAME(symbol, name)			\
    (strcmp_iw (SYMBOL_NATURAL_NAME (symbol), (name)) == 0)
  
+ /* Classification types for a minimal symbol.  These should be taken as
+    "advisory only", since if gdb can't easily figure out a
+    classification it simply selects mst_unknown.  It may also have to
+    guess when it can't figure out which is a better match between two
+    types (mst_data versus mst_bss) for example.  Since the minimal
+    symbol info is sometimes derived from the BFD library's view of a
+    file, we need to live with what information bfd supplies. */
+ 
+ enum minimal_symbol_type
+ {
+   mst_unknown = 0,		/* Unknown type, the default */
+   mst_text,			/* Generally executable instructions */
+   mst_data,			/* Generally initialized data */
+   mst_bss,			/* Generally uninitialized data */
+   mst_abs,			/* Generally absolute (nonrelocatable) */
+   /* GDB uses mst_solib_trampoline for the start address of a shared
+      library trampoline entry.  Breakpoints for shared library functions
+      are put there if the shared library is not yet loaded.
+      After the shared library is loaded, lookup_minimal_symbol will
+      prefer the minimal symbol from the shared library (usually
+      a mst_text symbol) over the mst_solib_trampoline symbol, and the
+      breakpoints will be moved to their true address in the shared
+      library via breakpoint_re_set.  */
+   mst_solib_trampoline,		/* Shared library trampoline code */
+   /* For the mst_file* types, the names are only guaranteed to be unique
+      within a given .o file.  */
+   mst_file_text,		/* Static version of mst_text */
+   mst_file_data,		/* Static version of mst_data */
+   mst_file_bss			/* Static version of mst_bss */
+ };
+ 
  /* Define a simple structure used to hold some very basic information about
     all defined global symbols (text, data, bss, abs, etc).  The only required
     information is the general_symbol_info.
*************** struct minimal_symbol
*** 268,304 ****
    char *filename;
  #endif
  
!   /* Classification types for this symbol.  These should be taken as "advisory
!      only", since if gdb can't easily figure out a classification it simply
!      selects mst_unknown.  It may also have to guess when it can't figure out
!      which is a better match between two types (mst_data versus mst_bss) for
!      example.  Since the minimal symbol info is sometimes derived from the
!      BFD library's view of a file, we need to live with what information bfd
!      supplies. */
  
!   enum minimal_symbol_type
!   {
!     mst_unknown = 0,		/* Unknown type, the default */
!     mst_text,			/* Generally executable instructions */
!     mst_data,			/* Generally initialized data */
!     mst_bss,			/* Generally uninitialized data */
!     mst_abs,			/* Generally absolute (nonrelocatable) */
!     /* GDB uses mst_solib_trampoline for the start address of a shared
!        library trampoline entry.  Breakpoints for shared library functions
!        are put there if the shared library is not yet loaded.
!        After the shared library is loaded, lookup_minimal_symbol will
!        prefer the minimal symbol from the shared library (usually
!        a mst_text symbol) over the mst_solib_trampoline symbol, and the
!        breakpoints will be moved to their true address in the shared
!        library via breakpoint_re_set.  */
!     mst_solib_trampoline,	/* Shared library trampoline code */
!     /* For the mst_file* types, the names are only guaranteed to be unique
!        within a given .o file.  */
!     mst_file_text,		/* Static version of mst_text */
!     mst_file_data,		/* Static version of mst_data */
!     mst_file_bss		/* Static version of mst_bss */
!   }
!   type BYTE_BITFIELD;
  
    /* Minimal symbols with the same hash key are kept on a linked
       list.  This is the link.  */
--- 288,296 ----
    char *filename;
  #endif
  
!   /* Classification type for this minimal symbol.  */
  
!   ENUM_BITFIELD(minimal_symbol_type) type : 8;
  
    /* Minimal symbols with the same hash key are kept on a linked
       list.  This is the link.  */
*************** struct minimal_symbol
*** 321,327 ****
  /* Different name domains for symbols.  Looking up a symbol specifies a
     domain and ignores symbol definitions in other name domains. */
  
! typedef enum
  {
    /* UNDEF_DOMAIN is used when a domain has not been discovered or
       none of the following apply.  This usually indicates an error either
--- 313,319 ----
  /* Different name domains for symbols.  Looking up a symbol specifies a
     domain and ignores symbol definitions in other name domains. */
  
! typedef enum domain_enum_tag
  {
    /* UNDEF_DOMAIN is used when a domain has not been discovered or
       none of the following apply.  This usually indicates an error either
*************** struct symbol
*** 578,588 ****
  
    /* Domain code.  */
  
!   domain_enum domain BYTE_BITFIELD;
  
    /* Address class */
  
!   enum address_class aclass BYTE_BITFIELD;
  
    /* Line number of definition.  FIXME:  Should we really make the assumption
       that nobody will try to debug files longer than 64K lines?  What about
--- 570,580 ----
  
    /* Domain code.  */
  
!   ENUM_BITFIELD(domain_enum_tag) domain : 6;
  
    /* Address class */
  
!   ENUM_BITFIELD(address_class) aclass : 6;
  
    /* Line number of definition.  FIXME:  Should we really make the assumption
       that nobody will try to debug files longer than 64K lines?  What about
*************** struct partial_symbol
*** 655,665 ****
  
    /* Name space code.  */
  
!   domain_enum domain BYTE_BITFIELD;
  
    /* Address class (for info_symbols) */
  
!   enum address_class aclass BYTE_BITFIELD;
  
  };
  
--- 647,657 ----
  
    /* Name space code.  */
  
!   ENUM_BITFIELD(domain_enum_tag) domain : 6;
  
    /* Address class (for info_symbols) */
  
!   ENUM_BITFIELD(address_class) aclass : 6;
  
  };
  

--h7KGdDs21142.1061397553/int-mx1.corp.redhat.com--


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

* Re: [rfa] ENUM_BITFIELD, here it comes again
       [not found] <200308200249.h7K2ni62029448@duracef.shout.net>
@ 2003-08-20  7:52 ` Jim Blandy
  0 siblings, 0 replies; 11+ messages in thread
From: Jim Blandy @ 2003-08-20  7:52 UTC (permalink / raw)
  To: gdb-patches


Michael Elizabeth Chastain <mec@shout.net> writes:
> Here we go again ... a new version of my ENUM_BITFIELD patch.
> +/* Classification types for this symbol.  These should be taken as "advisory
> +   only", since if gdb can't easily figure out a classification it simply
> +   selects mst_unknown.  It may also have to guess when it can't figure out
> +   which is a better match between two types (mst_data versus mst_bss) for
> +   example.  Since the minimal symbol info is sometimes derived from the
> +   BFD library's view of a file, we need to live with what information bfd
> +   supplies. */

Some of this comment needs to stay in the struct, and some needs to
stick with the enum.


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

* [rfa] ENUM_BITFIELD, here it comes again
@ 2003-08-20  2:50 Michael Elizabeth Chastain
  0 siblings, 0 replies; 11+ messages in thread
From: Michael Elizabeth Chastain @ 2003-08-20  2:50 UTC (permalink / raw)
  To: gdb-patches

Here we go again ... a new version of my ENUM_BITFIELD patch.

First the good part:

  before: 99360768
  after:  90001408

This is a medium sized program (a specific build of gdb) along with a
debugging version of glibc using "gdb -readnow HEAD-gdb-old".  Then I
typed 'maint space 1'.

The major difference from the previous version is that I hoisted the
definition of 'enum minimal_symbol_type' from inside 'struct
minimal_symbol' to the top level.  This avoids trouble with gcc
warnings (gcc 3.3.1) or errors (gcc 3.2-7-rh).

Testing: as before, I ran the test suite with gcc v2 and v3,
dwarf-2 and stabs+, binutils 2.14.  Also, I tested the non-gcc case
by putting an "#if 0" into the defs.h test in order to get the
non-gcc path.

Size reduction (on my vanilla native i686-pc-linux-gnu):

  struct general_symbol_info  24  20
  struct minimal_symbol       44  40
  struct symbol               60  48
  struct partial_symbol       32  24

Jim B approved an earlier version of this patch, but then I noticed
that little enum glitch.  Sigh.

Okay to commit?

Michael C

===

2003-08-19  Michael Chastain  <mec@shout.net>

	* defs.h (ENUM_BITFIELD): New macro.
	* symtab.h (ENUM_BITFIELD): Use it.
	(BYTE_BITFIELD): Remove old macro, which was already disabled.

Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.127
diff -u -r1.127 defs.h
--- defs.h	9 Aug 2003 14:57:30 -0000	1.127
+++ defs.h	19 Aug 2003 18:34:31 -0000
@@ -285,6 +285,15 @@
 #endif
 #endif
 
+/* Be conservative and use enum bitfields only with GCC.
+   This is copied from gcc 3.3.1, system.h.  */
+
+#if defined(__GNUC__) && (__GNUC__ >= 2)
+#define ENUM_BITFIELD(TYPE) enum TYPE
+#else
+#define ENUM_BITFIELD(TYPE) unsigned int
+#endif
+
 /* Needed for various prototypes */
 
 struct symtab;
Index: symtab.h
===================================================================
RCS file: /cvs/src/src/gdb/symtab.h,v
retrieving revision 1.77
diff -u -r1.77 symtab.h
--- symtab.h	22 Jul 2003 15:41:59 -0000	1.77
+++ symtab.h	19 Aug 2003 18:34:33 -0000
@@ -35,17 +35,6 @@
 struct axs_value;
 struct agent_expr;
 
-/* Don't do this; it means that if some .o's are compiled with GNU C
-   and some are not (easy to do accidentally the way we configure
-   things; also it is a pain to have to "make clean" every time you
-   want to switch compilers), then GDB dies a horrible death.  */
-/* GNU C supports enums that are bitfields.  Some compilers don't. */
-#if 0 && defined(__GNUC__) && !defined(BYTE_BITFIELD)
-#define	BYTE_BITFIELD	:8;
-#else
-#define	BYTE_BITFIELD		/*nothing */
-#endif
-
 /* Define a structure for the information that is common to all symbol types,
    including minimal symbols, partial symbols, and full symbols.  In a
    multilanguage environment, some language specific information may need to
@@ -107,7 +96,7 @@
      This is used to select one of the fields from the language specific
      union above. */
 
-  enum language language BYTE_BITFIELD;
+  ENUM_BITFIELD(language) language : 8;
 
   /* Which section is this symbol in?  This is an index into
      section_offsets for this objfile.  Negative means that the symbol
@@ -227,6 +216,37 @@
 #define SYMBOL_MATCHES_NATURAL_NAME(symbol, name)			\
   (strcmp_iw (SYMBOL_NATURAL_NAME (symbol), (name)) == 0)
 
+/* Classification types for this symbol.  These should be taken as "advisory
+   only", since if gdb can't easily figure out a classification it simply
+   selects mst_unknown.  It may also have to guess when it can't figure out
+   which is a better match between two types (mst_data versus mst_bss) for
+   example.  Since the minimal symbol info is sometimes derived from the
+   BFD library's view of a file, we need to live with what information bfd
+   supplies. */
+
+enum minimal_symbol_type
+{
+  mst_unknown = 0,		/* Unknown type, the default */
+  mst_text,			/* Generally executable instructions */
+  mst_data,			/* Generally initialized data */
+  mst_bss,			/* Generally uninitialized data */
+  mst_abs,			/* Generally absolute (nonrelocatable) */
+  /* GDB uses mst_solib_trampoline for the start address of a shared
+     library trampoline entry.  Breakpoints for shared library functions
+     are put there if the shared library is not yet loaded.
+     After the shared library is loaded, lookup_minimal_symbol will
+     prefer the minimal symbol from the shared library (usually
+     a mst_text symbol) over the mst_solib_trampoline symbol, and the
+     breakpoints will be moved to their true address in the shared
+     library via breakpoint_re_set.  */
+  mst_solib_trampoline,	/* Shared library trampoline code */
+  /* For the mst_file* types, the names are only guaranteed to be unique
+     within a given .o file.  */
+  mst_file_text,		/* Static version of mst_text */
+  mst_file_data,		/* Static version of mst_data */
+  mst_file_bss		/* Static version of mst_bss */
+};
+
 /* Define a simple structure used to hold some very basic information about
    all defined global symbols (text, data, bss, abs, etc).  The only required
    information is the general_symbol_info.
@@ -268,37 +288,7 @@
   char *filename;
 #endif
 
-  /* Classification types for this symbol.  These should be taken as "advisory
-     only", since if gdb can't easily figure out a classification it simply
-     selects mst_unknown.  It may also have to guess when it can't figure out
-     which is a better match between two types (mst_data versus mst_bss) for
-     example.  Since the minimal symbol info is sometimes derived from the
-     BFD library's view of a file, we need to live with what information bfd
-     supplies. */
-
-  enum minimal_symbol_type
-  {
-    mst_unknown = 0,		/* Unknown type, the default */
-    mst_text,			/* Generally executable instructions */
-    mst_data,			/* Generally initialized data */
-    mst_bss,			/* Generally uninitialized data */
-    mst_abs,			/* Generally absolute (nonrelocatable) */
-    /* GDB uses mst_solib_trampoline for the start address of a shared
-       library trampoline entry.  Breakpoints for shared library functions
-       are put there if the shared library is not yet loaded.
-       After the shared library is loaded, lookup_minimal_symbol will
-       prefer the minimal symbol from the shared library (usually
-       a mst_text symbol) over the mst_solib_trampoline symbol, and the
-       breakpoints will be moved to their true address in the shared
-       library via breakpoint_re_set.  */
-    mst_solib_trampoline,	/* Shared library trampoline code */
-    /* For the mst_file* types, the names are only guaranteed to be unique
-       within a given .o file.  */
-    mst_file_text,		/* Static version of mst_text */
-    mst_file_data,		/* Static version of mst_data */
-    mst_file_bss		/* Static version of mst_bss */
-  }
-  type BYTE_BITFIELD;
+  ENUM_BITFIELD(minimal_symbol_type) type : 8;
 
   /* Minimal symbols with the same hash key are kept on a linked
      list.  This is the link.  */
@@ -321,7 +311,7 @@
 /* Different name domains for symbols.  Looking up a symbol specifies a
    domain and ignores symbol definitions in other name domains. */
 
-typedef enum
+typedef enum domain_enum_tag
 {
   /* UNDEF_DOMAIN is used when a domain has not been discovered or
      none of the following apply.  This usually indicates an error either
@@ -578,11 +568,11 @@
 
   /* Domain code.  */
 
-  domain_enum domain BYTE_BITFIELD;
+  ENUM_BITFIELD(domain_enum_tag) domain : 6;
 
   /* Address class */
 
-  enum address_class aclass BYTE_BITFIELD;
+  ENUM_BITFIELD(address_class) aclass : 6;
 
   /* Line number of definition.  FIXME:  Should we really make the assumption
      that nobody will try to debug files longer than 64K lines?  What about
@@ -655,11 +645,11 @@
 
   /* Name space code.  */
 
-  domain_enum domain BYTE_BITFIELD;
+  ENUM_BITFIELD(domain_enum_tag) domain : 6;
 
   /* Address class (for info_symbols) */
 
-  enum address_class aclass BYTE_BITFIELD;
+  ENUM_BITFIELD(address_class) aclass : 6;
 
 };
 

--h7K2nks22828.1061347786/int-mx1.corp.redhat.com--


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

end of thread, other threads:[~2003-08-21 19:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-21 18:57 [rfa] ENUM BITFIELD, here it comes again Michael Elizabeth Chastain
2003-08-21 19:19 ` Andrew Cagney
  -- strict thread matches above, loose matches on Subject: below --
2003-08-21 19:49 Michael Elizabeth Chastain
2003-08-21 17:42 Michael Elizabeth Chastain
2003-08-21 18:46 ` Andrew Cagney
2003-08-20 17:42 Michael Elizabeth Chastain
     [not found] <200308201639.h7KGd6BX008220@duracef.shout.net>
2003-08-20 17:36 ` [rfa] ENUM_BITFIELD, " Jim Blandy
2003-08-20 16:49 [rfa] ENUM BITFIELD, " Michael Elizabeth Chastain
2003-08-21 13:48 ` Andrew Cagney
     [not found] <200308200249.h7K2ni62029448@duracef.shout.net>
2003-08-20  7:52 ` [rfa] ENUM_BITFIELD, " Jim Blandy
2003-08-20  2:50 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