| 64 | |
| 65 | |
| 66 | BNDisassemblyTextLine* DataRenderer::GetLinesForDataCallback(void* ctxt, BNBinaryView* view, uint64_t addr, |
| 67 | BNType* type, const BNInstructionTextToken* prefix, size_t prefixCount, size_t width, size_t* count, |
| 68 | BNTypeContext* typeCtx, size_t ctxCount, const char* language) |
| 69 | { |
| 70 | CallbackRef<DataRenderer> renderer(ctxt); |
| 71 | Ref<BinaryView> viewObj = new BinaryView(BNNewViewReference(view)); |
| 72 | Ref<Type> typeObj = new Type(BNNewTypeReference(type)); |
| 73 | vector<InstructionTextToken> prefixes = InstructionTextToken::ConvertInstructionTextTokenList(prefix, prefixCount); |
| 74 | |
| 75 | vector<pair<Type*, size_t>> context; |
| 76 | context.reserve(ctxCount); |
| 77 | for (size_t i = 0; i < ctxCount; i++) |
| 78 | { |
| 79 | // To keep API compatibility we have to manually do the refcounting here |
| 80 | Type* contextType = new Type(BNNewTypeReference(typeCtx[i].type)); |
| 81 | contextType->AddRef(); |
| 82 | context.push_back({contextType, typeCtx[i].offset}); |
| 83 | } |
| 84 | auto lines = renderer->GetLinesForData(viewObj, addr, typeObj, prefixes, width, context, |
| 85 | language ? language : string()); |
| 86 | BNDisassemblyTextLine* result = AllocAPIObjectList(lines, count); |
| 87 | for (size_t i = 0; i < ctxCount; i++) |
| 88 | context[i].first->Release(); |
| 89 | return result; |
| 90 | } |
| 91 | |
| 92 | |
| 93 | void DataRenderer::FreeCallback(void* ctxt) |
nothing calls this directly
no test coverage detected