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

Method InitializeUI

ui/ui.cpp:1390–1527  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1388
1389
1390void GlobalDebuggerUI::InitializeUI()
1391{
1392 Sidebar::addSidebarWidgetType(new DebuggerWidgetType(QImage(":/debugger_icons/icons/debugger.svg"), "Debugger"));
1393
1394 // We must use the sequence of these four calls to do the job, otherwise the keybinding does not work.
1395 // Though it really should be the case where I can specify the keybinding in the first registerAction() call.
1396 UIAction::registerAction("Debugger\\Toggle Breakpoint");
1397 UIAction::registerAction("Selection Target\\Debugger\\Toggle Breakpoint");
1398 PluginCommand::RegisterForAddress("Debugger\\Toggle Breakpoint", "Sets/clears breakpoint at right-clicked address",
1399 BreakpointToggleCallback, BinaryViewValid);
1400
1401 UIAction::registerAction("Debugger\\Run To Here");
1402 UIAction::registerAction("Selection Target\\Debugger\\Run To Here");
1403 PluginCommand::RegisterForAddress(
1404 "Debugger\\Run To Here", "Run until the current address", RunToHereCallback, ConnectedAndStopped);
1405
1406 std::string actionName = "Run";
1407 UIAction::registerAction(QString::asprintf("Debugger\\%s", actionName.c_str()));
1408 UIAction::registerAction(QString::asprintf("Selection Target\\Debugger\\%s", actionName.c_str()));
1409 PluginCommand::RegisterForAddress(
1410 QString::asprintf("Debugger\\%s", actionName.c_str()).toStdString(), "Launch or resume the target",
1411 [](BinaryView* view, uint64_t addr) {
1412 auto controller = DebuggerController::GetController(view);
1413 if (!controller)
1414 return;
1415 if (controller->IsConnected() && (!controller->IsRunning()))
1416 {
1417 std::thread([=]() { controller->Go(); }).detach();
1418 }
1419 else if (!controller->IsConnected())
1420 {
1421 QString text = QString(
1422 "The debugger is launching the target and preparing the debugger binary view. \n"
1423 "This might take a while.");
1424 ProgressTask* task =
1425 new ProgressTask(nullptr, "Launching", text, "", [&](std::function<bool(size_t, size_t)> progress) {
1426 controller->Launch();
1427
1428 // For now, this cant be canceled, as the Debugger model wasn't
1429 // designed with that in mind. This function below can return false if canceling is enabled
1430 progress(1, 1);
1431 return;
1432 });
1433 task->wait();
1434 }
1435 },
1436 BinaryViewValid);
1437
1438 actionName = "Step Into";
1439 UIAction::registerAction(QString::asprintf("Debugger\\%s", actionName.c_str()));
1440 UIAction::registerAction(QString::asprintf("Selection Target\\Debugger\\%s", actionName.c_str()));
1441 PluginCommand::RegisterForAddress(
1442 QString::asprintf("Debugger\\%s", actionName.c_str()).toStdString(), "Step into",
1443 [](BinaryView* view, uint64_t) {
1444 auto controller = DebuggerController::GetController(view);
1445 if (!controller)
1446 return;
1447 BNFunctionGraphType graphType = NormalFunctionGraph;

Callers

nothing calls this directly

Calls 9

detachMethod · 0.80
IsConnectedMethod · 0.45
IsRunningMethod · 0.45
GoMethod · 0.45
LaunchMethod · 0.45
StepIntoMethod · 0.45
StepOverMethod · 0.45
StepReturnMethod · 0.45
PauseMethod · 0.45

Tested by

no test coverage detected