Skip to content

Commit e8beb69

Browse files
mgornyJDevlieghere
authored andcommitted
[lldb] [test/Register] Attempt to fix x86-fp-read.test on Darwin
Darwin seems to use stmmN instead of stN. Use a regex to accept both. Also try to actually clear st(7). Differential revision: https://reviews.llvm.org/D88795
1 parent b180261 commit e8beb69

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

lldb/test/Shell/Register/Inputs/x86-fp-read.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ int main() {
1414
{0x8000000000000000, 0x7fff}, // +inf
1515
{0x8000000000000000, 0xffff}, // -inf
1616
{0xc000000000000000, 0xffff}, // nan
17-
// leave st7 empty to test tag word better
17+
// st7 will be freed to test tag word better
18+
{0x0000000000000000, 0x0000}, // +0
1819
};
1920

2021
// unmask divide-by-zero exception
@@ -26,13 +27,16 @@ int main() {
2627
"finit\n\t"
2728
"fldcw %1\n\t"
2829
// load on stack in reverse order to make the result easier to read
30+
"fldt 0x70(%0)\n\t"
2931
"fldt 0x60(%0)\n\t"
3032
"fldt 0x50(%0)\n\t"
3133
"fldt 0x40(%0)\n\t"
3234
"fldt 0x30(%0)\n\t"
3335
"fldt 0x20(%0)\n\t"
3436
"fldt 0x10(%0)\n\t"
3537
"fldt 0x00(%0)\n\t"
38+
// free st7
39+
"ffree %%st(7)\n\t"
3640
// this should trigger a divide-by-zero
3741
"fdivs (%2)\n\t"
3842
"int3\n\t"

lldb/test/Shell/Register/x86-fp-read.test

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# XFAIL: system-windows
2-
# XFAIL: system-darwin
32
# REQUIRES: native && (target-x86 || target-x86_64)
43
# RUN: %clangxx_host -g %p/Inputs/x86-fp-read.cpp -o %t
54
# RUN: %lldb -b -s %s %t | FileCheck %s
@@ -8,20 +7,20 @@ process launch
87

98
register read --all
109
# CHECK-DAG: fctrl = 0x037b
11-
# CHECK-DAG: fstat = 0x8884
10+
# CHECK-DAG: fstat = 0x8084
1211
# TODO: the following value is incorrect, it's a bug in the way
13-
# FXSAVE/XSAVE is interpreted; it should be 0xa963 once fixed
14-
# CHECK-DAG: ftag = 0x00fe
12+
# FXSAVE/XSAVE is interpreted
13+
# CHECK-DAG: ftag = 0x007f
1514
# CHECK-DAG: fop = 0x0033
1615

17-
# CHECK-DAG: st0 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x80 0x00 0x40}
18-
# CHECK-DAG: st1 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x3f 0x00 0x00}
19-
# CHECK-DAG: st2 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
20-
# CHECK-DAG: st3 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x80}
21-
# CHECK-DAG: st4 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x80 0xff 0x7f}
22-
# CHECK-DAG: st5 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x80 0xff 0xff}
23-
# CHECK-DAG: st6 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xc0 0xff 0xff}
24-
# CHECK-DAG: st7 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
16+
# CHECK-DAG: st{{(mm)?}}0 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x80 0x00 0x40}
17+
# CHECK-DAG: st{{(mm)?}}1 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x3f 0x00 0x00}
18+
# CHECK-DAG: st{{(mm)?}}2 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
19+
# CHECK-DAG: st{{(mm)?}}3 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x80}
20+
# CHECK-DAG: st{{(mm)?}}4 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x80 0xff 0x7f}
21+
# CHECK-DAG: st{{(mm)?}}5 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x80 0xff 0xff}
22+
# CHECK-DAG: st{{(mm)?}}6 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xc0 0xff 0xff}
23+
# CHECK-DAG: st{{(mm)?}}7 = {0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00}
2524

2625
# fdiv (%rbx) gets encoded into 2 bytes, int3 into 1 byte
2726
print (void*)($pc-3)

0 commit comments

Comments
 (0)