aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorJim Kingdon <jkingdon@engr.sgi.com>1994-03-24 18:32:31 +0000
committerJim Kingdon <jkingdon@engr.sgi.com>1994-03-24 18:32:31 +0000
commit2f3b7d8eb5f3f7823556b77cdd48ff2ae51b09c4 (patch)
treeb9da312f2056ebfabfcda7fa07afed32f10454de /gdb
parent9d7f682f8cd146e5c6161717610f27158fe3ced8 (diff)
downloadgdb-2f3b7d8eb5f3f7823556b77cdd48ff2ae51b09c4.zip
gdb-2f3b7d8eb5f3f7823556b77cdd48ff2ae51b09c4.tar.gz
gdb-2f3b7d8eb5f3f7823556b77cdd48ff2ae51b09c4.tar.bz2
* valops.c (value_at, value_at_lazy): Give error if we dereference
a pointer to void. * gdbtypes.h: Fix comments regarding TYPE_CODE_VOID. * stabsread.c: Use 1, not 0, for TYPE_LENGTH of void types.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/gdbtypes.h6
-rw-r--r--gdb/stabsread.c19
3 files changed, 22 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b757255..06de4db 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
Thu Mar 24 07:12:09 1994 Jim Kingdon (kingdon@lioth.cygnus.com)
+ * valops.c (value_at, value_at_lazy): Give error if we dereference
+ a pointer to void.
+ * gdbtypes.h: Fix comments regarding TYPE_CODE_VOID.
+ * stabsread.c: Use 1, not 0, for TYPE_LENGTH of void types.
+
* stabsread.c (patch_block_stabs): Add comment about what happens
if the definition is in another compilation unit from the stab.
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 90faea2..acd21c0 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -86,7 +86,11 @@ enum type_code
of GDB which bogusly assume that TYPE_CODE_FLT can mean complex. */
TYPE_CODE_FLT,
- /* Void type (values zero length; the length field is ignored). */
+ /* Void type. The length field specifies the length (probably always
+ one) which is used in pointer arithmetic involving pointers to
+ this type, but actually dereferencing such a pointer is invalid;
+ a void type has no length and no actual representation in memory
+ or registers. A pointer to a void type is a generic pointer. */
TYPE_CODE_VOID,
TYPE_CODE_SET, /* Pascal sets */
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index af486ff..6c81c10 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -1487,7 +1487,7 @@ read_type (pp, objfile)
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);
+ type = init_type (TYPE_CODE_VOID, 1, 0, NULL, objfile);
else
{
struct type *xtype;
@@ -1783,7 +1783,7 @@ rs6000_builtin_type (typenum)
"unsigned long", NULL);
break;
case 11:
- rettype = init_type (TYPE_CODE_VOID, 0, 0, "void", NULL);
+ rettype = init_type (TYPE_CODE_VOID, 1, 0, "void", NULL);
break;
case 12:
/* IEEE single precision (32 bit). */
@@ -3150,10 +3150,15 @@ read_sun_builtin_type (pp, typenums, objfile)
if (**pp == ';')
++(*pp);
- return init_type (type_bits == 0 ? TYPE_CODE_VOID : TYPE_CODE_INT,
- type_bits / TARGET_CHAR_BIT,
- signed_type ? 0 : TYPE_FLAG_UNSIGNED, (char *)NULL,
- objfile);
+ if (type_bits == 0)
+ return init_type (TYPE_CODE_VOID, 1,
+ signed_type ? 0 : TYPE_FLAG_UNSIGNED, (char *)NULL,
+ objfile);
+ else
+ return init_type (TYPE_CODE_INT,
+ type_bits / TARGET_CHAR_BIT,
+ signed_type ? 0 : TYPE_FLAG_UNSIGNED, (char *)NULL,
+ objfile);
}
static struct type *
@@ -3371,7 +3376,7 @@ read_range_type (pp, typenums, objfile)
/* A type defined as a subrange of itself, with bounds both 0, is void. */
if (self_subrange && n2 == 0 && n3 == 0)
- return init_type (TYPE_CODE_VOID, 0, 0, NULL, objfile);
+ return init_type (TYPE_CODE_VOID, 1, 0, NULL, objfile);
/* If n3 is zero and n2 is not, we want a floating type,
and n2 is the width in bytes.