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

Collapse All | Expand All

(-)src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses.java (-3 / +5 lines)
Lines 164-170 Link Here
164
		if (fProcId != null) {
164
		if (fProcId != null) {
165
			processDmc = createProcessContext(controlDmc, fProcId);
165
			processDmc = createProcessContext(controlDmc, fProcId);
166
		} else {
166
		} else {
167
			processDmc = createProcessContext(controlDmc, groupId);
167
			processDmc = createProcessContext(controlDmc, MIProcesses.UNIQUE_GROUP_ID);
168
		}
168
		}
169
    	return createContainerContext(processDmc, groupId);
169
    	return createContainerContext(processDmc, groupId);
170
    }
170
    }
Lines 277-290 Link Here
277
    }
277
    }
278
278
279
	@Override
279
	@Override
280
    public void detachDebuggerFromProcess(IDMContext dmc, final RequestMonitor rm) {
280
    public void detachDebuggerFromProcess(final IDMContext dmc, final RequestMonitor rm) {
281
		super.detachDebuggerFromProcess(
281
		super.detachDebuggerFromProcess(
282
			dmc, 
282
			dmc, 
283
			new RequestMonitor(getExecutor(), rm) {
283
			new RequestMonitor(getExecutor(), rm) {
284
				@Override
284
				@Override
285
				protected void handleSuccess() {					
285
				protected void handleSuccess() {					
286
					fProcId = null;
286
					fProcId = null;
287
					rm.done();
287
		        	MIBreakpointsManager bpmService = getServicesTracker().getService(MIBreakpointsManager.class);
288
		        	IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(dmc, IBreakpointsTargetDMContext.class);
289
		        	bpmService.stopTrackingBreakpoints(bpTargetDmc, rm);
288
				}
290
				}
289
			});
291
			});
290
	}
292
	}
(-)src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java (-3 / +36 lines)
Lines 301-312 Link Here
301
301
302
		@Override
302
		@Override
303
		public boolean equals(Object obj) {
303
		public boolean equals(Object obj) {
304
			return baseEquals(obj) && 
304
			if (baseEquals(obj) == false) {
305
			       (((MIProcessDMC)obj).fId == null ? fId == null : ((MIProcessDMC)obj).fId.equals(fId));
305
				return false;
306
			}
307
308
			MIProcessDMC other = (MIProcessDMC)obj;
309
			if ( (fId != null && fId.length() == 0) ||
310
				 (other.fId != null && other.fId.length() == 0) ) {
311
				// If either of the ids is the empty string, we consider it a wild card
312
				// and make it equal to anything
313
				return true;
314
			}
315
316
			if (fId == null) {
317
				return other.fId == null;
318
			}
319
			
320
			return fId.equals(other.fId);
306
		}
321
		}
307
322
308
		@Override
323
		@Override
309
		public int hashCode() { return baseHashCode() ^ (fId == null ? 0 : fId.hashCode()); }
324
		public int hashCode() { 
325
			// We cannot use fId in the hashCode.  This is because we support
326
			// a wildCard fId="" which is equal to any other fId.
327
			// But we also need the hashCode to the wildCard to be the same
328
			// as the one of all other fIds, which is why we need a constant hashCode
329
			// See bug 336890
330
			return baseHashCode(); 
331
		}
310
    }
332
    }
311
    
333
    
312
    /**
334
    /**
Lines 550-555 Link Here
550
	}
572
	}
551
573
552
	/** @since 4.0 */
574
	/** @since 4.0 */
575
	protected int getNumConnected() {
576
		return fNumConnected;
577
	}
578
579
	/** @since 4.0 */
580
	protected void setNumConnected(int num) {
581
		fNumConnected = num;
582
	}
583
584
	/** @since 4.0 */
553
	protected boolean isInitialProcess() {
585
	protected boolean isInitialProcess() {
554
		return fInitialProcess;
586
		return fInitialProcess;
555
	}
587
	}
Lines 631-636 Link Here
631
    	
663
    	
632
    	String pid = getGroupToPidMap().get(groupId);
664
    	String pid = getGroupToPidMap().get(groupId);
633
    	if (pid == null) {
665
    	if (pid == null) {
666
    		// For GDB 7.0 and 7.1, the groupId is the pid, so we can use it directly
634
    		pid = groupId;
667
    		pid = groupId;
635
    	}
668
    	}
636
    	IProcessDMContext processDmc = createProcessContext(controlDmc, pid);
669
    	IProcessDMContext processDmc = createProcessContext(controlDmc, pid);
(-)src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java (-1 / +38 lines)
Lines 28-33 Link Here
28
import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext;
28
import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext;
29
import org.eclipse.cdt.dsf.mi.service.IMIProcessDMContext;
29
import org.eclipse.cdt.dsf.mi.service.IMIProcessDMContext;
30
import org.eclipse.cdt.dsf.mi.service.MIBreakpointsManager;
30
import org.eclipse.cdt.dsf.mi.service.MIBreakpointsManager;
31
import org.eclipse.cdt.dsf.mi.service.MIProcesses;
31
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
32
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
32
import org.eclipse.cdt.dsf.mi.service.command.output.MIAddInferiorInfo;
33
import org.eclipse.cdt.dsf.mi.service.command.output.MIAddInferiorInfo;
33
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
34
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
Lines 83-88 Link Here
83
		super.shutdown(requestMonitor);
