diff options
author | Jim Kingdon <jkingdon@engr.sgi.com> | 1993-08-24 21:38:24 +0000 |
---|---|---|
committer | Jim Kingdon <jkingdon@engr.sgi.com> | 1993-08-24 21:38:24 +0000 |
commit | a1c8d76ef8cc1ddf20b43fe5660ba67a93339808 (patch) | |
tree | 26235bcfa4fead24c6b3fb645f61f90e30f92f38 | |
parent | fb2fc3b6b5f8f1f1ef57d4332e63d826c4271deb (diff) | |
download | gdb-a1c8d76ef8cc1ddf20b43fe5660ba67a93339808.zip gdb-a1c8d76ef8cc1ddf20b43fe5660ba67a93339808.tar.gz gdb-a1c8d76ef8cc1ddf20b43fe5660ba67a93339808.tar.bz2 |
* 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.
-rw-r--r-- | gdb/ChangeLog | 2 | ||||
-rw-r--r-- | gdb/c-exp.y | 2 | ||||
-rw-r--r-- | gdb/ch-exp.y | 2 | ||||
-rw-r--r-- | gdb/dwarfread.c | 39 | ||||
-rw-r--r-- | gdb/m2-exp.y | 4 | ||||
-rw-r--r-- | gdb/printcmd.c | 50 | ||||
-rw-r--r-- | gdb/symtab.c | 3 | ||||
-rw-r--r-- | gdb/symtab.h | 44 |
8 files changed, 66 insertions, 80 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3c95ef2..7f42e8c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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 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. * coffread.c (init_lineno, init_stringtab): Don't check whether diff --git a/gdb/c-exp.y b/gdb/c-exp.y index 42e482b..0b19ed5 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -667,6 +667,8 @@ variable: name_not_typename case LOC_REGPARM: case LOC_LOCAL: case LOC_LOCAL_ARG: + case LOC_BASEREG: + case LOC_BASEREG_ARG: if (innermost_block == 0 || contained_in (block_found, innermost_block)) diff --git a/gdb/ch-exp.y b/gdb/ch-exp.y index 58b82ea..8951133 100644 --- a/gdb/ch-exp.y +++ b/gdb/ch-exp.y @@ -1931,6 +1931,8 @@ yylex () case LOC_REGPARM: case LOC_LOCAL: case LOC_LOCAL_ARG: + case LOC_BASEREG: + case LOC_BASEREG_ARG: if (innermost_block == NULL || contained_in (block_found, innermost_block)) { diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c index ba00cd2..076f175 100644 --- a/gdb/dwarfread.c +++ b/gdb/dwarfread.c @@ -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? (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 }; -#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 */ #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 char *lnbase; /* Base pointer to line section */ 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 the section_offsets structure used by dbxread (once this is done, @@ -2207,21 +2204,13 @@ locval (loc) break; case OP_BASEREG: /* 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; - regno = target_to_host (loc, loc_value_size, GET_UNSIGNED, - current_objfile); + basereg = target_to_host (loc, loc_value_size, GET_UNSIGNED, + current_objfile); loc += loc_value_size; - if (regno == R_FP) - { - stack[++stacki] = 0; - } - else - { - stack[++stacki] = 0; - - complain (&basereg_not_handled, DIE_ID, DIE_NAME, regno); - } + stack[++stacki] = 0; break; case OP_ADDR: /* push address (relocated address) */ @@ -2988,7 +2977,8 @@ new_symbol (dip, objfile) } else if (offreg) { - SYMBOL_CLASS (sym) = LOC_LOCAL; + SYMBOL_CLASS (sym) = LOC_BASEREG; + SYMBOL_BASEREG (sym) = basereg; } else { @@ -3007,6 +2997,11 @@ new_symbol (dip, objfile) { SYMBOL_CLASS (sym) = LOC_REGPARM; } + else if (offreg) + { + SYMBOL_CLASS (sym) = LOC_BASEREG_ARG; + SYMBOL_BASEREG (sym) = basereg; + } else { SYMBOL_CLASS (sym) = LOC_ARG; diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y index b00af97..1d7e801 100644 --- a/gdb/m2-exp.y +++ b/gdb/m2-exp.y @@ -607,6 +607,8 @@ variable: NAME case LOC_REF_ARG: case LOC_REGPARM: case LOC_LOCAL_ARG: + case LOC_BASEREG: + case LOC_BASEREG_ARG: if (innermost_block == 0 || contained_in (block_found, innermost_block)) @@ -1119,6 +1121,8 @@ yylex () case LOC_REGPARM: case LOC_LOCAL: case LOC_LOCAL_ARG: + case LOC_BASEREG: + case LOC_BASEREG_ARG: case LOC_CONST: case LOC_CONST_BYTES: return NAME; diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 79d136c..7409b3a 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -927,50 +927,36 @@ address_info (exp, from_tty) printf ("an argument in register %s", reg_names[val]); break; - case LOC_REGPARM_ADDR: - printf ("address of an argument in register %s", reg_names[val]); - break; - + case LOC_REGPARM_ADDR: + printf ("address of an argument in register %s", reg_names[val]); + break; + case LOC_ARG: - if (SYMBOL_BASEREG_VALID (sym)) - { - printf ("an argument at offset %ld from register %s", - val, reg_names[basereg]); - } - else - { - printf ("an argument at offset %ld", val); - } + printf ("an argument at offset %ld", val); break; case LOC_LOCAL_ARG: - if (SYMBOL_BASEREG_VALID (sym)) - { - printf ("an argument at offset %ld from register %s", - val, reg_names[basereg]); - } - else - { - printf ("an argument at frame offset %ld", val); - } + printf ("an argument at frame offset %ld", val); break; case LOC_LOCAL: - if (SYMBOL_BASEREG_VALID (sym)) - { - printf ("a local variable at offset %ld from register %s", - val, reg_names[basereg]); - } - else - { - printf ("a local variable at frame offset %ld", val); - } + printf ("a local variable at frame offset %ld", val); break; case LOC_REF_ARG: printf ("a reference argument at offset %ld", val); 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: printf ("a typedef"); break; @@ -1494,6 +1480,8 @@ print_frame_args (func, fi, num, stream) case LOC_REGPARM: case LOC_REGPARM_ADDR: case LOC_LOCAL_ARG: + case LOC_BASEREG: + case LOC_BASEREG_ARG: break; /* Other types of symbols we just skip over. */ diff --git a/gdb/symtab.c b/gdb/symtab.c index 38675d1..745b74c 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -899,7 +899,8 @@ lookup_block_symbol (block, name, namespace) SYMBOL_CLASS (sym) != LOC_LOCAL_ARG && SYMBOL_CLASS (sym) != LOC_REF_ARG && SYMBOL_CLASS (sym) != LOC_REGPARM && - SYMBOL_CLASS (sym) != LOC_REGPARM_ADDR) + SYMBOL_CLASS (sym) != LOC_REGPARM_ADDR && + SYMBOL_CLASS (sym) != LOC_BASEREG_ARG) { break; } diff --git a/gdb/symtab.h b/gdb/symtab.h index 34bc099..8ac6972 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -515,6 +515,22 @@ enum address_class 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 value is ignored. */ @@ -551,12 +567,8 @@ struct symbol union { - /* for OP_BASEREG in DWARF location specs */ - struct - { - short regno_valid; /* 0 == regno invalid; !0 == regno valid */ - short regno; /* base register number {0, 1, 2, ...} */ - } basereg; + /* Used by LOC_BASEREG and LOC_BASEREG_ARG. */ + short basereg; } aux_value; @@ -566,25 +578,7 @@ struct symbol #define SYMBOL_CLASS(symbol) (symbol)->class #define SYMBOL_TYPE(symbol) (symbol)->type #define SYMBOL_LINE(symbol) (symbol)->line -#define SYMBOL_BASEREG(symbol) (symbol)->aux_value.basereg.regno - -/* 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 - +#define SYMBOL_BASEREG(symbol) (symbol)->aux_value.basereg /* A partial_symbol records the name, namespace, and address class of symbols whose types we have not parsed yet. For functions, it also |