aboutsummaryrefslogtreecommitdiff
path: root/gdb/valops.c
diff options
context:
space:
mode:
authorDaniel Berlin <dberlin@dberlin.org>2000-07-15 17:40:30 +0000
committerDaniel Berlin <dberlin@dberlin.org>2000-07-15 17:40:30 +0000
commit802db21b617808df4dd4a47aec3ccbe828f694f5 (patch)
tree2cc94cb60f14681b0b5e93eacdc6a58a423efd61 /gdb/valops.c
parent63bf565122c9b0a142fec08a935dcd6d84102d4c (diff)
downloadfsf-binutils-gdb-802db21b617808df4dd4a47aec3ccbe828f694f5.zip
fsf-binutils-gdb-802db21b617808df4dd4a47aec3ccbe828f694f5.tar.gz
fsf-binutils-gdb-802db21b617808df4dd4a47aec3ccbe828f694f5.tar.bz2
Properly handle references
Diffstat (limited to 'gdb/valops.c')
-rw-r--r--gdb/valops.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/gdb/valops.c b/gdb/valops.c
index a32db08..711392f 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -274,7 +274,7 @@ value_cast (type, arg2)
case TYPE_CODE_MEMBER:
retvalp = value_from_longest (type, value_as_long (arg2));
/* force evaluation */
- ptr = (unsigned int *) VALUE_CONTENTS (retvalp);
+ ptr = (unsigned int *) VALUE_CONTENTS (retvalp);
*ptr &= ~0x20000000; /* zap 29th bit to remove bias */
return retvalp;
@@ -287,10 +287,10 @@ value_cast (type, arg2)
}
}
longest = value_as_long (arg2);
- return value_from_longest (type, convert_to_boolean ?
+ return value_from_longest (type, convert_to_boolean ?
(LONGEST) (longest ? 1 : 0) : longest);
}
- else if (code1 == TYPE_CODE_PTR && (code2 == TYPE_CODE_INT ||
+ else if (code1 == TYPE_CODE_PTR && (code2 == TYPE_CODE_INT ||
code2 == TYPE_CODE_ENUM ||
code2 == TYPE_CODE_RANGE))
{
@@ -561,7 +561,7 @@ value_fetch_lazy (val)
}
else if (length)
read_memory (addr, VALUE_CONTENTS_ALL_RAW (val), length);
-
+
VALUE_LAZY (val) = 0;
return 0;
}
@@ -676,7 +676,7 @@ value_assign (toval, fromval)
if (VALUE_BITSIZE (toval))
{
char buffer[sizeof (LONGEST)];
- int len =
+ int len =
REGISTER_RAW_SIZE (VALUE_REGNO (toval)) - VALUE_OFFSET (toval);
if (len > (int) sizeof (LONGEST))
@@ -2029,12 +2029,22 @@ typecmp (staticp, t1, t2)
continue;
}
- while (TYPE_CODE (tt1) == TYPE_CODE_PTR
- && (TYPE_CODE (tt2) == TYPE_CODE_ARRAY
- || TYPE_CODE (tt2) == TYPE_CODE_PTR))
+ /* djb - 20000715 - Until the new type structure is in the
+ place, and we can attempt things like implicit conversions,
+ we need to do this so you can take something like a map<const
+ char *>, and properly access map["hello"], because the
+ argument to [] will be a reference to a pointer to a char,
+ and the arrgument will be a pointer to a char. */
+ while ( TYPE_CODE(tt1) == TYPE_CODE_REF ||
+ TYPE_CODE (tt1) == TYPE_CODE_PTR)
+ {
+ tt1 = check_typedef( TYPE_TARGET_TYPE(tt1) );
+ }
+ while ( TYPE_CODE(tt2) == TYPE_CODE_ARRAY ||
+ TYPE_CODE(tt2) == TYPE_CODE_PTR ||
+ TYPE_CODE(tt2) == TYPE_CODE_REF)
{
- tt1 = check_typedef (TYPE_TARGET_TYPE (tt1));
- tt2 = check_typedef (TYPE_TARGET_TYPE (tt2));
+ tt2 = check_typedef( TYPE_TARGET_TYPE(tt2) );
}
if (TYPE_CODE (tt1) == TYPE_CODE (tt2))
continue;
@@ -3324,7 +3334,7 @@ value_rtti_type (v, full, top, using_enc)
/*
Right now this is G++ RTTI. Plan on this changing in the
future as i get around to setting the vtables properly for G++
- compiled stuff. Also, i'll be using the type info functions,
+ compiled stuff. Also, i'll be using the type info functions,
which are always right. Deal with it until then.
*/
{
@@ -3353,7 +3363,7 @@ value_rtti_type (v, full, top, using_enc)
*using_enc=1;
}
/*
- We can't use value_ind here, because it would want to use RTTI, and
+ We can't use value_ind here, because it would want to use RTTI, and
we'd waste a bunch of time figuring out we already know the type.
Besides, we don't care about the type, just the actual pointer
*/