aboutsummaryrefslogtreecommitdiff
path: root/gdb/valprint.c
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1992-01-27 03:08:01 +0000
committerPer Bothner <per@bothner.com>1992-01-27 03:08:01 +0000
commit24b2fbdc543a7c51f9552a8607c88e50a61670a2 (patch)
tree620075d0211550ddbd4d5760f8d0fb2c6a425380 /gdb/valprint.c
parentcdb90e99e77765bbd0eb823df357f29ff5dbd787 (diff)
downloadgdb-24b2fbdc543a7c51f9552a8607c88e50a61670a2.zip
gdb-24b2fbdc543a7c51f9552a8607c88e50a61670a2.tar.gz
gdb-24b2fbdc543a7c51f9552a8607c88e50a61670a2.tar.bz2
Print C++ constructor methods without bogus "return type."
Diffstat (limited to 'gdb/valprint.c')
-rw-r--r--gdb/valprint.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 139679a..b031e16 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -1319,7 +1319,6 @@ type_print_method_args (args, prefix, varstring, staticp, stream)
{
int i;
- fputs_filtered (" ", stream);
fputs_demangled (prefix, stream, 1);
fputs_demangled (varstring, stream, 1);
fputs_filtered (" (", stream);
@@ -1698,7 +1697,8 @@ type_print_base (type, stream, show, level)
{
struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i);
int j, len2 = TYPE_FN_FIELDLIST_LENGTH (type, i);
-
+ char *method_name = TYPE_FN_FIELDLIST_NAME (type, i);
+ int is_constructor = strcmp(method_name, TYPE_NAME (type)) == 0;
for (j = 0; j < len2; j++)
{
QUIT;
@@ -1714,20 +1714,24 @@ type_print_base (type, stream, show, level)
TYPE_FN_FIELD_PHYSNAME (f, j));
break;
}
- else
- type_print (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)), "", stream, 0);
- if (TYPE_FLAGS (TYPE_FN_FIELD_TYPE (f, j)) & TYPE_FLAG_STUB)
+ else if (!is_constructor)
+ {
+ type_print (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)),
+ "", stream, 0);
+ fputs_filtered (" ", stream);
+ }
+ if (TYPE_FN_FIELD_STUB (f, j))
{
/* Build something we can demangle. */
char *strchr (), *gdb_mangle_name (), *cplus_demangle ();
char *mangled_name = gdb_mangle_name (type, i, j);
char *demangled_name = cplus_demangle (mangled_name, 1);
if (demangled_name == 0)
- fprintf_filtered (stream, " <badly mangled name %s>",
+ fprintf_filtered (stream, "<badly mangled name %s>",
mangled_name);
else
{
- fprintf_filtered (stream, " %s",
+ fprintf_filtered (stream, "%s",
strchr (demangled_name, ':') + 2);
free (demangled_name);
}
@@ -1737,11 +1741,11 @@ type_print_base (type, stream, show, level)
&& TYPE_FN_FIELD_PHYSNAME (f, j)[1] == CPLUS_MARKER)
type_print_method_args
(TYPE_FN_FIELD_ARGS (f, j) + 1, "~",
- TYPE_FN_FIELDLIST_NAME (type, i), 0, stream);
+ method_name, 0, stream);
else
type_print_method_args
(TYPE_FN_FIELD_ARGS (f, j), "",
- TYPE_FN_FIELDLIST_NAME (type, i),
+ method_name,
TYPE_FN_FIELD_STATIC_P (f, j), stream);
fprintf_filtered (stream, ";\n");