add MSVC tuple providers
This commit is contained in:
parent
62bf38fa60
commit
8b14227aa9
2 changed files with 58 additions and 1 deletions
|
|
@ -18,7 +18,10 @@ type synthetic add -l lldb_lookup.synthetic_lookup -x "^(core::([a-z_]+::)+)NonZ
|
|||
type synthetic add -l lldb_lookup.synthetic_lookup -x "^core::num::([a-z_]+::)*NonZero.+$" --category Rust
|
||||
type synthetic add -l lldb_lookup.synthetic_lookup -x "^(std::([a-z_]+::)+)PathBuf$" --category Rust
|
||||
type synthetic add -l lldb_lookup.synthetic_lookup -x "^&(mut )?(std::([a-z_]+::)+)Path$" --category Rust
|
||||
type synthetic add -l lldb_lookup.synthetic_lookup -x "^(.*)$" --category Rust
|
||||
type synthetic add -l lldb_lookup.MSVCStdSliceSyntheticProvider -x "^ref\$<slice2\$<.+> >" --category Rust
|
||||
type synthetic add -l lldb_lookup.MSVCTupleSyntheticProvider -x "^tuple\$<.+>$" --category Rust
|
||||
type summary add -F lldb_lookup.TupleSummaryProvider -e -x -h "^tuple\$<.+>$" --category Rust
|
||||
type synthetic add -l lldb_lookup.synthetic_lookup -x "^\(.*\)$" --category Rust
|
||||
type summary add -F _ -e -x -h "^.*$" --category Rust
|
||||
type summary add -F lldb_lookup.summary_lookup -e -x -h "^(alloc::([a-z_]+::)+)String$" --category Rust
|
||||
type summary add -F lldb_lookup.summary_lookup -e -x -h "^&(mut )?str$" --category Rust
|
||||
|
|
@ -40,4 +43,5 @@ type summary add -F lldb_lookup.summary_lookup -e -x -h "^(core::([a-z_]+::)+)N
|
|||
type summary add -F lldb_lookup.summary_lookup -e -x -h "^core::num::([a-z_]+::)*NonZero.+$" --category Rust
|
||||
type summary add -F lldb_lookup.summary_lookup -e -x -h "^(std::([a-z_]+::)+)PathBuf$" --category Rust
|
||||
type summary add -F lldb_lookup.summary_lookup -e -x -h "^&(mut )?(std::([a-z_]+::)+)Path$" --category Rust
|
||||
type summary add -F lldb_lookup.TupleSummaryProvider -e -x -h "^tuple\$<.+>$" --category Rust
|
||||
type category enable Rust
|
||||
|
|
|
|||
|
|
@ -205,6 +205,24 @@ def StdPathSummaryProvider(valobj: SBValue, _dict: LLDBOpaque) -> str:
|
|||
return '"%s"' % data
|
||||
|
||||
|
||||
def sequence_formatter(output: str, valobj: SBValue, _dict: LLDBOpaque):
|
||||
length: int = valobj.GetNumChildren()
|
||||
|
||||
long: bool = False
|
||||
for i in range(0, length):
|
||||
if len(output) > 32:
|
||||
long = True
|
||||
break
|
||||
child: SBValue = valobj.GetChildAtIndex(i)
|
||||
output += f"{child.value}, "
|
||||
if long:
|
||||
output = f"(len: {length}) " + output + "..."
|
||||
else:
|
||||
output = output[:-2]
|
||||
|
||||
return output
|
||||
|
||||
|
||||
class StructSyntheticProvider:
|
||||
"""Pretty-printer for structs and struct enum variants"""
|
||||
|
||||
|
|
@ -348,6 +366,41 @@ class TupleSyntheticProvider:
|
|||
return True
|
||||
|
||||
|
||||
class MSVCTupleSyntheticProvider:
|
||||
__slots__ = ["valobj"]
|
||||
|
||||
def __init__(self, valobj: SBValue, _dict: LLDBOpaque):
|
||||
self.valobj = valobj
|
||||
|
||||
def num_children(self) -> int:
|
||||
return self.valobj.GetNumChildren()
|
||||
|
||||
def get_child_index(self, name: str) -> int:
|
||||
return self.valobj.GetIndexOfChildWithName(name)
|
||||
|
||||
def get_child_at_index(self, index: int) -> SBValue:
|
||||
child: SBValue = self.valobj.GetChildAtIndex(index)
|
||||
return child.CreateChildAtOffset(str(index), 0, child.GetType())
|
||||
|
||||
def update(self):
|
||||
pass
|
||||
|
||||
def has_children(self) -> bool:
|
||||
return self.valobj.MightHaveChildren()
|
||||
|
||||
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]
|
||||
return "(" + name + ")"
|
||||
|
||||
|
||||
def TupleSummaryProvider(valobj: SBValue, _dict: LLDBOpaque):
|
||||
output: str = sequence_formatter("(", valobj, dict)
|
||||
output += ")"
|
||||
return output
|
||||
|
||||
|
||||
class StdVecSyntheticProvider:
|
||||
"""Pretty-printer for alloc::vec::Vec<T>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue