diff options
| author | Greg Clayton <gclayton@apple.com> | 2013-06-11 21:56:55 +0000 |
|---|---|---|
| committer | Greg Clayton <gclayton@apple.com> | 2013-06-11 21:56:55 +0000 |
| commit | bc8fc0f5e0c00d2d09840c615b145e2e2ab35fb7 (patch) | |
| tree | 8836f4247c0ff0ef565833b3aaafe4ffb43a1f08 /lldb/test/functionalities/data-formatter/data-formatter-smart-array | |
| parent | 1f16b743d9255f5f75a85c52e3a02d04b4a1e590 (diff) | |
| download | bcm5719-llvm-bc8fc0f5e0c00d2d09840c615b145e2e2ab35fb7.tar.gz bcm5719-llvm-bc8fc0f5e0c00d2d09840c615b145e2e2ab35fb7.zip | |
Use llvm::APFloat for formatting if a target is available. Each target when debugging has a "ASTContext" that helps us to use the correct floating point semantics. Now that APFloat supports toString we now use that. If we don't have a target, we still fall back on the old display methodology, but the important formatting should always have a target available and thus use the compiler floating point code.
Modified the test programs to use floating point constants that always will display correctly. We had some numbers that were being rounded, and now that we are using clang, we no longer round them and we get more correct results.
llvm-svn: 183792
Diffstat (limited to 'lldb/test/functionalities/data-formatter/data-formatter-smart-array')
| -rw-r--r-- | lldb/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py | 20 | ||||
| -rw-r--r-- | lldb/test/functionalities/data-formatter/data-formatter-smart-array/main.cpp | 14 |
2 files changed, 16 insertions, 18 deletions
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py b/lldb/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py index 6d3103cda4b..27ca2e1361c 100644 --- a/lldb/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py +++ b/lldb/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py @@ -283,29 +283,29 @@ class SmartArrayDataFormatterTestCase(TestBase): self.expect("frame variable flarr", substrs = ['flarr = arr =', - '{78.5},{77.4},{78},{76.1},{76.7},{76.8},{77}']) + '{78.5},{77.25},{78},{76.125},{76.75},{76.875},{77}']) self.expect("frame variable other.flarr", substrs = ['flarr = arr = ', - '{25.5},{25.7},{25.9},{26.4},{27.1},{27.3},{26.9}']) + '{25.5},{25.25},{25.125},{26.75},{27.375},{27.5},{26.125}']) # printing full array as an array self.runCmd("type summary add --summary-string \"arr = ${var%float32[]}\" \"float [7]\"") self.expect("frame variable flarr", substrs = ['flarr = arr =', - '78.5,77.4,78,76.1,76.7,76.8,77']) + '78.5,77.25,78,76.125,76.75,76.875,77']) self.expect("frame variable other.flarr", substrs = ['flarr = arr =', - '25.5,25.7,25.9,26.4,27.1,27.3,26.9']) + '25.5,25.25,25.125,26.75,27.375,27.5,26.125']) # using array smart summary strings for pointers should make no sense self.runCmd("type summary add --summary-string \"arr = ${var%float32[]}\" \"float *\"") self.runCmd("type summary add --summary-string \"arr = ${var%int32_t[]}\" \"int *\"") self.expect("frame variable flptr", matching=False, - substrs = ['78.5,77.4,78,76.1,76.7,76.8,77']) + substrs = ['78.5,77.25,78,76.125,76.75,76.875,77']) self.expect("frame variable intptr", matching=False, substrs = ['1,1,2,3,5']) @@ -316,11 +316,11 @@ class SmartArrayDataFormatterTestCase(TestBase): self.expect("frame variable flarr", substrs = ['flarr = arr =', - '00 00 9d 42,cd cc 9a 42,00 00 9c 42,33 33 98 42,66 66 99 42,9a 99 99 42,00 00 9a 42']) + '00 00 9d 42,00 80 9a 42,00 00 9c 42,00 40 98 42,00 80 99 42,00 c0 99 42,00 00 9a 42']) self.expect("frame variable other.flarr", substrs = ['flarr = arr =', - '00 00 cc 41,9a 99 cd 41,33 33 cf 41,33 33 d3 41,cd cc d8 41,66 66 da 41,33 33 d7 41']) + '00 00 cc 41,00 00 ca 41,00 00 c9 41,00 00 d6 41,00 00 db 41,00 00 dc 41,00 00 d1 41']) self.expect("frame variable intarr", substrs = ['intarr = arr =', @@ -335,13 +335,11 @@ class SmartArrayDataFormatterTestCase(TestBase): self.expect("frame variable flarr", substrs = ['flarr = arr =', - '...B,cd cc 9a 42', - 'ff.B,9a 99 99 42']) + '00 00 9d 42 ...B,00 80 9a 42 ...B,00 00 9c 42 ...B,00 40 98 42 .@.B,00 80 99 42 ...B,00 c0 99 42 ...B,00 00 9a 42 ...B']) self.expect("frame variable other.flarr", substrs = ['flarr = arr =', - '...A,33 33 cf 41', - '33.A,cd cc d8 41']) + '00 00 cc 41 ...A,00 00 ca 41 ...A,00 00 c9 41 ...A,00 00 d6 41 ...A,00 00 db 41 ...A,00 00 dc 41 ...A,00 00 d1 41 ...A']) self.expect("frame variable intarr", substrs = ['intarr = arr =', diff --git a/lldb/test/functionalities/data-formatter/data-formatter-smart-array/main.cpp b/lldb/test/functionalities/data-formatter/data-formatter-smart-array/main.cpp index 24ee5be9e9c..9279e414be3 100644 --- a/lldb/test/functionalities/data-formatter/data-formatter-smart-array/main.cpp +++ b/lldb/test/functionalities/data-formatter/data-formatter-smart-array/main.cpp @@ -36,12 +36,12 @@ struct SomeOtherData intarr[4] = 5; flarr[0] = 25.5; - flarr[1] = 25.7; - flarr[2] = 25.9; - flarr[3] = 26.4; - flarr[4] = 27.1; - flarr[5] = 27.3; - flarr[6] = 26.9; + flarr[1] = 25.25; + flarr[2] = 25.125; + flarr[3] = 26.75; + flarr[4] = 27.375; + flarr[5] = 27.5; + flarr[6] = 26.125; } }; @@ -51,7 +51,7 @@ int main (int argc, const char * argv[]) char *strptr = NULL; strptr = "Hello world!"; int intarr[5] = {1,1,2,3,5}; - float flarr[7] = {78.5,77.4,78.0,76.1,76.7,76.8,77.0}; + float flarr[7] = {78.5,77.25,78.0,76.125,76.75,76.875,77.0}; SomeData data; |

