aboutsummaryrefslogtreecommitdiff
path: root/gdb/coffread.c
diff options
context:
space:
mode:
authorElena Zannoni <ezannoni@kwikemart.cygnus.com>2000-05-04 16:52:34 +0000
committerElena Zannoni <ezannoni@kwikemart.cygnus.com>2000-05-04 16:52:34 +0000
commitb8fbeb1874605f3dfe03e0b3ced670f6308b95f5 (patch)
treeba47cc4aeefd9f6fd6515a2a4f5fe296511d6bf3 /gdb/coffread.c
parent70d1b0e82047b6bb257d95311fce2689dae98074 (diff)
downloadgdb-b8fbeb1874605f3dfe03e0b3ced670f6308b95f5.zip
gdb-b8fbeb1874605f3dfe03e0b3ced670f6308b95f5.tar.gz
gdb-b8fbeb1874605f3dfe03e0b3ced670f6308b95f5.tar.bz2
Elena Zannoni <ezannoni@kwikemart.cygnus.com>
* objfiles.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS, SECT_OFF_RODATA): Define as functions of OBJFILE. Add sect_index_text, sect_index_data, sect_index_rodata, sect_index_bss to objfile structure. * gdb-stabs.h (SECT_OFF_DATA, SECT_OFF_TEXT, SECT_OFF_BSS, SECT_OFF_RODATA): Remove. * objfiles.c (allocate_objfile): Initialize sect_index_{text,data,bss,rodata} to -1, for error detection. * symfile.c (default_symfile_offsets): Initialize sect_index_{text,data,bss,rodata} from bfd information. * xcoffread.c (xcoff_symfile_offsets): Ditto. * somread.c (som_symfile_offsets): Initialize sect_index_{text,data,bss,rodata}. * coffread.c, dbxread.c, elfread.c, hp-psymtab-read.c, hp-symtab-read.c, hpread.c, mdebugread.c, minsyms.c, mipsread.c, objfiles.c, os9kread.c, pa64solib.c, partial-stab.h, remote-os9k.c, remote-vx.c, remote.c, rs6000-nat.c, somsolib.c, stabsread.c, symfile.c, xcoffread.c: Update use of SECT_OFF_{TEXT,DATA,BSS,RODATA} to depend on the current objfile. * xcoffread.c: Add new field objfile to find_targ_sec_arg.
Diffstat (limited to 'gdb/coffread.c')
-rw-r--r--gdb/coffread.c52
1 files changed, 26 insertions, 26 deletions
diff --git a/gdb/coffread.c b/gdb/coffread.c
index 75a90f7..6f6e6cb 100644
--- a/gdb/coffread.c
+++ b/gdb/coffread.c
@@ -340,7 +340,7 @@ cs_to_section (cs, objfile)
{
asection *sect = NULL;
struct find_targ_sec_arg args;
- int off = SECT_OFF_TEXT;
+ int off = SECT_OFF_TEXT (objfile);
args.targ_index = cs->c_secnum;
args.resultp = &sect;
@@ -349,11 +349,11 @@ cs_to_section (cs, objfile)
{
/* This is the section. Figure out what SECT_OFF_* code it is. */
if (bfd_get_section_flags (abfd, sect) & SEC_CODE)
- off = SECT_OFF_TEXT;
+ off = SECT_OFF_TEXT (objfile);
else if (bfd_get_section_flags (abfd, sect) & SEC_LOAD)
- off = SECT_OFF_DATA;
+ off = SECT_OFF_DATA (objfile);
else
- off = SECT_OFF_BSS;
+ off = SECT_OFF_BSS (objfile);
}
return off;
}
@@ -843,7 +843,7 @@ coff_symtab_read (symtab_offset, nsyms, objfile)
if (ISFCN (cs->c_type) && cs->c_sclass != C_TPDEF)
{
/* Record all functions -- external and static -- in minsyms. */
- tmpaddr = cs->c_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+ tmpaddr = cs->c_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
record_minimal_symbol (cs->c_name, tmpaddr, mst_text, objfile);
fcn_line_ptr = main_aux.x_sym.x_fcnary.x_fcn.x_lnnoptr;
@@ -908,7 +908,7 @@ coff_symtab_read (symtab_offset, nsyms, objfile)
followed by a later file with no symbols. */
if (in_source_file)
complete_symtab (filestring,
- cs->c_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT),
+ cs->c_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)),
main_aux.x_scn.x_scnlen);
in_source_file = 0;
}
@@ -969,10 +969,8 @@ coff_symtab_read (symtab_offset, nsyms, objfile)
|| cs->c_sclass == C_THUMBEXT)
tmpaddr += ANOFFSET (objfile->section_offsets, sec);
- switch (sec)
+ if (sec == SECT_OFF_TEXT (objfile) || sec == SECT_OFF_RODATA (objfile))
{
- case SECT_OFF_TEXT:
- case SECT_OFF_RODATA:
ms_type =
cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXTFUNC
|| cs->c_sclass == C_THUMBEXT ?
@@ -981,21 +979,23 @@ coff_symtab_read (symtab_offset, nsyms, objfile)
if (tmpaddr & 1) /* FIXME: delete this line */
SMASH_TEXT_ADDRESS (tmpaddr);
#endif
- break;
- case SECT_OFF_DATA:
+ }
+ else
+ if (sec == SECT_OFF_DATA (objfile))
+ {
ms_type =
cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT ?
mst_data : mst_file_data;
- break;
- case SECT_OFF_BSS:
+ }
+ else
+ if (sec == SECT_OFF_BSS (objfile))
+ {
ms_type =
cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT ?
mst_data : mst_file_data;
- break;
- default:
- ms_type = mst_unknown;
- break;
- }
+ }
+ else
+ ms_type = mst_unknown;
}
if (cs->c_name[0] != '@' /* Skip tdesc symbols */ )
@@ -1099,11 +1099,11 @@ coff_symtab_read (symtab_offset, nsyms, objfile)
of the epilogue. */
cs->c_value
+ FUNCTION_EPILOGUE_SIZE
- + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT),
+ + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)),
#else
fcn_cs_saved.c_value
+ fcn_aux_saved.x_sym.x_misc.x_fsize
- + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT),
+ + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)),
#endif
objfile
);
@@ -1115,7 +1115,7 @@ coff_symtab_read (symtab_offset, nsyms, objfile)
if (STREQ (cs->c_name, ".bb"))
{
tmpaddr = cs->c_value;
- tmpaddr += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+ tmpaddr += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
push_context (++depth, tmpaddr);
}
else if (STREQ (cs->c_name, ".eb"))
@@ -1135,7 +1135,7 @@ coff_symtab_read (symtab_offset, nsyms, objfile)
if (local_symbols && context_stack_depth > 0)
{
tmpaddr =
- cs->c_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+ cs->c_value + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
/* Make a block for the local symbols within. */
finish_block (0, &local_symbols, new->old_blocks,
new->start_addr, tmpaddr, objfile);
@@ -1427,7 +1427,7 @@ enter_linenos (file_offset, first_line, last_line, objfile)
if (L_LNNO32 (&lptr) && L_LNNO32 (&lptr) <= last_line)
record_line (current_subfile, first_line + L_LNNO32 (&lptr),
lptr.l_addr.l_paddr
- + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT));
+ + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)));
else
break;
}
@@ -1547,7 +1547,7 @@ process_coff_symbol (cs, aux, objfile)
if (ISFCN (cs->c_type))
{
- SYMBOL_VALUE (sym) += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+ SYMBOL_VALUE (sym) += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
SYMBOL_TYPE (sym) =
lookup_function_type (decode_function_type (cs, cs->c_type, aux));
@@ -1577,7 +1577,7 @@ process_coff_symbol (cs, aux, objfile)
case C_EXT:
SYMBOL_CLASS (sym) = LOC_STATIC;
SYMBOL_VALUE_ADDRESS (sym) = (CORE_ADDR) cs->c_value;
- SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+ SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
add_symbol_to_list (sym, &global_symbols);
break;
@@ -1586,7 +1586,7 @@ process_coff_symbol (cs, aux, objfile)
case C_STAT:
SYMBOL_CLASS (sym) = LOC_STATIC;
SYMBOL_VALUE_ADDRESS (sym) = (CORE_ADDR) cs->c_value;
- SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+ SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
if (within_function)
{
/* Static symbol of local scope */