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 248636 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/dd/mi/service/MIProcesses.java (+7 lines)
Lines 674-677 Link Here
674
	public void flushCache(IDMContext context) {
674
	public void flushCache(IDMContext context) {
675
        fContainerCommandCache.reset(context);
675
        fContainerCommandCache.reset(context);
676
	}
676
	}
677
678
	public IMIExecutionDMContext[] getExecutionContexts(IMIContainerDMContext containerDmc) {
679
		// This method is meant to be used when we support multiple processes.
680
		// This version of the service does not support that, so the caller will figure it out
681
		// in its own.
682
		return null;
683
	}
677
}
684
}
(-)src/org/eclipse/dd/mi/service/IMIProcesses.java (+10 lines)
Lines 63-67 Link Here
63
     * @param threadId The thread id belonging to the container we want to create
63
     * @param threadId The thread id belonging to the container we want to create
64
     */
64
     */
65
    IMIContainerDMContext createContainerContextFromThreadId(ICommandControlDMContext controlDmc, String threadId);
65
    IMIContainerDMContext createContainerContextFromThreadId(ICommandControlDMContext controlDmc, String threadId);
66
    
67
    /**
68
     * Get a list of all execution contexts belonging to a container.  This call is synchronous,
69
     * unlike the call to getProcessesBeingDebugged().  However, some services may not be able
70
     * to fulfill this request synchronously and will have to rely on getProcessesBeingDebugged().
71
     *
72
     * @param containerDmc The container for which we want to get the execution contexts
73
     */
74
    IMIExecutionDMContext[] getExecutionContexts(IMIContainerDMContext containerDmc);
75
66
}
76
}
67
77
(-)src/org/eclipse/dd/mi/service/command/AbstractMIControl.java (-1 / +21 lines)
Lines 43-49 Link Here
43
import org.eclipse.dd.dsf.service.AbstractDsfService;
43
import org.eclipse.dd.dsf.service.AbstractDsfService;
44
import org.eclipse.dd.dsf.service.DsfSession;
44
import org.eclipse.dd.dsf.service.DsfSession;
45
import org.eclipse.dd.mi.internal.MIPlugin;
45
import org.eclipse.dd.mi.internal.MIPlugin;
46
import org.eclipse.dd.mi.service.IMIContainerDMContext;
46
import org.eclipse.dd.mi.service.IMIExecutionDMContext;
47
import org.eclipse.dd.mi.service.IMIExecutionDMContext;
48
import org.eclipse.dd.mi.service.IMIProcesses;
47
import org.eclipse.dd.mi.service.command.commands.MICommand;
49
import org.eclipse.dd.mi.service.command.commands.MICommand;
48
import org.eclipse.dd.mi.service.command.commands.MIStackSelectFrame;
50
import org.eclipse.dd.mi.service.command.commands.MIStackSelectFrame;
49
import org.eclipse.dd.mi.service.command.commands.MIThreadSelect;
51
import org.eclipse.dd.mi.service.command.commands.MIThreadSelect;
Lines 461-468 Link Here
461
463
462
        public String getThreadId() {
464
        public String getThreadId() {
463
        	IMIExecutionDMContext execCtx = DMContexts.getAncestorOfType(fCommand.getContext(), IMIExecutionDMContext.class);
465
        	IMIExecutionDMContext execCtx = DMContexts.getAncestorOfType(fCommand.getContext(), IMIExecutionDMContext.class);
464
        	if(execCtx != null)
466
        	if (execCtx != null) {
465
        		return Integer.toString(execCtx.getThreadId());
467
        		return Integer.toString(execCtx.getThreadId());
468
        	}
469
470
        	// If we don't have an execution context, try to see if we have a container context.
471
        	// If we do, then we should specify this container to MI; however, the only way to do this
472
        	// is to specify some thread within the container.
473
        	IMIContainerDMContext containerCtx = DMContexts.getAncestorOfType(fCommand.getContext(), IMIContainerDMContext.class);
474
        	if(containerCtx != null) {
475
    			IMIProcesses procService = getServicesTracker().getService(IMIProcesses.class);
476
477
    			if (procService != null) {
478
    				IMIExecutionDMContext[] execCtxs = procService.getExecutionContexts(containerCtx);
479
    				// Return any thread... let's take the first one.
480
    				if (execCtxs != null && execCtxs.length > 0) {
481
    					return Integer.toString(execCtxs[0].getThreadId());
482
    				}
483
    			}
484
        	}
485
466
        	return null;
486
        	return null;
467
        } 
487
        } 
