diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 31 | ||||
-rw-r--r-- | gdb/ada-exp.y | 2 | ||||
-rw-r--r-- | gdb/ada-lang.c | 83 | ||||
-rw-r--r-- | gdb/ax-gdb.c | 8 | ||||
-rw-r--r-- | gdb/buildsym.c | 48 | ||||
-rw-r--r-- | gdb/coffread.c | 4 | ||||
-rw-r--r-- | gdb/dwarf2read.c | 4 | ||||
-rw-r--r-- | gdb/eval.c | 3 | ||||
-rw-r--r-- | gdb/findvar.c | 8 | ||||
-rw-r--r-- | gdb/m2-exp.y | 2 | ||||
-rw-r--r-- | gdb/mdebugread.c | 12 | ||||
-rw-r--r-- | gdb/mi/mi-cmd-stack.c | 10 | ||||
-rw-r--r-- | gdb/printcmd.c | 12 | ||||
-rw-r--r-- | gdb/stabsread.c | 14 | ||||
-rw-r--r-- | gdb/stack.c | 31 | ||||
-rw-r--r-- | gdb/symmisc.c | 15 | ||||
-rw-r--r-- | gdb/symtab.c | 6 | ||||
-rw-r--r-- | gdb/symtab.h | 35 | ||||
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/frame-args.exp | 2 | ||||
-rw-r--r-- | gdb/tracepoint.c | 46 |
21 files changed, 144 insertions, 237 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e0c8c40..5237aec 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,34 @@ +2008-05-27 Andreas Schwab <schwab@suse.de> + + * symtab.h (enum address_class): Remove LOC_REGPARM and + LOC_COMPUTED_ARG. + (struct symbol): Add is_argument. + (SYMBOL_IS_ARGUMENT): Define. + + * ada-lang.c (ada_add_block_symbols): Use SYMBOL_IS_ARGUMENT. + * buildsym.c (finish_block): Likewise. + * stack.c (print_frame_args, print_block_frame_locals) + (print_frame_arg_vars): Likewise. + * symtab.c (lookup_block_symbol): Likewise. + * tracepoint.c (add_local_symbols): Likewise. + * mi/mi-cmd-stack.c (list_args_or_locals): Likewise. + + * coffread.c (process_coff_symbol): Set SYMBOL_IS_ARGUMENT. + * dwarf2read.c (new_symbol): Likewise. + * mdebugread.c (parse_symbol): Likewise. + * stabsread.c (define_symbol): Likewise. + + * ada-exp.y (select_possible_type_sym): Don't handle LOC_REGPARM + and LOC_COMPUTED_ARG. + * ada-lang.c (resolve_subexp, symtab_for_sym): Likewise. + * ax-gdb.c (gen_var_ref): Likewise. + * eval.c (evaluate_subexp_for_address): Likewise. + * findvar.c (symbol_read_needs_frame, read_var_value): Likewise. + * m2-exp.y (yylex): Likewise. + * printcmd.c (address_info): Likewise. + * symmisc.c (print_symbol, print_partial_symbols): Likewise. + * tracepoint.c (collect_symbol, scope_info): Likewise. + 2008-05-24 Carlos Eduardo Seo <cseo@linux.vnet.ibm.com> * gdbarch.sh: Added new gdbarch struct diff --git a/gdb/ada-exp.y b/gdb/ada-exp.y index 948bce4..53107a8 100644 --- a/gdb/ada-exp.y +++ b/gdb/ada-exp.y @@ -1056,11 +1056,9 @@ select_possible_type_sym (struct ada_symbol_info *syms, int nsyms) case LOC_REGISTER: case LOC_ARG: case LOC_REF_ARG: - case LOC_REGPARM: case LOC_REGPARM_ADDR: case LOC_LOCAL: case LOC_COMPUTED: - case LOC_COMPUTED_ARG: return NULL; default: break; diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 165e374..ea55bbc 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -2890,11 +2890,9 @@ resolve_subexp (struct expression **expp, int *pos, int deprocedure_p, case LOC_REGISTER: case LOC_ARG: case LOC_REF_ARG: - case LOC_REGPARM: case LOC_REGPARM_ADDR: case LOC_LOCAL: case LOC_COMPUTED: - case LOC_COMPUTED_ARG: goto FoundNonType; default: break; @@ -4315,12 +4313,10 @@ symtab_for_sym (struct symbol *sym) case LOC_REGISTER: case LOC_ARG: case LOC_REF_ARG: - case LOC_REGPARM: case LOC_REGPARM_ADDR: case LOC_LOCAL: case LOC_TYPEDEF: case LOC_COMPUTED: - case LOC_COMPUTED_ARG: for (j = FIRST_LOCAL_BLOCK; j < BLOCKVECTOR_NBLOCKS (BLOCKVECTOR (s)); j += 1) { @@ -5213,23 +5209,16 @@ ada_add_block_symbols (struct obstack *obstackp, SYMBOL_DOMAIN (sym), domain) && wild_match (name, name_len, SYMBOL_LINKAGE_NAME (sym))) { - switch (SYMBOL_CLASS (sym)) - { - case LOC_ARG: - case LOC_REF_ARG: - case LOC_REGPARM: - case LOC_REGPARM_ADDR: - case LOC_COMPUTED_ARG: - arg_sym = sym; - break; - case LOC_UNRESOLVED: - continue; - default: + if (SYMBOL_CLASS (sym) == LOC_UNRESOLVED) + continue; + else if (SYMBOL_IS_ARGUMENT (sym)) + arg_sym = sym; + else + { found_sym = 1; add_defn_to_vec (obstackp, fixup_symbol_section (sym, objfile), block); - break; } } } @@ -5245,24 +5234,18 @@ ada_add_block_symbols (struct obstack *obstackp, if (cmp == 0 && is_name_suffix (SYMBOL_LINKAGE_NAME (sym) + name_len)) { - switch (SYMBOL_CLASS (sym)) - { - case LOC_ARG: - case LOC_REF_ARG: - case LOC_REGPARM: - case LOC_REGPARM_ADDR: - case LOC_COMPUTED_ARG: - arg_sym = sym; - break; - case LOC_UNRESOLVED: - break; - default: - found_sym = 1; - add_defn_to_vec (obstackp, - fixup_symbol_section (sym, objfile), - block); - break; - } + if (SYMBOL_CLASS (sym) != LOC_UNRESOLVED) + { + if (SYMBOL_IS_ARGUMENT (sym)) + arg_sym = sym; + else + { + found_sym = 1; + add_defn_to_vec (obstackp, + fixup_symbol_section (sym, objfile), + block); + } + } } } } @@ -5299,24 +5282,18 @@ ada_add_block_symbols (struct obstack *obstackp, if (cmp == 0 && is_name_suffix (SYMBOL_LINKAGE_NAME (sym) + name_len + 5)) { - switch (SYMBOL_CLASS (sym)) - { - case LOC_ARG: - case LOC_REF_ARG: - case LOC_REGPARM: - case LOC_REGPARM_ADDR: - case LOC_COMPUTED_ARG: - arg_sym = sym; - break; - case LOC_UNRESOLVED: - break; - default: - found_sym = 1; - add_defn_to_vec (obstackp, - fixup_symbol_section (sym, objfile), - block); - break; - } + if (SYMBOL_CLASS (sym) != LOC_UNRESOLVED) + { + if (SYMBOL_IS_ARGUMENT (sym)) + arg_sym = sym; + else + { + found_sym = 1; + add_defn_to_vec (obstackp, + fixup_symbol_section (sym, objfile), + block); + } + } } } } diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c index 6acc318..09bf42c 100644 --- a/gdb/ax-gdb.c +++ b/gdb/ax-gdb.c @@ -580,7 +580,6 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var) break; case LOC_REGISTER: - case LOC_REGPARM: /* Don't generate any code at all; in the process of treating this as an lvalue or rvalue, the caller will generate the right code. */ @@ -589,9 +588,9 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var) break; /* A lot like LOC_REF_ARG, but the pointer lives directly in a - register, not on the stack. Simpler than LOC_REGISTER and - LOC_REGPARM, because it's just like any other case where the - thing has a real address. */ + register, not on the stack. Simpler than LOC_REGISTER + because it's just like any other case where the thing + has a real address. */ case LOC_REGPARM_ADDR: ax_reg (ax, SYMBOL_VALUE (var)); value->kind = axs_lvalue_memory; @@ -611,7 +610,6 @@ gen_var_ref (struct agent_expr *ax, struct axs_value *value, struct symbol *var) break; case LOC_COMPUTED: - case LOC_COMPUTED_ARG: /* FIXME: cagney/2004-01-26: It should be possible to unconditionally call the SYMBOL_OPS method when available. Unfortunately DWARF 2 stores the frame-base (instead of the diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 034c862..f3850a2 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -283,30 +283,8 @@ finish_block (struct symbol *symbol, struct pending **listhead, struct symbol *sym; ALL_BLOCK_SYMBOLS (block, iter, sym) { - switch (SYMBOL_CLASS (sym)) - { - case LOC_ARG: - case LOC_REF_ARG: - case LOC_REGPARM: - case LOC_REGPARM_ADDR: - case LOC_COMPUTED_ARG: - nparams++; - break; - case LOC_UNDEF: - case LOC_CONST: - case LOC_STATIC: - case LOC_REGISTER: - case LOC_LOCAL: - case LOC_TYPEDEF: - case LOC_LABEL: - case LOC_BLOCK: - case LOC_CONST_BYTES: - case LOC_UNRESOLVED: - case LOC_OPTIMIZED_OUT: - case LOC_COMPUTED: - default: - break; - } + if (SYMBOL_IS_ARGUMENT (sym)) + nparams++; } if (nparams > 0) { @@ -320,31 +298,11 @@ finish_block (struct symbol *symbol, struct pending **listhead, if (iparams == nparams) break; - switch (SYMBOL_CLASS (sym)) + if (SYMBOL_IS_ARGUMENT (sym)) { - case LOC_ARG: - case LOC_REF_ARG: - case LOC_REGPARM: - case LOC_REGPARM_ADDR: - case LOC_COMPUTED_ARG: TYPE_FIELD_TYPE (ftype, iparams) = SYMBOL_TYPE (sym); TYPE_FIELD_ARTIFICIAL (ftype, iparams) = 0; iparams++; - break; - case LOC_UNDEF: - case LOC_CONST: - case LOC_STATIC: - case LOC_REGISTER: - case LOC_LOCAL: - case LOC_TYPEDEF: - case LOC_LABEL: - case LOC_BLOCK: - case LOC_CONST_BYTES: - case LOC_UNRESOLVED: - case LOC_OPTIMIZED_OUT: - case LOC_COMPUTED: - default: - break; } } } diff --git a/gdb/coffread.c b/gdb/coffread.c index 7f01da6..e36b2f1 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1573,11 +1573,13 @@ process_coff_symbol (struct coff_symbol *cs, case C_ARG: SYMBOL_CLASS (sym) = LOC_ARG; + SYMBOL_IS_ARGUMENT (sym) = 1; add_symbol_to_list (sym, &local_symbols); break; case C_REGPARM: - SYMBOL_CLASS (sym) = LOC_REGPARM; + SYMBOL_CLASS (sym) = LOC_REGISTER; + SYMBOL_IS_ARGUMENT (sym) = 1; SYMBOL_VALUE (sym) = gdbarch_sdb_reg_to_regnum (current_gdbarch, cs->c_value); add_symbol_to_list (sym, &local_symbols); diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 67b734f..e36177a 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -7484,13 +7484,11 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) } break; case DW_TAG_formal_parameter: + SYMBOL_IS_ARGUMENT (sym) = 1; attr = dwarf2_attr (die, DW_AT_location, cu); if (attr) { var_decode_location (attr, sym, cu); - /* FIXME drow/2003-07-31: Is LOC_COMPUTED_ARG necessary? */ - if (SYMBOL_CLASS (sym) == LOC_COMPUTED) - SYMBOL_CLASS (sym) = LOC_COMPUTED_ARG; } attr = dwarf2_attr (die, DW_AT_const_value, cu); if (attr) @@ -2172,8 +2172,7 @@ evaluate_subexp_for_address (struct expression *exp, int *pos, if (sym_class == LOC_CONST || sym_class == LOC_CONST_BYTES - || sym_class == LOC_REGISTER - || sym_class == LOC_REGPARM) + || sym_class == LOC_REGISTER) error (_("Attempt to take address of register or constant.")); return diff --git a/gdb/findvar.c b/gdb/findvar.c index 13dea02..efe5af8 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -345,7 +345,6 @@ symbol_read_needs_frame (struct symbol *sym) /* All cases listed explicitly so that gcc -Wall will detect it if we failed to consider one. */ case LOC_COMPUTED: - case LOC_COMPUTED_ARG: /* FIXME: cagney/2004-01-26: It should be possible to unconditionally call the SYMBOL_OPS method when available. Unfortunately DWARF 2 stores the frame-base (instead of the @@ -356,7 +355,6 @@ symbol_read_needs_frame (struct symbol *sym) case LOC_REGISTER: case LOC_ARG: case LOC_REF_ARG: - case LOC_REGPARM: case LOC_REGPARM_ADDR: case LOC_LOCAL: return 1; @@ -395,9 +393,7 @@ read_var_value (struct symbol *var, struct frame_info *frame) int len; if (SYMBOL_CLASS (var) == LOC_COMPUTED - || SYMBOL_CLASS (var) == LOC_COMPUTED_ARG - || SYMBOL_CLASS (var) == LOC_REGISTER - || SYMBOL_CLASS (var) == LOC_REGPARM) + || SYMBOL_CLASS (var) == LOC_REGISTER) /* These cases do not use V. */ v = NULL; else @@ -496,7 +492,6 @@ read_var_value (struct symbol *var, struct frame_info *frame) return v; case LOC_REGISTER: - case LOC_REGPARM: case LOC_REGPARM_ADDR: { struct block *b; @@ -531,7 +526,6 @@ read_var_value (struct symbol *var, struct frame_info *frame) break; case LOC_COMPUTED: - case LOC_COMPUTED_ARG: /* FIXME: cagney/2004-01-26: It should be possible to unconditionally call the SYMBOL_OPS method when available. Unfortunately DWARF 2 stores the frame-base (instead of the diff --git a/gdb/m2-exp.y b/gdb/m2-exp.y index cffac98..951f778 100644 --- a/gdb/m2-exp.y +++ b/gdb/m2-exp.y @@ -1041,14 +1041,12 @@ yylex () case LOC_REGISTER: case LOC_ARG: case LOC_REF_ARG: - case LOC_REGPARM: case LOC_REGPARM_ADDR: case LOC_LOCAL: case LOC_CONST: case LOC_CONST_BYTES: case LOC_OPTIMIZED_OUT: case LOC_COMPUTED: - case LOC_COMPUTED_ARG: return NAME; case LOC_TYPEDEF: diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index c997ccd..856feaf 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -671,11 +671,12 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, s = new_symbol (name); SYMBOL_DOMAIN (s) = VAR_DOMAIN; + SYMBOL_IS_ARGUMENT (s) = 1; switch (sh->sc) { case scRegister: /* Pass by value in register. */ - SYMBOL_CLASS (s) = LOC_REGPARM; + SYMBOL_CLASS (s) = LOC_REGISTER; svalue = gdbarch_ecoff_reg_to_regnum (current_gdbarch, svalue); break; case scVar: @@ -1201,18 +1202,11 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, if (iparams == nparams) break; - switch (SYMBOL_CLASS (sym)) + if (SYMBOL_IS_ARGUMENT (sym)) { - case LOC_ARG: - case LOC_REF_ARG: - case LOC_REGPARM: - case LOC_REGPARM_ADDR: TYPE_FIELD_TYPE (ftype, iparams) = SYMBOL_TYPE (sym); TYPE_FIELD_ARTIFICIAL (ftype, iparams) = 0; iparams++; - break; - default: - break; } } } diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index 2b904b3..cddb8a1 100644 --- a/gdb/mi/mi-cmd-stack.c +++ b/gdb/mi/mi-cmd-stack.c @@ -252,18 +252,12 @@ list_args_or_locals (int locals, int values, struct frame_info *fi) case LOC_ARG: /* argument */ case LOC_REF_ARG: /* reference arg */ - case LOC_REGPARM: /* register arg */ case LOC_REGPARM_ADDR: /* indirect register arg */ - case LOC_COMPUTED_ARG: /* arg with computed location */ - if (!locals) - print_me = 1; - break; - case LOC_LOCAL: /* stack local */ case LOC_STATIC: /* static */ case LOC_REGISTER: /* register */ case LOC_COMPUTED: /* computed location */ - if (locals) + if (SYMBOL_IS_ARGUMENT (sym) ? !locals : locals) print_me = 1; break; } @@ -282,7 +276,7 @@ list_args_or_locals (int locals, int values, struct frame_info *fi) block, VAR_DOMAIN, (int *) NULL); else - sym2 = sym; + sym2 = sym; switch (values) { case PRINT_SIMPLE_VALUES: diff --git a/gdb/printcmd.c b/gdb/printcmd.c index ad94018..bbfef3e 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1105,7 +1105,6 @@ address_info (char *exp, int from_tty) break; case LOC_COMPUTED: - case LOC_COMPUTED_ARG: /* FIXME: cagney/2004-01-26: It should be possible to unconditionally call the SYMBOL_OPS method when available. Unfortunately DWARF 2 stores the frame-base (instead of the @@ -1115,7 +1114,11 @@ address_info (char *exp, int from_tty) break; case LOC_REGISTER: - printf_filtered (_("a variable in register %s"), + if (SYMBOL_IS_ARGUMENT (sym)) + printf_filtered (_("an argument in register %s"), + gdbarch_register_name (current_gdbarch, val)); + else + printf_filtered (_("a variable in register %s"), gdbarch_register_name (current_gdbarch, val)); break; @@ -1132,11 +1135,6 @@ address_info (char *exp, int from_tty) } break; - case LOC_REGPARM: - printf_filtered (_("an argument in register %s"), - gdbarch_register_name (current_gdbarch, val)); - break; - case LOC_REGPARM_ADDR: printf_filtered (_("address of an argument in register %s"), gdbarch_register_name (current_gdbarch, val)); diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 6d6b094..e9580f9 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -930,6 +930,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, SYMBOL_CLASS (sym) = LOC_ARG; SYMBOL_VALUE (sym) = valu; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; + SYMBOL_IS_ARGUMENT (sym) = 1; add_symbol_to_list (sym, &local_symbols); if (gdbarch_byte_order (gdbarch) != BFD_ENDIAN_BIG) @@ -974,7 +975,8 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, case 'R': /* Parameter which is in a register. */ SYMBOL_TYPE (sym) = read_type (&p, objfile); - SYMBOL_CLASS (sym) = LOC_REGPARM; + SYMBOL_CLASS (sym) = LOC_REGISTER; + SYMBOL_IS_ARGUMENT (sym) = 1; SYMBOL_VALUE (sym) = gdbarch_stab_reg_to_regnum (current_gdbarch, valu); if (SYMBOL_VALUE (sym) >= gdbarch_num_regs (current_gdbarch) + gdbarch_num_pseudo_regs (current_gdbarch)) @@ -1039,7 +1041,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, && strcmp (DEPRECATED_SYMBOL_NAME (prev_sym), DEPRECATED_SYMBOL_NAME (sym)) == 0) { - SYMBOL_CLASS (prev_sym) = LOC_REGPARM; + SYMBOL_CLASS (prev_sym) = LOC_REGISTER; /* Use the type from the LOC_REGISTER; that is the type that is actually in that register. */ SYMBOL_TYPE (prev_sym) = SYMBOL_TYPE (sym); @@ -1265,6 +1267,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, /* Reference parameter */ SYMBOL_TYPE (sym) = read_type (&p, objfile); SYMBOL_CLASS (sym) = LOC_REF_ARG; + SYMBOL_IS_ARGUMENT (sym) = 1; SYMBOL_VALUE (sym) = valu; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; add_symbol_to_list (sym, &local_symbols); @@ -1274,6 +1277,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, /* Reference parameter which is in a register. */ SYMBOL_TYPE (sym) = read_type (&p, objfile); SYMBOL_CLASS (sym) = LOC_REGPARM_ADDR; + SYMBOL_IS_ARGUMENT (sym) = 1; SYMBOL_VALUE (sym) = gdbarch_stab_reg_to_regnum (current_gdbarch, valu); if (SYMBOL_VALUE (sym) >= gdbarch_num_regs (current_gdbarch) + gdbarch_num_pseudo_regs (current_gdbarch)) @@ -1315,11 +1319,11 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, register or on the stack) instead of the structure itself. */ if (gdbarch_stabs_argument_has_addr (gdbarch, SYMBOL_TYPE (sym)) - && (SYMBOL_CLASS (sym) == LOC_REGPARM || SYMBOL_CLASS (sym) == LOC_ARG)) + && SYMBOL_IS_ARGUMENT (sym)) { - /* We have to convert LOC_REGPARM to LOC_REGPARM_ADDR (for + /* We have to convert LOC_REGISTER to LOC_REGPARM_ADDR (for variables passed in a register). */ - if (SYMBOL_CLASS (sym) == LOC_REGPARM) + if (SYMBOL_CLASS (sym) == LOC_REGISTER) SYMBOL_CLASS (sym) = LOC_REGPARM_ADDR; /* Likewise for converting LOC_ARG to LOC_REF_ARG (for the 7th and subsequent arguments on SPARC, for example). */ diff --git a/gdb/stack.c b/gdb/stack.c index 5d78be1..3d78f74 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -235,6 +235,9 @@ print_frame_args (struct symbol *func, struct frame_info *frame, /* Keep track of the highest stack argument offset seen, and skip over any kinds of symbols we don't care about. */ + if (!SYMBOL_IS_ARGUMENT (sym)) + continue; + switch (SYMBOL_CLASS (sym)) { case LOC_ARG: @@ -262,14 +265,12 @@ print_frame_args (struct symbol *func, struct frame_info *frame, /* We care about types of symbols, but don't need to keep track of stack offsets in them. */ - case LOC_REGPARM: + case LOC_REGISTER: case LOC_REGPARM_ADDR: - case LOC_COMPUTED_ARG: - break; - - /* Other types of symbols we just skip over. */ + case LOC_COMPUTED: + case LOC_OPTIMIZED_OUT: default: - continue; + break; } /* We have to look up the symbol because arguments can have @@ -291,7 +292,8 @@ print_frame_args (struct symbol *func, struct frame_info *frame, nsym = lookup_symbol (DEPRECATED_SYMBOL_NAME (sym), b, VAR_DOMAIN, NULL); gdb_assert (nsym != NULL); - if (SYMBOL_CLASS (nsym) == LOC_REGISTER) + if (SYMBOL_CLASS (nsym) == LOC_REGISTER + && !SYMBOL_IS_ARGUMENT (nsym)) { /* There is a LOC_ARG/LOC_REGISTER pair. This means that it was passed on the stack and loaded into a @@ -1375,6 +1377,8 @@ print_block_frame_locals (struct block *b, struct frame_info *frame, case LOC_REGISTER: case LOC_STATIC: case LOC_COMPUTED: + if (SYMBOL_IS_ARGUMENT (sym)) + break; values_printed = 1; for (j = 0; j < num_tabs; j++) fputs_filtered ("\t", stream); @@ -1571,13 +1575,9 @@ print_frame_arg_vars (struct frame_info *frame, struct ui_file *stream) b = SYMBOL_BLOCK_VALUE (func); ALL_BLOCK_SYMBOLS (b, iter, sym) { - switch (SYMBOL_CLASS (sym)) + /* Don't worry about things which aren't arguments. */ + if (SYMBOL_IS_ARGUMENT (sym)) { - case LOC_ARG: - case LOC_REF_ARG: - case LOC_REGPARM: - case LOC_REGPARM_ADDR: - case LOC_COMPUTED_ARG: values_printed = 1; fputs_filtered (SYMBOL_PRINT_NAME (sym), stream); fputs_filtered (" = ", stream); @@ -1597,11 +1597,6 @@ print_frame_arg_vars (struct frame_info *frame, struct ui_file *stream) b, VAR_DOMAIN, NULL); print_variable_value (sym2, frame, stream); fprintf_filtered (stream, "\n"); - break; - - default: - /* Don't worry about things which aren't arguments. */ - break; } } diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 90c1918..7365bab 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -643,7 +643,11 @@ print_symbol (void *args) break; case LOC_REGISTER: - fprintf_filtered (outfile, "register %ld", SYMBOL_VALUE (symbol)); + if (SYMBOL_IS_ARGUMENT (symbol)) + fprintf_filtered (outfile, "parameter register %ld", + SYMBOL_VALUE (symbol)); + else + fprintf_filtered (outfile, "register %ld", SYMBOL_VALUE (symbol)); break; case LOC_ARG: @@ -655,10 +659,6 @@ print_symbol (void *args) fprintf_filtered (outfile, "reference arg at 0x%lx", SYMBOL_VALUE (symbol)); break; - case LOC_REGPARM: - fprintf_filtered (outfile, "parameter register %ld", SYMBOL_VALUE (symbol)); - break; - case LOC_REGPARM_ADDR: fprintf_filtered (outfile, "address parameter register %ld", SYMBOL_VALUE (symbol)); break; @@ -698,7 +698,6 @@ print_symbol (void *args) break; case LOC_COMPUTED: - case LOC_COMPUTED_ARG: fprintf_filtered (outfile, "computed at runtime"); break; @@ -820,9 +819,6 @@ print_partial_symbols (struct partial_symbol **p, int count, char *what, case LOC_REF_ARG: fputs_filtered ("pass by reference", outfile); break; - case LOC_REGPARM: - fputs_filtered ("register parameter", outfile); - break; case LOC_REGPARM_ADDR: fputs_filtered ("register address parameter", outfile); break; @@ -848,7 +844,6 @@ print_partial_symbols (struct partial_symbol **p, int count, char *what, fputs_filtered ("optimized out", outfile); break; case LOC_COMPUTED: - case LOC_COMPUTED_ARG: fputs_filtered ("computed at runtime", outfile); break; default: diff --git a/gdb/symtab.c b/gdb/symtab.c index 847d5ea..6adecbf 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -1955,11 +1955,7 @@ lookup_block_symbol (const struct block *block, const char *name, ? strcmp (SYMBOL_LINKAGE_NAME (sym), linkage_name) == 0 : 1)) { sym_found = sym; - if (SYMBOL_CLASS (sym) != LOC_ARG && - SYMBOL_CLASS (sym) != LOC_REF_ARG && - SYMBOL_CLASS (sym) != LOC_REGPARM && - SYMBOL_CLASS (sym) != LOC_REGPARM_ADDR && - SYMBOL_CLASS (sym) != LOC_COMPUTED_ARG) + if (!SYMBOL_IS_ARGUMENT (sym)) { break; } diff --git a/gdb/symtab.h b/gdb/symtab.h index cd9936a..ae4faf5 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -426,7 +426,13 @@ enum address_class LOC_STATIC, - /* Value is in register. SYMBOL_VALUE is the register number. */ + /* Value is in register. SYMBOL_VALUE is the register number. + + For some symbol formats (stabs, for some compilers at least), + the compiler generates two symbols, an argument and a register. + In some cases we combine them to a single LOC_REGISTER in symbol + reading, but currently not for all cases (e.g. it's passed on the + stack and then loaded into a register). */ LOC_REGISTER, @@ -438,22 +444,7 @@ enum address_class LOC_REF_ARG, - /* Value is in register number SYMBOL_VALUE. Just like LOC_REGISTER - except this is an argument. Probably the cleaner way to handle - this would be to separate address_class (which would include - separate ARG and LOCAL to deal with the frame's arguments - (get_frame_args_address) versus the frame's locals - (get_frame_locals_address), and an is_argument flag. - - For some symbol formats (stabs, for some compilers at least), - the compiler generates two symbols, an argument and a register. - In some cases we combine them to a single LOC_REGPARM in symbol - reading, but currently not for all cases (e.g. it's passed on the - stack and then loaded into a register). */ - - LOC_REGPARM, - - /* Value is in specified register. Just like LOC_REGPARM except the + /* Value is in specified register. Just like LOC_REGISTER except the register holds the address of the argument instead of the argument itself. This is currently used for the passing of structs and unions on sparc and hppa. It is also used for call by reference where the @@ -505,9 +496,6 @@ enum address_class /* The variable's address is computed by a set of location functions (see "struct symbol_ops" below). */ LOC_COMPUTED, - - /* Same as LOC_COMPUTED, but for function arguments. */ - LOC_COMPUTED_ARG }; /* The methods needed to implement a symbol class. These methods can @@ -576,6 +564,10 @@ struct symbol ENUM_BITFIELD(address_class) aclass : 6; + /* Whether this is an argument. */ + + unsigned is_argument : 1; + /* Line number of definition. FIXME: Should we really make the assumption that nobody will try to debug files longer than 64K lines? What about machine generated programs? */ @@ -590,7 +582,7 @@ struct symbol /* An arbitrary data pointer, allowing symbol readers to record additional information on a per-symbol basis. Note that this data must be allocated using the same obstack as the symbol itself. */ - /* So far it is only used by LOC_COMPUTED and LOC_COMPUTED_ARG to + /* So far it is only used by LOC_COMPUTED to find the location information. For a LOC_BLOCK symbol for a function in a compilation unit compiled with DWARF 2 information, this is information used internally by the DWARF 2 @@ -608,6 +600,7 @@ struct symbol #define SYMBOL_DOMAIN(symbol) (symbol)->domain #define SYMBOL_CLASS(symbol) (symbol)->aclass +#define SYMBOL_IS_ARGUMENT(symbol) (symbol)->is_argument #define SYMBOL_TYPE(symbol) (symbol)->type #define SYMBOL_LINE(symbol) (symbol)->line #define SYMBOL_SYMTAB(symbol) (symbol)->symtab diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 608bc91..369f2b4 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-05-27 Andreas Schwab <schwab@suse.de> + + * gdb.base/frame-args.exp: Handle arguments that are optimized + out. + 2008-05-26 Luis Machado <luisgpm@br.ibm.com> * gdb.arch/ppc64-atomic-inst.exp: Make the expected compile failure diff --git a/gdb/testsuite/gdb.base/frame-args.exp b/gdb/testsuite/gdb.base/frame-args.exp index 1a97b39..fe50bb2 100644 --- a/gdb/testsuite/gdb.base/frame-args.exp +++ b/gdb/testsuite/gdb.base/frame-args.exp @@ -41,7 +41,7 @@ gdb_test "set print frame-arguments all" \ "" \ "set print frame-arguments all" gdb_test "frame 1" \ - ".*in call_me \\(i=3, f=5, s={a = 3, b = 5}, ss=0x\[0-9a-f\]\+, u={.*}, e=green\\) at .*frame-args\\.c:.*" \ + ".*in call_me \\(i=3, f=5, s=({a = 3, b = 5}|<value optimized out>), ss=0x\[0-9a-f\]\+, u=({.*}|<value optimized out>), e=green\\) at .*frame-args\\.c:.*" \ "frame 1 with print frame-arguments set to all" # Test with "print frame-arguments" set to "scalars" diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 9784af1..7cd98be 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -1237,7 +1237,6 @@ collect_symbol (struct collection_list *collect, add_memrange (collect, memrange_absolute, offset, len); break; case LOC_REGISTER: - case LOC_REGPARM: reg = SYMBOL_VALUE (sym); if (info_verbose) printf_filtered ("LOC_REG[parm] %s: ", @@ -1317,31 +1316,13 @@ add_local_symbols (struct collection_list *collect, CORE_ADDR pc, QUIT; /* allow user to bail out with ^C */ ALL_BLOCK_SYMBOLS (block, iter, sym) { - switch (SYMBOL_CLASS (sym)) + if (SYMBOL_IS_ARGUMENT (sym) + ? type == 'A' /* collecting Arguments */ + : type == 'L') /* collecting Locals */ { - default: - warning (_("don't know how to trace local symbol %s"), - DEPRECATED_SYMBOL_NAME (sym)); - case LOC_LOCAL: - case LOC_STATIC: - case LOC_REGISTER: - if (type == 'L') /* collecting Locals */ - { - count++; - collect_symbol (collect, sym, frame_regno, - frame_offset); - } - break; - case LOC_ARG: - case LOC_REF_ARG: - case LOC_REGPARM: - case LOC_REGPARM_ADDR: - if (type == 'A') /* collecting Arguments */ - { - count++; - collect_symbol (collect, sym, frame_regno, - frame_offset); - } + count++; + collect_symbol (collect, sym, frame_regno, + frame_offset); } } if (BLOCK_FUNCTION (block)) @@ -2439,8 +2420,13 @@ scope_info (char *args, int from_tty) printf_filtered ("%s", paddress (SYMBOL_VALUE_ADDRESS (sym))); break; case LOC_REGISTER: - printf_filtered ("a local variable in register $%s", - gdbarch_register_name + if (SYMBOL_IS_ARGUMENT (sym)) + printf_filtered ("an argument in register $%s", + gdbarch_register_name + (current_gdbarch, SYMBOL_VALUE (sym))); + else + printf_filtered ("a local variable in register $%s", + gdbarch_register_name (current_gdbarch, SYMBOL_VALUE (sym))); break; case LOC_ARG: @@ -2455,11 +2441,6 @@ scope_info (char *args, int from_tty) printf_filtered ("a reference argument at offset %ld", SYMBOL_VALUE (sym)); break; - case LOC_REGPARM: - printf_filtered ("an argument in register $%s", - gdbarch_register_name - (current_gdbarch, SYMBOL_VALUE (sym))); - break; case LOC_REGPARM_ADDR: printf_filtered ("the address of an argument, in register $%s", gdbarch_register_name @@ -2491,7 +2472,6 @@ scope_info (char *args, int from_tty) printf_filtered ("optimized out.\n"); continue; case LOC_COMPUTED: - case LOC_COMPUTED_ARG: SYMBOL_OPS (sym)->describe_location (sym, gdb_stdout); break; } |