diff options
author | Per Bothner <per@bothner.com> | 1991-11-12 22:20:02 +0000 |
---|---|---|
committer | Per Bothner <per@bothner.com> | 1991-11-12 22:20:02 +0000 |
commit | 0e2a896cf5a7231fe300fe0918a38f87bc9ee0ec (patch) | |
tree | 3ba6589b103df25eeaab1de54754fbe0f5cbea36 | |
parent | 5f12485297f7f829c0c035657197ce1de09a10cd (diff) | |
download | gdb-0e2a896cf5a7231fe300fe0918a38f87bc9ee0ec.zip gdb-0e2a896cf5a7231fe300fe0918a38f87bc9ee0ec.tar.gz gdb-0e2a896cf5a7231fe300fe0918a38f87bc9ee0ec.tar.bz2 |
Fixes related to handling of C++ methods (handle destructors
and parameters that are functions).
-rw-r--r-- | gdb/ChangeLog | 24 | ||||
-rw-r--r-- | gdb/buildsym.c | 16 | ||||
-rw-r--r-- | gdb/c-exp.y | 2 | ||||
-rw-r--r-- | gdb/symtab.c | 20 | ||||
-rw-r--r-- | gdb/values.c | 23 |
5 files changed, 56 insertions, 29 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d857fcf..620e5b2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,27 @@ +Tue Nov 12 13:43:26 1991 Per Bothner (bothner at cygnus.com) + + * symtab.c (decode_line_1): Remove spurious call to operator_chars. + + Allow setting breakpoints on C++ destructors. + * valops.c (destructor_name_p): Don't check TYPE_HAS_DESTRUCTOR, + since it lies. Rely on callers to catch missing destructors. + * symtab.c (decode_line_1): For example (see above), here. + * buildsym.c, symtab.h: Remove TYPE_FLAGS_HAS{CON,DE}STRUCTOR + flags since they are no longer used. + + Fixes to support C++ methods with functional parameters. + * c-exp.y (func_mod rule): Allow (and ignore) list of parameter + types in a function type. + * eval.c (parse_and_eval_type), value.h: New function, + parse_and_eval_type, is based on old code from check_stub_method. + But don't actually evaluate the cast, since that calls + value_cast(), whcih may fail. Just extract the type + from the parsed expression. + * values.c (check_stub_method): While looping through the + arguments, adjust depth *after* parameter has been handled. + Replace call and setup of parse_and_eval with new function + parse_and_eval_type. + Tue Nov 12 09:40:07 1991 Fred Fish (fnf at cygnus.com) * utils.c, rem-multi.shar: Remove fixed arg count version of diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 3e573f1..1c55a68 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -2383,20 +2383,10 @@ read_struct_type (pp, type) { *pp += 1; - if (**pp == '=') + if (**pp == '=' || **pp == '+' || **pp == '-') { - TYPE_FLAGS (type) - |= TYPE_FLAG_HAS_CONSTRUCTOR | TYPE_FLAG_HAS_DESTRUCTOR; - *pp += 1; - } - else if (**pp == '+') - { - TYPE_FLAGS (type) |= TYPE_FLAG_HAS_CONSTRUCTOR; - *pp += 1; - } - else if (**pp == '-') - { - TYPE_FLAGS (type) |= TYPE_FLAG_HAS_DESTRUCTOR; + /* Obsolete flags that used to indicate the presence + of constructors and/or destructors. */ *pp += 1; } diff --git a/gdb/c-exp.y b/gdb/c-exp.y index 3e318fe..0c51cd2 100644 --- a/gdb/c-exp.y +++ b/gdb/c-exp.y @@ -771,6 +771,8 @@ array_mod: '[' ']' func_mod: '(' ')' { $$ = 0; } + | '(' nonempty_typelist ')' + { free ($2); $$ = 0; } ; type : ptype diff --git a/gdb/symtab.c b/gdb/symtab.c index 709559c..9d4db8f 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -1270,6 +1270,18 @@ lookup_partial_symbol (pst, name, global, namespace) return (struct partial_symbol *) 0; } +/* Find the psymtab containing main(). */ + +struct partial_symtab * +find_main_psymtab () +{ + register struct partial_symtab *pst; + for (pst = partial_symtab_list; pst; pst = pst->next) + if (lookup_partial_symbol (pst, "main", 1, VAR_NAMESPACE)) + return pst; + return NULL; +} + /* Look for a symbol in block BLOCK. */ struct symbol * @@ -1930,7 +1942,6 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line) } while (p[0] == ' ' || p[0] == '\t') p++; - q = operator_chars (*argptr, &q1); if (p[0] == ':') { @@ -2043,7 +2054,12 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line) } else tmp = copy; - error ("that class does not have any method named %s", tmp); + if (tmp[0] == '~') + error ("The class `%s' does not have destructor defined", + sym_class->name); + else + error ("The class %s does not have any method named %s", + sym_class->name, tmp); } } else diff --git a/gdb/values.c b/gdb/values.c index eac4d59..810e00b 100644 --- a/gdb/values.c +++ b/gdb/values.c @@ -1284,27 +1284,22 @@ check_stub_method (type, i, j) if (*p != ')') /* () means no args, skip while */ { + depth = 0; while (*p) { - if (*p == '(') - depth += 1; - else if (*p == ')') - depth -= 1; - if (depth <= 0 && (*p == ',' || *p == ')')) { - char *tmp = (char *)alloca (p - argtypetext + 4); - value val; - tmp[0] = '('; - bcopy (argtypetext, tmp+1, p - argtypetext); - tmp[p-argtypetext+1] = ')'; - tmp[p-argtypetext+2] = '0'; - tmp[p-argtypetext+3] = '\0'; - val = parse_and_eval (tmp); - argtypes[argcount] = VALUE_TYPE (val); + argtypes[argcount] = + parse_and_eval_type (argtypetext, p - argtypetext); argcount += 1; argtypetext = p + 1; } + + if (*p == '(') + depth += 1; + else if (*p == ')') + depth -= 1; + p += 1; } } |