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

Collapse All | Expand All

(-)src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses.java (-2 / +1 lines)
Lines 92-99 Link Here
92
				new Hashtable<String, String>());
92
				new Hashtable<String, String>());
93
        
93
        
94
		ICommandControlService commandControl = getServicesTracker().getService(ICommandControlService.class);
94
		ICommandControlService commandControl = getServicesTracker().getService(ICommandControlService.class);
95
		IProcessDMContext procDmc = createProcessContext(commandControl.getContext(), MIProcesses.UNIQUE_GROUP_ID);
95
		IContainerDMContext containerDmc = createContainerContextFromGroupId(commandControl.getContext(), MIProcesses.UNIQUE_GROUP_ID);
96
		IContainerDMContext containerDmc = createContainerContext(procDmc, MIProcesses.UNIQUE_GROUP_ID);
97
		fGdb.getInferiorProcess().setContainerContext(containerDmc);
96
		fGdb.getInferiorProcess().setContainerContext(containerDmc);
98
97
99
		getSession().addServiceEventListener(this, null);		
98
		getSession().addServiceEventListener(this, null);		
(-)src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java (-19 / +49 lines)
Lines 392-397 Link Here
392
     *  A map of thread id to thread group id.  We use this to find out to which threadGroup a thread belongs.
392
     *  A map of thread id to thread group id.  We use this to find out to which threadGroup a thread belongs.
393
     */
393
     */
394
    private Map<String, String> fThreadToGroupMap = new HashMap<String, String>();
394
    private Map<String, String> fThreadToGroupMap = new HashMap<String, String>();
395
    /**
396
     *  A map of thread group id to process id.  We use this to find out to which pid a group refers.
397
     */
398
    private Map<String, String> fGroupToPidMap = new HashMap<String, String>();
395
399
396
    private IGDBControl fCommandControl;
400
    private IGDBControl fCommandControl;
397
    private IGDBBackend fBackend;
401
    private IGDBBackend fBackend;
Lines 549-558 Link Here
549
    			}
553
    			}
550
    		}
554
    		}
551
    	}
555
    	}
552
    	IProcessDMContext processDmc = createProcessContext(controlDmc, groupId);
556
    	
553
    	return createContainerContext(processDmc, groupId);
557
    	return createContainerContextFromGroupId(controlDmc, groupId);
554
    }
558
    }
555
559
560
    /** @since 4.0 */
561
    public IMIContainerDMContext createContainerContextFromGroupId(ICommandControlDMContext controlDmc, String groupId) {
562
    	String pid = fGroupToPidMap.get(groupId);
563
    	if (pid == null) {
564
    		pid = groupId;
565
    	}
566
    	IProcessDMContext processDmc = createProcessContext(controlDmc, pid);
567
    	return createContainerContext(processDmc, groupId);
568
    }
569
    
556
    public IMIExecutionDMContext[] getExecutionContexts(IMIContainerDMContext containerDmc) {
570
    public IMIExecutionDMContext[] getExecutionContexts(IMIContainerDMContext containerDmc) {
557
    	String groupId = containerDmc.getGroupId();
571
    	String groupId = containerDmc.getGroupId();
558
    	List<IMIExecutionDMContext> execDmcList = new ArrayList<IMIExecutionDMContext>(); 
572
    	List<IMIExecutionDMContext> execDmcList = new ArrayList<IMIExecutionDMContext>(); 
Lines 765-775 Link Here
765
						@Override
779
						@Override
766
						protected void handleFailure() {
780
						protected void handleFailure() {
767
							// If the target is not available, generate the list ourselves
781
							// If the target is not available, generate the list ourselves
768
							IMIContainerDMContext[] containerDmcs = new IMIContainerDMContext[fDebuggedProcessesAndNames.size()];
782
							IMIContainerDMContext[] containerDmcs = new IMIContainerDMContext[fGroupToPidMap.size()];
769
							int i = 0;
783
							int i = 0;
770
							for (String groupId : fDebuggedProcessesAndNames.keySet()) {
784
							for (String groupId : fGroupToPidMap.keySet()) {
771
								IProcessDMContext processDmc = createProcessContext(controlDmc, groupId);
785
								containerDmcs[i++] = createContainerContextFromGroupId(controlDmc, groupId);
772
								containerDmcs[i++] = createContainerContext(processDmc, groupId);
773
							}
786
							}
774
							rm.setData(containerDmcs);
787
							rm.setData(containerDmcs);
775
							rm.done();
788
							rm.done();
Lines 808-816 Link Here
808
		// code can be removed when GDB 7.2 is released
821
		// code can be removed when GDB 7.2 is released
809
		// START OF WORKAROUND
822
		// START OF WORKAROUND
810
		if (groups.length == 0 && fBackend.getSessionType() == SessionType.CORE) {
823
		if (groups.length == 0 && fBackend.getSessionType() == SessionType.CORE) {
811
			String groupId = MIProcesses.UNIQUE_GROUP_ID;
824
			return new IMIContainerDMContext[] {createContainerContextFromGroupId(controlDmc, MIProcesses.UNIQUE_GROUP_ID)};
812
			IProcessDMContext processDmc = createProcessContext(controlDmc, groupId);
813
			return new IMIContainerDMContext[] {createContainerContext(processDmc, groupId)};
814
		}
825
		}
815
		// END OF WORKAROUND to be removed when GDB 7.2 is available
826
		// END OF WORKAROUND to be removed when GDB 7.2 is available
816
		
827
		
Lines 828-835 Link Here
828
				continue;
839
				continue;
829
			}
840
			}
830
			String groupId = group.getGroupId();
841
			String groupId = group.getGroupId();
831
			IProcessDMContext procDmc = createProcessContext(controlDmc, groupId); 
842
			containerDmcs.add(createContainerContextFromGroupId(controlDmc, groupId));
832
			containerDmcs.add(createContainerContext(procDmc, groupId));
833
		}
843
		}
