aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKung Hsu <kung@cygnus>1995-09-12 23:05:22 +0000
committerKung Hsu <kung@cygnus>1995-09-12 23:05:22 +0000
commitaeca85c13afa016c2168009cef4d71263d02fe36 (patch)
tree8faecb15a5cab09307cda790d8ab2a13d0118c1c
parentf434284a2ce1f8ddcfe81143705f76922505f416 (diff)
downloadgdb-aeca85c13afa016c2168009cef4d71263d02fe36.zip
gdb-aeca85c13afa016c2168009cef4d71263d02fe36.tar.gz
gdb-aeca85c13afa016c2168009cef4d71263d02fe36.tar.bz2
* stabsread.c (read_one_struct_field): Add a patch to handle cfront
generated stabs that each field is in full mangled name.
-rw-r--r--gdb/ChangeLog3
-rw-r--r--gdb/stabsread.c31
2 files changed, 33 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 7d599ec..4ebb524 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,8 @@
Tue Sep 12 15:46:18 1995 Kung Hsu <kung@mexican.cygnus.com>
+ * stabsread.c (read_one_struct_field): Add a patch to handle cfront
+ generated stabs that each field is in full mangled name.
+
* infcmd.c (attach_command): Add solibs only when
auto_solib_add_at_startup is set.
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 5221c44..f9c619b 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -2344,7 +2344,36 @@ read_one_struct_field (fip, pp, p, type, objfile)
struct type *type;
struct objfile *objfile;
{
- fip -> list -> field.name =
+ /* The following is code to work around cfront generated stabs.
+ The stabs contains full mangled name for each field.
+ We try to demangle the name and extract the field name out of it.
+ */
+ if (current_language->la_language == language_cplus)
+ {
+ char save_p;
+ char *dem, *dem_p;
+ save_p = *p;
+ *p = '\0';
+ dem = cplus_demangle (*pp, DMGL_ANSI | DMGL_PARAMS);
+ if (dem != NULL)
+ {
+ dem_p = strrchr (dem, ':');
+ if (dem_p != 0 && *(dem_p-1)==':')
+ dem_p++;
+ fip->list->field.name =
+ obsavestring (dem_p, strlen(dem_p), &objfile -> type_obstack);
+ }
+ else
+ {
+ fip->list->field.name =
+ obsavestring (*pp, p - *pp, &objfile -> type_obstack);
+ }
+ *p = save_p;
+ }
+ /* end of code for cfront work around */
+
+ else
+ fip -> list -> field.name =
obsavestring (*pp, p - *pp, &objfile -> type_obstack);
*pp = p + 1;