These methods provide a simple interface for getting a copy
of a AddressSpaceView data structure from a target process but
with the AddressSpaceView type replaced with RemoteAddressSpaceView.
To support these methods, all types that take AddressSpaceView
as a template parameter now provide a ThisTASVT templated alias
that allows a convenient way to construct a type with a different
AddressSpaceView from an existing type. This will also be useful
for callers of the CopyFromTarget(...) methods.
The implementations of these functions copy fields from
type Type<AddressSpaceView> to a buffer of
Type<RemoteAddressSpaceView>. A copy if performed field by field
because C++ does not guarantee that the types have the same data-layout.
For fields that have identical size in the source and destination type
(i.e. fields that are not templated on AddressSpaceView) we copy
directly.
For fields that do depend on AddressSpaceView we recursively
call CopyFromTarget(...).
This approach might not be performant as copying the outter most data
structure directly into the buffer (i.e. CombinedAllocator) but it is
correct. We can investigate faster solutions (e.g. Compute if data
layout is same using constexpr functions and do fast copy in that case)
if it becomes necessary.
The main downside to this implementation is that it requires manually
keeping track of the fields in a class which will add a maintance
burden.
rdar://problem/45284065