84
		super.shutdown(requestMonitor);
84
	}
85
	}
85
	
86
	
87
	@Override
88
    public IMIContainerDMContext createContainerContextFromGroupId(ICommandControlDMContext controlDmc, String groupId) {
89
    	String pid = getGroupToPidMap().get(groupId);
90
    	if (pid == null) {
91
    		// For GDB 7.2, the groupId is no longer the pid, so use our wildcard pid instead
92
    		pid = MIProcesses.UNIQUE_GROUP_ID;
93
    	}
94
    	IProcessDMContext processDmc = createProcessContext(controlDmc, pid);
95
    	return createContainerContext(processDmc, groupId);
96
    }
97
    
86
    @Override
98
    @Override
87
	protected boolean doIsDebuggerAttachSupported() {
99
	protected boolean doIsDebuggerAttachSupported() {
88
		// Multi-process is not applicable to post-mortem sessions (core)
100
		// Multi-process is not applicable to post-mortem sessions (core)
Lines 225-233 Link Here
225
	}
237
	}
226
	
238
	
227
	@Override
239
	@Override
240
	protected boolean doCanDetachDebuggerFromProcess() {
241
		// Multi-process is not applicable to post-mortem sessions (core)
242
		// or to non-attach remote sessions.
243
		SessionType type = fBackend.getSessionType();
244
245
		if (type == SessionType.CORE) {
246
			return false;
247
		}
248
249
		if (type == SessionType.REMOTE && !fBackend.getIsAttachSession()) {
250
			return false;
251
		}
252
253
		return getNumConnected() > 0;
254
	}   
255
256
	@Override
228
    public void detachDebuggerFromProcess(IDMContext dmc, final RequestMonitor rm) {
257
    public void detachDebuggerFromProcess(IDMContext dmc, final RequestMonitor rm) {
229
    	
258
    	
230
		ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
259
		final ICommandControlDMContext controlDmc = DMContexts.getAncestorOfType(dmc, ICommandControlDMContext.class);
231
		final IMIContainerDMContext containerDmc = DMContexts.getAncestorOfType(dmc, IMIContainerDMContext.class);
260
		final IMIContainerDMContext containerDmc = DMContexts.getAncestorOfType(dmc, IMIContainerDMContext.class);
232
		
261
		
233
    	if (controlDmc != null && containerDmc != null) {
262
    	if (controlDmc != null && containerDmc != null) {
Lines 237-242 Link Here
237
                return;
266
                return;
238
        	}
267
        	}
239
268
269
        	// Stop tracking the breakpoints for the process we are about to detach from
270
        	MIBreakpointsManager bpmService = getServicesTracker().getService(MIBreakpointsManager.class);
271
        	IBreakpointsTargetDMContext bpTargetDmc = DMContexts.getAncestorOfType(containerDmc, IBreakpointsTargetDMContext.class);
272
        	bpmService.stopTrackingBreakpoints(bpTargetDmc, new RequestMonitor(ImmediateExecutor.getInstance(), rm) {
273
        		@Override
274
        		protected void handleCompleted() {      	
240
        	fCommandControl.queueCommand(
275
        	fCommandControl.queueCommand(
241
        			fCommandFactory.createMITargetDetach(controlDmc, containerDmc.getGroupId()),
276
        			fCommandFactory.createMITargetDetach(controlDmc, containerDmc.getGroupId()),
242
    				new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
277
    				new DataRequestMonitor<MIInfo>(getExecutor(), rm) {
Lines 259-264 Link Here
259
    						}
294
    						}
260
    					}
295
    					}
261
    				});
296
    				});
297
        		}
298
        	});        	
262
    	} else {
299
    	} else {
263
            rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid context.", null)); //$NON-NLS-1$
300
            rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INTERNAL_ERROR, "Invalid context.", null)); //$NON-NLS-1$
264
            rm.done();
301
            rm.done();
(-)src/org/eclipse/cdt/dsf/mi/service/MIProcesses.java (-1 / +1 lines)
Lines 419-425 Link Here
419
    
419
    
420
    /** @since 4.0 */
420
    /** @since 4.0 */
421
    public IMIContainerDMContext createContainerContextFromGroupId(ICommandControlDMContext controlDmc, String groupId) {
421
    public IMIContainerDMContext createContainerContextFromGroupId(ICommandControlDMContext controlDmc, String groupId) {
422
    	IProcessDMContext processDmc = createProcessContext(controlDmc, groupId);
422
    	IProcessDMContext processDmc = createProcessContext(controlDmc,  MIProcesses.UNIQUE_GROUP_ID);
423
    	return createContainerContext(processDmc, groupId);
423
    	return createContainerContext(processDmc, groupId);
424
    }
424
    }
425
425

Return to bug 336890