This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA 1/2] Fix two regressions in scalar printing


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]