saugustine added inline comments.

================
Comment at: lldb/source/Expression/DWARFExpression.cpp:1309
             stack.back().GetScalar() = DerefSizeExtractDataHelper(
-                addr_bytes, sizeof(addr_bytes), objfile->GetByteOrder(), size);
+                addr_bytes, size, objfile->GetByteOrder(), size);
             stack.back().ClearContext();
----------------
JDevlieghere wrote:
> Why size and not `8`?
Because that preserves the semantics of the original code.  The original code 
allocates anywhere from 1 to 8 bytes, based on size ```uint8_t 
addr_bytes[size];```. Then reads that amount from memory (line 1303 - 1304), 
and then passes the size of the allocation on this line (via 
```sizeof(addr_bytes)```).

Always passing eight here would be wrong, because the size of the pointer could 
have been anywhere from 1 to 8.

Not also how line 1309 read size-bytes read into addr_bytes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121732

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to