| 56 | |
| 57 | |
| 58 | void TargetScriptingInstance::SetCurrentBinaryView(BinaryNinja::BinaryView* view) |
| 59 | { |
| 60 | if (m_data.operator!=(view)) |
| 61 | { |
| 62 | m_data = view; |
| 63 | if (m_data) |
| 64 | { |
| 65 | if (m_controller) |
| 66 | m_controller->RemoveEventCallback(m_debuggerEventCallback); |
| 67 | |
| 68 | m_controller = DebuggerController::GetController(view); |
| 69 | if (m_controller) |
| 70 | { |
| 71 | m_debuggerEventCallback = m_controller->RegisterEventCallback( |
| 72 | [&](const DebuggerEvent& event) { |
| 73 | if (event.type == StdoutMessageEventType) |
| 74 | { |
| 75 | const std::string message = event.data.messageData.message; |
| 76 | Output(message); |
| 77 | } |
| 78 | }, |
| 79 | "Target Console"); |
| 80 | } |
| 81 | } |
| 82 | else |
| 83 | { |
| 84 | if (m_controller) |
| 85 | { |
| 86 | m_controller->RemoveEventCallback(m_debuggerEventCallback); |
| 87 | m_controller = nullptr; |
| 88 | m_debuggerEventCallback = -1; |
| 89 | } |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | BNScriptingProviderInputReadyState newReadyStatus = NotReadyForInput; |
| 94 | if (m_data && m_controller) |
| 95 | newReadyStatus = ReadyForScriptExecution; |
| 96 | else |
| 97 | newReadyStatus = NotReadyForInput; |
| 98 | |
| 99 | if (newReadyStatus != m_readyStatus) |
| 100 | { |
| 101 | m_readyStatus = newReadyStatus; |
| 102 | InputReadyStateChanged(m_readyStatus); |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | |
| 107 | BNScriptingProviderExecuteResult TargetScriptingInstance::ExecuteScriptInput(const std::string& input) |
nothing calls this directly
no test coverage detected