(self)
| 22 | return None |
| 23 | |
| 24 | def update(self): |
| 25 | self.size = 0 |
| 26 | self.capacity = 0 |
| 27 | self.is_direct = True |
| 28 | self.data_addr = lldb.LLDB_INVALID_ADDRESS |
| 29 | |
| 30 | self.type_t = self.valobj.GetType().GetTemplateArgumentType(0) |
| 31 | self.m_data = self._get_m_data() |
| 32 | |
| 33 | if not self.m_data or not self.m_data.IsValid(): |
| 34 | return |
| 35 | |
| 36 | # Use SBData instead of direct memory reading to support variables in registers |
| 37 | sb_data = self.m_data.GetData() |
| 38 | error = lldb.SBError() |
| 39 | if sb_data.GetByteSize() == 0: |
| 40 | return |
| 41 | |
| 42 | first_byte = sb_data.GetUnsignedInt8(error, 0) |
| 43 | if error.Fail(): |
| 44 | return |
| 45 | |
| 46 | self.is_direct = (first_byte & 1) != 0 |
| 47 | |
| 48 | target = self.valobj.GetTarget() |
| 49 | ptr_size = target.GetAddressByteSize() |
| 50 | |
| 51 | # Safely get alignment |
| 52 | align_t = 0 |
| 53 | if hasattr(self.type_t, "GetByteAlign"): |
| 54 | align_t = self.type_t.GetByteAlign() |
| 55 | if align_t == 0: |
| 56 | align_t = self.type_t.GetByteSize() |
| 57 | if align_t == 0: |
| 58 | align_t = ptr_size |
| 59 | |
| 60 | if self.is_direct: |
| 61 | self.size = first_byte >> 1 |
| 62 | self.capacity = 0 |
| 63 | |
| 64 | # Data starts at offset equal to the alignment of T |
| 65 | addr = self.m_data.GetLoadAddress() |
| 66 | if addr != lldb.LLDB_INVALID_ADDRESS: |
| 67 | self.data_addr = addr + align_t |
| 68 | else: |
| 69 | # Indirect Mode: read the pointer to the heap storage |
| 70 | void_ptr = sb_data.GetAddress(error, 0) |
| 71 | process = self.valobj.GetProcess() |
| 72 | |
| 73 | if error.Fail() or void_ptr == 0 or not process.IsValid(): |
| 74 | return |
| 75 | |
| 76 | self.size = process.ReadUnsignedIntegerFromMemory(void_ptr, ptr_size, error) |
| 77 | self.capacity = process.ReadUnsignedIntegerFromMemory( |
| 78 | void_ptr + ptr_size, ptr_size, error |
| 79 | ) |
| 80 | |
| 81 | # Calculate offset_to_data: round_up(sizeof(header), alignment_of_t) |
no test coverage detected