about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-10-01 18:42:34 +0200
committerGitHub <noreply@github.com>2025-10-01 18:42:34 +0200
commite40e50ed49a1f7e8d30e3d9b5449425528906c94 (patch)
tree2bcbeecb8ca57344242005522b1c979b7ee2cc5a
parent15b7792a65a5f50d22f77c02cff75f8015c48bc8 (diff)
parent1f8bef51e30a087a8b8843c19762952a50087a71 (diff)
downloadrust-e40e50ed49a1f7e8d30e3d9b5449425528906c94.tar.gz
rust-e40e50ed49a1f7e8d30e3d9b5449425528906c94.zip
Rollup merge of #147177 - Walnut356:tuples, r=Mark-Simulacrum
[DebugInfo] Fix MSVC tuple child creation

This is a fix for the debugger visualizer scripts

For whatever reason, using `CreateChildAtOffset` on the child element sometimes caused issues with pointers (and maybe some other types). The resulting child's memory would be a block 4 bytes too far forward. Creating the child off of the parent `valobj` and using the type definition to get the correct offset seems to fix that.

Before:

<img width="489" height="136" alt="image" src="https://github.com/user-attachments/assets/fb4cb95c-f199-49a6-8eba-6d3ff486b69a" />

After:

<img width="518" height="145" alt="image" src="https://github.com/user-attachments/assets/3f50dbc3-19ca-4fd8-87c5-b4be295f6e7c" />

This shouldn't affect any tests as we don't run debuginfo tests for MSVC afaik
-rw-r--r--src/etc/lldb_providers.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/etc/lldb_providers.py b/src/etc/lldb_providers.py
index 65f18baa937..3eb964d2fba 100644
--- a/src/etc/lldb_providers.py
+++ b/src/etc/lldb_providers.py
@@ -761,7 +761,8 @@ class MSVCTupleSyntheticProvider:
 
     def get_child_at_index(self, index: int) -> SBValue:
         child: SBValue = self.valobj.GetChildAtIndex(index)
-        return child.CreateChildAtOffset(str(index), 0, child.GetType())
+        offset = self.valobj.GetType().GetFieldAtIndex(index).byte_offset
+        return self.valobj.CreateChildAtOffset(str(index), offset, child.GetType())
 
     def update(self):
         pass
@@ -772,7 +773,7 @@ class MSVCTupleSyntheticProvider:
     def get_type_name(self) -> str:
         name = self.valobj.GetTypeName()
         # remove "tuple$<" and ">", str.removeprefix and str.removesuffix require python 3.9+
-        name = name[7:-1]
+        name = name[7:-1].strip()
         return "(" + name + ")"