@@ -292,23 +292,29 @@ DebugBreakpointsWidget::DebugBreakpointsWidget(ViewFrame* view, BinaryViewRef da
292292	m_actionHandler.bindAction (
293293		addBreakpointActionName, UIAction ([&]() { add (); }));
294294
295- 	QString enableBreakpointActionName  = QString::fromStdString (" Enable  Breakpoint"  );
296- 	UIAction::registerAction (enableBreakpointActionName );
297- 	m_menu->addAction (enableBreakpointActionName , " Options"  , MENU_ORDER_NORMAL);
295+ 	QString toggleBreakpointActionName  = QString::fromStdString (" Toggle  Breakpoint"  );
296+ 	UIAction::registerAction (toggleBreakpointActionName,  QKeySequence ( " Ctrl+Shift+B " ) );
297+ 	m_menu->addAction (toggleBreakpointActionName , " Options"  , MENU_ORDER_NORMAL);
298298	m_actionHandler.bindAction (
299- 		enableBreakpointActionName , UIAction ([&]() { enableSelected (); }, [&]() { return  selectionNotEmpty (); }));
299+ 		toggleBreakpointActionName , UIAction ([&]() { toggleSelected (); }, [&]() { return  selectionNotEmpty (); }));
300300
301- 	QString disableBreakpointActionName  = QString::fromStdString (" Disable Breakpoint "  );
302- 	UIAction::registerAction (disableBreakpointActionName );
303- 	m_menu->addAction (disableBreakpointActionName , " Options"  , MENU_ORDER_NORMAL);
301+ 	QString enableAllActionName  = QString::fromStdString (" Enable All Breakpoints "  );
302+ 	UIAction::registerAction (enableAllActionName );
303+ 	m_menu->addAction (enableAllActionName , " Options"  , MENU_ORDER_NORMAL);
304304	m_actionHandler.bindAction (
305- 		disableBreakpointActionName , UIAction ([&]() { disableSelected (); }, [&]() {  return   selectionNotEmpty (); }));
305+ 		enableAllActionName , UIAction ([&]() { enableAll (); }));
306306
307- 	QString toggleBreakpointActionName  = QString::fromStdString (" Toggle Breakpoint Enable/Disable "  );
308- 	UIAction::registerAction (toggleBreakpointActionName,  QKeySequence ( " Ctrl+Shift+B " ) );
309- 	m_menu->addAction (toggleBreakpointActionName , " Options"  , MENU_ORDER_NORMAL);
307+ 	QString disableAllActionName  = QString::fromStdString (" Disable All Breakpoints "  );
308+ 	UIAction::registerAction (disableAllActionName );
309+ 	m_menu->addAction (disableAllActionName , " Options"  , MENU_ORDER_NORMAL);
310310	m_actionHandler.bindAction (
311- 		toggleBreakpointActionName, UIAction ([&]() { toggleSelected (); }, [&]() { return  selectionNotEmpty (); }));
311+ 		disableAllActionName, UIAction ([&]() { disableAll (); }));
312+ 
313+ 	QString soloBreakpointActionName = QString::fromStdString (" Solo Breakpoint"  );
314+ 	UIAction::registerAction (soloBreakpointActionName);
315+ 	m_menu->addAction (soloBreakpointActionName, " Options"  , MENU_ORDER_NORMAL);
316+ 	m_actionHandler.bindAction (
317+ 		soloBreakpointActionName, UIAction ([&]() { soloSelected (); }, [&]() { return  selectionNotEmpty (); }));
312318
313319	connect (this , &QTableView::doubleClicked, this , &DebugBreakpointsWidget::onDoubleClicked);
314320
@@ -456,39 +462,67 @@ void DebugBreakpointsWidget::add()
456462}
457463
458464
459- void  DebugBreakpointsWidget::enableSelected  ()
465+ void  DebugBreakpointsWidget::toggleSelected  ()
460466{
461467	QModelIndexList sel = selectionModel ()->selectedRows ();
462468	for  (const  QModelIndex& index : sel)
463469	{
464470		BreakpointItem bp = m_model->getRow (index.row ());
465- 		m_controller->EnableBreakpoint (bp.location ());
471+ 		if  (bp.enabled ())
472+ 			m_controller->DisableBreakpoint (bp.location ());
473+ 		else 
474+ 			m_controller->EnableBreakpoint (bp.location ());
466475	}
467476}
468477
469478
470- void  DebugBreakpointsWidget::disableSelected  ()
479+ void  DebugBreakpointsWidget::enableAll  ()
471480{
472- 	QModelIndexList sel  = selectionModel ()-> selectedRows ();
473- 	for  (const  QModelIndex& index  : sel )
481+ 	std::vector<DebugBreakpoint> breakpoints  = m_controller-> GetBreakpoints ();
482+ 	for  (const  DebugBreakpoint& bp  : breakpoints )
474483	{
475- 		BreakpointItem bp = m_model->getRow (index.row ());
476- 		m_controller->DisableBreakpoint (bp.location ());
484+ 		ModuleNameAndOffset info;
485+ 		info.module  = bp.module ;
486+ 		info.offset  = bp.offset ;
487+ 		m_controller->EnableBreakpoint (info);
477488	}
478489}
479490
480491
481- void  DebugBreakpointsWidget::toggleSelected ()
492+ void  DebugBreakpointsWidget::disableAll ()
493+ {
494+ 	std::vector<DebugBreakpoint> breakpoints = m_controller->GetBreakpoints ();
495+ 	for  (const  DebugBreakpoint& bp : breakpoints)
496+ 	{
497+ 		ModuleNameAndOffset info;
498+ 		info.module  = bp.module ;
499+ 		info.offset  = bp.offset ;
500+ 		m_controller->DisableBreakpoint (info);
501+ 	}
502+ }
503+ 
504+ 
505+ void  DebugBreakpointsWidget::soloSelected ()
482506{
483507	QModelIndexList sel = selectionModel ()->selectedRows ();
484- 	for  (const  QModelIndex& index : sel)
508+ 	if  (sel.empty ())
509+ 		return ;
510+ 
511+ 	//  Get the selected breakpoint location
512+ 	BreakpointItem selectedBp = m_model->getRow (sel[0 ].row ());
513+ 	
514+ 	//  Disable all breakpoints first
515+ 	std::vector<DebugBreakpoint> breakpoints = m_controller->GetBreakpoints ();
516+ 	for  (const  DebugBreakpoint& bp : breakpoints)
485517	{
486- 		BreakpointItem bp = m_model->getRow (index.row ());
487- 		if  (bp.enabled ())
488- 			m_controller->DisableBreakpoint (bp.location ());
489- 		else 
490- 			m_controller->EnableBreakpoint (bp.location ());
518+ 		ModuleNameAndOffset info;
519+ 		info.module  = bp.module ;
520+ 		info.offset  = bp.offset ;
521+ 		m_controller->DisableBreakpoint (info);
491522	}
523+ 	
524+ 	//  Enable the selected breakpoint
525+ 	m_controller->EnableBreakpoint (selectedBp.location ());
492526}
493527
494528
0 commit comments