Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Replace some literal consts with enums.
@ 2002-01-31 17:15 Michael Snyder
  2002-01-31 17:23 ` Andrew Cagney
  2002-01-31 18:45 ` Elena Zannoni
  0 siblings, 2 replies; 4+ messages in thread
From: Michael Snyder @ 2002-01-31 17:15 UTC (permalink / raw)
  To: gdb-patches


2002-01-31  Michael Snyder  <msnyder@redhat.com>

	* symfile.h (enum overlay_debugging_state): 
	Define enum constant values for overlay mode.
	* symfile.c (overlay_debugging): Use enums instead of literals.
	(overlay_is_mapped, overlay_auto_command, 
	overlay_manual_command): Ditto.	

Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.50
diff -p -r1.50 symfile.c
*** symfile.c	2002/01/17 22:15:17	1.50
--- symfile.c	2002/02/01 01:10:58
*************** init_psymbol_list (struct objfile *objfi
*** 2509,2515 ****
  
  /* Overlay debugging state: */
  
! int overlay_debugging = 0;	/* 0 == off, 1 == manual, -1 == auto */
  int overlay_cache_invalid = 0;	/* True if need to refresh mapped state */
  
  /* Target vector for refreshing overlay mapped state */
--- 2509,2515 ----
  
  /* Overlay debugging state: */
  
! enum overlay_debugging_state overlay_debugging = ovly_off;
  int overlay_cache_invalid = 0;	/* True if need to refresh mapped state */
  
  /* Target vector for refreshing overlay mapped state */
*************** overlay_is_mapped (struct obj_section *o
*** 2566,2574 ****
    switch (overlay_debugging)
      {
      default:
!     case 0:
        return 0;			/* overlay debugging off */
!     case -1:			/* overlay debugging automatic */
        /* Unles there is a target_overlay_update function, 
           there's really nothing useful to do here (can't really go auto)  */
        if (target_overlay_update)
--- 2566,2574 ----
    switch (overlay_debugging)
      {
      default:
!     case ovly_off:
        return 0;			/* overlay debugging off */
!     case ovly_auto:		/* overlay debugging automatic */
        /* Unles there is a target_overlay_update function, 
           there's really nothing useful to do here (can't really go auto)  */
        if (target_overlay_update)
*************** overlay_is_mapped (struct obj_section *o
*** 2582,2588 ****
  	    (*target_overlay_update) (osect);
  	}
        /* fall thru to manual case */
!     case 1:			/* overlay debugging manual */
        return osect->ovly_mapped == 1;
      }
  }
--- 2582,2588 ----
  	    (*target_overlay_update) (osect);
  	}
        /* fall thru to manual case */
!     case ovly_on:		/* overlay debugging manual */
        return osect->ovly_mapped == 1;
      }
  }
*************** the 'overlay manual' command.");
*** 2897,2903 ****
  static void
  overlay_auto_command (char *args, int from_tty)
  {
!   overlay_debugging = -1;
    if (info_verbose)
      printf_filtered ("Automatic overlay debugging enabled.");
  }
--- 2897,2903 ----
  static void
  overlay_auto_command (char *args, int from_tty)
  {
!   overlay_debugging = ovly_auto;
    if (info_verbose)
      printf_filtered ("Automatic overlay debugging enabled.");
  }
