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 / +15 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
						            		fSession.dispatchEvent(new TraceRecordSelectedChangedEvent(previousDmc), new Hashtable<String, String>());
95
						            		rm.done();
96
						            	}
97
						            });
91
       							};
98
       							};
92
       						});
99
       						});
93
       			} else {
100
       			} else {
(-)a/dsf-gdb/org.eclipse.cdt.dsf.gdb.ui/src/org/eclipse/cdt/dsf/gdb/internal/ui/viewmodel/launch/LaunchVMProvider.java (+17 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
	private boolean fVisualizationModeEnabled;
51
	
48
	@ThreadSafe
52
	@ThreadSafe
49
    public LaunchVMProvider(AbstractVMAdapter adapter, IPresentationContext presentationContext, DsfSession session)
53
    public LaunchVMProvider(AbstractVMAdapter adapter, IPresentationContext presentationContext, DsfSession session)
50
    {
54
    {
Lines 107-112 Link Here
107
    		return;
111
    		return;
108
    	}    
112
    	}    
109
113
114
    	if (event instanceof ITraceRecordSelectedChangedDMEvent) {
115
    		ITraceRecordSelectedChangedDMEvent recordChanged = (ITraceRecordSelectedChangedDMEvent)event;
116
    		// If trace visualization has changed we have to refresh the debug view
117
    		if (recordChanged.isVisualizationModeEnabled() != fVisualizationModeEnabled) {
118
    			fVisualizationModeEnabled = recordChanged.isVisualizationModeEnabled();
119
    			
120
        		// Refresh the view because the set of threads has totally changed.
121
        		refresh();
122
        		rm.done();
123
        		return;
124
        	}
125
    	}
126
    	
110
    	super.handleEvent(event, rm);
127
    	super.handleEvent(event, rm);
111
    }
128
    }
112
129
(-)a/dsf-gdb/org.eclipse.cdt.dsf.gdb/.settings/.api_filters (+11 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
<component id="org.eclipse.cdt.dsf.gdb" version="2">
3
    <resource path="META-INF/MANIFEST.MF">
4
        <filter comment="Shouldn't increase the version for a maintenance branch" id="924844039">
5
            <message_arguments>
6
                <message_argument value="4.0.0"/>
7
                <message_argument value="4.0.0"/>
8
            </message_arguments>
9
        </filter>
10
    </resource>
11
</component>
(-)a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java (+41 lines)
Lines 27-35 Link Here
27
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
27
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
28
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
28
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
29
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
29
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
30
import org.eclipse.cdt.dsf.gdb.service.IGDBTraceControl.ITraceRecordSelectedChangedDMEvent;
30
import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl;
31
import org.eclipse.cdt.dsf.gdb.service.command.IGDBControl;
31
import org.eclipse.cdt.dsf.mi.service.IMICommandControl;
32
import org.eclipse.cdt.dsf.mi.service.IMICommandControl;
32
import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext;
33
import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext;
34
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
33
import org.eclipse.cdt.dsf.mi.service.IMIProcessDMContext;
35
import org.eclipse.cdt.dsf.mi.service.IMIProcessDMContext;
34
import org.eclipse.cdt.dsf.mi.service.IMIRunControl;
36
import org.eclipse.cdt.dsf.mi.service.IMIRunControl;
35
import org.eclipse.cdt.dsf.mi.service.IMIRunControl.MIRunMode;
37
import org.eclipse.cdt.dsf.mi.service.IMIRunControl.MIRunMode;
Lines 52-57 Link Here
52
 */
54
 */
53
public class GDBProcesses_7_2 extends GDBProcesses_7_1 {
55
public class GDBProcesses_7_2 extends GDBProcesses_7_1 {
54
    
56
    
57
    private static final String TRACE_VISUALIZATION_THREAD_ID = "1"; //$NON-NLS-1$
58
55
    private CommandFactory fCommandFactory;
59
    private CommandFactory fCommandFactory;
56
    private IGDBControl fCommandControl;
60
    private IGDBControl fCommandControl;
57
    private IGDBBackend fBackend;
61
    private IGDBBackend fBackend;
Lines 62-67 Link Here
62
     * because we know the process will be restarted.
66
     * because we know the process will be restarted.
63
     */
67
     */
64
	private Set<IContainerDMContext> fProcRestarting = new HashSet<IContainerDMContext>();
68
	private Set<IContainerDMContext> fProcRestarting = new HashSet<IContainerDMContext>();
69
70
	/** 
71
	 * Indicates that we are currently visualizing trace data.
72
	 * In this case, some errors should not be reported.
73
	 */
74
	private boolean fTraceVisualization;
65
75
66
	public GDBProcesses_7_2(DsfSession session) {
76
	public GDBProcesses_7_2(DsfSession session) {
67
		super(session);
77
		super(session);
Lines 343-348 Link Here
343
		return new DebugNewProcessSequence_7_2(executor, isInitial, dmc, file, attributes, rm);
353
		return new DebugNewProcessSequence_7_2(executor, isInitial, dmc, file, attributes, rm);
344
	}
354
	}
345
	
355
	
356
	@Override
357
	public void getProcessesBeingDebugged(final IDMContext dmc, final DataRequestMonitor<IDMContext[]> rm) {
358
		if (fTraceVisualization) {
359
			// If we are visualizing data during a live session, we should not ask GDB for the list of threads,
360
			// because we will get the list of active threads, while GDB only cares about thread 1 for visualization.
361
			final IMIContainerDMContext containerDmc = DMContexts.getAncestorOfType(dmc, IMIContainerDMContext.class);
362
			if (containerDmc != null) {
363
				IProcessDMContext procDmc = DMContexts.getAncestorOfType(containerDmc, IProcessDMContext.class);
364
				rm.setData(new IMIExecutionDMContext[]{createExecutionContext(containerDmc, 
365
                        createThreadContext(procDmc, TRACE_VISUALIZATION_THREAD_ID),
366
                        TRACE_VISUALIZATION_THREAD_ID)});
367
				rm.done();
368
				return;
369
			}
370
		}
371
		
372
		super.getProcessesBeingDebugged(dmc, rm);
373
	}
374
	
346
	/** 
375
	/** 
347
	 * Creates the container context that is to be used for the new process that will
376
	 * Creates the container context that is to be used for the new process that will
348
	 * be created by the restart operation.
377
	 * be created by the restart operation.
Lines 402-406 Link Here
402
    	
431
    	
403
    	super.eventDispatched(e);
432
    	super.eventDispatched(e);
404
    }
433
    }
434
    
435
    /**
436
	 * @since 4.0 Added on the CDT 8.0 maintenance branch only.
437
	 */
438
    @DsfServiceEventHandler
439
    public void eventDispatched(ITraceRecordSelectedChangedDMEvent e) {
440
    	if (e.isVisualizationModeEnabled()) {
441
    		fTraceVisualization = true;
442
    	} else {
443
    		fTraceVisualization = false;
444
    	}
445
    }
405
}
446
}
406
447
(-)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