Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/etc/lldb_batchmode/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def execute_command(command_interpreter: lldb.SBCommandInterpreter, command: str
+ str(res.GetError())
)
else:
print(res.GetOutput())
print(res.GetError())


Expand Down
49 changes: 39 additions & 10 deletions src/etc/lldb_lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,27 +126,44 @@ def register_providers_compatibility():
global RUST_CATEGORY

if LLDBFeature.TypeRecognizers in FEATURE_FLAGS:
# FIXME: this can be removed once full support for type recognizers is added.
# This prevents a semi-unfixable regression for CodeLLDB
register_synth(
synthetic_lookup,
# enforce uniform aggregate formatting
register_summary(
StructSummaryProvider,
lldb.SBTypeNameSpecifier(
MOD_PREFIX + is_udt.__name__,
lldb.eFormatterMatchCallback,
),
lldb.eTypeOptionCascade
| lldb.eTypeOptionHideEmptyAggregates
| lldb.eTypeOptionHideChildren,
)

# Tuple-structs
register_synth(
TupleSyntheticProvider,
lldb.SBTypeNameSpecifier(
MOD_PREFIX + is_tuple_type.__name__, lldb.eFormatterMatchCallback
),
lldb.eTypeOptionCascade,
)

# Gnu Sum-type Enums
register_synth(
ClangEncodedEnumProvider,
lldb.SBTypeNameSpecifier(
MOD_PREFIX + is_gnu_enum.__name__,
lldb.eFormatterMatchCallback,
),
lldb.eTypeOptionCascade,
)

# enforce uniform aggregate formatting
register_summary(
StructSummaryProvider,
ClangEncodedEnumSummaryProvider,
lldb.SBTypeNameSpecifier(
MOD_PREFIX + is_udt.__name__,
MOD_PREFIX + is_gnu_enum.__name__,
lldb.eFormatterMatchCallback,
),
lldb.eTypeOptionCascade
| lldb.eTypeOptionHideEmptyAggregates
| lldb.eTypeOptionHideChildren,
lldb.eTypeOptionCascade,
)
else:
# Need to toss any remaining types through this so that GNU enums are caught
Expand Down Expand Up @@ -395,6 +412,18 @@ def is_udt(type: lldb.SBType, _dict: LLDBOpaque) -> bool:
)


def is_gnu_enum(type: lldb.SBType, _dict: LLDBOpaque) -> bool:
return (
type.GetNumberOfFields() == 1
and type.GetFieldAtIndex(0).GetName() == "$variants$"
)


def is_tuple_type(type: lldb.SBType, _dict: LLDBOpaque) -> bool:
fields = type.fields
return len(fields) != 0 and is_tuple_fields(fields)


def classify_rust_type(type: lldb.SBType, is_msvc: bool) -> RustType:
if type.IsPointerType():
return RustType.Indirection
Expand Down
Loading