llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)

<details>
<summary>Changes</summary>

A bit or byte size of 0 is not a bug. It can legitimately (and frequently) 
happen in Swift and C, just not in C++. However, it doesn't make sense to read 
a scalar of zero bytes.

Currently, when this happens, we trigger an `lldb_assert` in the data extractor 
and return 0, which isn't accurate. I have a bunch of reports of the assert 
triggering, but nobody has been able to provide me with a reproducer that I can 
turn into a test and I wasn't able to concoct a test case by 
reverse-engineering the code. 

rdar://141630334

---
Full diff: https://github.com/llvm/llvm-project/pull/123107.diff


1 Files Affected:

- (modified) lldb/source/Symbol/CompilerType.cpp (+1-1) 


``````````diff
diff --git a/lldb/source/Symbol/CompilerType.cpp 
b/lldb/source/Symbol/CompilerType.cpp
index e9e6e3bf2600ce..3c4390b89a125a 100644
--- a/lldb/source/Symbol/CompilerType.cpp
+++ b/lldb/source/Symbol/CompilerType.cpp
@@ -1105,7 +1105,7 @@ bool CompilerType::GetValueAsScalar(const 
lldb_private::DataExtractor &data,
       return false;
 
     std::optional<uint64_t> byte_size = GetByteSize(exe_scope);
-    if (!byte_size)
+    if (!byte_size || *byte_size == 0)
       return false;
     lldb::offset_t offset = data_byte_offset;
     switch (encoding) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/123107
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to