aboutsummaryrefslogtreecommitdiff
path: root/gdb/dbxread.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/dbxread.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/dbxread.c')
-rw-r--r--gdb/dbxread.c59
1 files changed, 33 insertions, 26 deletions
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 74667e4..25302de 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -488,17 +488,17 @@ record_minimal_symbol (name, address, type, objfile)
{
case N_TEXT | N_EXT:
ms_type = mst_text;
- section = SECT_OFF_TEXT;
+ section = SECT_OFF_TEXT (objfile);
bfd_section = DBX_TEXT_SECTION (objfile);
break;
case N_DATA | N_EXT:
ms_type = mst_data;
- section = SECT_OFF_DATA;
+ section = SECT_OFF_DATA (objfile);
bfd_section = DBX_DATA_SECTION (objfile);
break;
case N_BSS | N_EXT:
ms_type = mst_bss;
- section = SECT_OFF_BSS;
+ section = SECT_OFF_BSS (objfile);
bfd_section = DBX_BSS_SECTION (objfile);
break;
case N_ABS | N_EXT:
@@ -509,7 +509,7 @@ record_minimal_symbol (name, address, type, objfile)
#ifdef N_SETV
case N_SETV | N_EXT:
ms_type = mst_data;
- section = SECT_OFF_DATA;
+ section = SECT_OFF_DATA (objfile);
bfd_section = DBX_DATA_SECTION (objfile);
break;
case N_SETV:
@@ -517,7 +517,7 @@ record_minimal_symbol (name, address, type, objfile)
of going over many .o files, it doesn't make sense to have one
file local. */
ms_type = mst_file_data;
- section = SECT_OFF_DATA;
+ section = SECT_OFF_DATA (objfile);
bfd_section = DBX_DATA_SECTION (objfile);
break;
#endif
@@ -526,7 +526,7 @@ record_minimal_symbol (name, address, type, objfile)
case N_FN:
case N_FN_SEQ:
ms_type = mst_file_text;
- section = SECT_OFF_TEXT;
+ section = SECT_OFF_TEXT (objfile);
bfd_section = DBX_TEXT_SECTION (objfile);
break;
case N_DATA:
@@ -547,12 +547,12 @@ record_minimal_symbol (name, address, type, objfile)
if (VTBL_PREFIX_P ((tempstring)))
ms_type = mst_data;
}
- section = SECT_OFF_DATA;
+ section = SECT_OFF_DATA (objfile);
bfd_section = DBX_DATA_SECTION (objfile);
break;
case N_BSS:
ms_type = mst_file_bss;
- section = SECT_OFF_BSS;
+ section = SECT_OFF_BSS (objfile);
bfd_section = DBX_BSS_SECTION (objfile);
break;
default:
@@ -1157,17 +1157,17 @@ read_dbx_dynamic_symtab (objfile)
if (bfd_get_section_flags (abfd, sec) & SEC_CODE)
{
- sym_value += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT);
+ sym_value += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
type = N_TEXT;
}
else if (bfd_get_section_flags (abfd, sec) & SEC_DATA)
{
- sym_value += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA);
+ sym_value += ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
type = N_DATA;
}
else if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC)
{
- sym_value += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS);
+ sym_value += ANOFFSET (objfile->section_offsets, SECT_OFF_BSS (objfile));
type = N_BSS;
}
else
@@ -1208,7 +1208,7 @@ read_dbx_dynamic_symtab (objfile)
{
arelent *rel = *relptr;
CORE_ADDR address =
- rel->address + ANOFFSET (objfile->section_offsets, SECT_OFF_DATA);
+ rel->address + ANOFFSET (objfile->section_offsets, SECT_OFF_DATA (objfile));
switch (bfd_get_arch (abfd))
{
@@ -1382,7 +1382,7 @@ read_dbx_symtab (objfile)
/* Don't set pst->texthigh lower than it already is. */
CORE_ADDR text_end =
(lowest_text_address == (CORE_ADDR) -1
- ? (text_addr + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT))
+ ? (text_addr + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)))
: lowest_text_address)
+ text_size;
@@ -1558,6 +1558,7 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
struct partial_symtab *subpst =
allocate_psymtab (include_list[i], objfile);
+ /* Copy the sesction_offsets array from the main psymtab. */
subpst->section_offsets = pst->section_offsets;
subpst->read_symtab_private =
(char *) obstack_alloc (&objfile->psymbol_obstack,
@@ -1738,6 +1739,10 @@ read_ofile_symtab (pst)
sym_size = LDSYMLEN (pst);
text_offset = pst->textlow;
text_size = pst->texthigh - pst->textlow;
+ /* This cannot be simply objfile->section_offsets because of
+ elfstab_offset_sections() which initializes the psymtab section
+ offsets information in a special way, and that is different from
+ objfile->section_offsets. */
section_offsets = pst->section_offsets;
current_objfile = objfile;
@@ -1880,7 +1885,7 @@ read_ofile_symtab (pst)
if (last_source_start_addr > text_offset)
last_source_start_addr = text_offset;
- pst->symtab = end_symtab (text_offset + text_size, objfile, SECT_OFF_TEXT);
+ pst->symtab = end_symtab (text_offset + text_size, objfile, SECT_OFF_TEXT (objfile));
/* Process items which we had to "process_later" due to dependancies
on other stabs. */
@@ -1899,6 +1904,8 @@ read_ofile_symtab (pst)
NAME is the symbol name, in our address space.
SECTION_OFFSETS is a set of amounts by which the sections of this object
file were relocated when it was loaded into memory.
+ Note that these section_offsets are not the
+ objfile->section_offsets but the pst->section_offsets.
All symbols that refer
to memory locations need to be offset by these amounts.
OBJFILE is the object file from which we are reading symbols.
@@ -1942,7 +1949,7 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
if (!block_address_function_relative)
/* N_LBRAC, N_RBRAC and N_SLINE entries are not relative to the
function start address, so just use the text offset. */
- function_start_offset = ANOFFSET (section_offsets, SECT_OFF_TEXT);
+ function_start_offset = ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
/* Something is wrong if we see real data before
seeing a source file name. */
@@ -1982,7 +1989,7 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
}
/* Relocate for dynamic loading */
- valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+ valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
#ifdef SMASH_TEXT_ADDRESS
SMASH_TEXT_ADDRESS (valu);
#endif
@@ -2090,7 +2097,7 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
case N_FN_SEQ:
/* This kind of symbol indicates the start of an object file. */
/* Relocate for dynamic loading */
- valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+ valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
break;
case N_SO:
@@ -2099,7 +2106,7 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
Finish the symbol table of the previous source file
(if any) and start accumulating a new symbol table. */
/* Relocate for dynamic loading */
- valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+ valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
n_opt_found = 0;
@@ -2126,7 +2133,7 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
patch_subfile_names (current_subfile, name);
break; /* Ignore repeated SOs */
}
- end_symtab (valu, objfile, SECT_OFF_TEXT);
+ end_symtab (valu, objfile, SECT_OFF_TEXT (objfile));
end_stabs ();
}
@@ -2149,7 +2156,7 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
included in the compilation of the main source file
(whose name was given in the N_SO symbol.) */
/* Relocate for dynamic loading */
- valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+ valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
start_subfile (name, current_subfile->dirname);
break;
@@ -2227,7 +2234,7 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
elfstab_offset_sections ever starts dealing with the
text offset, and we still need to do this, we need to
invent a SECT_OFF_ADDR_KLUDGE or something. */
- valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+ valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
goto define_a_symbol;
}
}
@@ -2247,22 +2254,22 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
case_N_STSYM: /* Static symbol in data seg */
case N_DSLINE: /* Source line number, data seg */
- valu += ANOFFSET (section_offsets, SECT_OFF_DATA);
+ valu += ANOFFSET (section_offsets, SECT_OFF_DATA (objfile));
goto define_a_symbol;
case_N_LCSYM: /* Static symbol in BSS seg */
case N_BSLINE: /* Source line number, bss seg */
/* N_BROWS: overlaps with N_BSLINE */
- valu += ANOFFSET (section_offsets, SECT_OFF_BSS);
+ valu += ANOFFSET (section_offsets, SECT_OFF_BSS (objfile));
goto define_a_symbol;
case_N_ROSYM: /* Static symbol in Read-only data seg */
- valu += ANOFFSET (section_offsets, SECT_OFF_RODATA);
+ valu += ANOFFSET (section_offsets, SECT_OFF_RODATA (objfile));
goto define_a_symbol;
case N_ENTRY: /* Alternate entry point */
/* Relocate for dynamic loading */
- valu += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+ valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
goto define_a_symbol;
/* The following symbol types we don't know how to process. Handle
@@ -2314,7 +2321,7 @@ process_one_symbol (type, desc, valu, name, section_offsets, objfile)
/* Deal with the SunPRO 3.0 compiler which omits the address
from N_FUN symbols. */
if (type == N_FUN
- && valu == ANOFFSET (section_offsets, SECT_OFF_TEXT))
+ && valu == ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile)))
valu =
find_stab_function_addr (name, last_source_file, objfile);
#endif