uninitialized typedef in value_sub on pointers
Andrew Cagney
ac131313@cygnus.com
Thu Jun 1 02:00:00 GMT 2000
Kevin Nomura wrote:
>
> Sometimes the second operand of a pointer subtraction has
> incomplete type info loaded, resulting in a bogus but
> self-repairing error as demonstrated by:
>
> (gdb) p (sk_Proc *) fm_givebackPid-sk_proc_table
> First argument of `-' is a pointer and second argument is neither
> an integer nor a pointer of the same type.
> >>> this next line was retrived with the uparrow, and a single space
> >>added at the end, which seems to make a difference:
> (gdb) p (sk_Proc *) fm_givebackPid-sk_proc_table
> $1 = 0
>
> Reproduces with gdb 4.18 and gdb 5.0, but not with the small
> testcase I tried to craft.
>
> I made the following patch to gdb-5.0/valarith.c:value_sub() to
> get around this problem:
>
> 113,114c113,114
> < && TYPE_LENGTH (check_typedef (TYPE_TARGET_TYPE (type1)))
> < == TYPE_LENGTH (check_typedef (TYPE_TARGET_TYPE (type2))))
> ---
> > && TYPE_LENGTH (TYPE_TARGET_TYPE (type1))
> > == TYPE_LENGTH (TYPE_TARGET_TYPE (type2)))
>
> Perhaps someone with more knowledge of the way gdb loads symbol
> info can divine the true nature of this bug and/or whether this
> is an appropriate fix.
Hello,
Would you be able to have another go of creating a test case? Without
things like the source code, a knowledge of the host/target, debug info
and the like it will be difficult for people to analize this problem.
Andrew
More information about the Gdb-patches
mailing list