Remove the object file specific fields from the partial symbol table
structure and replace them with a pointer to private data for each different flavor of object file reader to initialize appropriately.
This commit is contained in:
parent
ba04ec6e77
commit
4a35d6e91b
5 changed files with 280 additions and 112 deletions
|
@ -1,3 +1,10 @@
|
|||
Thu Oct 24 01:32:51 1991 Fred Fish (fnf at cygnus.com)
|
||||
|
||||
* dbxread.c, mipsread.c symmisc.c, symtab.c: Remove the object
|
||||
file specific fields from the partial symbol table structure and
|
||||
replace them with a pointer to private data for each different
|
||||
flavor of object file reader to initialize appropriately.
|
||||
|
||||
Tue Oct 22 18:04:32 1991 Stu Grossman (grossman at cygnus.com)
|
||||
|
||||
* infrun.c (wait_for_inferior): Check return value from
|
||||
|
|
|
@ -126,6 +126,25 @@ struct dbx_symfile_info {
|
|||
int desc; /* File descriptor of symbol file */
|
||||
};
|
||||
|
||||
/* Each partial symbol table entry contains a pointer to private data for the
|
||||
read_symtab() function to use when expanding a partial symbol table entry
|
||||
to a full symbol table entry.
|
||||
|
||||
For dbxread this structure contains the offset within the file symbol table
|
||||
of first local symbol for this file, and length (in bytes) of the section
|
||||
of the symbol table devoted to this file's symbols (actually, the section
|
||||
bracketed may contain more than just this file's symbols). If ldsymlen is
|
||||
0, the only reason for this thing's existence is the dependency list.
|
||||
Nothing else will happen when it is read in. */
|
||||
|
||||
#define LDSYMOFF(p) (((struct symloc *)((p)->read_symtab_private))->ldsymoff)
|
||||
#define LDSYMLEN(p) (((struct symloc *)((p)->read_symtab_private))->ldsymlen)
|
||||
|
||||
struct symloc {
|
||||
int ldsymoff;
|
||||
int ldsymlen;
|
||||
};
|
||||
|
||||
extern void qsort ();
|
||||
extern double atof ();
|
||||
extern struct cmd_list_element *cmdlist;
|
||||
|
@ -2017,7 +2036,7 @@ read_dbx_symtab (symfile_name, addr,
|
|||
things like "break c-exp.y:435" need to work (I
|
||||
suppose the psymtab_include_list could be hashed or put
|
||||
in a binary tree, if profiling shows this is a major hog). */
|
||||
if (!strcmp (namestring, pst->filename))
|
||||
if (pst && !strcmp (namestring, pst->filename))
|
||||
continue;
|
||||
{
|
||||
register int i;
|
||||
|
@ -2357,13 +2376,14 @@ read_dbx_symtab (symfile_name, addr,
|
|||
discard_cleanups (old_chain);
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocate and partially fill a partial symtab. It will be
|
||||
* completely filled at the end of the symbol list.
|
||||
/* Allocate and partially fill a partial symtab. It will be
|
||||
completely filled at the end of the symbol list.
|
||||
|
||||
SYMFILE_NAME is the name of the symbol-file we are reading from, and ADDR
|
||||
is the address relative to which its symbols are (incremental) or 0
|
||||
(normal). */
|
||||
|
||||
|
||||
SYMFILE_NAME is the name of the symbol-file we are reading from, and ADDR
|
||||
is the address relative to which its symbols are (incremental) or 0
|
||||
(normal). */
|
||||
static struct partial_symtab *
|
||||
start_psymtab (symfile_name, addr,
|
||||
filename, textlow, ldsymoff, global_syms, static_syms)
|
||||
|
@ -2392,7 +2412,9 @@ start_psymtab (symfile_name, addr,
|
|||
strcpy (result->filename, filename);
|
||||
|
||||
result->textlow = textlow;
|
||||
result->ldsymoff = ldsymoff;
|
||||
result->read_symtab_private = (char *) obstack_alloc (psymbol_obstack,
|
||||
sizeof (struct symloc));
|
||||
LDSYMOFF(result) = ldsymoff;
|
||||
|
||||
result->readin = 0;
|
||||
result->symtab = 0;
|
||||
|
@ -2450,7 +2472,7 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
|
|||
{
|
||||
int i;
|
||||
|
||||
pst->ldsymlen = capping_symbol_offset - pst->ldsymoff;
|
||||
LDSYMLEN(pst) = capping_symbol_offset - LDSYMOFF(pst);
|
||||
pst->texthigh = capping_text;
|
||||
|
||||
pst->n_global_syms =
|
||||
|
@ -2485,8 +2507,10 @@ end_psymtab (pst, include_list, num_includes, capping_symbol_offset,
|
|||
|
||||
subpst->symfile_name = pst->symfile_name;
|
||||
subpst->addr = pst->addr;
|
||||
subpst->ldsymoff =
|
||||
subpst->ldsymlen =
|
||||
subpst->read_symtab_private = (char *) obstack_alloc (psymbol_obstack,
|
||||
sizeof (struct symloc));
|
||||
LDSYMOFF(subpst) =
|
||||
LDSYMLEN(subpst) =
|
||||
subpst->textlow =
|
||||
subpst->texthigh = 0;
|
||||
|
||||
|
@ -2565,7 +2589,7 @@ psymtab_to_symtab_1 (pst, desc, stringtab, stringtab_size, sym_offset)
|
|||
stringtab, stringtab_size, sym_offset);
|
||||
}
|
||||
|
||||
if (pst->ldsymlen) /* Otherwise it's a dummy */
|
||||
if (LDSYMLEN(pst)) /* Otherwise it's a dummy */
|
||||
{
|
||||
/* Init stuff necessary for reading in symbols */
|
||||
free_pendings = 0;
|
||||
|
@ -2578,8 +2602,8 @@ psymtab_to_symtab_1 (pst, desc, stringtab, stringtab_size, sym_offset)
|
|||
lseek (desc, sym_offset, L_SET);
|
||||
pst->symtab =
|
||||
read_ofile_symtab (desc, stringtab, stringtab_size,
|
||||
pst->ldsymoff,
|
||||
pst->ldsymlen, pst->textlow,
|
||||
LDSYMOFF(pst),
|
||||
LDSYMLEN(pst), pst->textlow,
|
||||
pst->texthigh - pst->textlow, pst->addr);
|
||||
sort_symtab_syms (pst->symtab);
|
||||
|
||||
|
@ -2615,7 +2639,7 @@ dbx_psymtab_to_symtab (pst)
|
|||
return;
|
||||
}
|
||||
|
||||
if (pst->ldsymlen || pst->number_of_dependencies)
|
||||
if (LDSYMLEN(pst) || pst->number_of_dependencies)
|
||||
{
|
||||
/* Print the message now, before reading the string table,
|
||||
to avoid disconcerting pauses. */
|
||||
|
|
|
@ -57,6 +57,24 @@ struct coff_exec {
|
|||
struct external_aouthdr a;
|
||||
};
|
||||
|
||||
/* Each partial symbol table entry contains a pointer to private data for the
|
||||
read_symtab() function to use when expanding a partial symbol table entry
|
||||
to a full symbol table entry.
|
||||
|
||||
For mipsread this structure contains the index of the FDR that this psymtab
|
||||
represents and a pointer to the symbol table header HDRR from the symbol
|
||||
file that the psymtab was created from.
|
||||
|
||||
Note: This code is currently untested. -fnf */
|
||||
|
||||
#define FDR_IDX(p) (((struct symloc *)((p)->read_symtab_private))->fdr_idx)
|
||||
#define CUR_HDR(p) (((struct symloc *)((p)->read_symtab_private))->cur_hdr)
|
||||
|
||||
struct symloc {
|
||||
int fdr_idx;
|
||||
HDRR *cur_hdr;
|
||||
};
|
||||
|
||||
/* Things we import explicitly from other modules */
|
||||
|
||||
extern int info_verbose;
|
||||
|
@ -305,8 +323,7 @@ mipscoff_psymtab_to_symtab(pst)
|
|||
fflush(stdout);
|
||||
}
|
||||
/* Restore the header and list of pending typedefs */
|
||||
/* FIXME, we should use private data that is a proper pointer. */
|
||||
cur_hdr = (HDRR *) pst->ldsymlen;
|
||||
cur_hdr = CUR_HDR(pst);
|
||||
|
||||
psymtab_to_symtab_1(pst, pst->filename);
|
||||
|
||||
|
@ -1497,6 +1514,8 @@ parse_lines(fh, lt)
|
|||
delta -= 16;
|
||||
if (delta == -8) {
|
||||
delta = (base[0] << 8) | base[1];
|
||||
if (delta >= 0x8000)
|
||||
delta -= 0x10000;
|
||||
base += 2;
|
||||
}
|
||||
lineno += delta;/* first delta is 0 */
|
||||
|
@ -1556,7 +1575,6 @@ parse_partial_symbols(end_of_text_seg)
|
|||
int end_of_text_seg;
|
||||
{
|
||||
int f_idx, s_idx, h_max, stat_idx;
|
||||
CORE_ADDR dummy, *prevhigh;
|
||||
HDRR *hdr;
|
||||
/* Running pointers */
|
||||
FDR *fh;
|
||||
|
@ -1586,7 +1604,7 @@ parse_partial_symbols(end_of_text_seg)
|
|||
{
|
||||
struct partial_symtab * pst = new_psymtab("");
|
||||
fdr_to_pst[-1].pst = pst;
|
||||
pst->ldsymoff = -1;
|
||||
FDR_IDX(pst) = -1;
|
||||
}
|
||||
|
||||
/* Now scan the FDRs, mostly for dependencies */
|
||||
|
@ -1696,6 +1714,7 @@ parse_partial_symbols(end_of_text_seg)
|
|||
for (f_idx = 0; f_idx < hdr->ifdMax; f_idx++) {
|
||||
fh = f_idx + (FDR *)(cur_hdr->cbFdOffset);
|
||||
pst = fdr_to_pst[f_idx].pst;
|
||||
pst->texthigh = pst->textlow;
|
||||
|
||||
for (s_idx = 0; s_idx < fh->csym; ) {
|
||||
register struct partial_symbol *p;
|
||||
|
@ -1723,6 +1742,17 @@ parse_partial_symbols(end_of_text_seg)
|
|||
/* Skip over procedure to next one. */
|
||||
s_idx = (sh->index + (AUXU *)fh->iauxBase)
|
||||
->isym;
|
||||
{
|
||||
long high;
|
||||
long procaddr = sh->value;
|
||||
|
||||
sh = s_idx + (SYMR *) fh->isymBase - 1;
|
||||
if (sh->st != stEnd)
|
||||
continue;
|
||||
high = procaddr + sh->value;
|
||||
if (high > pst->texthigh)
|
||||
pst->texthigh = high;
|
||||
}
|
||||
continue;
|
||||
case stStatic: /* Variable */
|
||||
SYMBOL_CLASS(p) = LOC_STATIC;
|
||||
|
@ -1734,9 +1764,12 @@ parse_partial_symbols(end_of_text_seg)
|
|||
case stConstant: /* Constant decl */
|
||||
SYMBOL_CLASS(p) = LOC_CONST;
|
||||
break;
|
||||
case stBlock: /* { }, str, un, enum */
|
||||
/* Eventually we want struct names and enum
|
||||
values out of here. FIXME */
|
||||
case stBlock: /* { }, str, un, enum*/
|
||||
if (sh->sc == scInfo) {
|
||||
SYMBOL_NAMESPACE(p) = STRUCT_NAMESPACE;
|
||||
SYMBOL_CLASS(p) = LOC_TYPEDEF;
|
||||
pst->n_static_syms++;
|
||||
}
|
||||
/* Skip over the block */
|
||||
s_idx = sh->index;
|
||||
continue;
|
||||
|
@ -1762,40 +1795,19 @@ parse_partial_symbols(end_of_text_seg)
|
|||
}
|
||||
}
|
||||
|
||||
/* The array (of lists) of globals must be sorted.
|
||||
Take care, since we are at it, of pst->texthigh.
|
||||
|
||||
NOTE: The way we handle textlow/high is incorrect, but good
|
||||
enough for a first approximation. The case we fail is on a
|
||||
file "foo.c" that looks like
|
||||
proc1() {...}
|
||||
#include "bar.c" -- this contains proc2()
|
||||
proc3() {...}
|
||||
where proc3() is attributed to bar.c. But since this is a
|
||||
dependent file it will cause loading of foo.c as well, so
|
||||
everything will be fine at the end. */
|
||||
|
||||
/* First, sort the psymtabs by their textlow addresses. */
|
||||
/* The array (of lists) of globals must be sorted. */
|
||||
reorder_psymtabs();
|
||||
|
||||
/* Now, rip through and fill in "texthigh" from the textlow
|
||||
of the following psymtab. Slimy but it might work.
|
||||
Sort the global psymbols while we're at it. */
|
||||
prevhigh = &dummy;
|
||||
/* Now sort the global psymbols. */
|
||||
for (f_idx = 0; f_idx < hdr->ifdMax; f_idx++) {
|
||||
struct partial_symtab *pst = fdr_to_pst[f_idx].pst;
|
||||
if (pst->n_global_syms > 1)
|
||||
qsort (global_psymbols.list + pst->globals_offset,
|
||||
pst->n_global_syms, sizeof (struct partial_symbol),
|
||||
compare_psymbols);
|
||||
if (pst->textlow) {
|
||||
*prevhigh = pst->textlow;
|
||||
prevhigh = &pst->texthigh;
|
||||
}
|
||||
}
|
||||
|
||||
/* Mark the last code address, and remember it for later */
|
||||
*prevhigh = end_of_text_seg;
|
||||
hdr->cbDnOffset = end_of_text_seg;
|
||||
|
||||
free(&fdr_to_pst[-1]);
|
||||
|
@ -1837,7 +1849,7 @@ parse_fdr(f_idx, lev)
|
|||
}
|
||||
|
||||
/* Make everything point to everything. */
|
||||
pst->ldsymoff = f_idx;
|
||||
FDR_IDX(pst) = f_idx;
|
||||
fdr_to_pst[f_idx].pst = pst;
|
||||
fh->ioptBase = (int)pst;
|
||||
|
||||
|
@ -1900,11 +1912,11 @@ psymtab_to_symtab_1(pst, filename)
|
|||
/* How many symbols will we need */
|
||||
/* FIXME, this does not count enum values. */
|
||||
f_max = pst->n_global_syms + pst->n_static_syms;
|
||||
if (pst->ldsymoff == -1) {
|
||||
if (FDR_IDX(pst) == -1) {
|
||||
fh = 0;
|
||||
st = new_symtab( "unknown", f_max, 0);
|
||||
} else {
|
||||
fh = (FDR *) (cur_hdr->cbFdOffset) + pst->ldsymoff;
|
||||
fh = (FDR *) (cur_hdr->cbFdOffset) + FDR_IDX(pst);
|
||||
f_max += fh->csym + fh->cpd;
|
||||
st = new_symtab(pst->filename, 2 * f_max, 2 * fh->cline);
|
||||
}
|
||||
|
@ -1934,7 +1946,7 @@ psymtab_to_symtab_1(pst, filename)
|
|||
|
||||
/* Now read the symbols for this symtab */
|
||||
|
||||
cur_fd = pst->ldsymoff;
|
||||
cur_fd = FDR_IDX(pst);
|
||||
cur_fdr = fh;
|
||||
cur_stab = st;
|
||||
|
||||
|
@ -2405,8 +2417,9 @@ new_psymtab(name)
|
|||
partial_symtab_list = pst;
|
||||
|
||||
/* Keep a backpointer to the file's symbols */
|
||||
/* FIXME, we should use private data that is a proper pointer. */
|
||||
pst->ldsymlen = (int)cur_hdr;
|
||||
pst->read_symtab_private = (char *) obstack_alloc (psymbol_obstack,
|
||||
sizeof (struct symloc));
|
||||
CUR_HDR(pst) = cur_hdr;
|
||||
|
||||
/* The way to turn this into a symtab is to call... */
|
||||
pst->read_symtab = mipscoff_psymtab_to_symtab;
|
||||
|
@ -2527,6 +2540,7 @@ new_type(name)
|
|||
obstack_alloc (symbol_obstack, sizeof (struct type));
|
||||
|
||||
bzero (t, sizeof (*t));
|
||||
TYPE_VPTR_FIELDNO (t) = -1;
|
||||
TYPE_NAME(t) = name;
|
||||
return t;
|
||||
}
|
||||
|
@ -2549,6 +2563,7 @@ make_type(code, length, uns, name)
|
|||
TYPE_LENGTH(type) = length;
|
||||
TYPE_FLAGS(type) = uns ? TYPE_FLAG_UNSIGNED : 0;
|
||||
TYPE_NAME(type) = name;
|
||||
TYPE_VPTR_FIELDNO (type) = -1;
|
||||
|
||||
return type;
|
||||
}
|
||||
|
|
161
gdb/symmisc.c
161
gdb/symmisc.c
|
@ -3,28 +3,30 @@
|
|||
|
||||
This file is part of GDB.
|
||||
|
||||
GDB is free software; you can redistribute it and/or modify
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 1, or (at your option)
|
||||
any later version.
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GDB is distributed in the hope that it will be useful,
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GDB; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include "defs.h"
|
||||
#include "param.h"
|
||||
#include "symtab.h"
|
||||
#include "bfd.h"
|
||||
#include "symfile.h"
|
||||
#include "breakpoint.h"
|
||||
#include "command.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <obstack.h>
|
||||
|
||||
/* Free all the symtabs that are currently installed,
|
||||
|
@ -94,7 +96,6 @@ free_symtab (s)
|
|||
{
|
||||
register int i, n;
|
||||
register struct blockvector *bv;
|
||||
register struct typevector *tv;
|
||||
|
||||
switch (s->free_code)
|
||||
{
|
||||
|
@ -114,9 +115,6 @@ free_symtab (s)
|
|||
free_symtab_block (BLOCKVECTOR_BLOCK (bv, i));
|
||||
/* Free the blockvector itself. */
|
||||
free (bv);
|
||||
/* Free the type vector. */
|
||||
tv = TYPEVECTOR (s);
|
||||
free (tv);
|
||||
/* Also free the linetable. */
|
||||
|
||||
case free_linetable:
|
||||
|
@ -141,6 +139,7 @@ free_symtab (s)
|
|||
|
||||
static int block_depth ();
|
||||
static void print_symbol ();
|
||||
static void print_partial_symbol ();
|
||||
|
||||
void
|
||||
print_symtabs (filename)
|
||||
|
@ -314,10 +313,6 @@ print_symbol (symbol, depth, outfile)
|
|||
BLOCK_START (SYMBOL_BLOCK_VALUE (symbol)));
|
||||
break;
|
||||
|
||||
case LOC_EXTERNAL:
|
||||
fprintf (outfile, "external at 0x%x", SYMBOL_VALUE_ADDRESS (symbol));
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf (outfile, "botched symbol class %x", SYMBOL_CLASS (symbol));
|
||||
break;
|
||||
|
@ -326,6 +321,140 @@ print_symbol (symbol, depth, outfile)
|
|||
fprintf (outfile, "\n");
|
||||
}
|
||||
|
||||
void
|
||||
print_partial_symtabs (filename)
|
||||
char *filename;
|
||||
{
|
||||
FILE *outfile;
|
||||
struct partial_symtab *p;
|
||||
struct cleanup *cleanups;
|
||||
extern int fclose();
|
||||
|
||||
if (filename == 0)
|
||||
error_no_arg ("file to write partial symbol data in");
|
||||
|
||||
filename = tilde_expand (filename);
|
||||
make_cleanup (free, filename);
|
||||
|
||||
outfile = fopen (filename, "w");
|
||||
if (outfile == 0)
|
||||
perror_with_name (filename);
|
||||
|
||||
cleanups = make_cleanup (fclose, outfile);
|
||||
immediate_quit++;
|
||||
|
||||
for (p = partial_symtab_list; p; p = p->next)
|
||||
{
|
||||
fprintf_filtered (outfile, "Partial symtab for source file %s ",
|
||||
p->filename);
|
||||
fprintf_filtered (outfile, "(object 0x%x)\n\n", p);
|
||||
fprintf_filtered (outfile, " Full symbol table %s been read from %s\n",
|
||||
p->readin ? "has" : "has not yet",
|
||||
p->symfile_name);
|
||||
if (p->readin)
|
||||
fprintf_filtered (outfile, " Was read into symtab at 0x%x by function at 0x%x\n",
|
||||
p->symtab, p->read_symtab);
|
||||
fprintf_filtered (outfile, " Relocate symbols by 0x%x\n", p->addr);
|
||||
fprintf_filtered (outfile, " Symbols cover text addresses 0x%x-0x%x\n",
|
||||
p->textlow, p->texthigh);
|
||||
fprintf_filtered (outfile, " Depends on %d other partial symtabs.\n",
|
||||
p->number_of_dependencies);
|
||||
if (p->n_global_syms > 0)
|
||||
print_partial_symbol (global_psymbols.list + p->globals_offset,
|
||||
p->n_global_syms, "Global", outfile);
|
||||
if (p->n_static_syms > 0)
|
||||
print_partial_symbol (static_psymbols.list + p->statics_offset,
|
||||
p->n_static_syms, "Static", outfile);
|
||||
fprintf_filtered (outfile, "\n\n");
|
||||
}
|
||||
|
||||
immediate_quit--;
|
||||
do_cleanups (cleanups);
|
||||
}
|
||||
|
||||
static void
|
||||
print_partial_symbol (p, count, what, outfile)
|
||||
struct partial_symbol *p;
|
||||
int count;
|
||||
char *what;
|
||||
FILE *outfile;
|
||||
{
|
||||
char *space;
|
||||
char *class;
|
||||
|
||||
fprintf_filtered (outfile, " %s partial symbols:\n", what);
|
||||
while (count-- > 0)
|
||||
{
|
||||
fprintf_filtered (outfile, " `%s', ", SYMBOL_NAME(p));
|
||||
switch (SYMBOL_NAMESPACE (p))
|
||||
{
|
||||
case UNDEF_NAMESPACE:
|
||||
fputs_filtered ("undefined namespace, ", outfile);
|
||||
break;
|
||||
case VAR_NAMESPACE:
|
||||
/* This is the usual thing -- don't print it */
|
||||
break;
|
||||
case STRUCT_NAMESPACE:
|
||||
fputs_filtered ("struct namespace, ", outfile);
|
||||
break;
|
||||
case LABEL_NAMESPACE:
|
||||
fputs_filtered ("label namespace, ", outfile);
|
||||
break;
|
||||
default:
|
||||
fputs_filtered ("<invalid namespace>, ", outfile);
|
||||
break;
|
||||
}
|
||||
switch (SYMBOL_CLASS (p))
|
||||
{
|
||||
case LOC_UNDEF:
|
||||
fputs_filtered ("undefined", outfile);
|
||||
break;
|
||||
case LOC_CONST:
|
||||
fputs_filtered ("constant int", outfile);
|
||||
break;
|
||||
case LOC_STATIC:
|
||||
fputs_filtered ("static", outfile);
|
||||
break;
|
||||
case LOC_REGISTER:
|
||||
fputs_filtered ("register", outfile);
|
||||
break;
|
||||
case LOC_ARG:
|
||||
fputs_filtered ("pass by value", outfile);
|
||||
break;
|
||||
case LOC_REF_ARG:
|
||||
fputs_filtered ("pass by reference", outfile);
|
||||
break;
|
||||
case LOC_REGPARM:
|
||||
fputs_filtered ("register parameter", outfile);
|
||||
break;
|
||||
case LOC_LOCAL:
|
||||
fputs_filtered ("stack parameter", outfile);
|
||||
break;
|
||||
case LOC_TYPEDEF:
|
||||
fputs_filtered ("type", outfile);
|
||||
break;
|
||||
case LOC_LABEL:
|
||||
fputs_filtered ("label", outfile);
|
||||
break;
|
||||
case LOC_BLOCK:
|
||||
fputs_filtered ("function", outfile);
|
||||
break;
|
||||
case LOC_CONST_BYTES:
|
||||
fputs_filtered ("constant bytes", outfile);
|
||||
break;
|
||||
case LOC_LOCAL_ARG:
|
||||
fputs_filtered ("shuffled arg", outfile);
|
||||
break;
|
||||
default:
|
||||
fputs_filtered ("<invalid location>", outfile);
|
||||
break;
|
||||
}
|
||||
fputs_filtered (", ", outfile);
|
||||
fprintf_filtered (outfile, "0x%x\n", SYMBOL_VALUE (p));
|
||||
p++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Return the nexting depth of a block within other blocks in its symtab. */
|
||||
|
||||
static int
|
||||
|
@ -356,5 +485,7 @@ _initialize_symmisc ()
|
|||
|
||||
add_com ("printsyms", class_obscure, print_symtabs,
|
||||
"Print dump of current symbol definitions to file OUTFILE.");
|
||||
add_com ("printpsyms", class_obscure, print_partial_symtabs,
|
||||
"Print dump of current partial symbol definitions to file OUTFILE.");
|
||||
}
|
||||
|
||||
|
|
83
gdb/symtab.h
83
gdb/symtab.h
|
@ -1,21 +1,21 @@
|
|||
/* Symbol table definitions for GDB.
|
||||
Copyright (C) 1986, 1989 Free Software Foundation, Inc.
|
||||
Copyright (C) 1986, 1989, 1991 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
GDB is free software; you can redistribute it and/or modify
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 1, or (at your option)
|
||||
any later version.
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
GDB is distributed in the hope that it will be useful,
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with GDB; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#if !defined (SYMTAB_H)
|
||||
#define SYMTAB_H 1
|
||||
|
@ -59,7 +59,7 @@ extern void free ();
|
|||
/* Actually, the misc function list is used to store *all* of the
|
||||
global symbols (text, data, bss, and abs). It is sometimes used
|
||||
to figure out what symtabs to read in. The "type" field is used
|
||||
occasionally.
|
||||
occasionally. Calling it the misc "function" vector is now a misnomer.
|
||||
|
||||
The misc_info field is available for machine-specific information
|
||||
that can be cached along with a misc function vector entry. The
|
||||
|
@ -83,19 +83,6 @@ struct misc_function
|
|||
struct misc_function *misc_function_vector;
|
||||
int misc_function_count;
|
||||
|
||||
enum language {language_unknown, language_c};
|
||||
|
||||
/* All data types of symbols in the compiled program
|
||||
are represented by `struct type' objects.
|
||||
All of these objects are pointed to by the typevector.
|
||||
The type vector may have empty slots that contain zero. */
|
||||
|
||||
struct typevector
|
||||
{
|
||||
int length; /* Number of types described */
|
||||
struct type *type[1];
|
||||
};
|
||||
|
||||
/* Different kinds of data types are distinguished by the `code' field. */
|
||||
|
||||
enum type_code
|
||||
|
@ -119,6 +106,10 @@ enum type_code
|
|||
TYPE_CODE_MEMBER, /* Member type */
|
||||
TYPE_CODE_METHOD, /* Method type */
|
||||
TYPE_CODE_REF, /* C++ Reference types */
|
||||
|
||||
/* Modula-2 */
|
||||
TYPE_CODE_CHAR, /* *real* character type */
|
||||
TYPE_CODE_BOOL, /* Builtin Modula-2 BOOLEAN */
|
||||
};
|
||||
|
||||
/* This appears in a type's flags word for an unsigned integer type. */
|
||||
|
@ -403,11 +394,6 @@ enum address_class
|
|||
LOC_LABEL, /* Value is address SYMBOL_VALUE_ADDRESS in the code */
|
||||
LOC_BLOCK, /* Value is address SYMBOL_VALUE_BLOCK of a
|
||||
`struct block'. Function names have this class. */
|
||||
LOC_EXTERNAL, /* Value is at address SYMBOL_VALUE_ADDRESS not in
|
||||
this compilation.
|
||||
This is used only in psymtabs; in symtabs
|
||||
LOC_STATIC is used instead (since in that case
|
||||
we take the time to find the address). */
|
||||
LOC_CONST_BYTES, /* Value is a constant byte-sequence pointed to by
|
||||
SYMBOL_VALUE_ADDRESS, in target byte order. */
|
||||
LOC_LOCAL_ARG, /* Value is arg at spec'd offset in stack frame.
|
||||
|
@ -442,7 +428,7 @@ struct symbol
|
|||
LOC_REF_ARG, LOC_REGPARM, LOC_LOCAL */
|
||||
struct block *block; /* for LOC_BLOCK */
|
||||
char *bytes; /* for LOC_CONST_BYTES */
|
||||
CORE_ADDR address; /* for LOC_STATIC, LOC_LABEL, LOC_EXTERNAL */
|
||||
CORE_ADDR address; /* for LOC_STATIC, LOC_LABEL */
|
||||
struct symbol *chain; /* for opaque typedef struct chain */
|
||||
}
|
||||
value;
|
||||
|
@ -528,8 +514,6 @@ struct symtab
|
|||
struct blockvector *blockvector;
|
||||
/* Table mapping core addresses to line numbers for this file. */
|
||||
struct linetable *linetable;
|
||||
/* Vector containing all types defined for this symtab. */
|
||||
struct typevector *typevector;
|
||||
/* Name of this source file. */
|
||||
char *filename;
|
||||
/* Directory in which it was compiled, or NULL if we don't know. */
|
||||
|
@ -587,15 +571,6 @@ struct partial_symtab
|
|||
relocate by this amount when reading in symbols from the symbol
|
||||
file. */
|
||||
CORE_ADDR addr;
|
||||
|
||||
/* Offset within loader symbol table of first local symbol for this
|
||||
file and length (in bytes) of the section of the symbol table
|
||||
devoted to this file's symbols (actually, the section bracketed
|
||||
may contain more than just this files symbols
|
||||
If ldsymlen is 0, the only reason for this things existence is
|
||||
the dependency list below. Nothing else will happen when it is
|
||||
read in. */
|
||||
int ldsymoff, ldsymlen;
|
||||
/* Range of text addresses covered by this file; texthigh is the
|
||||
beginning of the next section. */
|
||||
CORE_ADDR textlow, texthigh;
|
||||
|
@ -608,14 +583,15 @@ struct partial_symtab
|
|||
/* Global symbol list. This list will be sorted after readin to
|
||||
improve access. Binary search will be the usual method of
|
||||
finding a symbol within it. globals_offset is an integer offset
|
||||
within ps_globals */
|
||||
within global_psymbols[]. */
|
||||
int globals_offset, n_global_syms;
|
||||
/* Static symbol list. This list will *not* be sorted after readin;
|
||||
to find a symbol in it, exhaustive search must be used. This is
|
||||
reasonable because searches through this list will eventually
|
||||
lead to either the read in of a files symbols for real (assumed
|
||||
to take a *lot* of time; check) or an error (and we don't care
|
||||
how long errors take). */
|
||||
how long errors take). This is an offset and size within
|
||||
static_psymbols[]. */
|
||||
int statics_offset, n_static_syms;
|
||||
/* Pointer to symtab eventually allocated for this source file, 0 if
|
||||
!readin or if we haven't looked for the symtab after it was readin. */
|
||||
|
@ -623,6 +599,12 @@ struct partial_symtab
|
|||
/* Pointer to function which will read in the symtab corresponding to
|
||||
this psymtab. */
|
||||
void (*read_symtab) ();
|
||||
/* Information that lets read_symtab() locate the part of the symbol table
|
||||
that this psymtab corresponds to. This information is private to the
|
||||
format-dependent symbol reading routines. For further detail examine
|
||||
the various symbol reading modules. Should really be (void *) but is
|
||||
(char *) as with other such gdb variables. (FIXME) */
|
||||
char *read_symtab_private;
|
||||
/* Non-zero if the symtab corresponding to this psymtab has been
|
||||
readin */
|
||||
unsigned char readin;
|
||||
|
@ -652,8 +634,6 @@ int current_source_line;
|
|||
#define BLOCKLIST(symtab) (symtab)->blockvector
|
||||
#define BLOCKVECTOR(symtab) (symtab)->blockvector
|
||||
|
||||
#define TYPEVECTOR(symtab) (symtab)->typevector
|
||||
|
||||
#define LINELIST(symtab) (symtab)->linetable
|
||||
#define LINETABLE(symtab) (symtab)->linetable
|
||||
|
||||
|
@ -664,9 +644,6 @@ int current_source_line;
|
|||
#define BLOCKVECTOR_NBLOCKS(blocklist) (blocklist)->nblocks
|
||||
#define BLOCKVECTOR_BLOCK(blocklist,n) (blocklist)->block[n]
|
||||
|
||||
#define TYPEVECTOR_NTYPES(typelist) (typelist)->length
|
||||
#define TYPEVECTOR_TYPE(typelist,n) (typelist)->type[n]
|
||||
|
||||
#define BLOCK_START(bl) (bl)->startaddr
|
||||
#define BLOCK_END(bl) (bl)->endaddr
|
||||
#define BLOCK_NSYMS(bl) (bl)->nsyms
|
||||
|
@ -809,7 +786,7 @@ extern struct type *create_array_type ();
|
|||
extern struct symbol *block_function ();
|
||||
extern struct symbol *find_pc_function ();
|
||||
extern int find_pc_partial_function ();
|
||||
extern void clearpc_function_cache ();
|
||||
extern void clear_pc_function_cache ();
|
||||
extern struct partial_symtab *lookup_partial_symtab ();
|
||||
extern struct partial_symtab *find_pc_psymtab ();
|
||||
extern struct symtab *find_pc_symtab ();
|
||||
|
@ -856,6 +833,13 @@ extern struct type *builtin_type_error;
|
|||
extern struct type *builtin_type_long_long;
|
||||
extern struct type *builtin_type_unsigned_long_long;
|
||||
|
||||
/* Modula-2 types */
|
||||
extern struct type *builtin_type_m2_char;
|
||||
extern struct type *builtin_type_m2_int;
|
||||
extern struct type *builtin_type_m2_card;
|
||||
extern struct type *builtin_type_m2_real;
|
||||
extern struct type *builtin_type_m2_bool;
|
||||
|
||||
/* LONG_LONG is defined if the host has "long long". */
|
||||
#ifdef LONG_LONG
|
||||
#define BUILTIN_TYPE_LONGEST builtin_type_long_long
|
||||
|
@ -930,4 +914,11 @@ char **make_symbol_completion_list ();
|
|||
/* The entry point of a file we are reading. */
|
||||
extern CORE_ADDR entry_point;
|
||||
|
||||
/* Maximum and minimum values of built-in types */
|
||||
#define MAX_OF_TYPE(t) \
|
||||
TYPE_UNSIGNED(t) ? UMAX_OF_SIZE(TYPE_LENGTH(t)) : MAX_OF_SIZE(TYPE_LENGTH(t))
|
||||
|
||||
#define MIN_OF_TYPE(t) \
|
||||
TYPE_UNSIGNED(t) ? UMIN_OF_SIZE(TYPE_LENGTH(t)) : MIN_OF_SIZE(TYPE_LENGTH(t))
|
||||
|
||||
#endif /* symtab.h not already included. */
|
||||
|
|
Loading…
Reference in a new issue