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

Method AddFunction

debuginfo.cpp:298–336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296
297
298bool DebugInfo::AddFunction(const DebugFunctionInfo& function)
299{
300 char** components = new char*[function.components.size()];
301 for (size_t i = 0; i < function.components.size(); ++i)
302 components[i] = (char*)function.components[i].c_str();
303
304 BNVariableNameAndType* localVariables = new BNVariableNameAndType[function.localVariables.size()];
305 for (size_t i = 0; i < function.localVariables.size(); i++)
306 {
307 auto v = function.localVariables[i];
308 localVariables[i].var = v.var;
309 localVariables[i].type = v.type.GetValue()->m_object;
310 localVariables[i].typeConfidence = v.type.GetConfidence();
311 localVariables[i].name = (char*)v.name.c_str();
312 localVariables[i].autoDefined = v.autoDefined;
313 }
314
315 BNDebugFunctionInfo input;
316
317 input.shortName = function.shortName.size() ? BNAllocString(function.shortName.c_str()) : nullptr;
318 input.fullName = function.fullName.size() ? BNAllocString(function.fullName.c_str()) : nullptr;
319 input.rawName = function.rawName.size() ? BNAllocString(function.rawName.c_str()) : nullptr;
320 input.address = function.address;
321 input.type = function.type ? function.type->GetObject() : nullptr;
322 input.platform = function.platform ? function.platform->GetObject() : nullptr;
323 input.components = components;
324 input.componentN = function.components.size();
325 input.localVariables = localVariables;
326 input.localVariableN = function.localVariables.size();
327
328 bool result = BNAddDebugFunction(m_object, &input);
329
330 BNFreeString(input.shortName);
331 BNFreeString(input.fullName);
332 BNFreeString(input.rawName);
333 delete[] components;
334 delete[] localVariables;
335 return result;
336}
337
338
339bool DebugInfo::AddDataVariable(uint64_t address, Ref<Type> type, const string& name, const vector<string>& components)

Callers

nothing calls this directly

Calls 5

c_strMethod · 0.80
GetConfidenceMethod · 0.80
sizeMethod · 0.45
GetValueMethod · 0.45
GetObjectMethod · 0.45

Tested by

no test coverage detected