som_symfile_finish PARAMS ((struct objfile *));
static void
-som_symtab_read PARAMS ((bfd *, CORE_ADDR, struct objfile *));
+som_symtab_read PARAMS ((bfd *, struct objfile *,
+ struct section_offsets *));
static struct section_offsets *
som_symfile_offsets PARAMS ((struct objfile *, CORE_ADDR));
SYNOPSIS
- void som_symtab_read (bfd *abfd, CORE_ADDR addr,
- struct objfile *objfile)
+ void som_symtab_read (bfd *abfd, struct objfile *objfile,
+ struct section_offsets *section_offsets)
DESCRIPTION
*/
static void
-som_symtab_read (abfd, addr, objfile)
+som_symtab_read (abfd, objfile, section_offsets)
bfd *abfd;
- CORE_ADDR addr;
struct objfile *objfile;
+ struct section_offsets *section_offsets;
{
unsigned int number_of_symbols;
int val, dynamic;
struct symbol_dictionary_record *buf, *bufp, *endbufp;
char *symname;
CONST int symsize = sizeof (struct symbol_dictionary_record);
+ CORE_ADDR text_offset, data_offset;
+
+
+ text_offset = ANOFFSET (section_offsets, 0);
+ data_offset = ANOFFSET (section_offsets, 1);
number_of_symbols = bfd_get_symcount (abfd);
case ST_MILLICODE:
symname = bufp->name.n_strx + stringtab;
ms_type = mst_text;
+ bufp->symbol_value += text_offset;
#ifdef SMASH_TEXT_ADDRESS
SMASH_TEXT_ADDRESS (bufp->symbol_value);
#endif
ms_type = mst_solib_trampoline;
else
ms_type = mst_text;
+ bufp->symbol_value += text_offset;
#ifdef SMASH_TEXT_ADDRESS
SMASH_TEXT_ADDRESS (bufp->symbol_value);
#endif
case ST_STUB:
symname = bufp->name.n_strx + stringtab;
ms_type = mst_solib_trampoline;
+ bufp->symbol_value += text_offset;
#ifdef SMASH_TEXT_ADDRESS
SMASH_TEXT_ADDRESS (bufp->symbol_value);
#endif
case ST_DATA:
symname = bufp->name.n_strx + stringtab;
+ bufp->symbol_value += data_offset;
ms_type = mst_data;
break;
default:
case ST_CODE:
symname = bufp->name.n_strx + stringtab;
ms_type = mst_file_text;
+ bufp->symbol_value += text_offset;
#ifdef SMASH_TEXT_ADDRESS
SMASH_TEXT_ADDRESS (bufp->symbol_value);
#endif
the nasty habit of placing section symbols from the literal
subspaces in the middle of the program's text. Filter
those out as best we can. Check for first and last character
- being '$'. */
+ being '$'.
+
+ And finally, the newer HP compilers emit crud like $PIC_foo$N
+ in some circumstance (PIC code I guess). It's also claimed
+ that they emit D$ symbols too. What stupidity. */
if ((symname[0] == 'L' && symname[1] == '$')
- || (symname[0] == '$' && symname[strlen(symname) - 1] == '$'))
+ || (symname[0] == '$' && symname[strlen(symname) - 1] == '$')
+ || (symname[0] == 'D' && symname[1] == '$')
+ || (strncmp (symname, "$PIC", 4) == 0))
continue;
break;
case ST_MILLICODE:
symname = bufp->name.n_strx + stringtab;
ms_type = mst_file_text;
+ bufp->symbol_value += text_offset;
#ifdef SMASH_TEXT_ADDRESS
SMASH_TEXT_ADDRESS (bufp->symbol_value);
#endif
ms_type = mst_solib_trampoline;
else
ms_type = mst_file_text;
+ bufp->symbol_value += text_offset;
#ifdef SMASH_TEXT_ADDRESS
SMASH_TEXT_ADDRESS (bufp->symbol_value);
#endif
case ST_STUB:
symname = bufp->name.n_strx + stringtab;
ms_type = mst_solib_trampoline;
+ bufp->symbol_value += text_offset;
#ifdef SMASH_TEXT_ADDRESS
SMASH_TEXT_ADDRESS (bufp->symbol_value);
#endif
case ST_DATA:
symname = bufp->name.n_strx + stringtab;
+ bufp->symbol_value += data_offset;
ms_type = mst_file_data;
goto check_strange_names;
{
bfd *abfd = objfile->obfd;
struct cleanup *back_to;
- CORE_ADDR offset;
init_minimal_symbol_collection ();
back_to = make_cleanup (discard_minimal_symbols, 0);
- /* FIXME, should take a section_offsets param, not just an offset. */
-
- offset = ANOFFSET (section_offsets, 0);
-
/* Process the normal SOM symbol table first. */
- som_symtab_read (abfd, offset, objfile);
+ som_symtab_read (abfd, objfile, section_offsets);
/* Now read information from the stabs debug sections. */
stabsect_build_psymtabs (objfile, section_offsets, mainline,
"$GDB_SYMBOLS$", "$GDB_STRINGS$", "$TEXT$");
-/* start-sanitize-hpread */
/* Now read the native debug information. */
hpread_build_psymtabs (objfile, section_offsets, mainline);
-/* end-sanitize-hpread */
/* Install any minimal symbols that have been collected as the current
minimal symbols for this objfile. */
install_minimal_symbols (objfile);
+ /* Force hppa-tdep.c to re-read the unwind descriptors. */
+ objfile->obj_private = NULL;
do_cleanups (back_to);
}
{
mfree (objfile -> md, objfile -> sym_stab_info);
}
-/* start-sanitize-hpread */
hpread_symfile_finish (objfile);
-/* end-sanitize-hpread */
}
/* SOM specific initialization routine for reading symbols.
som_symfile_init (objfile)
struct objfile *objfile;
{
-/* start-sanitize-hpread */
hpread_symfile_init (objfile);
-/* end-sanitize-hpread */
}
/* SOM specific parsing routine for section offsets.
sizeof (struct section_offsets)
+ sizeof (section_offsets->offsets) * (SECT_OFF_MAX-1));
- for (i = 0; i < SECT_OFF_MAX; i++)
- ANOFFSET (section_offsets, i) = addr;
+ /* First see if we're a shared library. If so, get the section
+ 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;
}