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 at redhat dot com>
- To: Tom Tromey <tom at tromey dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 14 Jul 2017 18:24:59 +0100
- Subject: Re: [RFA 1/2] Fix two regressions in scalar printing
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=palves at redhat dot com
- Dkim-filter: OpenDKIM Filter v2.11.0 mx1.redhat.com B9556C08D43E
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B9556C08D43E
- References: <20170713123400.28917-1-tom@tromey.com> <20170713123400.28917-2-tom@tromey.com> <22c48f9e-ec2c-850d-91d3-c6a3ea8cdb11@redhat.com> <871spjufnv.fsf@pokyo>
On 07/14/2017 05:49 PM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
>
> Pedro> I think this would all be fixed by simply having separate
> Pedro> 'u'/'d' cases with fixed signness:
>
> Pedro> case 'u':
> Pedro> print_decimal_chars (stream, valaddr, len, false, byte_order);
> Pedro> break;
> Pedro> case 'd':
> Pedro> print_decimal_chars (stream, valaddr, len, true, byte_order);
> Pedro> break;
>
> I'm testing this. Thanks for the feedback.
>
> One early note is that this changes the expected output for this test:
>
> FAIL: gdb.dwarf2/var-access.exp: verify re-initialized s2
>
> Now it says:
>
> print/d s2
> $9 = {a = -65, b = 73, c = -25, d = 123}
>
> but the test wants:
>
> gdb_test "print/d s2" " = \\{a = 191, b = 73, c = 231, d = 123\\}" \
> "verify re-initialized s2"
>
Yeah, that seems OK to me GDB-output-wise. "You get what you ask for".
Now, the test is for "# Byte-aligned register- and memory pieces.", and
is treating the bytes as raw bytes, even though the fields are
defined as "char".
We see just above that a test setting the fields using values over 0x7f:
gdb_test_no_output "set var s2 = {191, 73, 231, 123}" \
"re-initialize s2"
gdb_test "print/d s2" " = \\{a = 191, b = 73, c = 231, d = 123\\}" \
"verify re-initialized s2"
The /d was surely as a convenience to avoid printing the bytes
in character format. I'd just change it to /u. Same for the related
tests just above.
Thanks,
Pedro Alves