diff options
| author | Glenn Smith <glenn@vector35.com> | 2024-12-27 16:14:46 -0500 |
|---|---|---|
| committer | Glenn Smith <glenn@vector35.com> | 2025-01-30 17:20:05 -0500 |
| commit | 8862696926173104957729683832591438161557 (patch) | |
| tree | 78ba6d7dc8144430136086c8dc84726171eec8ab /linearviewobject.cpp | |
| parent | 5a5426d030b6be26d4564ba1eba2d8a275533256 (diff) | |
Render Layers
Diffstat (limited to 'linearviewobject.cpp')
| -rw-r--r-- | linearviewobject.cpp | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/linearviewobject.cpp b/linearviewobject.cpp index 4f00adb0..7cd08fcc 100644 --- a/linearviewobject.cpp +++ b/linearviewobject.cpp @@ -24,7 +24,27 @@ using namespace std; using namespace BinaryNinja; -LinearDisassemblyLine LinearDisassemblyLine::FromAPIObject(BNLinearDisassemblyLine* line) +BNLinearDisassemblyLine LinearDisassemblyLine::GetAPIObject() const +{ + BNLinearDisassemblyLine result; + result.type = this->type; + result.function = this->function ? BNNewFunctionReference(this->function->GetObject()) : nullptr; + result.block = this->block ? BNNewBasicBlockReference(this->block->GetObject()) : nullptr; + result.contents.addr = this->contents.addr; + result.contents.instrIndex = this->contents.instrIndex; + result.contents.highlight = this->contents.highlight; + result.contents.count = this->contents.tokens.size(); + result.contents.tokens = InstructionTextToken::CreateInstructionTextTokenList(this->contents.tokens); + result.contents.tags = Tag::CreateTagList(this->contents.tags, &result.contents.tagCount); + result.contents.typeInfo.hasTypeInfo = this->contents.typeInfo.hasTypeInfo; + result.contents.typeInfo.parentType = this->contents.typeInfo.parentType ? BNNewTypeReference(this->contents.typeInfo.parentType->GetObject()) : nullptr; + result.contents.typeInfo.fieldIndex = this->contents.typeInfo.fieldIndex; + result.contents.typeInfo.offset = this->contents.typeInfo.offset; + return result; +} + + +LinearDisassemblyLine LinearDisassemblyLine::FromAPIObject(const BNLinearDisassemblyLine* line) { LinearDisassemblyLine result; result.type = line->type; @@ -45,6 +65,19 @@ LinearDisassemblyLine LinearDisassemblyLine::FromAPIObject(BNLinearDisassemblyLi } +void LinearDisassemblyLine::FreeAPIObject(BNLinearDisassemblyLine* line) +{ + if (line->function) + BNFreeFunction(line->function); + if (line->block) + BNFreeBasicBlock(line->block); + InstructionTextToken::FreeInstructionTextTokenList(line->contents.tokens, line->contents.count); + Tag::FreeTagList(line->contents.tags, line->contents.tagCount); + if (line->contents.typeInfo.parentType) + BNFreeType(line->contents.typeInfo.parentType); +} + + LinearViewObjectIdentifier::LinearViewObjectIdentifier() : type(SingleLinearViewObject), start(0), end(0) {} |
