* somread.c (som_symtab_read): Handle dynamic relocation for both
text and data symbols. (som_symfile_offsets): If objfile is a shared library, then get text and data offsets from the shared library structures. * somsolib.c (som_solib_add): Copy the bfd pointer from the objfile rather than reopening the file again. (som_solib_section_offsets): New function. * somsolib.h (som_solib_section_offsets): Declare.
This commit is contained in:
parent
257fcf3621
commit
506af7a79c
|
@ -1,3 +1,14 @@
|
||||||
|
Thu Feb 9 12:09:09 1995 Jeff Law (law@snake.cs.utah.edu)
|
||||||
|
|
||||||
|
* somread.c (som_symtab_read): Handle dynamic relocation for both
|
||||||
|
text and data symbols.
|
||||||
|
(som_symfile_offsets): If objfile is a shared library, then get
|
||||||
|
text and data offsets from the shared library structures.
|
||||||
|
* somsolib.c (som_solib_add): Copy the bfd pointer from the
|
||||||
|
objfile rather than reopening the file again.
|
||||||
|
(som_solib_section_offsets): New function.
|
||||||
|
* somsolib.h (som_solib_section_offsets): Declare.
|
||||||
|
|
||||||
Wed Feb 8 20:32:18 1995 Jim Kingdon <kingdon@deneb.cygnus.com>
|
Wed Feb 8 20:32:18 1995 Jim Kingdon <kingdon@deneb.cygnus.com>
|
||||||
|
|
||||||
* config/sparc/tm-sun4sol2.h, dbxread.c: Rename
|
* config/sparc/tm-sun4sol2.h, dbxread.c: Rename
|
||||||
|
|
|
@ -103,11 +103,11 @@ som_symtab_read (abfd, objfile, section_offsets)
|
||||||
struct symbol_dictionary_record *buf, *bufp, *endbufp;
|
struct symbol_dictionary_record *buf, *bufp, *endbufp;
|
||||||
char *symname;
|
char *symname;
|
||||||
CONST int symsize = sizeof (struct symbol_dictionary_record);
|
CONST int symsize = sizeof (struct symbol_dictionary_record);
|
||||||
CORE_ADDR text_offset;
|
CORE_ADDR text_offset, data_offset;
|
||||||
|
|
||||||
|
|
||||||
/* FIXME. Data stuff needs dynamic relocation too! */
|
|
||||||
text_offset = ANOFFSET (section_offsets, 0);
|
text_offset = ANOFFSET (section_offsets, 0);
|
||||||
|
data_offset = ANOFFSET (section_offsets, 1);
|
||||||
|
|
||||||
number_of_symbols = bfd_get_symcount (abfd);
|
number_of_symbols = bfd_get_symcount (abfd);
|
||||||
|
|
||||||
|
@ -190,6 +190,7 @@ som_symtab_read (abfd, objfile, section_offsets)
|
||||||
|
|
||||||
case ST_DATA:
|
case ST_DATA:
|
||||||
symname = bufp->name.n_strx + stringtab;
|
symname = bufp->name.n_strx + stringtab;
|
||||||
|
bufp->symbol_value += data_offset;
|
||||||
ms_type = mst_data;
|
ms_type = mst_data;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -270,6 +271,7 @@ som_symtab_read (abfd, objfile, section_offsets)
|
||||||
|
|
||||||
case ST_DATA:
|
case ST_DATA:
|
||||||
symname = bufp->name.n_strx + stringtab;
|
symname = bufp->name.n_strx + stringtab;
|
||||||
|
bufp->symbol_value += data_offset;
|
||||||
ms_type = mst_file_data;
|
ms_type = mst_file_data;
|
||||||
goto check_strange_names;
|
goto check_strange_names;
|
||||||
|
|
||||||
|
@ -411,8 +413,13 @@ som_symfile_offsets (objfile, addr)
|
||||||
sizeof (struct section_offsets)
|
sizeof (struct section_offsets)
|
||||||
+ sizeof (section_offsets->offsets) * (SECT_OFF_MAX-1));
|
+ sizeof (section_offsets->offsets) * (SECT_OFF_MAX-1));
|
||||||
|
|
||||||
for (i = 0; i < SECT_OFF_MAX; i++)
|
/* First see if we're a shared library. If so, get the section
|
||||||
ANOFFSET (section_offsets, i) = addr;
|
offsets from the library, else get them from addr. */
|
||||||
|
if (!som_solib_section_offsets (objfile, section_offsets))
|
||||||
|
{
|
||||||
|
for (i = 0; i < SECT_OFF_MAX; i++)
|
||||||
|
ANOFFSET (section_offsets, i) = addr;
|
||||||
|
}
|
||||||
|
|
||||||
return section_offsets;
|
return section_offsets;
|
||||||
}
|
}
|
||||||
|
|
|
@ -338,8 +338,7 @@ som_solib_add (arg_string, from_tty, target)
|
||||||
addr = (CORE_ADDR)new_so->som_solib.next;
|
addr = (CORE_ADDR)new_so->som_solib.next;
|
||||||
|
|
||||||
new_so->objfile = symbol_file_add (name, from_tty, text_addr, 0, 0, 0);
|
new_so->objfile = symbol_file_add (name, from_tty, text_addr, 0, 0, 0);
|
||||||
new_so->abfd = bfd_openr (name, gnutarget);
|
new_so->abfd = new_so->objfile->obfd;
|
||||||
new_so->abfd->cacheable = true;
|
|
||||||
|
|
||||||
if (!bfd_check_format (new_so->abfd, bfd_object))
|
if (!bfd_check_format (new_so->abfd, bfd_object))
|
||||||
{
|
{
|
||||||
|
@ -571,6 +570,43 @@ som_solib_get_got_by_pc (addr)
|
||||||
return got_value;
|
return got_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
som_solib_section_offsets (objfile, offsets)
|
||||||
|
struct objfile *objfile;
|
||||||
|
struct section_offsets *offsets;
|
||||||
|
{
|
||||||
|
struct so_list *so_list = so_list_head;
|
||||||
|
|
||||||
|
while (so_list)
|
||||||
|
{
|
||||||
|
/* Oh what a pain! We need the offsets before so_list->objfile
|
||||||
|
is valid. The BFDs will never match. Make a best guess. */
|
||||||
|
if (!strcmp (so_list->som_solib.name, objfile->name))
|
||||||
|
{
|
||||||
|
asection *private_section;
|
||||||
|
|
||||||
|
/* The text offset is easy. */
|
||||||
|
ANOFFSET (offsets, 0) = so_list->som_solib.text_addr;
|
||||||
|
|
||||||
|
/* We should look at presumed_dp in the SOM header, but
|
||||||
|
that's not easily available. This should be OK though. */
|
||||||
|
private_section = bfd_get_section_by_name (objfile->obfd,
|
||||||
|
"$PRIVATE$");
|
||||||
|
if (!private_section)
|
||||||
|
{
|
||||||
|
warning ("Unable to find $PRIVATE$ in shared library!");
|
||||||
|
ANOFFSET (offsets, 1) = 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
ANOFFSET (offsets, 1) = (so_list->som_solib.data_start
|
||||||
|
- private_section->vma);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
so_list = so_list->next;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Dump information about all the currently loaded shared libraries. */
|
/* Dump information about all the currently loaded shared libraries. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -22,6 +22,8 @@ and by Cygnus Support. */
|
||||||
|
|
||||||
#ifdef __STDC__ /* Forward decl's for prototypes */
|
#ifdef __STDC__ /* Forward decl's for prototypes */
|
||||||
struct target_ops;
|
struct target_ops;
|
||||||
|
struct objfile;
|
||||||
|
struct section_offsets;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Called to add symbols from a shared library to gdb's symbol table. */
|
/* Called to add symbols from a shared library to gdb's symbol table. */
|
||||||
|
@ -35,6 +37,9 @@ som_solib_add PARAMS ((char *, int, struct target_ops *));
|
||||||
extern CORE_ADDR
|
extern CORE_ADDR
|
||||||
som_solib_get_got_by_pc PARAMS ((CORE_ADDR));
|
som_solib_get_got_by_pc PARAMS ((CORE_ADDR));
|
||||||
|
|
||||||
|
extern int
|
||||||
|
som_solib_section_offsets PARAMS ((struct objfile *, struct section_offsets *));
|
||||||
|
|
||||||
/* Function to be called when the inferior starts up, to discover the names
|
/* Function to be called when the inferior starts up, to discover the names
|
||||||
of shared libraries that are dynamically linked, the base addresses to
|
of shared libraries that are dynamically linked, the base addresses to
|
||||||
which they are linked, and sufficient information to read in their symbols
|
which they are linked, and sufficient information to read in their symbols
|
||||||
|
|
Loading…
Reference in New Issue