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

Method SetupMenu

ui/ui.cpp:229–790  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227
228
229void GlobalDebuggerUI::SetupMenu(UIContext* context)
230{
231 auto requireBinaryView = [](const UIActionContext& ctxt) {
232 return ctxt.binaryView;
233 };
234
235 auto notConnected = [=](const UIActionContext& ctxt) {
236 if (!ctxt.binaryView)
237 return false;
238 // TODO: these two calls should be combined into something like GetControllerIfExists
239 // The reason why we must avoid creating a new debugger controller here is because these enable callbacks
240 // are called in unpredictable order compared to the destroy of the controller when we close a tab.
241 // There is a chance that we first destroy the controller, and they quickly recreate it, causing a memory
242 // leak for the underlying binary view.
243 if (!DebuggerController::ControllerExists(ctxt.binaryView))
244 return false;
245 auto controller = DebuggerController::GetController(ctxt.binaryView);
246 if (!controller)
247 return false;
248
249 return !controller->IsConnected();
250 };
251
252 auto connected = [=](const UIActionContext& ctxt) {
253 if (!ctxt.binaryView)
254 return false;
255 if (!DebuggerController::ControllerExists(ctxt.binaryView))
256 return false;
257 auto controller = DebuggerController::GetController(ctxt.binaryView);
258 if (!controller)
259 return false;
260
261 return controller->IsConnected();
262 };
263
264 auto connectedAndStopped = [=](const UIActionContext& ctxt) {
265 if (!ctxt.binaryView)
266 return false;
267 if (!DebuggerController::ControllerExists(ctxt.binaryView))
268 return false;
269 auto controller = DebuggerController::GetController(ctxt.binaryView);
270 if (!controller)
271 return false;
272
273 return controller->IsConnected() && (!controller->IsRunning());
274 };
275
276 auto connectedAndRunning = [=](const UIActionContext& ctxt) {
277 if (!ctxt.binaryView)
278 return false;
279 if (!DebuggerController::ControllerExists(ctxt.binaryView))
280 return false;
281 auto controller = DebuggerController::GetController(ctxt.binaryView);
282 if (!controller)
283 return false;
284
285 return controller->IsConnected() && controller->IsRunning();
286 };

Callers

nothing calls this directly

Calls 15

BreakpointToggleCallbackFunction · 0.85
JumpToIPCallbackFunction · 0.85
detachMethod · 0.80
IsConnectedMethod · 0.45
IsRunningMethod · 0.45
IsFirstLaunchMethod · 0.45
GetExecutablePathMethod · 0.45
LaunchMethod · 0.45
QuitMethod · 0.45

Tested by

no test coverage detected