summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorKyleMiles <krm504@nyu.edu>2022-10-07 15:55:43 -0400
committerKyleMiles <krm504@nyu.edu>2022-10-09 18:08:24 -0400
commit1d21f2de35633113c38692a4fcb7e0481c96fd08 (patch)
tree0d30c740c9279940fa07d04f380c554a02b0632b /python
parented4dbf7bad554078139dcde3b437527078dc42ec (diff)
Remove default load settings; Move settings `analysis.debugInfoInternal` and `loader.debugInfoExternal` to `analysis.debugInfo.internal` and `analysis.debugInfo.external`
Diffstat (limited to 'python')
-rw-r--r--python/binaryview.py24
-rw-r--r--python/debuginfo.py2
-rwxr-xr-xpython/examples/debug_info.py2
-rw-r--r--python/examples/mappedview.py7
4 files changed, 10 insertions, 25 deletions
diff --git a/python/binaryview.py b/python/binaryview.py
index 02255b95..02b1cc53 100644
--- a/python/binaryview.py
+++ b/python/binaryview.py
@@ -1956,7 +1956,7 @@ class BinaryView:
binaryninja._init_plugins()
if file_metadata is None:
file_metadata = filemetadata.FileMetadata()
- _handle = core.BNCreateBinaryDataView(file_metadata.handle, True)
+ _handle = core.BNCreateBinaryDataView(file_metadata.handle)
self._file = filemetadata.FileMetadata(handle=core.BNNewFileReference(file_metadata.handle))
else:
binaryninja._init_plugins()
@@ -2223,11 +2223,11 @@ class BinaryView:
if isinstance(src, fileaccessor.FileAccessor):
if file_metadata is None:
file_metadata = filemetadata.FileMetadata()
- view = core.BNCreateBinaryDataViewFromFile(file_metadata.handle, src._cb, True)
+ view = core.BNCreateBinaryDataViewFromFile(file_metadata.handle, src._cb)
else:
if file_metadata is None:
file_metadata = filemetadata.FileMetadata(str(src))
- view = core.BNCreateBinaryDataViewFromFilename(file_metadata.handle, str(src), True)
+ view = core.BNCreateBinaryDataViewFromFilename(file_metadata.handle, str(src))
if view is None:
return None
return BinaryView(file_metadata=file_metadata, handle=view)
@@ -2238,12 +2238,12 @@ class BinaryView:
if file_metadata is None:
file_metadata = filemetadata.FileMetadata()
if data is None:
- view = core.BNCreateBinaryDataView(file_metadata.handle, True)
+ view = core.BNCreateBinaryDataView(file_metadata.handle)
elif isinstance(data, databuffer.DataBuffer):
- view = core.BNCreateBinaryDataViewFromBuffer(file_metadata.handle, data.handle, True)
+ view = core.BNCreateBinaryDataViewFromBuffer(file_metadata.handle, data.handle)
else:
buf = databuffer.DataBuffer(data)
- view = core.BNCreateBinaryDataViewFromBuffer(file_metadata.handle, buf.handle, True)
+ view = core.BNCreateBinaryDataViewFromBuffer(file_metadata.handle, buf.handle)
if view is None:
return None
return BinaryView(file_metadata=file_metadata, handle=view)
@@ -7808,18 +7808,6 @@ class BinaryView:
settings = settings.handle
core.BNBinaryViewSetLoadSettings(self.handle, type_name, settings)
- def get_default_load_settings(self, type_name: str, settings: settings.Settings) -> None:
- """
- ``get_default_load_settings`` retrieve a :py:class:`Settings` object which defines the load settings for the given :py:class:`BinaryViewType` ``type_name``
-
- :param str type_name: the :py:class:`BinaryViewType` name
- :param Settings settings: the load settings
- :rtype: :py:class:`Settings`, or ``None``
- """
- if settings is not None:
- settings = settings.handle
- core.BNBinaryViewGetDefaultLoadSettings(self.handle, type_name, settings)
-
def parse_expression(self, expression: str, here: int = 0) -> int:
r"""
Evaluates a string expression to an integer value.
diff --git a/python/debuginfo.py b/python/debuginfo.py
index 153e450d..f56b83de 100644
--- a/python/debuginfo.py
+++ b/python/debuginfo.py
@@ -177,7 +177,7 @@ class DebugInfoParser(object, metaclass=_DebugInfoParserMetaClass):
bn.debuginfo.DebugInfoParser.register("debug info parser", is_valid, parse_info)
- :py:class:`DebugInfo` will then be automatically applied to binary views that contain debug information (via the load setting `loader.debugInfoInternal`), binary views that provide valid external debug info files (`loader.debugInfoExternal`), or manually fetched/applied as below::
+ :py:class:`DebugInfo` will then be automatically applied to binary views that contain debug information (via the setting `analysis.debugInfo.internal`), binary views that provide valid external debug info files (`analysis.debugInfo.external`), or manually fetched/applied as below:
valid_parsers = bn.debuginfo.DebugInfoParser.get_parsers_for_view(bv)
parser = valid_parsers[0]
diff --git a/python/examples/debug_info.py b/python/examples/debug_info.py
index 0dd25786..a060e465 100755
--- a/python/examples/debug_info.py
+++ b/python/examples/debug_info.py
@@ -222,7 +222,7 @@ for p in bn.debuginfo.DebugInfoParser:
print(f" {bn.debuginfo.DebugInfoParser[p.name].name}")
# Test calling our `is_valid` callback
-bv = bn.open_view(filename, options={"loader.debugInfoInternal": False})
+bv = bn.open_view(filename, options={"analysis.debugInfo.internal": False})
if parser.is_valid_for_view(bv):
print("Parser is valid")
else:
diff --git a/python/examples/mappedview.py b/python/examples/mappedview.py
index cfefa87a..0b74ce3a 100644
--- a/python/examples/mappedview.py
+++ b/python/examples/mappedview.py
@@ -53,7 +53,7 @@ class MappedView(BinaryView):
def get_load_settings_for_data(cls, data):
# This method is optional. If provided this is where the Load Settings for a BinaryViewType are specified. Binary Ninja provides
# some default read-only load settings which are:
- # ["loader.architecture", "loader.platform", "loader.entryPointOffset", "loader.imageBase", "loader.segments", "loader.sections", "loader.debugInfoInternal", "loader.debugInfoExternal"]
+ # ["loader.architecture", "loader.platform", "loader.entryPointOffset", "loader.imageBase", "loader.segments", "loader.sections"]
# The default load settings are provided for consistency and convenience.
# The default load settings are always generated with a read-only indication which is respected by the UI.
# The read-only indication is a property that consists of a JSON name/value pair ("readOnly" : true).
@@ -75,10 +75,7 @@ class MappedView(BinaryView):
load_settings = registered_view.get_default_load_settings_for_data(view)
# Specify default load settings that can be overridden (from the UI).
- overrides = [
- "loader.architecture", "loader.platform", "loader.entryPointOffset", "loader.imageBase",
- "loader.segments", "loader.sections", "loader.debugInfoInternal", "loader.debugInfoExternal"
- ]
+ overrides = ["loader.architecture", "loader.platform", "loader.entryPointOffset", "loader.imageBase", "loader.segments", "loader.sections"]
for override in overrides:
if load_settings.contains(override):
load_settings.update_property(override, json.dumps({'readOnly': False}))