summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2024-02-14 16:24:00 -0500
committerGlenn Smith <glenn@vector35.com>2024-02-19 17:01:23 -0500
commit2911628937552644687336352361767840783854 (patch)
tree6afd4660db7c511abee0d5cb02c07a9396e6999d /python
parenta155071981b401f72fa3dad4626c7a891ff8f761 (diff)
Clean up type archives docs
Diffstat (limited to 'python')
-rw-r--r--python/binaryview.py23
-rw-r--r--python/typearchive.py20
2 files changed, 32 insertions, 11 deletions
diff --git a/python/binaryview.py b/python/binaryview.py
index cfce2c96..ec8475c8 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -7791,8 +7791,9 @@ class BinaryView:
def attach_type_archive(self, archive: 'typearchive.TypeArchive'):
"""
- Attach a given type archive to the owned analysis and try to connect to it.
- Names from that archive will be cached in the mapping but no types will actually be associated by calling this.
+ Attach a given type archive to the analysis and try to connect to it.
+ If attaching was successful, names from that archive will become available to pull,
+ but no types will actually be associated by calling this.
:param archive: New archive
"""
attached = self.attach_type_archive_by_id(archive.id, archive.path)
@@ -7801,18 +7802,22 @@ class BinaryView:
def attach_type_archive_by_id(self, id: str, path: str) -> Optional['typearchive.TypeArchive']:
"""
Attach a type archive to the owned analysis and try to connect to it.
- If attaching was successful, names from that archive will be cached in the mapping,
+ If attaching was successful, names from that archive will become available to pull,
but no types will actually be associated by calling this.
- The behavior of this function is rather complicated, in an attempt to enable
- control of both attaching and connecting Type Archives.
+ The behavior of this function is rather complicated, in an attempt to enable the
+ ability to have attached, but disconnected Type Archives.
+
+ Normal operation:
- If there was a previously connected Type Archive whose id matches `id`, nothing
- will happen and it will simply be returned.
If there was no previously connected Type Archive whose id matches `id`, and the
file at `path` contains a Type Archive whose id matches `id`, it will be
attached and connected.
+ Edge-cases:
+
+ If there was a previously connected Type Archive whose id matches `id`, nothing
+ will happen, and it will simply be returned.
If the file at `path` does not exist, nothing will happen and None will be returned.
If the file at `path` exists but does not contain a Type Archive whose id matches `id`,
nothing will happen and None will be returned.
@@ -7832,14 +7837,14 @@ class BinaryView:
def detach_type_archive(self, archive: 'typearchive.TypeArchive'):
"""
- Detach from a type archive, breaking all associations to types with the archive
+ Detach from a type archive, breaking all associations to types within the archive
:param archive: Type archive to detach
"""
self.detach_type_archive_by_id(archive.id)
def detach_type_archive_by_id(self, id: str):
"""
- Detach from a type archive, breaking all associations to types with the archive
+ Detach from a type archive, breaking all associations to types within the archive
:param id: Id of archive to detach
"""
if not core.BNBinaryViewDetachTypeArchive(self.handle, id):
diff --git a/python/typearchive.py b/python/typearchive.py
index 38493367..bf6c1a79 100644
--- a/python/typearchive.py
+++ b/python/typearchive.py
@@ -35,7 +35,18 @@ from . import binaryview
class TypeArchive:
+ """
+ Type Archives are a collection of types which can be shared between different analysis
+ sessions and are backed by a database file on disk. Their types can be modified, and
+ a history of previous versions of types is stored in snapshots in the archive.
+ """
+
def __init__(self, handle: core.BNTypeArchiveHandle):
+ """
+ Internal-use constructor. API users will want to use `:py:func:TypeArchive.open`
+ or `:py:func:TypeArchive.create` instead to get an instance of a TypeArchive.
+ :param handle:
+ """
binaryninja._init_plugins()
self.handle: core.BNTypeArchiveHandle = core.handle_of_type(handle, core.BNTypeArchive)
self._notifications = {}
@@ -177,7 +188,7 @@ class TypeArchive:
"""
Get the ids of the children to the given snapshot
:param snapshot: Parent snapshot id
- :return: Child snapshot ids, or empty list if the snapshot is a root
+ :return: Child snapshot ids, or empty list if the snapshot is a leaf
"""
count = ctypes.c_size_t(0)
ids = core.BNGetTypeArchiveSnapshotChildIds(self.handle, snapshot, count)
@@ -204,7 +215,7 @@ class TypeArchive:
def add_types(self, new_types: List[Tuple['_types.QualifiedNameType', '_types.Type']]) -> None:
"""
Add named types to the type archive. Types must have all dependant named
- types prior to being added, or this function will fail.
+ types prior to being added, or included in the list, or this function will fail.
Types already existing with any added names will be overwritten.
:param new_types: Names and definitions of new types
"""
@@ -638,6 +649,11 @@ class TypeArchive:
class TypeArchiveNotification:
+ """
+ Class providing an interface to receive event notifications for updates that happen to
+ a Type Archive.
+ """
+
def __init__(self):
pass