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

Method DetectLoadedModule

core/debuggercontroller.cpp:730–771  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

728
729
730void DebuggerController::DetectLoadedModule()
731{
732 // Rebase the binary and create DebugView
733 uint64_t remoteBase;
734 // Right now we only support applying the analysis info from one module into the debugger view, So we use a bool
735 // here. In the future, we would like to support loading multiple modules, and we will need a more
736 // robust mechanism.
737 if (m_inputFileLoaded || (!m_state->GetRemoteBase(remoteBase)))
738 return;
739
740 if (BinaryNinja::IsUIEnabled())
741 {
742 // When the UI is enabled, let the debugger UI do the work. It can show a progress bar if the operation takes
743 // a while.
744 DebuggerEvent event;
745 event.type = ModuleLoadedEvent;
746 event.data.absoluteAddress = remoteBase;
747 PostDebuggerEvent(event);
748 }
749 else
750 {
751 if (remoteBase != GetData()->GetStart())
752 {
753 // remote base is different from the local base, first need a rebase
754 if (!m_file->Rebase(GetData(), remoteBase, [&](size_t cur, size_t total) { return true; }))
755 {
756 LogWarn("rebase failed");
757 }
758 }
759
760 Ref<BinaryView> rebasedView = m_file->GetViewOfType(m_viewName);
761
762 bool ok = m_file->CreateSnapshotedView(rebasedView, "Debugger", [&](size_t cur, size_t total) {
763 return true;
764 });
765 if (!ok)
766 LogWarn("create snapshoted view failed");
767 }
768
769 m_liveView->UpdateAnalysis();
770 m_inputFileLoaded = true;
771}
772
773
774DebugThread DebuggerController::GetActiveThread() const

Callers

nothing calls this directly

Calls 1

GetRemoteBaseMethod · 0.80

Tested by

no test coverage detected