Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 347514 | Differences between
and this patch

Collapse All | Expand All

(-)a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/commands/GdbSelectNextTraceRecordCommand.java (-8 / +16 lines)
Lines 80-93 Link Here
80
       						new DataRequestMonitor<ITraceRecordDMContext>(fExecutor, rm) {
80
       						new DataRequestMonitor<ITraceRecordDMContext>(fExecutor, rm) {
81
       							@Override
81
       							@Override
82
       							protected void handleSuccess() {
82
       							protected void handleSuccess() {
83
       							    final ITraceRecordDMContext nextDmc = traceControl.createNextRecordContext(getData());
83
       								final ITraceRecordDMContext previousDmc = getData();
84
       							    traceControl.selectTraceRecord(nextDmc, new RequestMonitor(ImmediateExecutor.getInstance(), rm) {
84
       							    ITraceRecordDMContext nextDmc = traceControl.createNextRecordContext(previousDmc);
85
       							        @Override
85
       							    // Must send the event right away to tell the services we are starting visualization
86
       							        protected void handleSuccess() {
86
       							    // If we don't, the services won't behave accordingly soon enough
87
       							            fSession.dispatchEvent(new TraceRecordSelectedChangedEvent(nextDmc), new Hashtable<String, String>());
87
       							    // Bug 347514
88
       							            rm.done();
88
						            fSession.dispatchEvent(new TraceRecordSelectedChangedEvent(nextDmc), new Hashtable<String, String>());
89
       							        }
89
						            
90
       							    });
90
						            traceControl.selectTraceRecord(nextDmc, new RequestMonitor(ImmediateExecutor.getInstance(), rm) {
91
						            	@Override
92
						            	protected void handleError() {
93
						            		// If we weren't able to select the next record, we must notify that we are still on the previous one
94
						            		// since we have already sent a TraceRecordSelectedChangedEvent early, but it didn't happen.
95
						            		fSession.dispatchEvent(new TraceRecordSelectedChangedEvent(previousDmc), new Hashtable<String, String>());
96
						            		rm.done();
97
						            	}
98
						            });
91
       							};
99
       							};
92
       						});
100
       						});
93
       			} else {
101
       			} else {
(-)a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/LaunchVMProvider.java (+29 lines)
Lines 26-31 Link Here
26
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.LaunchRootVMNode;
26
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.LaunchRootVMNode;
27
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.StackFramesVMNode;
27
import org.eclipse.cdt.dsf.debug.ui.viewmodel.launch.StackFramesVMNode;
28
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
28
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
29
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITraceRecordSelectedChangedDMEvent;
29
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITracingStartedDMEvent;
30
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITracingStartedDMEvent;
30
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITracingStoppedDMEvent;
31
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITracingStoppedDMEvent;
31
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITracingSupportedChangeDMEvent;
32
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITracingSupportedChangeDMEvent;
Lines 45-50 Link Here
45
public class LaunchVMProvider extends AbstractLaunchVMProvider 
46
public class LaunchVMProvider extends AbstractLaunchVMProvider 
46
    implements IDebugEventSetListener, ILaunchesListener2
47
    implements IDebugEventSetListener, ILaunchesListener2
47
{
48
{
49
	
50
	/**
51
	 * Indicates that we are currently visualizing trace data.
52
	 */
53
	private boolean fTracepointVisualizationModeEnabled;
54
	
48
	@ThreadSafe
55
	@ThreadSafe
49
    public LaunchVMProvider(AbstractVMAdapter adapter, IPresentationContext presentationContext, DsfSession session)
56
    public LaunchVMProvider(AbstractVMAdapter adapter, IPresentationContext presentationContext, DsfSession session)
50
    {
57
    {
Lines 91-96 Link Here
91
        		return true;
98
        		return true;
92
        	}
99
        	}
93
        }
100
        }
101
        
102
        if (eventToSkip instanceof ITraceRecordSelectedChangedDMEvent) {
103
    		ITraceRecordSelectedChangedDMEvent recordChanged = (ITraceRecordSelectedChangedDMEvent)eventToSkip;
104
    		if (recordChanged.isVisualizationModeEnabled() == fTracepointVisualizationModeEnabled) {
105
    			// We only care about this event if it indicates a change of visualization state
106
    			return true;
107
    		}
108
        }
109
        
94
        return super.canSkipHandlingEvent(newEvent, eventToSkip);
110
        return super.canSkipHandlingEvent(newEvent, eventToSkip);
95
    }