834
		return containerDmcs.toArray(new IMIContainerDMContext[containerDmcs.size()]);
844
		return containerDmcs.toArray(new IMIContainerDMContext[containerDmcs.size()]);
835
	}
845
	}
Lines 1049-1054 Link Here
1049
    					   "thread-group-exited".equals(miEvent)) { //$NON-NLS-1$
1059
    					   "thread-group-exited".equals(miEvent)) { //$NON-NLS-1$
1050
    				
1060
    				
1051
    				String groupId = null;
1061
    				String groupId = null;
1062
    				String pId = null;
1052
1063
1053
    				MIResult[] results = exec.getMIResults();
1064
    				MIResult[] results = exec.getMIResults();
1054
    				for (int i = 0; i < results.length; i++) {
1065
    				for (int i = 0; i < results.length; i++) {
Lines 1058-1076 Link Here
1058
    						if (val instanceof MIConst) {
1069
    						if (val instanceof MIConst) {
1059
    							groupId = ((MIConst) val).getString().trim();
1070
    							groupId = ((MIConst) val).getString().trim();
1060
    						}
1071
    						}
1072
    					} else if (var.equals("pid")) { //$NON-NLS-1$
1073
    						// Available starting with GDB 7.2
1074
    						if (val instanceof MIConst) {
1075
    							pId = ((MIConst) val).getString().trim();
1076
    						}
1061
    					}
1077
    					}
1062
    				}
1078
    				}
1063
1079
1080
    				if (pId == null) {
1081
    					// Before GDB 7.2, the groupId was the pid of the process
1082
    					pId = groupId;
1083
    				}
