* [PATCH][PR 18702] Fix wrong output of x87 registers due to truncation to double on amd64
@ 2015-11-20 22:07 Ruslan Kabatsayev
2015-12-02 11:32 ` Yao Qi
2015-12-03 12:28 ` Pedro Alves
0 siblings, 2 replies; 14+ messages in thread
From: Ruslan Kabatsayev @ 2015-11-20 22:07 UTC (permalink / raw)
To: gdb-patches
When `info float` is used on an AMD64 system, GDB prints floating-point
values of x87 registers with raw contents like 0x361a867a8e0527397ce0 or
0xc4f988454a1ddd3cfdab wrongly. This happens due to truncation to double,
after which the former becomes 0.0, and the latter becomes negative infinity.
This is caused by failed detection of x86-64 host, which results in setting
gdb_host_{float,double,long_double}_format to zeros.
This commit fixes this misdetection.
gdb/ChangeLog:
* configure.host: Fix detection of x86_64 host when setting floatformats
---
gdb/configure.host | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/configure.host b/gdb/configure.host
index 48714f4..ef265eb 100644
--- a/gdb/configure.host
+++ b/gdb/configure.host
@@ -195,7 +195,7 @@ esac
# "double" and "long double" types.
case "${host}" in
-i[34567]86-*-*)
+i[34567]86-*-*|x86_64-*-*)
gdb_host_float_format="&floatformat_ieee_single_little"
gdb_host_double_format="&floatformat_ieee_double_little"
gdb_host_long_double_format="&floatformat_i387_ext"
--
1.7.10.2
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH][PR 18702] Fix wrong output of x87 registers due to truncation to double on amd64
2015-11-20 22:07 [PATCH][PR 18702] Fix wrong output of x87 registers due to truncation to double on amd64 Ruslan Kabatsayev
@ 2015-12-02 11:32 ` Yao Qi
2015-12-02 14:26 ` Ruslan Kabatsayev
2015-12-03 12:28 ` Pedro Alves
1 sibling, 1 reply; 14+ messages in thread
From: Yao Qi @ 2015-12-02 11:32 UTC (permalink / raw)
To: Ruslan Kabatsayev; +Cc: gdb-patches
Ruslan Kabatsayev <b7.10110111@gmail.com> writes:
Hi Ruslan,
> When `info float` is used on an AMD64 system, GDB prints floating-point
> values of x87 registers with raw contents like 0x361a867a8e0527397ce0 or
> 0xc4f988454a1ddd3cfdab wrongly. This happens due to truncation to double,
> after which the former becomes 0.0, and the latter becomes negative infinity.
> This is caused by failed detection of x86-64 host, which results in setting
> gdb_host_{float,double,long_double}_format to zeros.
> This commit fixes this misdetection.
I think your patch is correct, but I am not confident approving it
because I know few about floating point stuff. Do you run GDB
regression tests?
>
> gdb/ChangeLog:
>
> * configure.host: Fix detection of x86_64 host when setting floatformats
This line is too long, the max is 74. Sentence should be ended with ".".
--
Yao (齐尧)
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH][PR 18702] Fix wrong output of x87 registers due to truncation to double on amd64
2015-12-02 11:32 ` Yao Qi
@ 2015-12-02 14:26 ` Ruslan Kabatsayev
2015-12-03 11:27 ` Yao Qi
0 siblings, 1 reply; 14+ messages in thread
From: Ruslan Kabatsayev @ 2015-12-02 14:26 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
Hi Yao,
Thanks for your reply.
On Wed, Dec 2, 2015 at 2:32 PM, Yao Qi <qiyaoltc@gmail.com> wrote:
> I think your patch is correct, but I am not confident approving it
> because I know few about floating point stuff. Do you run GDB
> regression tests?
I did a `make check` for unpatched gdb-7.10 and patched with my
changes. Here's the unpatched result:
# of expected passes 32377
# of unexpected failures 85
# of unexpected successes 2
# of expected failures 72
# of unknown successes 2
# of known failures 62
# of untested testcases 36
# of unsupported tests 201
And here's after my patch:
# of expected passes 32378
# of unexpected failures 85
# of unexpected successes 2
# of expected failures 71
# of unknown successes 2
# of known failures 62
# of untested testcases 36
# of unsupported tests 201
I.e. one "expected failure" less and one "expected pass" more. I'm not
sure how to interpret this result.
>> gdb/ChangeLog:
>>
>> * configure.host: Fix detection of x86_64 host when setting floatformats
>
> This line is too long, the max is 74. Sentence should be ended with ".".
Should I resend the whole original mail with this fixed?
Regards,
Ruslan
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH][PR 18702] Fix wrong output of x87 registers due to truncation to double on amd64
2015-12-02 14:26 ` Ruslan Kabatsayev
@ 2015-12-03 11:27 ` Yao Qi
2015-12-04 14:41 ` Ruslan Kabatsayev
0 siblings, 1 reply; 14+ messages in thread
From: Yao Qi @ 2015-12-03 11:27 UTC (permalink / raw)
To: Ruslan Kabatsayev; +Cc: Yao Qi, gdb-patches
Ruslan Kabatsayev <b7.10110111@gmail.com> writes:
> I did a `make check` for unpatched gdb-7.10 and patched with my
> changes. Here's the unpatched result:
Thanks for running the test. Could you test your patch against GDB git
mainline please? The patch will be applied to mainline, so we need to
test it against mainline.
>
> # of expected passes 32377
> # of unexpected failures 85
> # of unexpected successes 2
> # of expected failures 72
> # of unknown successes 2
> # of known failures 62
> # of untested testcases 36
> # of unsupported tests 201
>
> And here's after my patch:
>
> # of expected passes 32378
> # of unexpected failures 85
> # of unexpected successes 2
> # of expected failures 71
> # of unknown successes 2
> # of known failures 62
> # of untested testcases 36
> # of unsupported tests 201
>
> I.e. one "expected failure" less and one "expected pass" more. I'm not
> sure how to interpret this result.
>
This may happen from time to time, especially in some gdb.threads tests.
>>> gdb/ChangeLog:
>>>
>>> * configure.host: Fix detection of x86_64 host when setting
>>> floatformats
>>
>> This line is too long, the max is 74. Sentence should be ended with ".".
>
> Should I resend the whole original mail with this fixed?
Please post the changelog entry only for the reference.
If there is no regression in the GDB mainline tests, and no objections
from other people in 3 days, your patch can go in.
Do you have write access to git repository and FSF copyright assignment?
If you don't have them, I can commit it for you as a tiny patch.
However, if you want to contribute more patches, you need an FSF
copyright assignment, and git write access, so that you can push by yourself.
--
Yao (齐尧)
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH][PR 18702] Fix wrong output of x87 registers due to truncation to double on amd64
2015-11-20 22:07 [PATCH][PR 18702] Fix wrong output of x87 registers due to truncation to double on amd64 Ruslan Kabatsayev
2015-12-02 11:32 ` Yao Qi
@ 2015-12-03 12:28 ` Pedro Alves
2015-12-04 15:06 ` Ruslan Kabatsayev
1 sibling, 1 reply; 14+ messages in thread
From: Pedro Alves @ 2015-12-03 12:28 UTC (permalink / raw)
To: Ruslan Kabatsayev, gdb-patches
On 11/20/2015 10:07 PM, Ruslan Kabatsayev wrote:
> When `info float` is used on an AMD64 system, GDB prints floating-point
> values of x87 registers with raw contents like 0x361a867a8e0527397ce0 or
> 0xc4f988454a1ddd3cfdab wrongly. This happens due to truncation to double,
> after which the former becomes 0.0, and the latter becomes negative infinity.
> This is caused by failed detection of x86-64 host, which results in setting
> gdb_host_{float,double,long_double}_format to zeros.
> This commit fixes this misdetection.
A test to make sure we don't regress this would be nice.
Maybe add something to gdb.arch/i386-float.exp ?
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH][PR 18702] Fix wrong output of x87 registers due to truncation to double on amd64
2015-12-03 11:27 ` Yao Qi
@ 2015-12-04 14:41 ` Ruslan Kabatsayev
0 siblings, 0 replies; 14+ messages in thread
From: Ruslan Kabatsayev @ 2015-12-04 14:41 UTC (permalink / raw)
To: Yao Qi; +Cc: gdb-patches
On 12/03/2015 02:27 PM, Yao Qi wrote:
> Thanks for running the test. Could you test your patch against GDB git
> mainline please? The patch will be applied to mainline, so we need to
> test it against mainline.
With current git master the result is the same: no noticeable changes between patched and unpatched version.
>> # of expected passes 32377
>> # of unexpected failures 85
>> # of unexpected successes 2
>> # of expected failures 72
>> # of unknown successes 2
>> # of known failures 62
>> # of untested testcases 36
>> # of unsupported tests 201
>>
>> And here's after my patch:
>>
>> # of expected passes 32378
>> # of unexpected failures 85
>> # of unexpected successes 2
>> # of expected failures 71
>> # of unknown successes 2
>> # of known failures 62
>> # of untested testcases 36
>> # of unsupported tests 201
>>
>> I.e. one "expected failure" less and one "expected pass" more. I'm not
>> sure how to interpret this result.
>>
> This may happen from time to time, especially in some gdb.threads tests.
For some reason such things happen with different individual tests almost on
every `make check` here, be it patched or unpatched version.
>>>> gdb/ChangeLog:
>>>>
>>>> * configure.host: Fix detection of x86_64 host when setting
>>>> floatformats
>>> This line is too long, the max is 74. Sentence should be ended with ".".
>> Should I resend the whole original mail with this fixed?
> Please post the changelog entry only for the reference.
gdb/ChangeLog:
* configure.host: Fix detection of x86_64 host when setting
floatformats.
> If there is no regression in the GDB mainline tests, and no objections
> from other people in 3 days, your patch can go in.
>
> Do you have write access to git repository and FSF copyright assignment?
> If you don't have them, I can commit it for you as a tiny patch.
> However, if you want to contribute more patches, you need an FSF
> copyright assignment, and git write access, so that you can push by yourself.
I think I don't. How do I get them?
As for more patches, I'm going to make a regression test for this fix, as
suggested by Pedro Alves in another email.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH][PR 18702] Fix wrong output of x87 registers due to truncation to double on amd64
2015-12-03 12:28 ` Pedro Alves
@ 2015-12-04 15:06 ` Ruslan Kabatsayev
2015-12-04 15:11 ` Pedro Alves
0 siblings, 1 reply; 14+ messages in thread
From: Ruslan Kabatsayev @ 2015-12-04 15:06 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
On Thu, Dec 3, 2015 at 3:28 PM, Pedro Alves <palves@redhat.com> wrote:
> A test to make sure we don't regress this would be nice.
> Maybe add something to gdb.arch/i386-float.exp ?
I think I'll do this. Should this go as a separate patch?
>
> Thanks,
> Pedro Alves
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH][PR 18702] Fix wrong output of x87 registers due to truncation to double on amd64
2015-12-04 15:06 ` Ruslan Kabatsayev
@ 2015-12-04 15:11 ` Pedro Alves
2015-12-04 15:17 ` Ruslan Kabatsayev
0 siblings, 1 reply; 14+ messages in thread
From: Pedro Alves @ 2015-12-04 15:11 UTC (permalink / raw)
To: Ruslan Kabatsayev; +Cc: gdb-patches
On 12/04/2015 03:06 PM, Ruslan Kabatsayev wrote:
> On Thu, Dec 3, 2015 at 3:28 PM, Pedro Alves <palves@redhat.com> wrote:
>> A test to make sure we don't regress this would be nice.
>> Maybe add something to gdb.arch/i386-float.exp ?
>
> I think I'll do this. Should this go as a separate patch?
Ideally it'd go in the same patch.
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH][PR 18702] Fix wrong output of x87 registers due to truncation to double on amd64
2015-12-04 15:11 ` Pedro Alves
@ 2015-12-04 15:17 ` Ruslan Kabatsayev
2015-12-04 15:35 ` Pedro Alves
0 siblings, 1 reply; 14+ messages in thread
From: Ruslan Kabatsayev @ 2015-12-04 15:17 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
On Fri, Dec 4, 2015 at 6:11 PM, Pedro Alves <palves@redhat.com> wrote:
> On 12/04/2015 03:06 PM, Ruslan Kabatsayev wrote:
>> On Thu, Dec 3, 2015 at 3:28 PM, Pedro Alves <palves@redhat.com> wrote:
>>> A test to make sure we don't regress this would be nice.
>>> Maybe add something to gdb.arch/i386-float.exp ?
>>
>> I think I'll do this. Should this go as a separate patch?
>
> Ideally it'd go in the same patch.
Oh, OK. What about email subject? Can I just send it as a follow-up to
this conversation, or does it have to be an independent email with
subject="[PATCH]..."? Or is there no difference?
(Sorry for silly questions, I'm just trying to fulfill all the
requirements at the first try :) )
>
> Thanks,
> Pedro Alves
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH][PR 18702] Fix wrong output of x87 registers due to truncation to double on amd64
2015-12-04 15:17 ` Ruslan Kabatsayev
@ 2015-12-04 15:35 ` Pedro Alves
2015-12-04 16:09 ` Ruslan Kabatsayev
0 siblings, 1 reply; 14+ messages in thread
From: Pedro Alves @ 2015-12-04 15:35 UTC (permalink / raw)
To: Ruslan Kabatsayev; +Cc: gdb-patches
On 12/04/2015 03:16 PM, Ruslan Kabatsayev wrote:
> On Fri, Dec 4, 2015 at 6:11 PM, Pedro Alves <palves@redhat.com> wrote:
>> On 12/04/2015 03:06 PM, Ruslan Kabatsayev wrote:
>>> On Thu, Dec 3, 2015 at 3:28 PM, Pedro Alves <palves@redhat.com> wrote:
>>>> A test to make sure we don't regress this would be nice.
>>>> Maybe add something to gdb.arch/i386-float.exp ?
>>>
>>> I think I'll do this. Should this go as a separate patch?
>>
>> Ideally it'd go in the same patch.
> Oh, OK. What about email subject? Can I just send it as a follow-up to
> this conversation, or does it have to be an independent email with
> subject="[PATCH]..."? Or is there no difference?
> (Sorry for silly questions, I'm just trying to fulfill all the
> requirements at the first try :) )
As it's a single patch, reply is fine. Repost as new thread
would be fine too. Ideally tagged with "[PATCH v2]" in that case.
I suggest using "git send-email" to send patches.
Thanks,
Pedro Alves
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH][PR 18702] Fix wrong output of x87 registers due to truncation to double on amd64
2015-12-04 15:35 ` Pedro Alves
@ 2015-12-04 16:09 ` Ruslan Kabatsayev
2015-12-05 22:41 ` Andrew Burgess
0 siblings, 1 reply; 14+ messages in thread
From: Ruslan Kabatsayev @ 2015-12-04 16:09 UTC (permalink / raw)
To: Pedro Alves; +Cc: gdb-patches
When `info float` is used on an AMD64 system, GDB prints floating-point
values of x87 registers with raw contents like 0x361a867a8e0527397ce0 or
0xc4f988454a1ddd3cfdab wrongly. This happens due to truncation to double,
after which the former becomes 0.0, and the latter becomes negative infinity.
This is caused by failed detection of x86-64 host, which results in setting
gdb_host_{float,double,long_double}_format to zeros.
This commit fixes this misdetection, and adds a test to make sure future
commits don't introduce a regression here.
gdb/ChangeLog:
* configure.host: Fix detection of x86_64 host when setting
floatformats.
* testsuite/gdb.arch/i386-float.S: Add a regression test for the fix.
* testsuite/gdb.arch/i386-float.exp: Add checking of the test results.
---
gdb/configure.host | 2 +-
gdb/testsuite/gdb.arch/i386-float.S | 4 ++++
gdb/testsuite/gdb.arch/i386-float.exp | 6 +++++-
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/gdb/configure.host b/gdb/configure.host
index 48714f4..ef265eb 100644
--- a/gdb/configure.host
+++ b/gdb/configure.host
@@ -195,7 +195,7 @@ esac
# "double" and "long double" types.
case "${host}" in
-i[34567]86-*-*)
+i[34567]86-*-*|x86_64-*-*)
gdb_host_float_format="&floatformat_ieee_single_little"
gdb_host_double_format="&floatformat_ieee_double_little"
gdb_host_long_double_format="&floatformat_i387_ext"
diff --git a/gdb/testsuite/gdb.arch/i386-float.S b/gdb/testsuite/gdb.arch/i386-float.S
index 76126c4..f5de8c2 100644
--- a/gdb/testsuite/gdb.arch/i386-float.S
+++ b/gdb/testsuite/gdb.arch/i386-float.S
@@ -29,6 +29,10 @@
SYMBOL(main):
fninit
fldt val
+ fldt bigval
+ fldt smallval
ret
.data
val: .byte 0x00,0x00,0x45,0x07,0x11,0x19,0x22,0xe9,0xfe,0xbf
+ smallval: .byte 0xe9,0xd0,0xd7,0x65,0x81,0xb7,0x43,0xc6,0x5c,0x6a
+ bigval: .byte 0x6a,0x45,0x90,0xdc,0x03,0xc1,0xf8,0xc6,0xe5,0x03
diff --git a/gdb/testsuite/gdb.arch/i386-float.exp b/gdb/testsuite/gdb.arch/i386-float.exp
index e638ceb..4260f29 100644
--- a/gdb/testsuite/gdb.arch/i386-float.exp
+++ b/gdb/testsuite/gdb.arch/i386-float.exp
@@ -39,5 +39,9 @@ if ![runto_main] then {
gdb_test "stepi" ".*fldt.*" "first stepi"
gdb_test "info float" ".*R7: Empty 0x00000000000000000000\r\n.*"
-gdb_test "stepi" ".*ret.*" "second stepi"
+gdb_test "stepi" ".*fldt.*" "second stepi"
gdb_test "info float" ".*=>R7: Valid 0xbffee922191107450000 .*"
+gdb_test "stepi" ".*fldt.*" "third stepi"
+gdb_test "info float" ".*=>R6: Valid 0x03e5c6f8c103dc90456a \\+3.500000000000000007e-4632\r\n.*"
+gdb_test "stepi" ".*ret.*" "fourth stepi"
+gdb_test "info float" ".*=>R5: Valid 0x6a5cc643b78165d7d0e9 \\+7.250000000000000005e\\+3264\r\n.*"
--
1.9.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH][PR 18702] Fix wrong output of x87 registers due to truncation to double on amd64
2015-12-04 16:09 ` Ruslan Kabatsayev
@ 2015-12-05 22:41 ` Andrew Burgess
2015-12-06 6:30 ` Ruslan Kabatsayev
0 siblings, 1 reply; 14+ messages in thread
From: Andrew Burgess @ 2015-12-05 22:41 UTC (permalink / raw)
To: Ruslan Kabatsayev; +Cc: Pedro Alves, gdb-patches
* Ruslan Kabatsayev <b7.10110111@gmail.com> [2015-12-04 19:09:46 +0300]:
> When `info float` is used on an AMD64 system, GDB prints floating-point
> values of x87 registers with raw contents like 0x361a867a8e0527397ce0 or
> 0xc4f988454a1ddd3cfdab wrongly. This happens due to truncation to double,
> after which the former becomes 0.0, and the latter becomes negative infinity.
> This is caused by failed detection of x86-64 host, which results in setting
> gdb_host_{float,double,long_double}_format to zeros.
> This commit fixes this misdetection, and adds a test to make sure future
> commits don't introduce a regression here.
>
> gdb/ChangeLog:
>
> * configure.host: Fix detection of x86_64 host when setting
> floatformats.
> * testsuite/gdb.arch/i386-float.S: Add a regression test for the fix.
> * testsuite/gdb.arch/i386-float.exp: Add checking of the test results.
There's a separate ChangeLog in the gdb/testsuite directory, so you
need to split your entry over these two files. And remember files
names in the testsuite ChangeLog don't need to have the testsuite/
prefix.
Thanks,
Andrew
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH][PR 18702] Fix wrong output of x87 registers due to truncation to double on amd64
2015-12-05 22:41 ` Andrew Burgess
@ 2015-12-06 6:30 ` Ruslan Kabatsayev
2015-12-09 12:23 ` Pedro Alves
0 siblings, 1 reply; 14+ messages in thread
From: Ruslan Kabatsayev @ 2015-12-06 6:30 UTC (permalink / raw)
To: Andrew Burgess; +Cc: Pedro Alves, gdb-patches
On 12/06/2015 01:41 AM, Andrew Burgess wrote:
> * Ruslan Kabatsayev <b7.10110111@gmail.com> [2015-12-04 19:09:46 +0300]:
>
>> When `info float` is used on an AMD64 system, GDB prints floating-point
>> values of x87 registers with raw contents like 0x361a867a8e0527397ce0 or
>> 0xc4f988454a1ddd3cfdab wrongly. This happens due to truncation to double,
>> after which the former becomes 0.0, and the latter becomes negative infinity.
>> This is caused by failed detection of x86-64 host, which results in setting
>> gdb_host_{float,double,long_double}_format to zeros.
>> This commit fixes this misdetection, and adds a test to make sure future
>> commits don't introduce a regression here.
>>
>> gdb/ChangeLog:
>>
>> * configure.host: Fix detection of x86_64 host when setting
>> floatformats.
>> * testsuite/gdb.arch/i386-float.S: Add a regression test for the fix.
>> * testsuite/gdb.arch/i386-float.exp: Add checking of the test results.
>
> There's a separate ChangeLog in the gdb/testsuite directory, so you
> need to split your entry over these two files. And remember files
> names in the testsuite ChangeLog don't need to have the testsuite/
> prefix.
gdb/ChangeLog:
* configure.host: Fix detection of x86_64 host when setting
floatformats.
gdb/testsuite/ChangeLog:
* gdb.arch/i386-float.S: Add a regression test for the fix of
floatformats setup on x86_64 hosts.
* gdb.arch/i386-float.exp: Add checking of the test results for
floatformats setup on x86_64 hosts.
>
> Thanks,
> Andrew
>
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH][PR 18702] Fix wrong output of x87 registers due to truncation to double on amd64
2015-12-06 6:30 ` Ruslan Kabatsayev
@ 2015-12-09 12:23 ` Pedro Alves
0 siblings, 0 replies; 14+ messages in thread
From: Pedro Alves @ 2015-12-09 12:23 UTC (permalink / raw)
To: Ruslan Kabatsayev, Andrew Burgess; +Cc: gdb-patches
On 12/06/2015 06:29 AM, Ruslan Kabatsayev wrote:
>
>
> On 12/06/2015 01:41 AM, Andrew Burgess wrote:
>> * Ruslan Kabatsayev <b7.10110111@gmail.com> [2015-12-04 19:09:46 +0300]:
>>
>>> When `info float` is used on an AMD64 system, GDB prints floating-point
>>> values of x87 registers with raw contents like 0x361a867a8e0527397ce0 or
>>> 0xc4f988454a1ddd3cfdab wrongly. This happens due to truncation to double,
>>> after which the former becomes 0.0, and the latter becomes negative infinity.
>>> This is caused by failed detection of x86-64 host, which results in setting
>>> gdb_host_{float,double,long_double}_format to zeros.
>>> This commit fixes this misdetection, and adds a test to make sure future
>>> commits don't introduce a regression here.
>>>
>>> gdb/ChangeLog:
>>>
>>> * configure.host: Fix detection of x86_64 host when setting
>>> floatformats.
>>> * testsuite/gdb.arch/i386-float.S: Add a regression test for the fix.
>>> * testsuite/gdb.arch/i386-float.exp: Add checking of the test results.
>>
>> There's a separate ChangeLog in the gdb/testsuite directory, so you
>> need to split your entry over these two files. And remember files
>> names in the testsuite ChangeLog don't need to have the testsuite/
>> prefix.
>
> gdb/ChangeLog:
>
> * configure.host: Fix detection of x86_64 host when setting
> floatformats.
>
> gdb/testsuite/ChangeLog:
>
> * gdb.arch/i386-float.S: Add a regression test for the fix of
> floatformats setup on x86_64 hosts.
> * gdb.arch/i386-float.exp: Add checking of the test results for
> floatformats setup on x86_64 hosts.
Thanks! I tweaked the testsuite ChangeLog entry to mention what changed
rather than why, as convention. Also, I noticed that the test has
duplicated test messages, so I made it use with_test_prefix as well.
Below's what I pushed.
(BTW, "tiny patch" is just the GNU convention for marking patches that fall
below the copyright assignment requirement. If you're going to contribute
more to gdb (which would of course be great), let me know offlist so we
can start the copyright assignment process.)
From b593e3d9b00b09af43abf1e95d68e68200e3c2a5 Mon Sep 17 00:00:00 2001
From: Ruslan Kabatsayev <b7.10110111@gmail.com>
Date: Wed, 9 Dec 2015 12:17:40 +0000
Subject: [PATCH] Fix wrong output of x87 registers due to truncation to double
on amd64
When `info float` is used on an AMD64 system, GDB prints
floating-point values of x87 registers with raw contents like
0x361a867a8e0527397ce0 or 0xc4f988454a1ddd3cfdab wrongly.
This happens due to truncation to double, after which the former
becomes 0.0, and the latter becomes negative infinity. This is caused
by failed detection of x86-64 host, which results in setting
gdb_host_{float,double,long_double}_format to zeros.
This commit fixes this misdetection, and adds a test to make sure
future commits don't introduce a regression here.
gdb/ChangeLog:
2015-12-09 Ruslan Kabatsayev <b7.10110111@gmail.com>
PR gdb/18702
* configure.host: Fix detection of x86_64 host when setting
floatformats.
gdb/testsuite/ChangeLog:
2015-12-09 Ruslan Kabatsayev <b7.10110111@gmail.com>
Pedro Alves <pedro@redhat.com>
PR gdb/18702
Add checking of floatformats setup on x86_64 hosts.
* gdb.arch/i386-float.S (main): Load bigval and smallval.
(smallval, bigval): New labels/constants.
* gdb.arch/i386-float.exp: Use with_test_prefix and test "info
float" after loading bigval and smallval.
---
gdb/ChangeLog | 6 ++++++
gdb/testsuite/ChangeLog | 10 ++++++++++
gdb/configure.host | 2 +-
gdb/testsuite/gdb.arch/i386-float.S | 4 ++++
gdb/testsuite/gdb.arch/i386-float.exp | 20 ++++++++++++++++----
5 files changed, 37 insertions(+), 5 deletions(-)
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b5d2431..8a8202c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2015-12-09 Ruslan Kabatsayev <b7.10110111@gmail.com> (tiny patch)
+
+ PR gdb/18702
+ * configure.host: Fix detection of x86_64 host when setting
+ floatformats.
+
2015-12-08 Pierre-Marie de Rodat <derodat@adacore.com>
* NEWS: Announce this enhancement and the corresponding new
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 8316d32..d959e7b 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,13 @@
+2015-12-09 Ruslan Kabatsayev <b7.10110111@gmail.com>
+ Pedro Alves <pedro@redhat.com>
+
+ PR gdb/18702
+ Add checking of floatformats setup on x86_64 hosts.
+ * gdb.arch/i386-float.S (main): Load bigval and smallval.
+ (smallval, bigval): New labels/constants.
+ * gdb.arch/i386-float.exp: Use with_test_prefix and test "info
+ float" after loading bigval and smallval.
+
2015-12-07 Pierre-Marie de Rodat <derodat@adacore.com>
* gdb.ada/fun_overload_menu.exp: New testcase.
diff --git a/gdb/configure.host b/gdb/configure.host
index 48714f4..ef265eb 100644
--- a/gdb/configure.host
+++ b/gdb/configure.host
@@ -195,7 +195,7 @@ esac
# "double" and "long double" types.
case "${host}" in
-i[34567]86-*-*)
+i[34567]86-*-*|x86_64-*-*)
gdb_host_float_format="&floatformat_ieee_single_little"
gdb_host_double_format="&floatformat_ieee_double_little"
gdb_host_long_double_format="&floatformat_i387_ext"
diff --git a/gdb/testsuite/gdb.arch/i386-float.S b/gdb/testsuite/gdb.arch/i386-float.S
index 76126c4..f5de8c2 100644
--- a/gdb/testsuite/gdb.arch/i386-float.S
+++ b/gdb/testsuite/gdb.arch/i386-float.S
@@ -29,6 +29,10 @@
SYMBOL(main):
fninit
fldt val
+ fldt bigval
+ fldt smallval
ret
.data
val: .byte 0x00,0x00,0x45,0x07,0x11,0x19,0x22,0xe9,0xfe,0xbf
+ smallval: .byte 0xe9,0xd0,0xd7,0x65,0x81,0xb7,0x43,0xc6,0x5c,0x6a
+ bigval: .byte 0x6a,0x45,0x90,0xdc,0x03,0xc1,0xf8,0xc6,0xe5,0x03
diff --git a/gdb/testsuite/gdb.arch/i386-float.exp b/gdb/testsuite/gdb.arch/i386-float.exp
index e638ceb..e3ae3ba 100644
--- a/gdb/testsuite/gdb.arch/i386-float.exp
+++ b/gdb/testsuite/gdb.arch/i386-float.exp
@@ -37,7 +37,19 @@ if ![runto_main] then {
return 0
}
-gdb_test "stepi" ".*fldt.*" "first stepi"
-gdb_test "info float" ".*R7: Empty 0x00000000000000000000\r\n.*"
-gdb_test "stepi" ".*ret.*" "second stepi"
-gdb_test "info float" ".*=>R7: Valid 0xbffee922191107450000 .*"
+with_test_prefix "zero" {
+ gdb_test "stepi" ".*fldt.*"
+ gdb_test "info float" "R7: Empty 0x00000000000000000000\r\n.*"
+}
+with_test_prefix "val" {
+ gdb_test "stepi" ".*fldt.*"
+ gdb_test "info float" "=>R7: Valid 0xbffee922191107450000 .*"
+}
+with_test_prefix "smallval" {
+ gdb_test "stepi" ".*fldt.*"
+ gdb_test "info float" "=>R6: Valid 0x03e5c6f8c103dc90456a \\+3.500000000000000007e-4632\r\n.*"
+}
+with_test_prefix "bigval" {
+ gdb_test "stepi" ".*ret.*"
+ gdb_test "info float" "=>R5: Valid 0x6a5cc643b78165d7d0e9 \\+7.250000000000000005e\\+3264\r\n.*"
+}
--
1.9.3
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2015-12-09 12:23 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-20 22:07 [PATCH][PR 18702] Fix wrong output of x87 registers due to truncation to double on amd64 Ruslan Kabatsayev
2015-12-02 11:32 ` Yao Qi
2015-12-02 14:26 ` Ruslan Kabatsayev
2015-12-03 11:27 ` Yao Qi
2015-12-04 14:41 ` Ruslan Kabatsayev
2015-12-03 12:28 ` Pedro Alves
2015-12-04 15:06 ` Ruslan Kabatsayev
2015-12-04 15:11 ` Pedro Alves
2015-12-04 15:17 ` Ruslan Kabatsayev
2015-12-04 15:35 ` Pedro Alves
2015-12-04 16:09 ` Ruslan Kabatsayev
2015-12-05 22:41 ` Andrew Burgess
2015-12-06 6:30 ` Ruslan Kabatsayev
2015-12-09 12:23 ` Pedro Alves
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox