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

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 6 15:45:07 PDT 2020


clayborg added a comment.

There is no requirement that data be aligned when stored in a buffer that DataExtractor points to, so this patch doesn't seem correct. Since GetData() calls can return unaligned pointers, the usual way to make this work is to to make a local variable and do a memcpy into that local variable. See the ReadSwapInt32() function to see how it is done for integers. Then we need to swap the bytes depending on the byte size. So maybe a function that can do byte swapping for any sized data can be made. Then we can call it from the Get<T> function.  More comments inline.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D83256





More information about the lldb-commits mailing list