aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Kingdon <jkingdon@engr.sgi.com>1994-01-03 22:36:52 +0000
committerJim Kingdon <jkingdon@engr.sgi.com>1994-01-03 22:36:52 +0000
commit4b404661b61a0dfc9e085563c4e08178605b48e9 (patch)
treed1ce2320529d1fbdb1cf03d00b0a6d061cf4a6cd
parentb563c370fb0b2dd9a4c511977452d9e86b189431 (diff)
downloadgdb-4b404661b61a0dfc9e085563c4e08178605b48e9.zip
gdb-4b404661b61a0dfc9e085563c4e08178605b48e9.tar.gz
gdb-4b404661b61a0dfc9e085563c4e08178605b48e9.tar.bz2
* stabsread.c (read_type): Allow defining several type numbers
at once (e.g. "(1,2)=(3,4)="...).
-rw-r--r--gdb/ChangeLog3
-rw-r--r--gdb/stabsread.c72
2 files changed, 43 insertions, 32 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ea7f384..2687f97 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,8 @@
Mon Jan 3 11:57:29 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
+ * stabsread.c (read_type): Allow defining several type numbers
+ at once (e.g. "(1,2)=(3,4)="...).
+
* stabsread.c (read_enum_type): Use TARGET_INT_BIT not sizeof (int).
* breakpoint.c (frame_in_dummy): Check PC as well as frame.
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 85d54a9..52b59e0 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -1418,41 +1418,49 @@ read_type (pp, objfile)
case '9':
case '(':
- (*pp)--;
- if (read_type_number (pp, xtypenums) != 0)
- return error_type (pp);
+ {
+ char *pp_saved;
- if (typenums[0] == xtypenums[0] && typenums[1] == xtypenums[1])
- /* It's being defined as itself. That means it is "void". */
- type = init_type (TYPE_CODE_VOID, 0, 0, NULL, objfile);
- else
- {
- struct type *xtype = *dbx_lookup_type (xtypenums);
+ (*pp)--;
+ pp_saved = *pp;
- /* This can happen if we had '-' followed by a garbage character,
- for example. */
- if (xtype == NULL)
- return error_type (pp);
+ /* Peek ahead at the number to detect void. */
+ if (read_type_number (pp, xtypenums) != 0)
+ return error_type (pp);
- /* The type is being defined to another type. So we copy the type.
- This loses if we copy a C++ class and so we lose track of how
- the names are mangled (but g++ doesn't output stabs like this
- now anyway). */
-
- type = alloc_type (objfile);
- memcpy (type, xtype, sizeof (struct type));
-
- /* The idea behind clearing the names is that the only purpose
- for defining a type to another type is so that the name of
- one can be different. So we probably don't need to worry much
- about the case where the compiler doesn't give a name to the
- new type. */
- TYPE_NAME (type) = NULL;
- TYPE_TAG_NAME (type) = NULL;
- }
- if (typenums[0] != -1)
- *dbx_lookup_type (typenums) = type;
- break;
+ if (typenums[0] == xtypenums[0] && typenums[1] == xtypenums[1])
+ /* It's being defined as itself. That means it is "void". */
+ type = init_type (TYPE_CODE_VOID, 0, 0, NULL, objfile);
+ else
+ {
+ struct type *xtype;
+
+ /* Go back to the number and have read_type get it. This means
+ that we can deal with something like t(1,2)=(3,4)=... which
+ the Lucid compiler uses. */
+ *pp = pp_saved;
+ xtype = read_type (pp, objfile);
+
+ /* The type is being defined to another type. So we copy the type.
+ This loses if we copy a C++ class and so we lose track of how
+ the names are mangled (but g++ doesn't output stabs like this
+ now anyway). */
+
+ type = alloc_type (objfile);
+ memcpy (type, xtype, sizeof (struct type));
+
+ /* The idea behind clearing the names is that the only purpose
+ for defining a type to another type is so that the name of
+ one can be different. So we probably don't need to worry much
+ about the case where the compiler doesn't give a name to the
+ new type. */
+ TYPE_NAME (type) = NULL;
+ TYPE_TAG_NAME (type) = NULL;
+ }
+ if (typenums[0] != -1)
+ *dbx_lookup_type (typenums) = type;
+ break;
+ }
/* In the following types, we must be sure to overwrite any existing
type that the typenums refer to, rather than allocating a new one