1084
1064
    				if (groupId != null) {
1085
    				if (groupId != null) {
1065
    					if ("thread-group-created".equals(miEvent) || "thread-group-started".equals(miEvent)) { //$NON-NLS-1$ //$NON-NLS-2$
1086
    					if ("thread-group-created".equals(miEvent) || "thread-group-started".equals(miEvent)) { //$NON-NLS-1$ //$NON-NLS-2$
1066
    						fDebuggedProcessesAndNames.put(groupId, ""); //$NON-NLS-1$
1087
    						
1088
    						fGroupToPidMap.put(groupId, pId);
1089
    						
1090
    						fDebuggedProcessesAndNames.put(pId, ""); //$NON-NLS-1$
1067
    					
1091
    					
1068
							// GDB is debugging a new process. Let's fetch its
1092
							// GDB is debugging a new process. Let's fetch its
1069
							// name and remember it. In order to get the name,
1093
							// name and remember it. In order to get the name,
1070
							// we have to request all running processes, not
1094
							// we have to request all running processes, not
1071
							// just the ones being debugged. We got a lot more 
1095
							// just the ones being debugged. We got a lot more 
1072
    						// information when we request all processes.
1096
    						// information when we request all processes.
1073
        					final String finalGroupId = groupId;
1097
        					final String finalPId = pId;
1074
    						fListThreadGroupsAvailableCache.execute(
1098
    						fListThreadGroupsAvailableCache.execute(
1075
    								fCommandFactory.createMIListThreadGroups(fCommandControl.getContext(), true),
1099
    								fCommandFactory.createMIListThreadGroups(fCommandControl.getContext(), true),
1076
    								new DataRequestMonitor<MIListThreadGroupsInfo>(getExecutor(), null) {
1100
    								new DataRequestMonitor<MIListThreadGroupsInfo>(getExecutor(), null) {
Lines 1081-1090 Link Here
1081
    										// sending of this command.
1105
    										// sending of this command.
1082
    										fListThreadGroupsAvailableCache.reset();
1106
    										fListThreadGroupsAvailableCache.reset();
1083
1107
1108
    										// Note that the output of the "-list-thread-groups --available" command
1109
    										// still shows the pid as a groupId, even for GDB 7.2.
1084
    										if (isSuccess()) {
1110
    										if (isSuccess()) {
1085
    											for (IThreadGroupInfo groupInfo : getData().getGroupList()) {
1111
    											for (IThreadGroupInfo groupInfo : getData().getGroupList()) {
1086
    												if (groupInfo.getPid().equals(finalGroupId)) {
1112
    												if (groupInfo.getPid().equals(finalPId)) {
1087
    													fDebuggedProcessesAndNames.put(finalGroupId, groupInfo.getName());
1113
    													fDebuggedProcessesAndNames.put(finalPId, groupInfo.getName());
1088
    												}
1114
    												}
1089
    											}
1115
    											}
1090
    										}
1116
    										}
Lines 1097-1106 Link Here
1097
	    											IProcessList list = null;
1123
	    											IProcessList list = null;
1098
	    											try {
1124
	    											try {
1099
	    												list = CCorePlugin.getDefault().getProcessList();
1125
	    												list = CCorePlugin.getDefault().getProcessList();
1100
	        											int groupId_int = Integer.parseInt(finalGroupId);
1126
	        											int pId_int = Integer.parseInt(finalPId);
1101
	        											for (IProcessInfo procInfo : list.getProcessList()) {
1127
	        											for (IProcessInfo procInfo : list.getProcessList()) {
1102
	        												if (procInfo.getPid() == groupId_int) {
1128
	        												if (procInfo.getPid() == pId_int) {
1103
	        													fDebuggedProcessesAndNames.put(finalGroupId, procInfo.getName());
1129
	        													fDebuggedProcessesAndNames.put(finalPId, procInfo.getName());
1130
	        													break;
1104
	        												}
1131
	        												}
1105
	        											}
1132
	        											}
1106
	    											} catch (CoreException e) {
1133
	    											} catch (CoreException e) {
Lines 1110-1117 Link Here
1110
    									}
1137
    									}
1111
    								});
1138
    								});
1112
    					} else if ("thread-group-exited".equals(miEvent)) { //$NON-NLS-1$
1139
    					} else if ("thread-group-exited".equals(miEvent)) { //$NON-NLS-1$
1140
    						
1141
    						fGroupToPidMap.remove(groupId);
1142
1113
    						// GDB is no longer debugging this process.  Remove it from our list.
1143
    						// GDB is no longer debugging this process.  Remove it from our list.
1114
    						fDebuggedProcessesAndNames.remove(groupId);
1144
    						fDebuggedProcessesAndNames.remove(pId);
1115
    						
1145
    						
1116
    						// Remove any entries for that group from our thread to group map
1146
    						// Remove any entries for that group from our thread to group map
1117
    						// When detaching from a group, we won't have received any thread-exited event
1147
    						// When detaching from a group, we won't have received any thread-exited event
(-)src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl.java (-6 / +4 lines)
Lines 18-25 Link Here
18
import java.util.ArrayList;
18
import java.util.ArrayList;
19
import java.util.Hashtable;
19
import java.util.Hashtable;
20
import java.util.List;
20
import java.util.List;
21
import java.util.Properties;
22
import java.util.Map.Entry;
21
import java.util.Map.Entry;
22
import java.util.Properties;
23
import java.util.concurrent.Future;
23
import java.util.concurrent.Future;
24
import java.util.concurrent.TimeUnit;
24
import java.util.concurrent.TimeUnit;
25
25
Lines 32-38 Link Here
32
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
32
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
33
import org.eclipse.cdt.dsf.concurrent.Sequence;
33
import org.eclipse.cdt.dsf.concurrent.Sequence;
34
import org.eclipse.cdt.dsf.datamodel.AbstractDMEvent;
34
import org.eclipse.cdt.dsf.datamodel.AbstractDMEvent;
35
import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext;
36
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
35
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
37
import org.eclipse.cdt.dsf.debug.service.command.ICommand;
36
import org.eclipse.cdt.dsf.debug.service.command.ICommand;
38
import org.eclipse.cdt.dsf.debug.service.command.ICommandControl;
37
import org.eclipse.cdt.dsf.debug.service.command.ICommandControl;
Lines 43-52 Link Here
43
import org.eclipse.cdt.dsf.gdb.service.IGDBBackend;
42
import org.eclipse.cdt.dsf.gdb.service.IGDBBackend;
44
import org.eclipse.cdt.dsf.gdb.service.SessionType;
43
import org.eclipse.cdt.dsf.gdb.service.SessionType;
45
import org.eclipse.cdt.dsf.mi.service.IMIBackend;
44
import org.eclipse.cdt.dsf.mi.service.IMIBackend;
45
import org.eclipse.cdt.dsf.mi.service.IMIBackend.BackendStateChangedEvent;
46
import org.eclipse.cdt.dsf.mi.service.IMICommandControl;
46
import org.eclipse.cdt.dsf.mi.service.IMICommandControl;
47
import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
47
import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
48
import org.eclipse.cdt.dsf.mi.service.MIProcesses;
48
import org.eclipse.cdt.dsf.mi.service.MIProcesses;
49
import org.eclipse.cdt.dsf.mi.service.IMIBackend.BackendStateChangedEvent;
50
import org.eclipse.cdt.dsf.mi.service.MIProcesses.ContainerExitedDMEvent;
49
import org.eclipse.cdt.dsf.mi.service.MIProcesses.ContainerExitedDMEvent;
51
import org.eclipse.cdt.dsf.mi.service.MIProcesses.ContainerStartedDMEvent;
50
import org.eclipse.cdt.dsf.mi.service.MIProcesses.ContainerStartedDMEvent;
52
import org.eclipse.cdt.dsf.mi.service.command.AbstractCLIProcess;
51
import org.eclipse.cdt.dsf.mi.service.command.AbstractCLIProcess;
Lines 55-62 Link Here
55
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
54
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
56
import org.eclipse.cdt.dsf.mi.service.command.MIControlDMContext;
55
import org.eclipse.cdt.dsf.mi.service.command.MIControlDMContext;
57
import org.eclipse.cdt.dsf.mi.service.command.MIInferiorProcess;
56
import org.eclipse.cdt.dsf.mi.service.command.MIInferiorProcess;
58
import org.eclipse.cdt.dsf.mi.service.command.MIRunControlEventProcessor;
59
import org.eclipse.cdt.dsf.mi.service.command.MIInferiorProcess.State;
57
import org.eclipse.cdt.dsf.mi.service.command.MIInferiorProcess.State;
58
import org.eclipse.cdt.dsf.mi.service.command.MIRunControlEventProcessor;
60
import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakInsertInfo;
59
import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakInsertInfo;
61
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
60
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
62
import org.eclipse.cdt.dsf.service.DsfServiceEventHandler;
61
import org.eclipse.cdt.dsf.service.DsfServiceEventHandler;
Lines 319-326 Link Here
319
    	DsfServicesTracker servicesTracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), getSession().getId());
318
    	DsfServicesTracker servicesTracker = new DsfServicesTracker(GdbPlugin.getBundleContext(), getSession().getId());
320
    	IMIProcesses procService = servicesTracker.getService(IMIProcesses.class);
319
    	IMIProcesses procService = servicesTracker.getService(IMIProcesses.class);
321
    	servicesTracker.dispose();
320
    	servicesTracker.dispose();
322
   		IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
321
   		final IContainerDMContext containerDmc = procService.createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
323
   		final IContainerDMContext containerDmc = procService.createContainerContext(procDmc, MIProcesses.UNIQUE_GROUP_ID);
324
322
325
    	final ICommand<MIInfo> execCommand;
323
    	final ICommand<MIInfo> execCommand;
326
    	if (useContinueCommand(launch, restart)) {
324
    	if (useContinueCommand(launch, restart)) {
(-)src/org/eclipse/cdt/dsf/gdb/service/command/GDBControl_7_0.java (-3 / +1 lines)
Lines 32-38 Link Here
32
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
32
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
33
import org.eclipse.cdt.dsf.concurrent.Sequence;
33
import org.eclipse.cdt.dsf.concurrent.Sequence;
34
import org.eclipse.cdt.dsf.datamodel.AbstractDMEvent;
34
import org.eclipse.cdt.dsf.datamodel.AbstractDMEvent;
35
import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext;
36
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
35
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
37
import org.eclipse.cdt.dsf.debug.service.command.ICommand;
36
import org.eclipse.cdt.dsf.debug.service.command.ICommand;
38
import org.eclipse.cdt.dsf.debug.service.command.ICommandControl;
37
import org.eclipse.cdt.dsf.debug.service.command.ICommandControl;
Lines 449-456 Link Here
449
       	    	@Override
448
       	    	@Override
450
      	    	public void execute(RequestMonitor rm) {
449
      	    	public void execute(RequestMonitor rm) {
451
               		IMIProcesses procService = getServicesTracker().getService(IMIProcesses.class);
450
               		IMIProcesses procService = getServicesTracker().getService(IMIProcesses.class);
452
               	    IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
451
               	    fContainerDmc = procService.createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
453
               	    fContainerDmc = procService.createContainerContext(procDmc, MIProcesses.UNIQUE_GROUP_ID);
454
               	    ICommand<MIInfo> command;
452
               	    ICommand<MIInfo> command;
455
453
456
       	    		if (useContinueCommand(launch, restart)) {
454
       	    		if (useContinueCommand(launch, restart)) {
(-)src/org/eclipse/cdt/dsf/mi/service/IMIProcesses.java (-1 / +13 lines)
Lines 57-67 Link Here
57
57
58
    /**
58
    /**
59
     * Create a container context based on a threadId.  This implies knowledge
59
     * Create a container context based on a threadId.  This implies knowledge
60
     * of which threads belong to which container.
60
     * of which threads belong to which container.  This method can only be used
61
     * if the threadId has been already created.
61
     * 
62
     * 
62
     * @param controlDmc The parent command control context of this context
63
     * @param controlDmc The parent command control context of this context
63
     * @param threadId The thread id belonging to the container we want to create
64
     * @param threadId The thread id belonging to the container we want to create
64
     */
65
     */
65
    IMIContainerDMContext createContainerContextFromThreadId(ICommandControlDMContext controlDmc, String threadId);
66
    IMIContainerDMContext createContainerContextFromThreadId(ICommandControlDMContext controlDmc, String threadId);
67
68
    /**
69
     * Create a container context based on a groupId.  This implies knowledge
70
     * of which pid is represented by the groupId.  This method can only be used
71
     * if the groupId has been already created.
72
     * 
73
     * @param controlDmc The parent command control context of this context
74
     * @param goupId The thread-group id of the container we want to create
75
     * @since 4.0
76
     */
77
    IMIContainerDMContext createContainerContextFromGroupId(ICommandControlDMContext controlDmc, String groupId);
66
}
78
}
67
79
(-)src/org/eclipse/cdt/dsf/mi/service/MIProcesses.java (-4 / +7 lines)
Lines 413-423 Link Here
413
    }
413
    }
414
414
415
    public IMIContainerDMContext createContainerContextFromThreadId(ICommandControlDMContext controlDmc, String threadId) {
415
    public IMIContainerDMContext createContainerContextFromThreadId(ICommandControlDMContext controlDmc, String threadId) {
416
    	String groupId = UNIQUE_GROUP_ID;
416
    	return createContainerContextFromGroupId(controlDmc, UNIQUE_GROUP_ID);
417
    }
418
    
419
    /** @since 4.0 */
420
    public IMIContainerDMContext createContainerContextFromGroupId(ICommandControlDMContext controlDmc, String groupId) {
417
    	IProcessDMContext processDmc = createProcessContext(controlDmc, groupId);
421
    	IProcessDMContext processDmc = createProcessContext(controlDmc, groupId);
418
    	return createContainerContext(processDmc, groupId);
422
    	return createContainerContext(processDmc, groupId);
419
    }
423
    }
420
424
425
421
	public void getExecutionData(IThreadDMContext dmc, final DataRequestMonitor<IThreadDMData> rm) {
426
	public void getExecutionData(IThreadDMContext dmc, final DataRequestMonitor<IThreadDMData> rm) {
422
		if (dmc instanceof MIProcessDMC) {
427
		if (dmc instanceof MIProcessDMC) {
423
			rm.setData(new MIThreadDMData("", ((MIProcessDMC)dmc).getProcId())); //$NON-NLS-1$
428
			rm.setData(new MIThreadDMData("", ((MIProcessDMC)dmc).getProcId())); //$NON-NLS-1$
Lines 568-576 Link Here
568
			// This service version only handles a single process to debug, therefore, we can simply
573
			// This service version only handles a single process to debug, therefore, we can simply
569
			// create the context describing this process ourselves.
574
			// create the context describing this process ourselves.
570
			ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
575
			ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
571
			String groupId = MIProcesses.UNIQUE_GROUP_ID;
576
			IMIContainerDMContext newContainerDmc = createContainerContextFromGroupId(controlDmc, UNIQUE_GROUP_ID);
572
			IProcessDMContext procDmc = createProcessContext(controlDmc, groupId);
573
			IMIContainerDMContext newContainerDmc = createContainerContext(procDmc, groupId);
574
			rm.setData(new IContainerDMContext[] {newContainerDmc});
577
			rm.setData(new IContainerDMContext[] {newContainerDmc});
575
			rm.done();
578
			rm.done();
576
		}
579
		}
(-)src/org/eclipse/cdt/dsf/mi/service/command/CLIEventProcessor.java (-10 / +3 lines)
Lines 20-34 Link Here
20
import org.eclipse.cdt.dsf.datamodel.DMContexts;
20
import org.eclipse.cdt.dsf.datamodel.DMContexts;
21
import org.eclipse.cdt.dsf.datamodel.IDMContext;
21
import org.eclipse.cdt.dsf.datamodel.IDMContext;
22
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
22
import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext;
23
import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext;
24
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
23
import org.eclipse.cdt.dsf.debug.service.IRunControl.IContainerDMContext;
25
import org.eclipse.cdt.dsf.debug.service.ISignals.ISignalsDMContext;
24
import org.eclipse.cdt.dsf.debug.service.ISignals.ISignalsDMContext;
26
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
25
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
26
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
27
import org.eclipse.cdt.dsf.debug.service.command.ICommandListener;
27
import org.eclipse.cdt.dsf.debug.service.command.ICommandListener;
28
import org.eclipse.cdt.dsf.debug.service.command.ICommandResult;
28
import org.eclipse.cdt.dsf.debug.service.command.ICommandResult;
29
import org.eclipse.cdt.dsf.debug.service.command.ICommandToken;
29
import org.eclipse.cdt.dsf.debug.service.command.ICommandToken;
30
import org.eclipse.cdt.dsf.debug.service.command.IEventListener;
30
import org.eclipse.cdt.dsf.debug.service.command.IEventListener;
31
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
32
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
31
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
33
import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
32
import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
34
import org.eclipse.cdt.dsf.mi.service.MIProcesses;
33
import org.eclipse.cdt.dsf.mi.service.MIProcesses;
Lines 124-133 Link Here
124
            		
123
            		
125
                    IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
124
                    IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
126
                    if (procService != null) {
125
                    if (procService != null) {
127
                    	String groupId = MIProcesses.UNIQUE_GROUP_ID;
126
                    	IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
128
129
                    	IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
130
                    	IContainerDMContext processContainerDmc = procService.createContainerContext(procDmc, groupId);
131
                    	MIEvent<?> e =  new MIThreadCreatedEvent(processContainerDmc, threadId);
127
                    	MIEvent<?> e =  new MIThreadCreatedEvent(processContainerDmc, threadId);
132
                    	fCommandControl.getSession().dispatchEvent(e, fCommandControl.getProperties());
128
                    	fCommandControl.getSession().dispatchEvent(e, fCommandControl.getProperties());
133
                    }
129
                    }
Lines 167-176 Link Here
167
            // if it was a step instruction set state running
163
            // if it was a step instruction set state running
168
            IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
164
            IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
169
            if (procService != null) {
165
            if (procService != null) {
170
            	String groupId = MIProcesses.UNIQUE_GROUP_ID;
166
            	IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
171
172
            	IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
173
            	IContainerDMContext processContainerDmc = procService.createContainerContext(procDmc, groupId);
174
            	MIEvent<?> event = new MIRunningEvent(processContainerDmc, token, type);
167
            	MIEvent<?> event = new MIRunningEvent(processContainerDmc, token, type);
175
            	fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
168
            	fCommandControl.getSession().dispatchEvent(event, fCommandControl.getProperties());
176
            }
169
            }
(-)src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor.java (-16 / +7 lines)
Lines 15-20 Link Here
15
import java.util.List;
15
import java.util.List;
16
16
17
import org.eclipse.cdt.dsf.concurrent.ConfinedToDsfExecutor;
17
import org.eclipse.cdt.dsf.concurrent.ConfinedToDsfExecutor;
18
import org.eclipse.cdt.dsf.datamodel.DMContexts;
18
import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext;
19
import org.eclipse.cdt.dsf.debug.service.IProcesses.IProcessDMContext;
19
import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMContext;
20
import org.eclipse.cdt.dsf.debug.service.IProcesses.IThreadDMContext;
20
import org.eclipse.cdt.dsf.debug.service.IRunControl;
21
import org.eclipse.cdt.dsf.debug.service.IRunControl;
Lines 192-200 Link Here
192
    							IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
193
    							IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
193
    							if (runControl != null && procService != null) {
194
    							if (runControl != null && procService != null) {
194
    								// We don't know which thread stopped so we simply create a container event.
195
    								// We don't know which thread stopped so we simply create a container event.
195
    								String groupId = MIProcesses.UNIQUE_GROUP_ID;
196
    								IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
196
    								IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
197
    								IContainerDMContext processContainerDmc = procService.createContainerContext(procDmc, groupId);
198
197
199
    								if (runControl.isSuspended(processContainerDmc) == false) {
198
    								if (runControl.isSuspended(processContainerDmc) == false) {
200
    									// Create an MISignalEvent because that is what the *stopped event should have been
199
    									// Create an MISignalEvent because that is what the *stopped event should have been
Lines 235-247 Link Here
235
        	return null;
234
        	return null;
236
        }
235
        }
237
        
236
        
238
   		String groupId = MIProcesses.UNIQUE_GROUP_ID;
237
    	IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
239
240
    	IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
241
    	IContainerDMContext processContainerDmc = procService.createContainerContext(procDmc, groupId);
242
238
243
    	IExecutionDMContext execDmc = processContainerDmc;
239
    	IExecutionDMContext execDmc = processContainerDmc;
244
    	if (threadId != null) {
240
    	if (threadId != null) {
241
    		IProcessDMContext procDmc = DMContexts.getAncestorOfType(processContainerDmc, IProcessDMContext.class);
245
   			IThreadDMContext threadDmc = procService.createThreadContext(procDmc, threadId);
242
   			IThreadDMContext threadDmc = procService.createThreadContext(procDmc, threadId);
246
   			execDmc = procService.createExecutionContext(processContainerDmc, threadDmc, threadId);
243
   			execDmc = procService.createExecutionContext(processContainerDmc, threadDmc, threadId);
247
    	}
244
    	}
Lines 318-326 Link Here
318
315
319
                IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
316
                IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
320
                if (procService != null) {
317
                if (procService != null) {
321
                	String groupId = MIProcesses.UNIQUE_GROUP_ID;
318
                	IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
322
                	IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
323
                	IContainerDMContext processContainerDmc = procService.createContainerContext(procDmc, groupId);
324
319
325
                	fCommandControl.getSession().dispatchEvent(
320
                	fCommandControl.getSession().dispatchEvent(
326
                			new MIRunningEvent(processContainerDmc, id, type), fCommandControl.getProperties());
321
                			new MIRunningEvent(processContainerDmc, id, type), fCommandControl.getProperties());
Lines 343-351 Link Here
343
                if (backendService != null && backendService.getIsAttachSession() == false) {
338
                if (backendService != null && backendService.getIsAttachSession() == false) {
344
                	IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
339
                	IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
345
                	if (procService != null) {
340
                	if (procService != null) {
346
                		String groupId = MIProcesses.UNIQUE_GROUP_ID;
341
                		IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
347
                		IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
348
                		IContainerDMContext processContainerDmc = procService.createContainerContext(procDmc, groupId);
349
342
350
                		fCommandControl.getSession().dispatchEvent(
343
                		fCommandControl.getSession().dispatchEvent(
351
                				new ContainerStartedDMEvent(processContainerDmc), fCommandControl.getProperties());
344
                				new ContainerStartedDMEvent(processContainerDmc), fCommandControl.getProperties());
Lines 367-375 Link Here
367
            			IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
360
            			IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
368
            			if (runControl != null && procService != null) {
361
            			if (runControl != null && procService != null) {
369
            				// We don't know which thread stopped so we simply create a container event.
362
            				// We don't know which thread stopped so we simply create a container event.
370
            				String groupId = MIProcesses.UNIQUE_GROUP_ID;
363
            				IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc, MIProcesses.UNIQUE_GROUP_ID);
371
            				IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
372
            				IContainerDMContext processContainerDmc = procService.createContainerContext(procDmc, groupId);
373
364
374
            				// An attaching operation is debugging a new inferior and always stops it.
365
            				// An attaching operation is debugging a new inferior and always stops it.
375
            				// We should not check that the container is suspended, because at startup, we are considered
366
            				// We should not check that the container is suspended, because at startup, we are considered
(-)src/org/eclipse/cdt/dsf/mi/service/command/MIRunControlEventProcessor_7_0.java (-6 / +15 lines)
Lines 197-204 Link Here
197
    		    	IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
197
    		    	IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
198
198
199
    		    	if (procService != null) {
199
    		    	if (procService != null) {
200
    		    		IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
200
    		    		IContainerDMContext processContainerDmc = procService.createContainerContextFromGroupId(fControlDmc, groupId);
201
    		    		IContainerDMContext processContainerDmc = procService.createContainerContext(procDmc, groupId);
202
201
203
    		    		MIEvent<?> event = null;
202
    		    		MIEvent<?> event = null;
204
    		    		if ("thread-created".equals(miEvent)) { //$NON-NLS-1$
203
    		    		if ("thread-created".equals(miEvent)) { //$NON-NLS-1$
Lines 216-221 Link Here
216
    					   "thread-group-exited".equals(miEvent)) { //$NON-NLS-1$
215
    					   "thread-group-exited".equals(miEvent)) { //$NON-NLS-1$
217
    				
216
    				
218
    				String groupId = null;
217
    				String groupId = null;
218
    				String pId = null;
219
219
220
    				MIResult[] results = exec.getMIResults();
220
    				MIResult[] results = exec.getMIResults();
221
    				for (int i = 0; i < results.length; i++) {
221
    				for (int i = 0; i < results.length; i++) {
Lines 225-236 Link Here
225
    						if (val instanceof MIConst) {
225
    						if (val instanceof MIConst) {
226
    							groupId = ((MIConst) val).getString().trim();
226
    							groupId = ((MIConst) val).getString().trim();
227
    						}
227
    						}
228
    					} else if (var.equals("pid")) { //$NON-NLS-1$
229
    						// Available starting with GDB 7.2
230
    						if (val instanceof MIConst) {
231
    							pId = ((MIConst) val).getString().trim();
232
    						}
228
    					}
233
    					}
229
    				}
234
    				}
235
    				
236
    				if (pId == null) {
237
    					// Before GDB 7.2, the groupId was the pid of the process
238
    					pId = groupId;
239
    				}
230
240
231
					IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
241
					IMIProcesses procService = fServicesTracker.getService(IMIProcesses.class);
232
    				if (groupId != null && procService != null) {
242
    				if (pId != null && procService != null) {
233
    					IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, groupId);
243
    					IProcessDMContext procDmc = procService.createProcessContext(fControlDmc, pId);
234
244
235
    					MIEvent<?> event = null;
245
    					MIEvent<?> event = null;
236
    					if ("thread-group-created".equals(miEvent) || "thread-group-started".equals(miEvent)) { //$NON-NLS-1$ //$NON-NLS-2$
246
    					if ("thread-group-created".equals(miEvent) || "thread-group-started".equals(miEvent)) { //$NON-NLS-1$ //$NON-NLS-2$
Lines 295-302 Link Here
295
   				procDmc = DMContexts.getAncestorOfType(containerDmc, IProcessDMContext.class);
305
   				procDmc = DMContexts.getAncestorOfType(containerDmc, IProcessDMContext.class);
296
    		} else {
306
    		} else {
297
    			// This code would only trigger if the groupId was provided by MI
307
    			// This code would only trigger if the groupId was provided by MI
298
    			procDmc = procService.createProcessContext(fControlDmc, groupId);
308
    			containerDmc = procService.createContainerContextFromGroupId(fControlDmc, groupId);
299
    			containerDmc = procService.createContainerContext(procDmc, groupId);
300
    		}
309
    		}
301
310
302
    		IExecutionDMContext execDmc = containerDmc;
311
    		IExecutionDMContext execDmc = containerDmc;

Return to bug 317500