This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 1/2] Fix two regressions in scalar printing
> From: Pedro Alves <palves@redhat.com>
> Date: Fri, 14 Jul 2017 15:56:27 +0100
>
> The manual says:
>
> @item d
> Print as integer in signed decimal.
>
> @item u
> Print as integer in unsigned decimal.
>
> And I see this with a gdb from before the recent print_scalar_formatted
> changes:
>
> (gdb) p /d (unsigned long long) -1
> $1 = -1
>
> while we see this with either current master, or your patch:
>
> (gdb) p /d (unsigned long long) -1
> $1 = 18446744073709551615
>
> which also doesn't look right to me.
>
> And here:
>
> (gdb) p /d (unsigned) -1
> $2 = 4294967295
>
> I'd expect "-1", but we don't get it with any gdb version (before
> original print_scalar_formatted changes, or current master, or
> your current patch), which also looks like a bug to me.
I think I agree: we should produce what the format says, not what the
cast says.