Description of Problem:
Gdb hangs in the function finish_cv_type() for ever. I was able to work around
the problem by modifying the gdb source as shown below:
/* When reading in a class type, we may have created references to
cv-qualified versions of the type (in method arguments, for
instance). Update everything on the cv ring from the primary
type TYPE.
The only reason we do not need to do the same thing for address
spaces is that type readers do not create address space qualified
types. */
void
finish_cv_type (struct type *type)
{
int cnt=0;
struct type *ntype, *cv_type, *ptr_type, *ref_type;
int cv_flags;
gdb_assert (!TYPE_CONST (type) && !TYPE_VOLATILE (type));
ntype = type;
while ((ntype = TYPE_CV_TYPE (ntype)) != type)
{
if(++cnt>10000) break;
/* Save cv_flags. */
cv_flags = TYPE_FLAGS (ntype) & (TYPE_FLAG_VOLATILE | TYPE_FLAG_CONST);
/* If any reference or pointer types were created, save them too. */
ptr_type = TYPE_POINTER_TYPE (ntype);
ref_type = TYPE_REFERENCE_TYPE (ntype);
/* Don't disturb the CV chain. */
cv_type = TYPE_CV_TYPE (ntype);
/* Verify that we haven't added any address-space qualified types,
for the future. */
gdb_assert (ntype == TYPE_AS_TYPE (ntype));
/* Copy original type */
memcpy ((char *) ntype, (char *) type, sizeof (struct type));
/* Restore everything. */
TYPE_POINTER_TYPE (ntype) = ptr_type;
TYPE_REFERENCE_TYPE (ntype) = ref_type;
TYPE_CV_TYPE (ntype) = cv_type;
TYPE_FLAGS (ntype) = TYPE_FLAGS (ntype) | cv_flags;
TYPE_AS_TYPE (ntype) = ntype;
}
}
I added the cnt variable and the code to break out of the loop. This makes the
problem go away and does not seem to have any ill effects. Im not suggesting
this as the way to fix the problem, just to point out where it is.
Version-Release number of selected component (if applicable):
It happens with the gdb in 7.2, 7.3, and the gdb-5.2-2 update to 7.3
How Reproducible:
I can reproduce this but I unfortunatly cant send you the code :-( I have
narrowed it down and found that if I compile one file with out -g the problem
goes away. I am going to attach the resulting dot.o file, compiled with -g,
in case it helps