*************** overlay_auto_command (char *args, int fr
*** 2909,2915 ****
  static void
  overlay_manual_command (char *args, int from_tty)
  {
!   overlay_debugging = 1;
    if (info_verbose)
      printf_filtered ("Overlay debugging enabled.");
  }
--- 2909,2915 ----
  static void
  overlay_manual_command (char *args, int from_tty)
  {
!   overlay_debugging = ovly_on;
    if (info_verbose)
      printf_filtered ("Overlay debugging enabled.");
  }
*************** overlay_manual_command (char *args, int 
*** 2921,2927 ****
  static void
  overlay_off_command (char *args, int from_tty)
  {
!   overlay_debugging = 0;
    if (info_verbose)
      printf_filtered ("Overlay debugging disabled.");
  }
--- 2921,2927 ----
  static void
  overlay_off_command (char *args, int from_tty)
  {
!   overlay_debugging = ovly_off;
    if (info_verbose)
      printf_filtered ("Overlay debugging disabled.");
  }
Index: symfile.h
===================================================================
RCS file: /cvs/src/src/gdb/symfile.h,v
retrieving revision 1.11
diff -p -r1.11 symfile.h
*** symfile.h	2001/12/07 12:10:15	1.11
--- symfile.h	2002/02/01 01:10:58
*************** extern void find_lowest_section (bfd *, 
*** 253,259 ****
  extern bfd *symfile_bfd_open (char *);
  
  /* Utility functions for overlay sections: */
! extern int overlay_debugging;
  extern int overlay_cache_invalid;
  
  /* return the "mapped" overlay section  containing the PC */
--- 253,263 ----
  extern bfd *symfile_bfd_open (char *);
  
  /* Utility functions for overlay sections: */
! extern enum overlay_debugging_state {
!   ovly_off, 
!   ovly_on, 
!   ovly_auto
! } overlay_debugging;
  extern int overlay_cache_invalid;
  
  /* return the "mapped" overlay section  containing the PC */


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

* Re: [PATCH] Replace some literal consts with enums.
  2002-01-31 17:15 [PATCH] Replace some literal consts with enums Michael Snyder
@ 2002-01-31 17:23 ` Andrew Cagney
  2002-01-31 18:45 ` Elena Zannoni
  1 sibling, 0 replies; 4+ messages in thread
From: Andrew Cagney @ 2002-01-31 17:23 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches

> 2002-01-31  Michael Snyder  <msnyder@redhat.com>
> 
> * symfile.h (enum overlay_debugging_state): 
> 	Define enum constant values for overlay mode.
> 	* symfile.c (overlay_debugging): Use enums instead of literals.
> 	(overlay_is_mapped, overlay_auto_command, 
> 	overlay_manual_command): Ditto.	
> 
> 

Michael, check set_auto_boolean_cmd().

Andrew




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

* Re: [PATCH] Replace some literal consts with enums.
  2002-01-31 17:15 [PATCH] Replace some literal consts with enums Michael Snyder
  2002-01-31 17:23 ` Andrew Cagney
@ 2002-01-31 18:45 ` Elena Zannoni
  2002-02-01 14:35   ` Michael Snyder
  1 sibling, 1 reply; 4+ messages in thread
From: Elena Zannoni @ 2002-01-31 18:45 UTC (permalink / raw)
  To: Michael Snyder; +Cc: gdb-patches


Cool, I like enums. But the formatting of the enum in the .h file is
non-GNU.  Is symfile.c the only place where these are used? Would it
be possible to pull the enum inside symfile.c, if this is the case?

Thanks
Elena


Michael Snyder writes:
 > 
 > 2002-01-31  Michael Snyder  <msnyder@redhat.com>
 > 
 > 	* symfile.h (enum overlay_debugging_state): 
 > 	Define enum constant values for overlay mode.
 > 	* symfile.c (overlay_debugging): Use enums instead of literals.
 > 	(overlay_is_mapped, overlay_auto_command, 
 > 	overlay_manual_command): Ditto.	
 > 

 > Index: symfile.h
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/symfile.h,v
 > retrieving revision 1.11
 > diff -p -r1.11 symfile.h
 > *** symfile.h	2001/12/07 12:10:15	1.11
 > --- symfile.h	2002/02/01 01:10:58
 > *************** extern void find_lowest_section (bfd *, 
 > *** 253,259 ****
 >   extern bfd *symfile_bfd_open (char *);
 >   
 >   /* Utility functions for overlay sections: */
 > ! extern int overlay_debugging;
 >   extern int overlay_cache_invalid;
 >   
 >   /* return the "mapped" overlay section  containing the PC */
 > --- 253,263 ----
 >   extern bfd *symfile_bfd_open (char *);
 >   
 >   /* Utility functions for overlay sections: */
 > ! extern enum overlay_debugging_state {
 > !   ovly_off, 
 > !   ovly_on, 
 > !   ovly_auto
 > ! } overlay_debugging;
 >   extern int overlay_cache_invalid;
 >   
 >   /* return the "mapped" overlay section  containing the PC */


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

* Re: [PATCH] Replace some literal consts with enums.
  2002-01-31 18:45 ` Elena Zannoni
@ 2002-02-01 14:35   ` Michael Snyder
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Snyder @ 2002-02-01 14:35 UTC (permalink / raw)
  To: Elena Zannoni; +Cc: gdb-patches

Elena Zannoni wrote:
> 
> Cool, I like enums. But the formatting of the enum in the .h file is
> non-GNU.  Is symfile.c the only place where these are used? Would it
> be possible to pull the enum inside symfile.c, if this is the case?
> 
> Thanks
> Elena

The problem is that the variable itself is referred to 
by other files.  It would require some jumping thru hoops
to declare the variable in the header file, but not the 
enum.

> 
> Michael Snyder writes:
>  >
>  > 2002-01-31  Michael Snyder  <msnyder@redhat.com>
>  >
>  >      * symfile.h (enum overlay_debugging_state):
>  >      Define enum constant values for overlay mode.
>  >      * symfile.c (overlay_debugging): Use enums instead of literals.
>  >      (overlay_is_mapped, overlay_auto_command,
>  >      overlay_manual_command): Ditto.
>  >
> 
>  > Index: symfile.h
>  > ===================================================================
>  > RCS file: /cvs/src/src/gdb/symfile.h,v
>  > retrieving revision 1.11
>  > diff -p -r1.11 symfile.h
>  > *** symfile.h        2001/12/07 12:10:15     1.11
>  > --- symfile.h        2002/02/01 01:10:58
>  > *************** extern void find_lowest_section (bfd *,
>  > *** 253,259 ****
>  >   extern bfd *symfile_bfd_open (char *);
>  >
>  >   /* Utility functions for overlay sections: */
>  > ! extern int overlay_debugging;
>  >   extern int overlay_cache_invalid;
>  >
>  >   /* return the "mapped" overlay section  containing the PC */
>  > --- 253,263 ----
>  >   extern bfd *symfile_bfd_open (char *);
>  >
>  >   /* Utility functions for overlay sections: */
>  > ! extern enum overlay_debugging_state {
>  > !   ovly_off,
>  > !   ovly_on,
>  > !   ovly_auto
>  > ! } overlay_debugging;
>  >   extern int overlay_cache_invalid;
>  >
>  >   /* return the "mapped" overlay section  containing the PC */


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

end of thread, other threads:[~2002-02-01 22:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-31 17:15 [PATCH] Replace some literal consts with enums Michael Snyder
2002-01-31 17:23 ` Andrew Cagney
2002-01-31 18:45 ` Elena Zannoni
2002-02-01 14:35   ` Michael Snyder

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