[Lldb-commits] [PATCH] D83256: [lldb] Fix unaligned load in DataExtractor

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 6 19:16:02 PDT 2020


clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Just need some sanity checks to make sure the sizeof(float) == 4 and sizeof(double) == 8 for the tests to make sure this doesn't fail on systems where that isn't true.



================
Comment at: lldb/unittests/Utility/DataExtractorTest.cpp:308
+  {
+    uint8_t buffer[] = {0x00, 0x00, 0x80, 0x40};
+    DataExtractor LE(buffer, sizeof(buffer), lldb::eByteOrderLittle,
----------------
You might want to make check if the size of a float is 4 bytes here and return without testing anything if it isn't or this will fail.


================
Comment at: lldb/unittests/Utility/DataExtractorTest.cpp:332
+  {
+    uint8_t buffer[] = {0x00, 0x00, 0x00, 0x80, 0x40};
+    DataExtractor LE(buffer, sizeof(buffer), lldb::eByteOrderLittle,
----------------
You might want to make check if the size of a float is 4 bytes here and return without testing anything if it isn't or this will fail.


================
Comment at: lldb/unittests/Utility/DataExtractorTest.cpp:356
+  {
+    uint8_t buffer[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x40};
+    DataExtractor LE(buffer, sizeof(buffer), lldb::eByteOrderLittle,
----------------
You might want to make check if the size of a double is 8 bytes here and return without testing anything if it isn't or this will fail. Windows used 10 byte floats for doubles I believe?


================
Comment at: lldb/unittests/Utility/DataExtractorTest.cpp:380
+  {
+    uint8_t buffer[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x40};
+    DataExtractor LE(buffer, sizeof(buffer), lldb::eByteOrderLittle,
----------------
You might want to make check if the size of a double is 8 bytes here and return without testing anything if it isn't or this will fail. Windows used 10 byte floats for doubles I believe?




CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83256/new/

https://reviews.llvm.org/D83256





More information about the lldb-commits mailing list