Skip to content

[lldb] Register NSString summary provider for Swift.__StringStorage class #11058

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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
4 changes: 4 additions & 0 deletions lldb/source/Plugins/Language/Swift/SwiftLanguage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,10 @@ static void LoadSwiftFormatters(lldb::TypeCategoryImplSP swift_category_sp) {
AddCXXSummary(swift_category_sp, staticstring_summary_provider,
"Swift.StaticString summary provider",
ConstString("Swift.StaticString"), summary_flags);
AddCXXSummary(swift_category_sp,
lldb_private::formatters::NSStringSummaryProvider,
"Swift.__StringStorage summary provider",
"Swift.__StringStorage", summary_flags);
AddCXXSummary(swift_category_sp,
lldb_private::formatters::swift::TaskPriority_SummaryProvider,
"Swift TaskPriority summary provider", "Swift.TaskPriority",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SWIFT_SOURCES := main.swift
SWIFTFLAGS_EXTRAS := -parse-as-library
include Makefile.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
import lldbsuite.test.lldbutil as lldbutil


class TestCase(TestBase):

@swiftTest
@skipUnlessFoundation
def test(self):
self.build()
lldbutil.run_to_source_breakpoint(
self, "break here", lldb.SBFileSpec("main.swift")
)
self.expect("v d[0].value", substrs=['value = "one.2.three"'])
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import Foundation

@main struct Entry {
static func main() {
let s = "one.two.three"
let d = NSMutableDictionary()
d["key"] = s.replacingOccurrences(of: "two", with: "2")
print("break here")
}
}