aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorFred Fish <fnf@specifix.com>1992-06-15 14:26:57 +0000
committerFred Fish <fnf@specifix.com>1992-06-15 14:26:57 +0000
commit1c92ca6f3b4681e5d8a782875a92c2ce54f89cef (patch)
treea62ef6ac05e6e345a1d72bc341c8282690268b11 /gdb
parent2778e915845a70ed0031e93a78917c5fff7fcd02 (diff)
downloadgdb-1c92ca6f3b4681e5d8a782875a92c2ce54f89cef.zip
gdb-1c92ca6f3b4681e5d8a782875a92c2ce54f89cef.tar.gz
gdb-1c92ca6f3b4681e5d8a782875a92c2ce54f89cef.tar.bz2
* dwarfread.c (decode_modified_type): Change type of first arg.
Change 'modifier' to char from unsigned char. Cast single use that needs to be unsigned char. * symtab.h (SYMBOL_BASEREG_VALID): Explain disabling. * utils.c (strdup_demangled): Add function. * defs.h (strdup_demangled): Add prototype. * stack.c (return_command): Demangle C++ function names for query. * infcmd.c (jump_command): Demangle C++ function names for query. * cplus-dem.c (consume_count): New function and prototype. * cplus-dem.c (demangle_class, gnu_special, demangle_func_type, do_type): Replace conversion code with consume_count(). * cplus-dem.c (gnu_special): Fix demangled of static members. * source.c (list_command): Print demangled function names when appropriate. Fix supplied by Peter Schauer.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog23
-rw-r--r--gdb/cplus-dem.c145
-rw-r--r--gdb/dwarfread.c14
3 files changed, 125 insertions, 57 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c762244..274fab7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,26 @@
+Mon Jun 15 07:21:00 1992 Fred Fish (fnf@cygnus.com)
+
+ * dwarfread.c (decode_modified_type): Change type of first arg.
+ Change 'modifier' to char from unsigned char. Cast single use
+ that needs to be unsigned char.
+ * symtab.h (SYMBOL_BASEREG_VALID): Explain disabling.
+ * utils.c (strdup_demangled): Add function.
+ * defs.h (strdup_demangled): Add prototype.
+ * stack.c (return_command): Demangle C++ function names for query.
+ * infcmd.c (jump_command): Demangle C++ function names for query.
+ * cplus-dem.c (consume_count): New function and prototype.
+ * cplus-dem.c (demangle_class, gnu_special, demangle_func_type,
+ do_type): Replace conversion code with consume_count().
+ * cplus-dem.c (gnu_special): Fix demangled of static members.
+ * source.c (list_command): Print demangled function names
+ when appropriate. Fix supplied by Peter Schauer.
+
+Mon Jun 15 01:45:48 1992 John Gilmore (gnu at cygnus.com)
+
+ * buildsym.c (define_symbol): Nameless types are now on several
+ platforms; generalize them and un-ifdef them to make Solaris 2
+ work.
+
Sun Jun 14 10:55:51 1992 John Gilmore (gnu at cygnus.com)
* infcmd.c: Fix typo (reported by Rob Savoye).
diff --git a/gdb/cplus-dem.c b/gdb/cplus-dem.c
index de58130..6dfd6fa 100644
--- a/gdb/cplus-dem.c
+++ b/gdb/cplus-dem.c
@@ -233,6 +233,9 @@ static int
get_count PARAMS ((const char **, int *));
static int
+consume_count PARAMS ((const char **));
+
+static int
demangle_args PARAMS ((string *, const char **, struct work_stuff *));
static int
@@ -253,6 +256,23 @@ static void
string_prepends PARAMS ((string *, string *));
#endif
+/* Translate count to integer, consuming tokens in the process.
+ Conversion terminates on the first non-digit character. */
+
+static int
+consume_count (type)
+ const char **type;
+{
+ int count = 0;
+
+ do
+ {
+ count *= 10;
+ count += **type - '0';
+ (*type)++;
+ } while (isdigit (**type));
+ return (count);
+}
/* Takes operator name as e.g. "++" and returns mangled
operator name (e.g. "postincrement_expr"), or NULL if not found.
@@ -806,14 +826,7 @@ demangle_class (declp, mangled, work)
int n;
int success = 0;
- n = 0;
- do
- {
- n *= 10;
- n += **mangled - '0';
- (*mangled)++;
- }
- while (isdigit (**mangled));
+ n = consume_count (mangled);
if (strlen (*mangled) >= n)
{
if (work -> constructor || work -> destructor)
@@ -925,6 +938,29 @@ demangle_prefix (declp, mangled, work)
return (success);
}
+/*
+
+LOCAL FUNCTION
+
+ gnu_special -- special handling of gnu mangled strings
+
+SYNOPSIS
+
+ static int
+ gnu_special (string *declp, const char **mangled,
+ struct work_stuff *work)
+
+
+DESCRIPTION
+
+ Process some special GNU style mangling forms that don't fit
+ the normal pattern. For example:
+
+ _$_3foo (destructor for class foo)
+ _vt$foo (virtual table)
+ _3foo$varname (static data member)
+ */
+
static int
gnu_special (declp, mangled, work)
string *declp;
@@ -943,17 +979,6 @@ gnu_special (declp, mangled, work)
(*mangled) += 3;
work -> destructor = 1;
}
- else if (**mangled != '_' && (p = strchr (*mangled, CPLUS_MARKER)) != NULL)
- {
-#if 0
- /* static data member */
- n = strlen (*mangled) + 2;
- tem = (char *) xmalloc (n);
- memcpy (tem, *mangled, p - *mangled);
- strcpy (tem + (p - *mangled), "::");
- strcpy (tem + (p - *mangled) + 2, p + 1);
-#endif
- }
else if ((*mangled)[0] == '_'
&& (*mangled)[1] == 'v'
&& (*mangled)[2] == 't'
@@ -969,6 +994,20 @@ gnu_special (declp, mangled, work)
string_append (declp, " virtual table");
(*mangled) += n;
}
+ else if ((*mangled)[0] == '_'
+ && isdigit ((*mangled)[1])
+ && (p = strchr (*mangled, CPLUS_MARKER)) != NULL)
+ {
+ /* static data member, "_3foo$varname" for example */
+ (*mangled)++;
+ p++;
+ n = consume_count (mangled);
+ string_appendn (declp, *mangled, n);
+ string_append (declp, "::");
+ n = strlen (p);
+ string_appendn (declp, p, n);
+ (*mangled) = p + n;
+ }
else
{
success = 0;
@@ -1021,6 +1060,22 @@ demangle_qualified (declp, mangled, work)
return (success);
}
+/*
+
+LOCAL FUNCTION
+
+ get_count -- convert an ascii count to integer, consuming tokens
+
+SYNOPSIS
+
+ static int
+ get_count (const char **type, int *count)
+
+DESCRIPTION
+
+ Return 0 if no conversion is performed, 1 if a string is converted.
+*/
+
static int
get_count (type, count)
const char **type;
@@ -1033,24 +1088,26 @@ get_count (type, count)
{
return (0);
}
- *count = **type - '0';
- (*type)++;
- /* see flush_repeats in cplus-method.c */
- if (isdigit (**type))
+ else
{
- p = *type;
- n = *count;
- do
- {
- n *= 10;
- n += *p - '0';
- p++;
- }
- while (isdigit (*p));
- if (*p == '_')
+ *count = **type - '0';
+ (*type)++;
+ if (isdigit (**type))
{
- *type = p + 1;
- *count = n;
+ p = *type;
+ n = *count;
+ do
+ {
+ n *= 10;
+ n += *p - '0';
+ p++;
+ }
+ while (isdigit (*p));
+ if (*p == '_')
+ {
+ *type = p + 1;
+ *count = n;
+ }
}
}
return (1);
@@ -1162,14 +1219,7 @@ do_type (type, result, work)
success = 0;
break;
}
- n = 0;
- do
- {
- n *= 10;
- n += **type - '0';
- (*type)++;
- }
- while (isdigit (**type));
+ n = consume_count (type);
if (strlen (*type) < n)
{
success = 0;
@@ -1394,14 +1444,7 @@ demangle_fund_type (type, result, work)
case '7':
case '8':
case '9':
- n = 0;
- do
- {
- n *= 10;
- n += **type - '0';
- (*type)++;
- }
- while (isdigit (**type));
+ n = consume_count (type);
if (strlen (*type) < n)
{
success = 0;
diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c
index 8a9cebd..32a9846 100644
--- a/gdb/dwarfread.c
+++ b/gdb/dwarfread.c
@@ -380,7 +380,7 @@ static struct type *
decode_mod_u_d_type PARAMS ((char *));
static struct type *
-decode_modified_type PARAMS ((unsigned char *, unsigned int, int));
+decode_modified_type PARAMS ((char *, unsigned int, int));
static struct type *
decode_fund_type PARAMS ((unsigned int));
@@ -2711,7 +2711,7 @@ LOCAL FUNCTION
SYNOPSIS
- static struct type *decode_modified_type (unsigned char *modifiers,
+ static struct type *decode_modified_type (char *modifiers,
unsigned short modcount, int mtype)
DESCRIPTION
@@ -2745,14 +2745,14 @@ BUGS
static struct type *
decode_modified_type (modifiers, modcount, mtype)
- unsigned char *modifiers;
+ char *modifiers;
unsigned int modcount;
int mtype;
{
struct type *typep = NULL;
unsigned short fundtype;
DIE_REF die_ref;
- unsigned char modifier;
+ char modifier;
int nbytes;
if (modcount == 0)
@@ -2799,9 +2799,11 @@ decode_modified_type (modifiers, modcount, mtype)
SQUAWK (("type modifier 'volatile' ignored")); /* FIXME */
break;
default:
- if (!(MOD_lo_user <= modifier && modifier <= MOD_hi_user))
+ if (!(MOD_lo_user <= (unsigned char) modifier
+ && (unsigned char) modifier <= MOD_hi_user))
{
- SQUAWK (("unknown type modifier %u", modifier));
+ SQUAWK (("unknown type modifier %u",
+ (unsigned char) modifier));
}
break;
}