Commit Graph

13 Commits

Author SHA1 Message Date
Alejandro Alonso
382510fa50 Rename Reflection library to RemoteInspection (#62846) 2023-01-06 13:21:32 -05:00
Adrian Prantl
33eb213e28 [swift-reflection-dump] Make ObjC interoperability configurable.
This addresses a FIXME in the code. This allows running swift-reflection-dump
on macOS to dump the contents of an ELF binary.
2022-10-13 17:21:39 -07:00
Artem Chikin
c2190aefc0 [SwiftStaticMirror] Create API to query an opaque associated type's same-type requirements 2022-07-08 13:20:05 -07:00
Artem Chikin
3aad9fad9d [SwiftStaticMirror] Create API to query an opaque associated type's protocol requirements 2022-07-05 11:47:58 -07:00
Dave Lee
cfe0b9774d [Reflection] Update MemoryReader to distinguish related operations (#41530)
Until recently, `MemoryReader` had a single function `resovlePointer` which did two things, and has a somewhat vague name. The two things were:

1. Tool-specific mapping between real addresses and tagged addresses (first implemented in `swift-reflection-dump` and then later in lldb)
2. Finding a "symbol" for a given address

Recently, `resolvePointerAsSymbol` was added, which overloaded the term "resolve" and it added another way to deal with symbols for addresses. Symbols themselves were a bit muddled, as `swift-reflection-dump` was dealing with dynamic symbols aka bindings, while lldb was dealing in regular (static) symbols.

This change separates these two parts of functionality, and also divides symbol lookup into two cases. The API surface will now be:

1. `resolvePointer` for mapping/tagging addresses
3. `getSymbol` for looking up a symbol for an address
4. `getDynamicSymbol` for looking up a dyld binding for an address

Note: each of these names could be improved. Some alternative terms: `lookup` instead of `get`, `Binding` or `BindingName` instead of `DynamicSymbol`. Maybe even another term instead of "resolve". Suggestions welcome!

Currently, `swift-reflection-dump` supports `getDynamicSymbol` but not `getSymbol`. For lldb it's the reverse, `getSymbol` is supported but `getDynamicSymbol` needs to be implemented.

For everything but lldb, this change is NFC. For lldb it fixes a bug where `LLDBMemoryReader` returns regular symbols where we should instead be returning dynamic symbols.
2022-03-11 22:36:20 -08:00
Artem Chikin
02e15882d4 [Static Mirror] Add entry-points for querying field type information for properties and enum cases 2022-03-04 16:05:08 -08:00
Artem Chikin
e376af58f5 Refactor gathering of field type info from a binary into two steps: collect and output.
The collect step can then be used for other tools, such as the `BinaryScanningTool`.
2022-03-04 14:41:07 -08:00
Artem Chikin
62e07dc339 [Static Mirror] Refactor gathering of associated types from a binary and add SwiftStaticMirror entry-point for it. 2022-03-02 16:28:12 -08:00
Artem Chikin
d24e15812b Build libSwiftStaticMirror as a standalone library with minimal required dependencies.
This separates it from `libSwiftScan` and allows us to build this library without building much of the rest of the compiler.

Also refactor `utils/build-parser-lib` into `utils/build-tooling-libs` which builds both SwiftSyntaxParser and SwiftStaticMirror.
2022-02-09 12:28:21 -08:00
Artem Chikin
458eccca5f [LibSwiftScan] Add entry-points for querying protocol conformances from the static mirror
This commit adds new entry-points to `libSwiftScan` that operate on the new BinaryScanningTool, which reads out Swift type information from object files, starting with a query of all protocol conformances.
2022-02-02 11:56:17 -08:00
Artem Chikin
59d1960c7c Add support for reading protocol descriptors from an indirect protocol descriptor target in an conformance descriptor.
Previously, the code assumed that such an indirect target will always point to an external symbol pointer, but it can also be an absolute pointer to an in-image protocol descriptor.
2022-01-27 10:55:29 -08:00
Artem Chikin
e934fe201a Add extraction protocol conformance descriptor extraction, as read from an object file image, to TypeRefBuilder. 2022-01-26 13:54:02 -08:00
Artem Chikin
f3d784fd0f Factor out Object File handling from swift-reflection-dump to separate CMake target: StaticMirror
This target will then be used to have a broader set of tools for reading metadata from object files.
2022-01-24 16:49:01 -08:00