File tree Expand file tree Collapse file tree 5 files changed +47
-0
lines changed
source/Plugins/LanguageRuntime/Swift
test/API/lang/swift/observation Expand file tree Collapse file tree 5 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -605,6 +605,19 @@ LLDBMemoryReader::getFileAddressAndModuleForTaggedAddress(
605
605
return {{file_address, module }};
606
606
}
607
607
608
+ std::optional<swift::reflection::RemoteAddress>
609
+ LLDBMemoryReader::resolveRemoteAddress (
610
+ swift::reflection::RemoteAddress address) const {
611
+ std::optional<Address> lldb_address =
612
+ LLDBMemoryReader::resolveRemoteAddress (address.getAddressData ());
613
+ if (!lldb_address)
614
+ return {};
615
+ lldb::addr_t addr = lldb_address->GetLoadAddress (&m_process.GetTarget ());
616
+ if (addr != LLDB_INVALID_ADDRESS)
617
+ return swift::reflection::RemoteAddress (addr);
618
+ return {};
619
+ }
620
+
608
621
std::optional<Address>
609
622
LLDBMemoryReader::resolveRemoteAddress (uint64_t address) const {
610
623
Log *log (GetLog (LLDBLog::Types));
Original file line number Diff line number Diff line change @@ -77,6 +77,9 @@ class LLDBMemoryReader : public swift::remote::MemoryReader {
77
77
resolvePointer (swift::remote::RemoteAddress address,
78
78
uint64_t readValue) override ;
79
79
80
+ std::optional<swift::remote::RemoteAddress>
81
+ resolveRemoteAddress (swift::remote::RemoteAddress address) const override ;
82
+
80
83
bool readBytes (swift::remote::RemoteAddress address, uint8_t *dest,
81
84
uint64_t size) override ;
82
85
Original file line number Diff line number Diff line change
1
+ SWIFT_SOURCES := main.swift
2
+ include Makefile.rules
Original file line number Diff line number Diff line change
1
+ import lldb
2
+ from lldbsuite .test .lldbtest import *
3
+ from lldbsuite .test .decorators import *
4
+ import lldbsuite .test .lldbutil as lldbutil
5
+
6
+ class TestSwiftObservation (TestBase ):
7
+ NO_DEBUG_INFO_TESTCASE = True
8
+ @swiftTest
9
+ def test (self ):
10
+ """Test that types with private discriminators read from the file cache work"""
11
+ self .build ()
12
+ lldbutil .run_to_source_breakpoint (self , 'break here' ,
13
+ lldb .SBFileSpec ('main.swift' ))
14
+ # FIXME: Private discriminators are UUIDs in DWARF and pointers
15
+ # in Reflection metafdata, making tham not comparable.
16
+ # rdar://74374120
17
+ self .expect ("settings set symbols.swift-validate-typesystem false" )
18
+ self .expect ("settings set target.experimental.swift-read-metadata-from-file-cache true" )
19
+ r = self .frame ().FindVariable ("r" )
20
+ extent = r .GetChildAtIndex (0 )
21
+ self .assertEqual (extent .GetName (), "extent" )
Original file line number Diff line number Diff line change
1
+ import Observation
2
+
3
+ func f( ) {
4
+ let r = ObservationRegistrar ( )
5
+ print ( " break here " )
6
+ }
7
+
8
+ f ( )
You can’t perform that action at this time.
0 commit comments