111
    }
96
    
112
    
Lines 107-112 Link Here
107
    		return;
123
    		return;
108
    	}    
124
    	}    
109
125
126
    	if (event instanceof ITraceRecordSelectedChangedDMEvent) {
127
    		ITraceRecordSelectedChangedDMEvent recordChanged = (ITraceRecordSelectedChangedDMEvent)event;
128
    		// If trace visualization has changed we have to refresh the debug view
129
    		if (recordChanged.isVisualizationModeEnabled() != fTracepointVisualizationModeEnabled) {
130
    			fTracepointVisualizationModeEnabled = recordChanged.isVisualizationModeEnabled();
131
    			
132
        		// Refresh the view because the set of threads has totally changed.
133
        		refresh();
134
        		rm.done();
135
        		return;
136
        	}
137
    	}
138
    	
110
    	super.handleEvent(event, rm);
139
    	super.handleEvent(event, rm);
111
    }
140
    }
112
141
(-)a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java (+50 lines)
Lines 29-37 Link Here
29
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
29
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
30
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
30
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
31
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
31
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
32
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITraceRecordSelectedChangedDMEvent;
32
import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl;
33
import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl;
33
import org.eclipse.cdt.dsf.mi.service.IMICommandControl;
34
import org.eclipse.cdt.dsf.mi.service.IMICommandControl;
34
import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext;
35
import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext;
36
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
35
import org.eclipse.cdt.dsf.mi.service.IMIProcessDMContext;
37
import org.eclipse.cdt.dsf.mi.service.IMIProcessDMContext;
36
import org.eclipse.cdt.dsf.mi.service.IMIRunControl;
38
import org.eclipse.cdt.dsf.mi.service.IMIRunControl;
37
import org.eclipse.cdt.dsf.mi.service.IMIRunControl.MIRunMode;
39
import org.eclipse.cdt.dsf.mi.service.IMIRunControl.MIRunMode;
Lines 54-59 Link Here
54
 */
56
 */
