diff options
author | Fred Fish <fnf@specifix.com> | 1992-07-09 04:40:39 +0000 |
---|---|---|
committer | Fred Fish <fnf@specifix.com> | 1992-07-09 04:40:39 +0000 |
commit | 8050a57b2c1a8e7a54a81b540e6446d310a08b6b (patch) | |
tree | 94a82a32f7273ad3f341c172bf8ed44298ed10de /gdb/symtab.c | |
parent | e17e8e0e03750974d678548fae82ba44f038a1c9 (diff) | |
download | fsf-binutils-gdb-8050a57b2c1a8e7a54a81b540e6446d310a08b6b.zip fsf-binutils-gdb-8050a57b2c1a8e7a54a81b540e6446d310a08b6b.tar.gz fsf-binutils-gdb-8050a57b2c1a8e7a54a81b540e6446d310a08b6b.tar.bz2 |
* dwarfread.c (alloc_utype, decode_subscr_data): Call alloc_type
to create new blank types, instead of handcrafting them.
* defs.h (printfi_filtered): Add prototype.
* utils.c (printfi_filtered): New function.
* gdbtypes.c (recursive_dump_type): Use printfi_filtered to
to simplify the code. Other cleanups.
* gdbtypes.c (check_stub_method): Demangle using DMGL_ANSI.
* gdbtypes.h (struct cplus_struct_type): Add comments describing
use of various fields.
* gdbtypes.c (print_bit_vector, print_cplus_stuff): New functions.
* c-exp.y (%token): Add CLASS as a token for C++, add grammar
production that currently treats it exactly the same as STRUCT.
* c-exp.y (yylex): Recognize "class" as token CLASS.
* symtab.c (gdb_mangle_name): Rewrite to match current g++ stabs.
* symtab.c (decode_line_1): Fix to pass quoted args on down to
general symbol handling code. Call cplus_mangle_opname with
DMGL_ANSI.
* symtab.c (decode_line_2): Print demangled function names in
breakpoint menus, instead of just file and line number.
* symtab.c (name_match): Call cplus_demangle with DMGL_ANSI.
* valprint.c (type_print_base): Print "class" for C++ classes,
rather than "struct". Print section labels for public, protected
and private members of C++ classes.
* values.c: Include demangle.h.
* values.c (value_headof): Call cplus_demangle with DMGL_ANSI.
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r-- | gdb/symtab.c | 85 |
1 files changed, 46 insertions, 39 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c index 1913c5b..a0033d9 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -261,48 +261,58 @@ gdb_mangle_name (type, i, j) struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i); struct fn_field *method = &f[j]; char *field_name = TYPE_FN_FIELDLIST_NAME (type, i); - int is_constructor = strcmp(field_name, TYPE_NAME (type)) == 0; + char *physname = TYPE_FN_FIELD_PHYSNAME (f, j); + char *opname; + int is_constructor = strcmp (field_name, type_name_no_tag (type)) == 0; /* Need a new type prefix. */ char *const_prefix = method->is_const ? "C" : ""; char *volatile_prefix = method->is_volatile ? "V" : ""; - char *newname = type_name_no_tag (type); char buf[20]; - int len = strlen (newname); - sprintf (buf, "__%s%s%d", const_prefix, volatile_prefix, len); + if (is_constructor) + { + buf[0] = '\0'; + } + else + { + sprintf (buf, "__%s%s", const_prefix, volatile_prefix); + } + mangled_name_len = ((is_constructor ? 0 : strlen (field_name)) - + strlen (buf) + len - + strlen (TYPE_FN_FIELD_PHYSNAME (f, j)) - + 1); + + strlen (buf) + strlen (physname) + 1); /* Only needed for GNU-mangled names. ANSI-mangled names work with the normal mechanisms. */ if (OPNAME_PREFIX_P (field_name)) { - char *opname = cplus_mangle_opname (field_name + 3, 0); + opname = cplus_mangle_opname (field_name + 3, 0); if (opname == NULL) - error ("No mangling for \"%s\"", field_name); + { + error ("No mangling for \"%s\"", field_name); + } mangled_name_len += strlen (opname); - mangled_name = (char *)xmalloc (mangled_name_len); + mangled_name = (char *) xmalloc (mangled_name_len); strncpy (mangled_name, field_name, 3); - mangled_name[3] = '\0'; - strcat (mangled_name, opname); + strcpy (mangled_name + 3, opname); } else { - mangled_name = (char *)xmalloc (mangled_name_len); + mangled_name = (char *) xmalloc (mangled_name_len); if (is_constructor) - mangled_name[0] = '\0'; + { + mangled_name[0] = '\0'; + } else - strcpy (mangled_name, field_name); + { + strcpy (mangled_name, field_name); + } } strcat (mangled_name, buf); - strcat (mangled_name, newname); - strcat (mangled_name, TYPE_FN_FIELD_PHYSNAME (f, j)); + strcat (mangled_name, physname); - return mangled_name; + return (mangled_name); } @@ -1440,6 +1450,7 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line) char *copy; struct symbol *sym_class; int i1; + int is_quoted; struct symbol **sym_arr; struct type *t; char **physnames; @@ -1454,22 +1465,9 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line) default_line = current_source_line; } + /* See if arg is *PC */ - /* Check to see if *ARGPTR points to a string that has been quoted with - gdb_completer_quote_characters. If so, P will be left pointing at - someplace other than *ARGPTR */ - - if (((p = skip_quoted (*argptr)) != *argptr) && - ((*(p - 1) != **argptr) || - (strchr (gdb_completer_quote_characters, **argptr) == NULL))) - { - /* Not quoted symbol string specification, reset P */ - p = *argptr; - } - - /* See if arg is *PC or '<some symbol specifier string>' */ - - if ((**argptr == '*') || (p != *argptr)) + if (**argptr == '*') { if (**argptr == '*') { @@ -1486,7 +1484,8 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line) /* Maybe arg is FILE : LINENUM or FILE : FUNCTION */ - s = 0; + s = NULL; + is_quoted = (strchr (gdb_completer_quote_characters, **argptr) != NULL); for (p = *argptr; *p; p++) { @@ -1495,7 +1494,7 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line) } while (p[0] == ' ' || p[0] == '\t') p++; - if (p[0] == ':') + if ((p[0] == ':') && !is_quoted) { /* C++ */ @@ -1532,7 +1531,7 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line) char *tmp = alloca (q1 - q + 1); memcpy (tmp, q, q1 - q); tmp[q1 - q] = '\0'; - opname = cplus_mangle_opname (tmp, 1); + opname = cplus_mangle_opname (tmp, DMGL_ANSI); if (opname == NULL) { warning ("no mangling for \"%s\"", tmp); @@ -1857,6 +1856,7 @@ decode_line_2 (sym_arr, nelts, funfirstline) char *args, *arg1; int i; char *prompt; + char *demangled; values.sals = (struct symtab_and_line *) alloca (nelts * sizeof(struct symtab_and_line)); return_values.sals = (struct symtab_and_line *) xmalloc (nelts * sizeof(struct symtab_and_line)); @@ -1875,8 +1875,15 @@ decode_line_2 (sym_arr, nelts, funfirstline) values.sals[i] = find_pc_line (pc, 0); values.sals[i].pc = (values.sals[i].end && values.sals[i].pc != pc) ? values.sals[i].end : pc; - printf("[%d] file:%s; line number:%d\n", - (i+2), values.sals[i].symtab->filename, values.sals[i].line); + demangled = cplus_demangle (SYMBOL_NAME (sym_arr[i]), + DMGL_PARAMS | DMGL_ANSI); + printf("[%d] %s at %s:%d\n", (i+2), + demangled ? demangled : SYMBOL_NAME (sym_arr[i]), + values.sals[i].symtab->filename, values.sals[i].line); + if (demangled != NULL) + { + free (demangled); + } } else printf ("?HERE\n"); i++; @@ -2042,7 +2049,7 @@ static int name_match (name) char *name; { - char *demangled = cplus_demangle (name, 0); + char *demangled = cplus_demangle (name, DMGL_ANSI); if (demangled != NULL) { int cond = re_exec (demangled); |