MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / _assemble

Method _assemble

python/architecture.py:1225–1246  ·  view source on GitHub ↗

This function calls the `assemble` command for the actual architecture plugin. If the plugin does not provide an `assemble(self, code, addr)`-style function, it uses the default function provided in CoreArchitecture.

(self, ctxt, code, addr, result, errors)

Source from the content-addressed store, hash-verified

1223 log_error(traceback.format_exc())
1224
1225 def _assemble(self, ctxt, code, addr, result, errors):
1226 """
1227 This function calls the `assemble` command for the actual architecture plugin.
1228 If the plugin does not provide an `assemble(self, code, addr)`-style function,
1229 it uses the default function provided in CoreArchitecture.
1230 """
1231 try:
1232 data = self.assemble(code, addr)
1233 if data is None:
1234 return False
1235 buf = ctypes.create_string_buffer(len(data))
1236 ctypes.memmove(buf, data, len(data))
1237 core.BNSetDataBufferContents(result, buf, len(data))
1238 return True
1239 except ValueError as e: # Overridden `assemble` functions should raise a ValueError if the input was invalid (with a reasonable error message)
1240 log_error(traceback.format_exc())
1241 errors[0] = core.BNAllocString(str(e))
1242 return False
1243 except:
1244 log_error(traceback.format_exc())
1245 errors[0] = core.BNAllocString("Unhandled exception during assembly.\n")
1246 return False
1247
1248 def _is_never_branch_patch_available(self, ctxt, data, addr, length):
1249 try:

Callers

nothing calls this directly

Calls 2

assembleMethod · 0.95
log_errorFunction · 0.85

Tested by

no test coverage detected