lldb-formatters: Use StdSliceSyntheticProvider for &str

This commit is contained in:
Vladimir Makayev 2024-04-28 14:02:32 -07:00
parent 100b123a0d
commit 330ce83a8d
5 changed files with 70 additions and 4 deletions

View file

@ -92,7 +92,7 @@ def synthetic_lookup(valobj, dict):
return StdVecSyntheticProvider(valobj, dict)
if rust_type == RustType.STD_VEC_DEQUE:
return StdVecDequeSyntheticProvider(valobj, dict)
if rust_type == RustType.STD_SLICE:
if rust_type == RustType.STD_SLICE or rust_type == RustType.STD_STR:
return StdSliceSyntheticProvider(valobj, dict)
if rust_type == RustType.STD_HASH_MAP:

View file

@ -159,6 +159,9 @@ def StdStrSummaryProvider(valobj, dict):
# logger = Logger.Logger()
# logger >> "[StdStrSummaryProvider] for " + str(valobj.GetName())
# the code below assumes non-synthetic value, this makes sure the assumption holds
valobj = valobj.GetNonSyntheticValue()
length = valobj.GetChildMemberWithName("length").GetValueAsUnsigned()
if length == 0:
return '""'