Skip to content

Commit

Permalink
Use the MemoryMap API to represent the memory regions for the debugger.
Browse files Browse the repository at this point in the history
  • Loading branch information
xusheng6 committed Jun 19, 2024
1 parent dfd8b2b commit f5389dd
Show file tree
Hide file tree
Showing 16 changed files with 358 additions and 498 deletions.
5 changes: 5 additions & 0 deletions api/debuggerapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,11 @@ namespace BinaryNinjaDebuggerAPI {
bool IsTTD();

void PostDebuggerEvent(const DebuggerEvent& event);

bool RemoveDebuggerMemoryRegion();
bool ReAddDebuggerMemoryRegion();

uint64_t GetViewFileSegmentsStart();
};


Expand Down
18 changes: 18 additions & 0 deletions api/debuggercontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -912,3 +912,21 @@ void DebuggerController::PostDebuggerEvent(const DebuggerEvent &event)
BNDebuggerFreeString(evt->data.messageData.message);
delete evt;
}


bool DebuggerController::RemoveDebuggerMemoryRegion()
{
return BNDebuggerRemoveMemoryRegion(m_object);
}


bool DebuggerController::ReAddDebuggerMemoryRegion()
{
return BNDebuggerReAddMemoryRegion(m_object);
}


uint64_t DebuggerController::GetViewFileSegmentsStart()
{
return BNDebuggerGetViewFileSegmentsStart(m_object);
}
5 changes: 5 additions & 0 deletions api/ffi.h
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,11 @@ extern "C"

DEBUGGER_FFI_API void BNDebuggerPostDebuggerEvent(BNDebuggerController* controller, BNDebuggerEvent* event);

DEBUGGER_FFI_API bool BNDebuggerRemoveMemoryRegion(BNDebuggerController* controller);
DEBUGGER_FFI_API bool BNDebuggerReAddMemoryRegion(BNDebuggerController* controller);

DEBUGGER_FFI_API uint64_t BNDebuggerGetViewFileSegmentsStart(BNDebuggerController* controller);

// DebugAdapterType
DEBUGGER_FFI_API BNDebugAdapterType* BNGetDebugAdapterTypeByName(const char* name);
DEBUGGER_FFI_API bool BNDebugAdapterTypeCanExecute(BNDebugAdapterType* adapter, BNBinaryView* data);
Expand Down
2 changes: 0 additions & 2 deletions core/debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ limitations under the License.
*/

#include <inttypes.h>
#include "processview.h"
#include "adapters/lldbadapter.h"
#ifdef WIN32
#include "adapters/dbgengadapter.h"
Expand Down Expand Up @@ -181,7 +180,6 @@ extern "C"
LogDebug("Native debugger loaded!");
RegisterSettings();
InitDebugAdapterTypes();
InitDebugProcessViewType();
return true;
}
}
Loading

0 comments on commit f5389dd

Please sign in to comment.