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

Method Assemble

arch/armv7/arch_armv7.cpp:2110–2139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2108}
2109
2110bool ArmCommonArchitecture::Assemble(const string& code, uint64_t addr, DataBuffer& result, string& errors)
2111{
2112 (void)addr;
2113
2114 char *instrBytes=NULL, *err=NULL;
2115 int instrBytesLen=0, errLen=0;
2116
2117 int assembleResult;
2118
2119 string triple = GetAssemblerTriple();
2120 LogDebug("%s() retrieves and uses triple %s\n", __func__, triple.c_str());
2121
2122 BNLlvmServicesInit();
2123
2124 errors.clear();
2125 assembleResult = BNLlvmServicesAssemble(code.c_str(), LLVM_SVCS_DIALECT_UNSPEC,
2126 triple.c_str(), LLVM_SVCS_CM_DEFAULT, LLVM_SVCS_RM_STATIC,
2127 &instrBytes, &instrBytesLen, &err, &errLen);
2128
2129 if(assembleResult || errLen) {
2130 errors = err;
2131 BNLlvmServicesAssembleFree(instrBytes, err);
2132 return false;
2133 }
2134
2135 result.Clear();
2136 result.Append(instrBytes, instrBytesLen);
2137 BNLlvmServicesAssembleFree(instrBytes, err);
2138 return true;
2139}
2140
2141class ArmCallingConvention: public CallingConvention
2142{

Callers

nothing calls this directly

Calls 4

c_strMethod · 0.80
clearMethod · 0.45
ClearMethod · 0.45
AppendMethod · 0.45

Tested by

no test coverage detected