aboutsummaryrefslogtreecommitdiff
path: root/gdb/mdebugread.c
diff options
context:
space:
mode:
authorStu Grossman <grossman@cygnus>1994-03-21 19:57:38 +0000
committerStu Grossman <grossman@cygnus>1994-03-21 19:57:38 +0000
commit72bba93b85e2e8c887df447c4237d0e7c21d07d8 (patch)
tree9f5fb008f8a97b4b4acd26c64fd1802442d63b36 /gdb/mdebugread.c
parent4fd5eed484d95b5a5647a0bba76533ba66cb57a3 (diff)
downloadgdb-72bba93b85e2e8c887df447c4237d0e7c21d07d8.zip
gdb-72bba93b85e2e8c887df447c4237d0e7c21d07d8.tar.gz
gdb-72bba93b85e2e8c887df447c4237d0e7c21d07d8.tar.bz2
Mon Mar 21 11:02:51 1994 Stu Grossman (grossman at cygnus.com)
* alpha-tdep.c: Gobs of changes (many imported from mips-tdep) to improve remote debugging efficiency. Also fixed problems with doing function calls for programs with no entry points. * infcmd.c (run_stack_dummy): Use CALL_DUMMY_ADDRESS instead of entry_point_address. * inferior.h (PC_IN_CALL_DUMMY): ditto. * mdebugread.c (parse_symbol, parse_procedure, parse_external, parse_lines): Pass section_offsets info to these routines so that we can relocate symbol table entries upon readin. * (psymtab_to_symtab_1): Set symtab->primary to tell objfile_relocate to do relocations for our symbols. * (ecoff_relocate_efi): New routine to relocate adr field of PDRs (which hang off of the symbol table). * Use prim_record_minimal_symbols_and_info instead of prim_record_minimal_symbols to supply section info to make minimal symbol relocations work. * minsyms.c (prim_record_minimal_symbols_and_info): If section is -1, try to deduce it from ms_type. * objfiles.c (objfile_relocate): Use ALL_OBJFILE_SYMTABS where appropriate. Handle relocation of MIPS_EFI symbols special. Also, add code to relocate objfile->sections data structure. * remote.c (get_offsets): Use new protocol message to acquire section offsets from the target. * (remote_wait): Get rid of relocation stuff. That's all handled by objfile_relocate now. * config/alpha/alpha-nw.mt (TM_FILE): Use tm-alphanw.h. * config/alpha/tm-alpha.h: Define CALL_DUMMY_ADDRESS, and VM_MIN_ADDRESS. * config/alpha/tm-alphanw.h: DECR_PC_AFTER_BREAK=0, VM_MIN_ADDRESS=0.
Diffstat (limited to 'gdb/mdebugread.c')
-rw-r--r--gdb/mdebugread.c92
1 files changed, 68 insertions, 24 deletions
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index 4e71322..7471f1e 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -315,7 +315,7 @@ static struct blockvector *
new_bvect PARAMS ((int));
static int
-parse_symbol PARAMS ((SYMR *, union aux_ext *, char *, int));
+parse_symbol PARAMS ((SYMR *, union aux_ext *, char *, int, struct section_offsets *));
static struct type *
parse_type PARAMS ((int, union aux_ext *, unsigned int, int *, int, char *));
@@ -648,11 +648,12 @@ add_pending (fh, sh, t)
SYMR's handled (normally one). */
static int
-parse_symbol (sh, ax, ext_sh, bigend)
+parse_symbol (sh, ax, ext_sh, bigend, section_offsets)
SYMR *sh;
union aux_ext *ax;
char *ext_sh;
int bigend;
+ struct section_offsets *section_offsets;
{
const bfd_size_type external_sym_size = debug_swap->external_sym_size;
void (* const swap_sym_in) PARAMS ((bfd *, PTR, SYMR *)) =
@@ -674,6 +675,19 @@ parse_symbol (sh, ax, ext_sh, bigend)
else
name = debug_info->ss + cur_fdr->issBase + sh->iss;
+ switch (sh->sc)
+ {
+ case scText:
+ sh->value += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+ break;
+ case scData:
+ sh->value += ANOFFSET (section_offsets, SECT_OFF_DATA);
+ break;
+ case scBss:
+ sh->value += ANOFFSET (section_offsets, SECT_OFF_BSS);
+ break;
+ }
+
switch (sh->st)
{
case stNil:
@@ -1699,13 +1713,15 @@ upgrade_type (fd, tpp, tq, ax, bigend, sym_name)
to look for the function which contains the MIPS_EFI_SYMBOL_NAME symbol
in question, or NULL to use top_stack->cur_block. */
-static void parse_procedure PARAMS ((PDR *, struct symtab *, unsigned long));
+static void parse_procedure PARAMS ((PDR *, struct symtab *, unsigned long,
+ struct section_offsets *));
static void
-parse_procedure (pr, search_symtab, first_off)
+parse_procedure (pr, search_symtab, first_off, section_offsets)
PDR *pr;
struct symtab *search_symtab;
unsigned long first_off;
+ struct section_offsets *section_offsets;
{
struct symbol *s, *i;
struct block *b;
@@ -1810,7 +1826,8 @@ parse_procedure (pr, search_symtab, first_off)
e = (struct mips_extra_func_info *) SYMBOL_VALUE (i);
e->pdr = *pr;
e->pdr.isym = (long) s;
- e->pdr.adr += cur_fdr->adr - first_off;
+ e->pdr.adr += cur_fdr->adr - first_off
+ + ANOFFSET (section_offsets, SECT_OFF_TEXT);
/* Correct incorrect setjmp procedure descriptor from the library
to make backtrace through setjmp work. */
@@ -1824,6 +1841,20 @@ parse_procedure (pr, search_symtab, first_off)
}
}
+/* Relocate the extra function info pointed to by the symbol table. */
+
+void
+ecoff_relocate_efi (sym, delta)
+ struct symbol *sym;
+ CORE_ADDR delta;
+{
+ struct mips_extra_func_info *e;
+
+ e = (struct mips_extra_func_info *) SYMBOL_VALUE (sym);
+
+ e->pdr.adr += delta;
+}
+
/* Parse the external symbol ES. Just call parse_symbol() after
making sure we know where the aux are for it. For procedures,
parsing of the PDRs has already provided all the needed
@@ -1834,10 +1865,11 @@ parse_procedure (pr, search_symtab, first_off)
This routine clobbers top_stack->cur_block and ->cur_st. */
static void
-parse_external (es, skip_procedures, bigend)
+parse_external (es, skip_procedures, bigend, section_offsets)
EXTR *es;
int skip_procedures;
int bigend;
+ struct section_offsets *section_offsets;
{
union aux_ext *ax;
@@ -1904,7 +1936,7 @@ parse_external (es, skip_procedures, bigend)
case stLabel:
/* Note that the case of a symbol with indexNil must be handled
anyways by parse_symbol(). */
- parse_symbol (&es->asym, ax, (char *) NULL, bigend);
+ parse_symbol (&es->asym, ax, (char *) NULL, bigend, section_offsets);
break;
default:
break;
@@ -1918,11 +1950,12 @@ parse_external (es, skip_procedures, bigend)
with that and do not need to reorder our linetables */
static void
-parse_lines (fh, pr, lt, maxlines)
+parse_lines (fh, pr, lt, maxlines, section_offsets)
FDR *fh;
PDR *pr;
struct linetable *lt;
int maxlines;
+ struct section_offsets *section_offsets;
{
unsigned char *base;
int j, k;
@@ -1932,8 +1965,6 @@ parse_lines (fh, pr, lt, maxlines)
if (fh->cbLine == 0)
return;
- base = debug_info->line + fh->cbLineOffset;
-
/* Scan by procedure descriptors */
k = 0;
for (j = 0; j < fh->cpd; j++, pr++)
@@ -1956,7 +1987,9 @@ parse_lines (fh, pr, lt, maxlines)
halt = base + fh->cbLine;
base += pr->cbLineOffset;
- adr = fh->adr + pr->adr - first_off;
+ adr = fh->adr + pr->adr - first_off
+ + ANOFFSET (section_offsets, SECT_OFF_TEXT);
+
l = adr >> 2; /* in words */
for (lineno = pr->lnLow; base < halt; )
{
@@ -2286,9 +2319,11 @@ parse_partial_symbols (objfile, section_offsets)
{
if (sh.st == stProc || sh.st == stStaticProc)
{
- long procaddr = sh.value;
+ long procaddr;
long isym;
-
+
+ sh.value += ANOFFSET (section_offsets, SECT_OFF_TEXT);
+ procaddr = sh.value;
isym = AUX_GET_ISYM (fh->fBigendian,
(debug_info->external_aux
@@ -2358,8 +2393,9 @@ parse_partial_symbols (objfile, section_offsets)
int new_sdx;
case stStaticProc:
- prim_record_minimal_symbol (name, sh.value, mst_file_text,
- objfile);
+ prim_record_minimal_symbol_and_info (name, sh.value,
+ mst_file_text, NULL,
+ SECT_OFF_TEXT, objfile);
/* FALLTHROUGH */
@@ -2427,11 +2463,15 @@ parse_partial_symbols (objfile, section_offsets)
|| sh.sc == scRData
|| sh.sc == scPData
|| sh.sc == scXData)
- prim_record_minimal_symbol (name, sh.value, mst_file_data,
- objfile);
+ prim_record_minimal_symbol_and_info (name, sh.value,
+ mst_file_data, NULL,
+ SECT_OFF_DATA,
+ objfile);
else
- prim_record_minimal_symbol (name, sh.value, mst_file_bss,
- objfile);
+ prim_record_minimal_symbol_and_info (name, sh.value,
+ mst_file_bss, NULL,
+ SECT_OFF_BSS,
+ objfile);
class = LOC_STATIC;
break;
@@ -2899,7 +2939,7 @@ psymtab_to_symtab_1 (pst, filename)
first_off = pr.adr;
first_pdr = 0;
}
- parse_procedure (&pr, st, first_off);
+ parse_procedure (&pr, st, first_off, pst->section_offsets);
}
}
else
@@ -2966,7 +3006,7 @@ psymtab_to_symtab_1 (pst, filename)
(*swap_sym_in) (cur_bfd, sym_ptr, &sh);
c = parse_symbol (&sh,
debug_info->external_aux + fh->iauxBase,
- sym_ptr, fh->fBigendian);
+ sym_ptr, fh->fBigendian, pst->section_offsets);
sym_ptr += c * external_sym_size;
}
@@ -2995,7 +3035,8 @@ psymtab_to_symtab_1 (pst, filename)
pdr_ptr += external_pdr_size, pdr_in++)
(*swap_pdr_in) (cur_bfd, pdr_ptr, pdr_in);
- parse_lines (fh, pr_block, lines, maxlines);
+ parse_lines (fh, pr_block, lines, maxlines,
+ pst->section_offsets);
if (lines->nitems < fh->cline)
lines = shrink_linetable (lines);
@@ -3003,7 +3044,8 @@ psymtab_to_symtab_1 (pst, filename)
pdr_in = pr_block;
pdr_in_end = pdr_in + fh->cpd;
for (; pdr_in < pdr_in_end; pdr_in++)
- parse_procedure (pdr_in, 0, pr_block->adr);
+ parse_procedure (pdr_in, 0, pr_block->adr,
+ pst->section_offsets);
do_cleanups (old_chain);
}
@@ -3025,7 +3067,7 @@ psymtab_to_symtab_1 (pst, filename)
ext_ptr = PST_PRIVATE (pst)->extern_tab;
for (i = PST_PRIVATE (pst)->extern_count; --i >= 0; ext_ptr++)
- parse_external (ext_ptr, 1, fh->fBigendian);
+ parse_external (ext_ptr, 1, fh->fBigendian, pst->section_offsets);
/* If there are undefined symbols, tell the user.
The alpha has an undefined symbol for every symbol that is
@@ -3041,6 +3083,8 @@ psymtab_to_symtab_1 (pst, filename)
}
pop_parse_stack ();
+ st->primary = 1;
+
/* Sort the symbol table now, we are done adding symbols to it.*/
sort_symtab_syms (st);