MCPcopy Create free account
hub / github.com/Vector35/debugger / GetLinesForData

Method GetLinesForData

ui/codedatarenderer.cpp:39–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37
38
39std::vector<DisassemblyTextLine> CodeDataRenderer::GetLinesForData(BinaryView* data, uint64_t addr, Type* type,
40 const std::vector<InstructionTextToken>& prefix, size_t width, std::vector<std::pair<Type*, size_t>>& context)
41{
42 size_t instCount = 50;
43 auto arch = data->GetDefaultArchitecture();
44 size_t readLength = arch->GetMaxInstructionLength() * instCount;
45
46 std::vector<DisassemblyTextLine> result;
47 DisassemblyTextLine contents;
48
49 auto buffer = data->ReadBuffer(addr, readLength);
50 if (buffer.GetLength() == 0)
51 return result;
52
53 size_t totalRead = 0;
54 for (size_t i = 0; i < instCount; i++)
55 {
56 uint64_t lineAddr = addr + totalRead;
57 size_t length = readLength - totalRead;
58 std::vector<InstructionTextToken> insnTokens;
59 auto ok = arch->GetInstructionText((uint8_t*)buffer.GetDataAt(totalRead), lineAddr, length, insnTokens);
60 if ((!ok) || (insnTokens.size() == 0))
61 {
62 insnTokens = {InstructionTextToken(TextToken, "??")};
63 length = arch->GetInstructionAlignment();
64 if (length == 0)
65 length = 1;
66 }
67
68 contents.addr = lineAddr;
69 contents.tokens = insnTokens;
70
71 result.push_back(contents);
72 totalRead += length;
73 }
74
75 return result;
76}

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected