diff options
author | Kung Hsu <kung@cygnus> | 1994-03-01 23:13:56 +0000 |
---|---|---|
committer | Kung Hsu <kung@cygnus> | 1994-03-01 23:13:56 +0000 |
commit | 1340861c99fc5ca7f4acacbdaa449f1d4c57eb80 (patch) | |
tree | 81dddce5ec765062988b2b06eec7dbca18a2e91c /gdb/objfiles.c | |
parent | bb37e7161e6c7f271f56d8b920cb3a0ad06116de (diff) | |
download | gdb-1340861c99fc5ca7f4acacbdaa449f1d4c57eb80.zip gdb-1340861c99fc5ca7f4acacbdaa449f1d4c57eb80.tar.gz gdb-1340861c99fc5ca7f4acacbdaa449f1d4c57eb80.tar.bz2 |
Modified Files:
ChangeLog objfiles.c objfiles.h symfile.c target.c main.c
Makefile.in configure.in
Added Files:
os9kread.c os9kstab.c remote-os9k.c
* os9kread.c: New file to read os9000 style symbo table.
* os9kstab.c: new file to read os9000 style stabs.
* remote-os9k.c: remote protocol talking to os9000 rombug monitor.
* objfiles.c (find_pc_objfile): new function to search objfile
from pc.
* objfiles.c (objfile_relocate_data): new function to relocate
data symbols in symbol table.
* objfiles.h: Add two aux fields in struct objfile to handle
multiple symbol table files situation like in os9000.
* symfile.c: Change so 'symbol-file' command can handle multiple
files. Also call target_link() to get relocation infos.
* target.c (target_link): new function to get relocation info when
a symbol file is requested to load.
* main.c (quit_command): take out 'inferior_pid != 0' condition,
because in cross mode there's no inferior pid, bit they need to
be detached.
Makefile.in: add os9kread.c os9kstab.c and .o's.
configure.in: add i386os9k target.
config/i386/i386os9k.mt: new add.
config/i386/tm-i386os9k.h: new add.
Diffstat (limited to 'gdb/objfiles.c')
-rw-r--r-- | gdb/objfiles.c | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 381a095..40ab8fb 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -421,6 +421,21 @@ free_all_objfiles () clear_symtab_users (); } +struct objfile * +find_pc_objfile(pc) + CORE_ADDR pc; +{ +struct objfile *obj; +struct obj_section *s; + + ALL_OBJFILES (obj) + for (s = obj->sections; s < obj->sections_end; s++) + { + if (s->addr <= pc && s->endaddr > pc) return obj; + } + return (struct objfile *)NULL; +} + /* Relocate OBJFILE to NEW_OFFSETS. There should be OBJFILE->NUM_SECTIONS entries in new_offsets. */ void @@ -540,6 +555,107 @@ objfile_relocate (objfile, new_offsets) } } +/* Relocate OBJFILE to NEW_OFFSETS. There should be OBJFILE->NUM_SECTIONS + entries in new_offsets. */ +void +objfile_relocate_data (objfile, new_offsets) + struct objfile *objfile; + struct section_offsets *new_offsets; +{ + struct section_offsets *delta = (struct section_offsets *) alloca + (sizeof (struct section_offsets) + + objfile->num_sections * sizeof (delta->offsets)); + + { + int i; + int something_changed = 0; + for (i = 0; i < objfile->num_sections; ++i) + { + if (i != SECT_OFF_DATA && i != SECT_OFF_BSS) + ANOFFSET (delta, i) = 0; + else + ANOFFSET (delta, i) = ANOFFSET(new_offsets, i) + - ANOFFSET (objfile->section_offsets, i); + if (ANOFFSET (delta, i) != 0) + something_changed = 1; + } + if (!something_changed) + return; + } + + /* OK, get all the symtabs. */ + { + struct symtab *s; + + for (s = objfile->symtabs; s; s = s->next) + { + struct linetable *l; + struct blockvector *bv; + int i; + + /* Don't relocate a shared blockvector more than once. */ + if (!s->primary) + continue; + + bv = BLOCKVECTOR (s); + for (i = 0; i < BLOCKVECTOR_NBLOCKS (bv); ++i) + { + struct block *b; + int j; + + b = BLOCKVECTOR_BLOCK (bv, i); + BLOCK_START (b) += ANOFFSET (delta, s->block_line_section); + BLOCK_END (b) += ANOFFSET (delta, s->block_line_section); + + for (j = 0; j < BLOCK_NSYMS (b); ++j) + { + struct symbol *sym = BLOCK_SYM (b, j); + /* The RS6000 code from which this was taken skipped + any symbols in STRUCT_NAMESPACE or UNDEF_NAMESPACE. + But I'm leaving out that test, on the theory that + they can't possibly pass the tests below. */ + if ((SYMBOL_CLASS (sym) == LOC_LABEL + || SYMBOL_CLASS (sym) == LOC_STATIC) + && SYMBOL_SECTION (sym) >= 0) + { + SYMBOL_VALUE_ADDRESS (sym) += + ANOFFSET (delta, SYMBOL_SECTION (sym)); + } + } + } + } + } + + { + struct partial_symbol *psym; + + for (psym = objfile->global_psymbols.list; + psym < objfile->global_psymbols.next; + psym++) + if (SYMBOL_SECTION (psym) >= 0) + SYMBOL_VALUE_ADDRESS (psym) += ANOFFSET (delta, SYMBOL_SECTION (psym)); + for (psym = objfile->static_psymbols.list; + psym < objfile->static_psymbols.next; + psym++) + if (SYMBOL_SECTION (psym) >= 0) + SYMBOL_VALUE_ADDRESS (psym) += ANOFFSET (delta, SYMBOL_SECTION (psym)); + } + + { + struct minimal_symbol *msym; + ALL_OBJFILE_MSYMBOLS (objfile, msym) + if (SYMBOL_SECTION (msym) >= 0) + SYMBOL_VALUE_ADDRESS (msym) += ANOFFSET (delta, SYMBOL_SECTION (msym)); + } + + { + int i; + for (i = 0; i < objfile->num_sections; ++i) + if (i == SECT_OFF_DATA || i == SECT_OFF_BSS) + ANOFFSET (objfile->section_offsets, i) = ANOFFSET (new_offsets, i); + } +} + /* Many places in gdb want to test just to see if we have any partial symbols available. This function returns zero if none are currently available, nonzero otherwise. */ |