mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Merge pull request #41160 from mikeash/swift-inspect-concurrency
[RemoteMirror][swift-inspect] Add a command to inspect the state of the concurrency runtime.
This commit is contained in:
@@ -40,6 +40,10 @@ public:
|
||||
using ReadBytesResult =
|
||||
std::unique_ptr<const void, std::function<void(const void *)>>;
|
||||
|
||||
template <typename T>
|
||||
using ReadObjResult =
|
||||
std::unique_ptr<const T, std::function<void(const void *)>>;
|
||||
|
||||
virtual bool queryDataLayout(DataLayoutQueryType type, void *inBuffer,
|
||||
void *outBuffer) = 0;
|
||||
|
||||
@@ -90,6 +94,15 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
ReadObjResult<T> readObj(RemoteAddress address) {
|
||||
auto bytes = readBytes(address, sizeof(T));
|
||||
auto deleter = bytes.get_deleter();
|
||||
auto ptr = bytes.get();
|
||||
bytes.release();
|
||||
return ReadObjResult<T>(reinterpret_cast<const T *>(ptr), deleter);
|
||||
}
|
||||
|
||||
/// Attempts to read 'size' bytes from the given address in the remote process.
|
||||
///
|
||||
/// Returns a pointer to the requested data and a function that must be called to
|
||||
|
||||
Reference in New Issue
Block a user