This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[patch] gdbarch_update() -> gdbarch_update_p()


FYI,

I've changed this function's name.  No one was remembering to check the
return status of other function so hopefully the new name will remind
people :-).  I believe I've updated all calls.

	Andrew
2000-08-10  Andrew Cagney  <cagney@ops1.cygnus.com>

	* rs6000-nat.c (set_host_arch): Check value returned by
	gdbarch_update_p.
	* gdbarch.sh (gdbarch_update_p): Rename gdbarch_update.
	* gdbarch.h, gdbarch.c: Regenerate
	* arch-utils.c (set_gdbarch_from_file,
 	initialize_current_architecture, set_endian): Update.
 
Index: arch-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.c,v
retrieving revision 1.12
diff -p -r1.12 arch-utils.c
*** arch-utils.c	2000/08/02 11:05:50	1.12
--- arch-utils.c	2000/08/11 01:16:46
*************** set_endian (char *ignore_args, int from_
*** 298,304 ****
  	  struct gdbarch_info info;
  	  memset (&info, 0, sizeof info);
  	  info.byte_order = LITTLE_ENDIAN;
! 	  gdbarch_update (info);
  	}
        else
  	{
--- 298,307 ----
  	  struct gdbarch_info info;
  	  memset (&info, 0, sizeof info);
  	  info.byte_order = LITTLE_ENDIAN;
! 	  if (! gdbarch_update_p (info))
! 	    {
! 	      printf_unfiltered ("Little endian target not supported by GDB\n");
! 	    }
  	}
        else
  	{
*************** set_endian (char *ignore_args, int from_
*** 313,319 ****
  	  struct gdbarch_info info;
  	  memset (&info, 0, sizeof info);
  	  info.byte_order = BIG_ENDIAN;
! 	  gdbarch_update (info);
  	}
        else
  	{
--- 316,325 ----
  	  struct gdbarch_info info;
  	  memset (&info, 0, sizeof info);
  	  info.byte_order = BIG_ENDIAN;
! 	  if (! gdbarch_update_p (info))
! 	    {
! 	      printf_unfiltered ("Big endian target not supported by GDB\n");
! 	    }
  	}
        else
  	{
*************** set_architecture (char *ignore_args, int
*** 484,490 ****
        info.bfd_arch_info = bfd_scan_arch (set_architecture_string);
        if (info.bfd_arch_info == NULL)
  	internal_error ("set_architecture: bfd_scan_arch failed");
!       if (gdbarch_update (info))
  	target_architecture_auto = 0;
        else
  	printf_unfiltered ("Architecture `%s' not reconized.\n",
--- 490,496 ----
        info.bfd_arch_info = bfd_scan_arch (set_architecture_string);
        if (info.bfd_arch_info == NULL)
  	internal_error ("set_architecture: bfd_scan_arch failed");
!       if (gdbarch_update_p (info))
  	target_architecture_auto = 0;
        else
  	printf_unfiltered ("Architecture `%s' not reconized.\n",
*************** set_gdbarch_from_file (bfd *abfd)
*** 546,552 ****
        struct gdbarch_info info;
        memset (&info, 0, sizeof info);
        info.abfd = abfd;
!       gdbarch_update (info);
      }
    else
      {
--- 552,559 ----
        struct gdbarch_info info;
        memset (&info, 0, sizeof info);
        info.abfd = abfd;
!       if (! gdbarch_update_p (info))
! 	error ("Architecture of file not reconized.\n");
      }
    else
      {
*************** initialize_current_architecture (void)
*** 641,647 ****
  
    if (GDB_MULTI_ARCH)
      {
!       gdbarch_update (info);
      }
  
    /* Create the ``set architecture'' command appending ``auto'' to the
--- 648,657 ----
  
    if (GDB_MULTI_ARCH)
      {
!       if (! gdbarch_update_p (info))
! 	{
! 	  internal_error ("initialize_current_architecture: Selection of initial architecture failed");
! 	}
      }
  
    /* Create the ``set architecture'' command appending ``auto'' to the
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.37
diff -p -r1.37 gdbarch.sh
*** gdbarch.sh	2000/08/04 03:17:57	1.37
--- gdbarch.sh	2000/08/11 01:16:47
*************** extern void gdbarch_free (struct gdbarch
*** 789,804 ****
     architecture manipulation commands.
  
     The INFO parameter shall be fully initialized (\`\`memset (&INFO,
!    sizeof (info), 0)'' set relevant fields) before gdbarch_update() is
!    called.  gdbarch_update() shall initialize any \`\`default'' fields
!    using information obtained from the previous architecture or
     INFO.ABFD (if specified) before calling the corresponding
!    architectures INIT function. */
  
! extern int gdbarch_update (struct gdbarch_info info);
  
  
  
  /* Register per-architecture data-pointer.
  
     Reserve space for a per-architecture data-pointer.  An identifier
--- 789,806 ----
     architecture manipulation commands.
  
     The INFO parameter shall be fully initialized (\`\`memset (&INFO,
!    sizeof (info), 0)'' set relevant fields) before gdbarch_update_p()
!    is called.  gdbarch_update_p() shall initialize any \`\`default''
!    fields using information obtained from the previous architecture or
     INFO.ABFD (if specified) before calling the corresponding
!    architectures INIT function.
  
!    Returns non-zero if the update succeeds */
  
+ extern int gdbarch_update_p (struct gdbarch_info info);
  
  
+ 
  /* Register per-architecture data-pointer.
  
     Reserve space for a per-architecture data-pointer.  An identifier
*************** gdbarch_list_lookup_by_info (struct gdba
*** 1723,1729 ****
     failed. */
  
  int
! gdbarch_update (struct gdbarch_info info)
  {
    struct gdbarch *new_gdbarch;
    struct gdbarch_list **list;
--- 1725,1731 ----
     failed. */
  
  int
! gdbarch_update_p (struct gdbarch_info info)
  {
    struct gdbarch *new_gdbarch;
    struct gdbarch_list **list;
Index: rs6000-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-nat.c,v
retrieving revision 1.7
diff -p -r1.7 rs6000-nat.c
*** rs6000-nat.c	2000/06/16 21:02:21	1.7
--- rs6000-nat.c	2000/08/11 01:16:47
*************** set_host_arch (int pid)
*** 908,914 ****
    memset (&info, 0, sizeof info);
    info.bfd_arch_info = bfd_get_arch_info (&abfd);
  
!   gdbarch_update (info);
  }
  
  
--- 908,917 ----
    memset (&info, 0, sizeof info);
    info.bfd_arch_info = bfd_get_arch_info (&abfd);
  
!   if (!gdbarch_update_p (info))
!     {
!       internal_error ("set_host_arch: failed to select architecture");
!     }
  }
  
  

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]