* frame.h, symtab.h, findvar.c (read_var_value): Change basereg
support to use LOC_BASEREG rather than SYMBOL_BASEREG_VALID. * dwarfread.c: Use LOC_BASEREG where appropriate. * Various: Support LOC_BASEREG and LOC_BASEREG_ARG.
This commit is contained in:
parent
fb2fc3b6b5
commit
a1c8d76ef8
8 changed files with 66 additions and 80 deletions
|
@ -4,7 +4,7 @@ Tue Aug 24 00:36:17 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
|
||||||
|
|
||||||
* frame.h, symtab.h, findvar.c (read_var_value): Change basereg
|
* frame.h, symtab.h, findvar.c (read_var_value): Change basereg
|
||||||
support to use LOC_BASEREG rather than SYMBOL_BASEREG_VALID.
|
support to use LOC_BASEREG rather than SYMBOL_BASEREG_VALID.
|
||||||
* dwarfread: Use LOC_BASEREG where appropriate.
|
* dwarfread.c: Use LOC_BASEREG where appropriate.
|
||||||
* Various: Support LOC_BASEREG and LOC_BASEREG_ARG.
|
* Various: Support LOC_BASEREG and LOC_BASEREG_ARG.
|
||||||
|
|
||||||
* coffread.c (init_lineno, init_stringtab): Don't check whether
|
* coffread.c (init_lineno, init_stringtab): Don't check whether
|
||||||
|
|
|
@ -667,6 +667,8 @@ variable: name_not_typename
|
||||||
case LOC_REGPARM:
|
case LOC_REGPARM:
|
||||||
case LOC_LOCAL:
|
case LOC_LOCAL:
|
||||||
case LOC_LOCAL_ARG:
|
case LOC_LOCAL_ARG:
|
||||||
|
case LOC_BASEREG:
|
||||||
|
case LOC_BASEREG_ARG:
|
||||||
if (innermost_block == 0 ||
|
if (innermost_block == 0 ||
|
||||||
contained_in (block_found,
|
contained_in (block_found,
|
||||||
innermost_block))
|
innermost_block))
|
||||||
|
|
|
@ -1931,6 +1931,8 @@ yylex ()
|
||||||
case LOC_REGPARM:
|
case LOC_REGPARM:
|
||||||
case LOC_LOCAL:
|
case LOC_LOCAL:
|
||||||
case LOC_LOCAL_ARG:
|
case LOC_LOCAL_ARG:
|
||||||
|
case LOC_BASEREG:
|
||||||
|
case LOC_BASEREG_ARG:
|
||||||
if (innermost_block == NULL
|
if (innermost_block == NULL
|
||||||
|| contained_in (block_found, innermost_block))
|
|| contained_in (block_found, innermost_block))
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,9 +21,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
FIXME: Figure out how to get the frame pointer register number in the
|
|
||||||
execution environment of the target. Remove R_FP kludge
|
|
||||||
|
|
||||||
FIXME: Do we need to generate dependencies in partial symtabs?
|
FIXME: Do we need to generate dependencies in partial symtabs?
|
||||||
(Perhaps we don't need to).
|
(Perhaps we don't need to).
|
||||||
|
|
||||||
|
@ -180,10 +177,6 @@ struct complaint not_row_major =
|
||||||
"DIE @ 0x%x \"%s\", array not row major; not handled correctly", 0, 0
|
"DIE @ 0x%x \"%s\", array not row major; not handled correctly", 0, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef R_FP /* FIXME */
|
|
||||||
#define R_FP 14 /* Kludge to get frame pointer register number */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef unsigned int DIE_REF; /* Reference to a DIE */
|
typedef unsigned int DIE_REF; /* Reference to a DIE */
|
||||||
|
|
||||||
#ifndef GCC_PRODUCER
|
#ifndef GCC_PRODUCER
|
||||||
|
@ -332,7 +325,11 @@ static int dbsize; /* Size of dwarf info in bytes */
|
||||||
static int dbroff; /* Relative offset from start of .debug section */
|
static int dbroff; /* Relative offset from start of .debug section */
|
||||||
static char *lnbase; /* Base pointer to line section */
|
static char *lnbase; /* Base pointer to line section */
|
||||||
static int isreg; /* Kludge to identify register variables */
|
static int isreg; /* Kludge to identify register variables */
|
||||||
static int offreg; /* Kludge to identify basereg references */
|
/* Kludge to identify basereg references. Nonzero if we have an offset
|
||||||
|
relative to a basereg. */
|
||||||
|
static int offreg;
|
||||||
|
/* Which base register is it relative to? */
|
||||||
|
static int basereg;
|
||||||
|
|
||||||
/* This value is added to each symbol value. FIXME: Generalize to
|
/* This value is added to each symbol value. FIXME: Generalize to
|
||||||
the section_offsets structure used by dbxread (once this is done,
|
the section_offsets structure used by dbxread (once this is done,
|
||||||
|
@ -2207,21 +2204,13 @@ locval (loc)
|
||||||
break;
|
break;
|
||||||
case OP_BASEREG:
|
case OP_BASEREG:
|
||||||
/* push value of register (number) */
|
/* push value of register (number) */
|
||||||
/* Actually, we compute the value as if register has 0 */
|
/* Actually, we compute the value as if register has 0, so the
|
||||||
|
value ends up being the offset from that register. */
|
||||||
offreg = 1;
|
offreg = 1;
|
||||||
regno = target_to_host (loc, loc_value_size, GET_UNSIGNED,
|
basereg = target_to_host (loc, loc_value_size, GET_UNSIGNED,
|
||||||
current_objfile);
|
current_objfile);
|
||||||
loc += loc_value_size;
|
loc += loc_value_size;
|
||||||
if (regno == R_FP)
|
stack[++stacki] = 0;
|
||||||
{
|
|
||||||
stack[++stacki] = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
stack[++stacki] = 0;
|
|
||||||
|
|
||||||
complain (&basereg_not_handled, DIE_ID, DIE_NAME, regno);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case OP_ADDR:
|
case OP_ADDR:
|
||||||
/* push address (relocated address) */
|
/* push address (relocated address) */
|
||||||
|
@ -2988,7 +2977,8 @@ new_symbol (dip, objfile)
|
||||||
}
|
}
|
||||||
else if (offreg)
|
else if (offreg)
|
||||||
{
|
{
|
||||||
SYMBOL_CLASS (sym) = LOC_LOCAL;
|
SYMBOL_CLASS (sym) = LOC_BASEREG;
|
||||||
|
SYMBOL_BASEREG (sym) = basereg;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -3007,6 +2997,11 @@ new_symbol (dip, objfile)
|
||||||
{
|
{
|
||||||
SYMBOL_CLASS (sym) = LOC_REGPARM;
|
SYMBOL_CLASS (sym) = LOC_REGPARM;
|
||||||
}
|
}
|
||||||
|
else if (offreg)
|
||||||
|
{
|
||||||
|
SYMBOL_CLASS (sym) = LOC_BASEREG_ARG;
|
||||||
|
SYMBOL_BASEREG (sym) = basereg;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SYMBOL_CLASS (sym) = LOC_ARG;
|
SYMBOL_CLASS (sym) = LOC_ARG;
|
||||||
|
|
|
@ -607,6 +607,8 @@ variable: NAME
|
||||||
case LOC_REF_ARG:
|
case LOC_REF_ARG:
|
||||||
case LOC_REGPARM:
|
case LOC_REGPARM:
|
||||||
case LOC_LOCAL_ARG:
|
case LOC_LOCAL_ARG:
|
||||||
|
case LOC_BASEREG:
|
||||||
|
case LOC_BASEREG_ARG:
|
||||||
if (innermost_block == 0 ||
|
if (innermost_block == 0 ||
|
||||||
contained_in (block_found,
|
contained_in (block_found,
|
||||||
innermost_block))
|
innermost_block))
|
||||||
|
@ -1119,6 +1121,8 @@ yylex ()
|
||||||
case LOC_REGPARM:
|
case LOC_REGPARM:
|
||||||
case LOC_LOCAL:
|
case LOC_LOCAL:
|
||||||
case LOC_LOCAL_ARG:
|
case LOC_LOCAL_ARG:
|
||||||
|
case LOC_BASEREG:
|
||||||
|
case LOC_BASEREG_ARG:
|
||||||
case LOC_CONST:
|
case LOC_CONST:
|
||||||
case LOC_CONST_BYTES:
|
case LOC_CONST_BYTES:
|
||||||
return NAME;
|
return NAME;
|
||||||
|
|
|
@ -927,50 +927,36 @@ address_info (exp, from_tty)
|
||||||
printf ("an argument in register %s", reg_names[val]);
|
printf ("an argument in register %s", reg_names[val]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LOC_REGPARM_ADDR:
|
case LOC_REGPARM_ADDR:
|
||||||
printf ("address of an argument in register %s", reg_names[val]);
|
printf ("address of an argument in register %s", reg_names[val]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LOC_ARG:
|
case LOC_ARG:
|
||||||
if (SYMBOL_BASEREG_VALID (sym))
|
printf ("an argument at offset %ld", val);
|
||||||
{
|
|
||||||
printf ("an argument at offset %ld from register %s",
|
|
||||||
val, reg_names[basereg]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf ("an argument at offset %ld", val);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LOC_LOCAL_ARG:
|
case LOC_LOCAL_ARG:
|
||||||
if (SYMBOL_BASEREG_VALID (sym))
|
printf ("an argument at frame offset %ld", val);
|
||||||
{
|
|
||||||
printf ("an argument at offset %ld from register %s",
|
|
||||||
val, reg_names[basereg]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf ("an argument at frame offset %ld", val);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LOC_LOCAL:
|
case LOC_LOCAL:
|
||||||
if (SYMBOL_BASEREG_VALID (sym))
|
printf ("a local variable at frame offset %ld", val);
|
||||||
{
|
|
||||||
printf ("a local variable at offset %ld from register %s",
|
|
||||||
val, reg_names[basereg]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
printf ("a local variable at frame offset %ld", val);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LOC_REF_ARG:
|
case LOC_REF_ARG:
|
||||||
printf ("a reference argument at offset %ld", val);
|
printf ("a reference argument at offset %ld", val);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case LOC_BASEREG:
|
||||||
|
printf ("a variable at offset %ld from register %s",
|
||||||
|
val, reg_names[basereg]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LOC_BASEREG_ARG:
|
||||||
|
printf ("an argument at offset %ld from register %s",
|
||||||
|
val, reg_names[basereg]);
|
||||||
|
break;
|
||||||
|
|
||||||
case LOC_TYPEDEF:
|
case LOC_TYPEDEF:
|
||||||
printf ("a typedef");
|
printf ("a typedef");
|
||||||
break;
|
break;
|
||||||
|
@ -1494,6 +1480,8 @@ print_frame_args (func, fi, num, stream)
|
||||||
case LOC_REGPARM:
|
case LOC_REGPARM:
|
||||||
case LOC_REGPARM_ADDR:
|
case LOC_REGPARM_ADDR:
|
||||||
case LOC_LOCAL_ARG:
|
case LOC_LOCAL_ARG:
|
||||||
|
case LOC_BASEREG:
|
||||||
|
case LOC_BASEREG_ARG:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Other types of symbols we just skip over. */
|
/* Other types of symbols we just skip over. */
|
||||||
|
|
|
@ -899,7 +899,8 @@ lookup_block_symbol (block, name, namespace)
|
||||||
SYMBOL_CLASS (sym) != LOC_LOCAL_ARG &&
|
SYMBOL_CLASS (sym) != LOC_LOCAL_ARG &&
|
||||||
SYMBOL_CLASS (sym) != LOC_REF_ARG &&
|
SYMBOL_CLASS (sym) != LOC_REF_ARG &&
|
||||||
SYMBOL_CLASS (sym) != LOC_REGPARM &&
|
SYMBOL_CLASS (sym) != LOC_REGPARM &&
|
||||||
SYMBOL_CLASS (sym) != LOC_REGPARM_ADDR)
|
SYMBOL_CLASS (sym) != LOC_REGPARM_ADDR &&
|
||||||
|
SYMBOL_CLASS (sym) != LOC_BASEREG_ARG)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
44
gdb/symtab.h
44
gdb/symtab.h
|
@ -515,6 +515,22 @@ enum address_class
|
||||||
|
|
||||||
LOC_LOCAL_ARG,
|
LOC_LOCAL_ARG,
|
||||||
|
|
||||||
|
/* Value is at SYMBOL_VALUE offset from the current value of
|
||||||
|
register number SYMBOL_BASEREG. This exists mainly for the same
|
||||||
|
things that LOC_LOCAL and LOC_ARG do; but we need to do this
|
||||||
|
instead because on 88k DWARF gives us the offset from the
|
||||||
|
frame/stack pointer, rather than the offset from the "canonical
|
||||||
|
frame address" used by COFF, stabs, etc., and we don't know how
|
||||||
|
to convert between these until we start examining prologues.
|
||||||
|
|
||||||
|
Note that LOC_BASEREG is much less general than a DWARF expression. */
|
||||||
|
|
||||||
|
LOC_BASEREG,
|
||||||
|
|
||||||
|
/* Same as LOC_BASEREG but it is an argument. */
|
||||||
|
|
||||||
|
LOC_BASEREG_ARG,
|
||||||
|
|
||||||
/* The variable does not actually exist in the program.
|
/* The variable does not actually exist in the program.
|
||||||
The value is ignored. */
|
The value is ignored. */
|
||||||
|
|
||||||
|
@ -551,12 +567,8 @@ struct symbol
|
||||||
|
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
/* for OP_BASEREG in DWARF location specs */
|
/* Used by LOC_BASEREG and LOC_BASEREG_ARG. */
|
||||||
struct
|
short basereg;
|
||||||
{
|
|
||||||
short regno_valid; /* 0 == regno invalid; !0 == regno valid */
|
|
||||||
short regno; /* base register number {0, 1, 2, ...} */
|
|
||||||
} basereg;
|
|
||||||
}
|
}
|
||||||
aux_value;
|
aux_value;
|
||||||
|
|
||||||
|
@ -566,25 +578,7 @@ struct symbol
|
||||||
#define SYMBOL_CLASS(symbol) (symbol)->class
|
#define SYMBOL_CLASS(symbol) (symbol)->class
|
||||||
#define SYMBOL_TYPE(symbol) (symbol)->type
|
#define SYMBOL_TYPE(symbol) (symbol)->type
|
||||||
#define SYMBOL_LINE(symbol) (symbol)->line
|
#define SYMBOL_LINE(symbol) (symbol)->line
|
||||||
#define SYMBOL_BASEREG(symbol) (symbol)->aux_value.basereg.regno
|
#define SYMBOL_BASEREG(symbol) (symbol)->aux_value.basereg
|
||||||
|
|
||||||
/* If we want to do baseregs using this approach we should have a
|
|
||||||
LOC_BASEREG (and LOC_BASEREG_ARG) rather than changing the meaning
|
|
||||||
of LOC_LOCAL, LOC_ARG, etc. based on SYMBOL_BASEREG_VALID. But
|
|
||||||
this approach provides just a small fraction of the expressiveness
|
|
||||||
of a DWARF location, so it does less than we might want. On the
|
|
||||||
other hand, it may do more than we need; FRAME_LOCALS_ADDRESS,
|
|
||||||
LOC_REGPARM_ADDR, and similar things seem to handle most of the
|
|
||||||
cases which actually come up. */
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* This currently fails because some symbols are not being initialized
|
|
||||||
to zero on allocation, and no code is currently setting this value. */
|
|
||||||
#define SYMBOL_BASEREG_VALID(symbol) (symbol)->aux_value.basereg.regno_valid
|
|
||||||
#else
|
|
||||||
#define SYMBOL_BASEREG_VALID(symbol) 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* A partial_symbol records the name, namespace, and address class of
|
/* A partial_symbol records the name, namespace, and address class of
|
||||||
symbols whose types we have not parsed yet. For functions, it also
|
symbols whose types we have not parsed yet. For functions, it also
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue