This is the mail archive of the gdb-patches@sourceware.cygnus.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 to make top-of-tree GDB compile on Digital UNIX


To get top-of-tree GDB to compile on Digital/Tru64 UNIX,
"gdb/osfsolib.c" needs to be changed not to set the "text_addr" member
of a "struct section_addr_info".

I don't know if this is the correct fix, but at least it allows GDB to
compile; the fix is modeled after recent changes to other "*solib.c"
changes.

I also changed "symbol_add_stub()" and "solib_map_sections()" to take a
"PTR" rather than a "char *" as an argument, similar to the signatures
they have in other "*solib.c" files, to eliminate some compiler
warnings; Elena Zannoni suggested to me that "PTR" is deprecated in
favor of "void *", so perhaps "void *" should be used instead.

I've attached a ChangeLog and a patch.
2000-04-21  Guy Harris  <guy@netapp.com>

	* osfsolib.c  (symbol_add_stub): Don't treat .text as a special
 	section anymore.
	* osfsolib.c  (symbol_add_stub): Make it take a PTR rather than
	a char * as an argument, to eliminate a compiler warning.
	* osfsolib.c  (solib_map_sections): Ditto.

Index: gdb/osfsolib.c
===================================================================
RCS file: /cvs/src/src/gdb/osfsolib.c,v
retrieving revision 1.2
diff -c -3 -p -r1.2 osfsolib.c
*** osfsolib.c	2000/04/04 02:08:52	1.2
--- osfsolib.c	2000/04/22 00:07:48
*************** static void
*** 185,191 ****
  info_sharedlibrary_command PARAMS ((char *, int));
  
  static int
! symbol_add_stub PARAMS ((char *));
  
  static struct so_list *
    find_solib PARAMS ((struct so_list *));
--- 185,191 ----
  info_sharedlibrary_command PARAMS ((char *, int));
  
  static int
! symbol_add_stub PARAMS ((PTR));
  
  static struct so_list *
    find_solib PARAMS ((struct so_list *));
*************** static void
*** 200,206 ****
  xfer_link_map_member PARAMS ((struct so_list *, struct link_map *));
  
  static int
! solib_map_sections PARAMS ((char *));
  
  /*
  
--- 200,206 ----
  xfer_link_map_member PARAMS ((struct so_list *, struct link_map *));
  
  static int
! solib_map_sections PARAMS ((PTR));
  
  /*
  
*************** solib_map_sections PARAMS ((char *));
*** 231,237 ****
  
  static int
  solib_map_sections (arg)
!      char *arg;
  {
    struct so_list *so = (struct so_list *) arg;	/* catch_errors bogon */
    char *filename;
--- 231,237 ----
  
  static int
  solib_map_sections (arg)
!      PTR arg;
  {
    struct so_list *so = (struct so_list *) arg;	/* catch_errors bogon */
    char *filename;
*************** xfer_link_map_member (so_list_ptr, lm)
*** 494,500 ****
  	}
  #endif
  
!       catch_errors (solib_map_sections, (char *) so_list_ptr,
  		    "Error while mapping shared library sections:\n",
  		    RETURN_MASK_ALL);
      }
--- 494,500 ----
  	}
  #endif
  
!       catch_errors (solib_map_sections, so_list_ptr,
  		    "Error while mapping shared library sections:\n",
  		    RETURN_MASK_ALL);
      }
*************** find_solib (so_list_ptr)
*** 574,586 ****
  
  static int
  symbol_add_stub (arg)
!      char *arg;
  {
    register struct so_list *so = (struct so_list *) arg;		/* catch_errs bogon */
    CORE_ADDR text_addr = 0;
!   struct section_addr_info section_addrs;
  
!   memset (&section_addrs, 0, sizeof (section_addrs));
    if (so->textsection)
      text_addr = so->textsection->addr;
    else if (so->abfd != NULL)
--- 574,588 ----
  
  static int
  symbol_add_stub (arg)
!      PTR arg;
  {
    register struct so_list *so = (struct so_list *) arg;		/* catch_errs bogon */
    CORE_ADDR text_addr = 0;
!   struct section_addr_info *sap;
!   int i;
!   asection *text_section;
  
!   /* Find the shared object's text segment.  */
    if (so->textsection)
      text_addr = so->textsection->addr;
    else if (so->abfd != NULL)
*************** symbol_add_stub (arg)
*** 597,606 ****
        if (lowest_sect)
  	text_addr = bfd_section_vma (so->abfd, lowest_sect) + LM_OFFSET (so);
      }
  
!   section_addrs.text_addr = text_addr;
    so->objfile = symbol_file_add (so->so_name, so->from_tty,
! 				 &section_addrs, 0, OBJF_SHARED);
    return (1);
  }
  
--- 599,619 ----
        if (lowest_sect)
  	text_addr = bfd_section_vma (so->abfd, lowest_sect) + LM_OFFSET (so);
      }
+ 
+   sap = build_section_addr_info_from_section_table (so->sections,
+                                                     so->sections_end);
  
!   /* Look for the index for the .text section in the sap structure. */
!   text_section = bfd_get_section_by_name (so->abfd, ".text");
!   for (i = 0; i < MAX_SECTIONS && sap->other[i].name; i++)
!     if (sap->other[i].sectindex == text_section->index)
!       break;
!   
!   sap->other[i].addr = text_addr;
    so->objfile = symbol_file_add (so->so_name, so->from_tty,
! 				 sap, 0, OBJF_SHARED);
!   free_section_addr_info (sap);
! 
    return (1);
  }
  
*************** solib_add (arg_string, from_tty, target)
*** 690,696 ****
  		}
  	    }
  	  else if (catch_errors
! 		   (symbol_add_stub, (char *) so,
  		    "Error while reading shared library symbols:\n",
  		    RETURN_MASK_ALL))
  	    {
--- 703,709 ----
  		}
  	    }
  	  else if (catch_errors
! 		   (symbol_add_stub, so,
  		    "Error while reading shared library symbols:\n",
  		    RETURN_MASK_ALL))
  	    {

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