Properly handle references
This commit is contained in:
parent
63bf565122
commit
802db21b61
@ -1,3 +1,10 @@
|
||||
2000-07-15 Daniel Berlin <dberlin@redhat.com>
|
||||
|
||||
* valops.c (typecmp): Seperate loop into two, add support for
|
||||
references. This way, we can say a reference to a pointer to a
|
||||
char is compatible with a pointer to a char. Before, this would
|
||||
not be true.
|
||||
|
||||
2000-07-14 Nicholas Duffek <nsd@redhat.com>
|
||||
|
||||
* ppcbug-rom.c (ppcbug_regnames[]): Make array size implicit.
|
||||
|
34
gdb/valops.c
34
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));
|
||||
tt2 = check_typedef (TYPE_TARGET_TYPE (tt2));
|
||||
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)
|
||||
{
|
||||
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
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user