55
public class GDBProcesses_7_2 extends GDBProcesses_7_1 {
57
public class GDBProcesses_7_2 extends GDBProcesses_7_1 {
56
    
58
    
59
    /**
60
     * The id of the single thread to be used during event visualization. 
61
     * @since 4.1 
62
     */
63
    protected static final String TRACE_VISUALIZATION_THREAD_ID = "1"; //$NON-NLS-1$
64
57
    private CommandFactory fCommandFactory;
65
    private CommandFactory fCommandFactory;
58
    private IGDBControl fCommandControl;
66
    private IGDBControl fCommandControl;
59
    private IGDBBackend fBackend;
67
    private IGDBBackend fBackend;
Lines 73-78 Link Here
73
     * because we know the process will be restarted.
81
     * because we know the process will be restarted.
74
     */
82
     */
75
	private Set<IContainerDMContext> fProcRestarting = new HashSet<IContainerDMContext>();
83
	private Set<IContainerDMContext> fProcRestarting = new HashSet<IContainerDMContext>();
84
85
	/** 
86
	 * Indicates that we are currently visualizing trace data.
87
	 */
88
	private boolean fTraceVisualization;
76
89
77
	public GDBProcesses_7_2(DsfSession session) {
90
	public GDBProcesses_7_2(DsfSession session) {
78
		super(session);
91
		super(session);
Lines 107-112 Link Here
107
	@Override
120
	@Override
108
	public void shutdown(RequestMonitor requestMonitor) {
121
	public void shutdown(RequestMonitor requestMonitor) {
109
		super.shutdown(requestMonitor);
122
		super.shutdown(requestMonitor);
123
	}
124
	
125
	/** @since 4.1 */
126
	protected boolean getTraceVisualization() {
127
		return fTraceVisualization;
128
	}
129
130
	/** @since 4.1 */
131
	protected void setTraceVisualization(boolean visualizing) {
132
		fTraceVisualization = visualizing;
110
	}
133
	}
111
	
134
	
112
	@Override
135
	@Override
Lines 459-464 Link Here
459
		return new DebugNewProcessSequence_7_2(executor, isInitial, dmc, file, attributes, rm);
482
		return new DebugNewProcessSequence_7_2(executor, isInitial, dmc, file, attributes, rm);
460
	}
483
	}
461
	
484
	
485
	@Override
486
	public void getProcessesBeingDebugged(final IDMContext dmc, final DataRequestMonitor<IDMContext[]> rm) {
487
		if (getTraceVisualization()) {
488
			// If we are visualizing data during a live session, we should not ask GDB for the list of threads,
489
			// because we will get the list of active threads, while GDB only cares about thread 1 for visualization.
490
			final IMIContainerDMContext containerDmc = DMContexts.getAncestorOfType(dmc, IMIContainerDMContext.class);
491
			if (containerDmc != null) {
492
				IProcessDMContext procDmc = DMContexts.getAncestorOfType(containerDmc, IProcessDMContext.class);
493
				rm.setData(new IMIExecutionDMContext[]{createExecutionContext(containerDmc, 
494
                        createThreadContext(procDmc, TRACE_VISUALIZATION_THREAD_ID),
495
                        TRACE_VISUALIZATION_THREAD_ID)});
496
				rm.done();
497
				return;
498
			}
499
		}
500
		
501
		super.getProcessesBeingDebugged(dmc, rm);
502
	}
503
	
462
	/** 
504
	/** 
463
	 * Creates the container context that is to be used for the new process that will
505
	 * Creates the container context that is to be used for the new process that will
464
	 * be created by the restart operation.
506
	 * be created by the restart operation.
Lines 535-539 Link Here
535
    protected boolean needFixForGDB72Bug352998() {
577
    protected boolean needFixForGDB72Bug352998() {
536
    	return true;
578
    	return true;
537
    }
579
    }
580
    
581
    /**
582
	 * @since 4.1
583
	 */
584
    @DsfServiceEventHandler
585
    public void eventDispatched(ITraceRecordSelectedChangedDMEvent e) {
586
    	setTraceVisualization(e.isVisualizationModeEnabled());
587
    }
538
}
588
}
539
589
(-)a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBTraceControl_7_2.java (-1 / +1 lines)
Lines 972-978 Link Here
972
    										// process?
972
    										// process?
973
    										IContainerDMContext processContainerDmc = (IContainerDMContext)(getData()[0]);
973
    										IContainerDMContext processContainerDmc = (IContainerDMContext)(getData()[0]);
974
    										
974
    										
975
    										// Now find the proper thread.  We must do this hear because in post-mortem debugging
975
    										// Now find the proper thread.  We must do this here because in post-mortem debugging
976
    										// we cannot rely on MIRunControl using 'thread', as it will fail
976
    										// we cannot rely on MIRunControl using 'thread', as it will fail
977
    			    						IMIProcesses procService = getServicesTracker().getService(IMIProcesses.class);
977
    			    						IMIProcesses procService = getServicesTracker().getService(IMIProcesses.class);
978
    			    						if (procService == null) {
978
    			    						if (procService == null) {
(-)a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_0.java (-12 lines)
Lines 345-362 Link Here
345
    /** @since 3.0 */
345
    /** @since 3.0 */
346
    @DsfServiceEventHandler 
346
    @DsfServiceEventHandler 
347
    public void eventDispatched(ITraceRecordSelectedChangedDMEvent e) {
347
    public void eventDispatched(ITraceRecordSelectedChangedDMEvent e) {
348
    	if (e.isVisualizationModeEnabled()) {
349
    		// Once we start looking at trace frames, we should not use
350
    		// the --thread or --frame options because GDB does not handle
351
    		// it well, there are no actual threads running.
352
    		// We only need to do this once, but it won't hurt to do it
353
    		// every time.
354
    		setUseThreadAndFrameOptions(false);
355
    	} else {
356
    		// We stopped looking at trace frames, so we can start
357
    		// using --thread and --frame again
358
    		setUseThreadAndFrameOptions(true);
359
    	}
360
    }
348
    }
361
349
362
    public static class InitializationShutdownStep extends Sequence.Step {
350
    public static class InitializationShutdownStep extends Sequence.Step {

Return to bug 347514