This is an archive of the discontinued LLVM Phabricator instance.

Implement `CopyFromTarget(...)` methods.
Needs RevisionPublic

Authored by delcypher on Jan 27 2019, 12:48 PM.

Details

Summary

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

Event Timeline

delcypher created this revision.Jan 27 2019, 12:48 PM
Herald added subscribers: Restricted Project, kubamracek. · View Herald TranscriptJan 27 2019, 12:48 PM
vitalybuka requested changes to this revision.Apr 24 2019, 11:13 AM

Removing stale patches from the "Ready to Review" list.

This revision now requires changes to proceed.Apr 24 2019, 11:13 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 24 2019, 11:13 AM
yln resigned from this revision.Jul 22 2021, 4:14 PM