468
        
488
        
(-)src/org/eclipse/dd/gdb/internal/provisional/service/GDBRunControl_7_0.java (-2 / +1 lines)
Lines 28-34 Link Here
28
import org.eclipse.dd.dsf.service.DsfSession;
28
import org.eclipse.dd.dsf.service.DsfSession;
29
import org.eclipse.dd.gdb.internal.GdbPlugin;
29
import org.eclipse.dd.gdb.internal.GdbPlugin;
30
import org.eclipse.dd.gdb.internal.provisional.service.command.IGDBControl;
30
import org.eclipse.dd.gdb.internal.provisional.service.command.IGDBControl;
31
import org.eclipse.dd.mi.internal.MIPlugin;
32
import org.eclipse.dd.mi.service.IMIExecutionDMContext;
31
import org.eclipse.dd.mi.service.IMIExecutionDMContext;
33
import org.eclipse.dd.mi.service.IMIProcesses;
32
import org.eclipse.dd.mi.service.IMIProcesses;
34
import org.eclipse.dd.mi.service.MIRunControl;
33
import org.eclipse.dd.mi.service.MIRunControl;
Lines 108-114 Link Here
108
							IExecutionDMContext[] execDmcs = (IExecutionDMContext[])getData();
107
							IExecutionDMContext[] execDmcs = (IExecutionDMContext[])getData();
109
							rm.setData(execDmcs);
108
							rm.setData(execDmcs);
110
						} else {
109
						} else {
111
							rm.setStatus(new Status(IStatus.ERROR, MIPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid contexts", null)); //$NON-NLS-1$
110
							rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid contexts", null)); //$NON-NLS-1$
112
						}
111
						}
113
						rm.done();
112
						rm.done();
114
					}
113
					}
(-)src/org/eclipse/dd/gdb/internal/provisional/service/GDBProcesses_7_0.java (+20 lines)
Lines 10-18 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.dd.gdb.internal.provisional.service;
11
package org.eclipse.dd.gdb.internal.provisional.service;
12
12
13
import java.util.ArrayList;
13
import java.util.HashMap;
14
import java.util.HashMap;
14
import java.util.Hashtable;
15
import java.util.Hashtable;
15
import java.util.Iterator;
16
import java.util.Iterator;
17
import java.util.List;
16
import java.util.Map;
18
import java.util.Map;
17
19
18
import org.eclipse.core.runtime.IStatus;
20
import org.eclipse.core.runtime.IStatus;
Lines 448-453 Link Here
448
    	return createContainerContext(processDmc, groupId);
450
    	return createContainerContext(processDmc, groupId);
449
    }
451
    }
450
452
453
    public IMIExecutionDMContext[] getExecutionContexts(IMIContainerDMContext containerDmc) {
454
    	String groupId = containerDmc.getGroupId();
455
    	List<IMIExecutionDMContext> execDmcList = new ArrayList<IMIExecutionDMContext>(); 
456
    	Iterator<Map.Entry<String, String>> iterator = fThreadToGroupMap.entrySet().iterator();
457
    	while (iterator.hasNext()){
458
    		Map.Entry<String, String> entry = iterator.next();
459
    		if (entry.getValue().equals(groupId)) {
460
    			String threadId = entry.getKey();
461
    			IProcessDMContext procDmc = DMContexts.getAncestorOfType(containerDmc, IProcessDMContext.class);
462
    			IMIExecutionDMContext execDmc = createExecutionContext(containerDmc, 
463
    																   createThreadContext(procDmc, threadId),
464
    																   threadId);
465
    			execDmcList.add(execDmc);
466
    		}
467
    	}
468
    	return execDmcList.toArray(new IMIExecutionDMContext[0]);
469
    }
470
451
	/**
471
	/**
452
	 * This method obtains the model data for a given IThreadDMContext object
472
	 * This method obtains the model data for a given IThreadDMContext object
453
	 * which can represent a thread or a process.
473
	 * which can represent a thread or a process.

Return to bug 248636