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

Method GetAllRegisters

core/debuggerstate.cpp:98–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96
97
98std::vector<DebugRegister> DebuggerRegisters::GetAllRegisters()
99{
100 if (IsDirty())
101 Update();
102
103 std::vector<DebugRegister> result {};
104 for (auto& [reg_name, reg] : m_registerCache)
105 result.push_back(reg);
106
107 std::sort(result.begin(), result.end(), [](const DebugRegister& lhs, const DebugRegister& rhs) {
108 return lhs.m_registerIndex < rhs.m_registerIndex;
109 });
110
111 // TODO: maybe we should not hold a m_state at all; instead we just hold a m_controller
112 auto controller = m_state->GetController();
113 if (!controller->GetState()->IsConnected())
114 return result;
115
116 std::map<uint64_t, std::string> regHints;
117 for (auto& reg : result)
118 {
119 auto it = regHints.find(reg.m_value);
120 if (it != regHints.end())
121 {
122 reg.m_hint = it->second;
123 }
124 else
125 {
126 const std::string hint = controller->GetAddressInformation(reg.m_value);
127 regHints[reg.m_value] = hint;
128 reg.m_hint = hint;
129 }
130 }
131
132 return result;
133}
134
135
136DebuggerThreads::DebuggerThreads(DebuggerState* state) : m_state(state)

Callers 1

BNDebuggerGetRegistersFunction · 0.45

Calls 4

GetStateMethod · 0.80
GetControllerMethod · 0.45
IsConnectedMethod · 0.45
GetAddressInformationMethod · 0.45

Tested by

no test coverage detected