diff options
author | Jim Kingdon <jkingdon@engr.sgi.com> | 1993-10-08 20:33:22 +0000 |
---|---|---|
committer | Jim Kingdon <jkingdon@engr.sgi.com> | 1993-10-08 20:33:22 +0000 |
commit | 443abae18cc0f7c2654a6d0ddda239a4c6c846a5 (patch) | |
tree | 76d1f9fd7a9bb44a320b34e230bc61c687ad3956 /gdb/findvar.c | |
parent | 1aa6938eb37f89db944795a21aadb98af7e44399 (diff) | |
download | gdb-443abae18cc0f7c2654a6d0ddda239a4c6c846a5.zip gdb-443abae18cc0f7c2654a6d0ddda239a4c6c846a5.tar.gz gdb-443abae18cc0f7c2654a6d0ddda239a4c6c846a5.tar.bz2 |
* findvar.c, value.h (symbol_read_needs_frame): New function.
* c-exp.y, m2-exp.y: Call it instead of having our own switch on
the symbol's class.
* valops.c (value_of_variable): Use symbol_read_needs_frame to
decide whether we care about finding a frame.
Diffstat (limited to 'gdb/findvar.c')
-rw-r--r-- | gdb/findvar.c | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/gdb/findvar.c b/gdb/findvar.c index 36c72f6..50d5da6 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -467,7 +467,7 @@ read_register (regno) void write_register (regno, val) int regno; - long val; + LONGEST val; { PTR buf; int size; @@ -518,6 +518,45 @@ supply_register (regno, val) #endif } +/* Will calling read_var_value or locate_var_value on SYM end + up caring what frame it is being evaluated relative to? SYM must + be non-NULL. */ +int +symbol_read_needs_frame (sym) + struct symbol *sym; +{ + switch (SYMBOL_CLASS (sym)) + { + /* All cases listed explicitly so that gcc -Wall will detect it if + we failed to consider one. */ + case LOC_REGISTER: + case LOC_ARG: + case LOC_REF_ARG: + case LOC_REGPARM: + case LOC_REGPARM_ADDR: + case LOC_LOCAL: + case LOC_LOCAL_ARG: + case LOC_BASEREG: + case LOC_BASEREG_ARG: + return 1; + + case LOC_UNDEF: + case LOC_CONST: + case LOC_STATIC: + case LOC_TYPEDEF: + + case LOC_LABEL: + /* Getting the address of a label can be done independently of the block, + even if some *uses* of that address wouldn't work so well without + the right frame. */ + + case LOC_BLOCK: + case LOC_CONST_BYTES: + case LOC_OPTIMIZED_OUT: + return 0; + } +} + /* Given a struct symbol for a variable, and a stack frame id, read the value of the variable and return a (pointer to a) struct value containing the value. |