Skip to content
Draft
Show file tree
Hide file tree
Changes from 5 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
38 changes: 38 additions & 0 deletions Sources/BasicContainers/RigidArray/RigidArray+Formatter.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#if swift(>=6.3)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about adding either a comment at the top of this file with instructions for how to regenerate it from the python source?
I guess that could even be a feature of the compiler script...

Copy link
Copy Markdown
Author

@kastiglione kastiglione Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment is now added as part of the new generate_formatters.sh script.

#if os(macOS) || os(iOS) || os(watchOS) || os(tvOS) || os(visionOS)
@section("__DATA_CONST,__lldbformatters")
#else
@section(".lldbformatters")
#endif
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be using:

  • #if objectFormat(…) from SE-0492 — with section names for MachO, ELF, COFF, and Wasm?

  • #if os(anyAppleOS) when using a Swift 6.4 compiler?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL I learned about these. Thank you. I will update it accordingly.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@used
let __BasicContainers___RigidArray______formatter: (UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8) = (
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this use a raw identifier from SE-0451, instead of the replacement underscores?

I was also going to ask about using an InlineArray literal, but then I found your previous discussion.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will look into whether it would be feasible to allow InlineArray to be used in the future as a constant.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A raw identifier is another good suggestion. The name of this is irrelevant to lldb.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

// version
0x01,
// remaining record size
0x5f,
// type name size
0x22,
// type name
0x5e, 0x42, 0x61, 0x73, 0x69, 0x63, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x5b, 0x2e, 0x5d, 0x52, 0x69, 0x67, 0x69, 0x64, 0x41, 0x72, 0x72, 0x61, 0x79, 0x3c, 0x2e, 0x2b, 0x3e, 0x24,
// flags
0x00,
// sig_update
0x06,
// program size
0x27,
// program
0x20, 0x00, 0x03, 0x22, 0x08, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x23, 0x12, 0x60, 0x23, 0x18, 0x60, 0x20, 0x00, 0x03, 0x22, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x23, 0x12, 0x60, 0x23, 0x18, 0x60, 0x23, 0x21, 0x60,
// sig_get_num_children
0x02,
// program size
0x04,
// program
0x20, 0x02, 0x03, 0x13,
// sig_get_child_at_index
0x04,
// program size
0x0a,
// program
0x20, 0x01, 0x03, 0x20, 0x03, 0x03, 0x23, 0x11, 0x60, 0x13
)
#endif
26 changes: 26 additions & 0 deletions Utils/Debugger/Formatters/RigidArray.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import lldb


class RigidArraySynthetic:
valobj: lldb.SBValue
storage: lldb.SBValue
count: int

def __init__(self, valobj: lldb.SBValue, _) -> None:
self.valobj = valobj

def num_children(self) -> int:
return self.count

def get_child_at_index(self, idx: int) -> lldb.SBValue:
return self.storage.GetChildAtIndex(idx)

def update(self) -> None:
self.storage = self.valobj.GetChildMemberWithName(
"_storage"
).GetSyntheticValue()
self.count = (
self.valobj.GetChildMemberWithName("_count")
.GetSyntheticValue()
.GetValueAsUnsigned()
)
Loading