aboutsummaryrefslogtreecommitdiff
path: root/gdb/valprint.c
diff options
context:
space:
mode:
authorFred Fish <fnf@specifix.com>1992-05-10 01:43:04 +0000
committerFred Fish <fnf@specifix.com>1992-05-10 01:43:04 +0000
commitf9b5584c8ef0ade5f768c2fdedfb581ae01de65a (patch)
tree33274323aa180dc874d7610af07299b608c0ea82 /gdb/valprint.c
parent1e939db1573f1c1c81b7bd659783dfd8754022bd (diff)
downloadfsf-binutils-gdb-f9b5584c8ef0ade5f768c2fdedfb581ae01de65a.zip
fsf-binutils-gdb-f9b5584c8ef0ade5f768c2fdedfb581ae01de65a.tar.gz
fsf-binutils-gdb-f9b5584c8ef0ade5f768c2fdedfb581ae01de65a.tar.bz2
* Makefile.in (VERSION): Bump to 4.5.3
* Makefile.in (DEMANGLE_OPTS): Remove obsolete -Dnounderscore * Makefile.in (demangle): New target to create standalone demangler with same code and options as internal demangler. * cplus-dem.c: Massive restructuring, rewriting, cleanups, etc to support ARM style and Lucid style demangling, improve maintainability, fix several demangling bugs. More changes to follow. * defs.h (strstr): Add ANSI compatible prototype. * valprint.c (type_print_1): Demangle using ansi option. * config/ncr3000.mt (DEMANGLE_OPTS): Remove -Dnounderscore.
Diffstat (limited to 'gdb/valprint.c')
-rw-r--r--gdb/valprint.c44
1 files changed, 29 insertions, 15 deletions
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 6492f1d..c4ea667 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -52,7 +52,7 @@ static void
type_print_base PARAMS ((struct type *, FILE *, int, int));
static void
-type_print_varspec_suffix PARAMS ((struct type *, FILE *, int, int));
+type_print_varspec_suffix PARAMS ((struct type *, FILE *, int, int, int));
static void
type_print_varspec_prefix PARAMS ((struct type *, FILE *, int, int));
@@ -1350,6 +1350,8 @@ type_print_1 (type, varstring, stream, show, level)
int level;
{
register enum type_code code;
+ char *demangled;
+
type_print_base (type, stream, show, level);
code = TYPE_CODE (type);
if ((varstring && *varstring)
@@ -1365,13 +1367,23 @@ type_print_1 (type, varstring, stream, show, level)
|| code == TYPE_CODE_REF)))
fprintf_filtered (stream, " ");
type_print_varspec_prefix (type, stream, show, 0);
- /* FIXME: Previously this printed demangled names without function args,
- which is a lose since you can't distinguish between overloaded function
- names (try "info func" for example). This change is still not optimal,
- since you now get a superflous pair of parens for functions, but at
- least you can distinguish them. */
- fputs_demangled (varstring, stream, DMGL_PARAMS);
- type_print_varspec_suffix (type, stream, show, 0);
+ if (demangle)
+ {
+ demangled = cplus_demangle (varstring, DMGL_ANSI | DMGL_PARAMS);
+ }
+ if ((demangled != NULL) && (code == TYPE_CODE_FUNC))
+ {
+ /* For demangled function names, we have the arglist as part
+ of the name, so don't print an additional pair of ()'s */
+ fputs_filtered (demangled, stream);
+ type_print_varspec_suffix (type, stream, show, 0, 1);
+ free (demangled);
+ }
+ else
+ {
+ fputs_filtered (varstring, stream);
+ type_print_varspec_suffix (type, stream, show, 0, 0);
+ }
}
/* Print the method arguments ARGS to the file STREAM. */
@@ -1550,11 +1562,12 @@ type_print_varspec_prefix (type, stream, show, passed_a_ptr)
Args work like type_print_varspec_prefix. */
static void
-type_print_varspec_suffix (type, stream, show, passed_a_ptr)
+type_print_varspec_suffix (type, stream, show, passed_a_ptr, demangled_args)
struct type *type;
FILE *stream;
int show;
int passed_a_ptr;
+ int demangled_args;
{
if (type == 0)
return;
@@ -1579,19 +1592,19 @@ type_print_varspec_suffix (type, stream, show, passed_a_ptr)
fprintf_filtered (stream, "]");
type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
- 0);
+ 0, 0);
break;
case TYPE_CODE_MEMBER:
if (passed_a_ptr)
fprintf_filtered (stream, ")");
- type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0);
+ type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0);
break;
case TYPE_CODE_METHOD:
if (passed_a_ptr)
fprintf_filtered (stream, ")");
- type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0);
+ type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 0, 0);
if (passed_a_ptr)
{
int i;
@@ -1616,15 +1629,16 @@ type_print_varspec_suffix (type, stream, show, passed_a_ptr)
case TYPE_CODE_PTR:
case TYPE_CODE_REF:
- type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 1);
+ type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0, 1, 0);
break;
case TYPE_CODE_FUNC:
type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
- passed_a_ptr);
+ passed_a_ptr, 0);
if (passed_a_ptr)
fprintf_filtered (stream, ")");
- fprintf_filtered (stream, "()");
+ if (!demangled_args)
+ fprintf_filtered (stream, "()");
break;
case TYPE_CODE_UNDEF: