This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: Patch to make top-of-tree GDB compile on Digital UNIX
- To: Guy Harris <guy at netapp dot com>
- Subject: Re: Patch to make top-of-tree GDB compile on Digital UNIX
- From: Elena Zannoni <ezannoni at cygnus dot com>
- Date: Mon, 24 Apr 2000 10:50:44 -0400 (EDT)
- Cc: gdb-patches at sourceware dot cygnus dot com
- References: <200004220016.RAA02113@tooting>
Guy Harris writes:
> 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".
>
Thanks Guy, I missed that one.
> 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.
>
Unfortunately I don't have this platform available for testing,
is anybody willing to give this a spin?
Your changes to symbol_add_stub are actually more than what necessary
for compilation. You have added the use of the function
build_section_addr_info_from_section_table() which Kevin Buettner
introduced for other purposes a few weeks back. It probably works
fine, but a more concise change would just be this:
Index: osfsolib.c
===================================================================
RCS file: /cvs/src/src/gdb/osfsolib.c,v
retrieving revision 1.2
diff -c -r1.2 osfsolib.c
*** osfsolib.c 2000/04/04 02:08:52 1.2
--- osfsolib.c 2000/04/24 14:42:07
***************
*** 598,604 ****
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,
§ion_addrs, 0, OBJF_SHARED);
return (1);
--- 598,605 ----
text_addr = bfd_section_vma (so->abfd, lowest_sect) + LM_OFFSET (so);
}
! section_addrs.other[0].addr = text_addr;
! section_addrs.other[0].name = ".text";
so->objfile = symbol_file_add (so->so_name, so->from_tty,
§ion_addrs, 0, OBJF_SHARED);
return (1);
I don't think we have a maintainer for this platform, do we?
Elena
> 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 (§ion_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,
> ! §ion_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))
> {