diff options
| author | Rusty Wagner <rusty.wagner@gmail.com> | 2024-08-22 12:55:49 -0600 |
|---|---|---|
| committer | Rusty Wagner <rusty.wagner@gmail.com> | 2024-10-21 13:56:55 -0400 |
| commit | d8e3001e535fad178c621ff07418f81f25123dc4 (patch) | |
| tree | 54c03cef2f0bdfd9a3b6df4334c81becb63e4993 /function.cpp | |
| parent | 0e281a30d73c0f31ef9442fef0346779164231ad (diff) | |
Allow multiple high level representations for display, add Pseudo Rust and a Pseudo Python example plugin
Diffstat (limited to 'function.cpp')
| -rw-r--r-- | function.cpp | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/function.cpp b/function.cpp index 033a8453..33cb5e52 100644 --- a/function.cpp +++ b/function.cpp @@ -200,12 +200,12 @@ ConstantData::ConstantData(BNRegisterValueType _state, uint64_t _value, size_t _ } -DataBuffer ConstantData::ToDataBuffer() const +pair<DataBuffer, BNBuiltinType> ConstantData::ToDataBuffer() const { if (func) return func->GetConstantData(state, value, size); - return DataBuffer(); + return make_pair(DataBuffer(), BuiltinNone); } @@ -612,9 +612,11 @@ void PossibleValueSet::FreeAPIObject(BNPossibleValueSet* value) } -DataBuffer Function::GetConstantData(BNRegisterValueType state, uint64_t value, size_t size) +pair<DataBuffer, BNBuiltinType> Function::GetConstantData(BNRegisterValueType state, uint64_t value, size_t size) { - return DataBuffer(BNGetConstantData(m_object, state, value, size)); + BNBuiltinType builtin; + auto buffer = DataBuffer(BNGetConstantData(m_object, state, value, size, &builtin)); + return make_pair(buffer, builtin); } @@ -908,21 +910,22 @@ Ref<HighLevelILFunction> Function::GetHighLevelILIfAvailable() const } -Ref<LanguageRepresentationFunction> Function::GetLanguageRepresentation() const +Ref<LanguageRepresentationFunction> Function::GetLanguageRepresentation(const string& language) const { - BNLanguageRepresentationFunction* function = BNGetFunctionLanguageRepresentation(m_object); + BNLanguageRepresentationFunction* function = BNGetFunctionLanguageRepresentation(m_object, language.c_str()); if (!function) return nullptr; - return new LanguageRepresentationFunction(function); + return new CoreLanguageRepresentationFunction(function); } -Ref<LanguageRepresentationFunction> Function::GetLanguageRepresentationIfAvailable() const +Ref<LanguageRepresentationFunction> Function::GetLanguageRepresentationIfAvailable(const string& language) const { - BNLanguageRepresentationFunction* function = BNGetFunctionLanguageRepresentationIfAvailable(m_object); + BNLanguageRepresentationFunction* function = + BNGetFunctionLanguageRepresentationIfAvailable(m_object, language.c_str()); if (!function) return nullptr; - return new LanguageRepresentationFunction(function); + return new CoreLanguageRepresentationFunction(function); } @@ -1275,9 +1278,9 @@ void Function::ApplyAutoDiscoveredType(Type* type) } -Ref<FlowGraph> Function::CreateFunctionGraph(BNFunctionGraphType type, DisassemblySettings* settings) +Ref<FlowGraph> Function::CreateFunctionGraph(const FunctionViewType& type, DisassemblySettings* settings) { - BNFlowGraph* graph = BNCreateFunctionGraph(m_object, type, settings ? settings->GetObject() : nullptr); + BNFlowGraph* graph = BNCreateFunctionGraph(m_object, type.ToAPIObject(), settings ? settings->GetObject() : nullptr); return new CoreFlowGraph(graph); } |
