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/launching/GdbLaunch.java (-1 / +1 lines)
Lines 135-141 Link Here
135
                                GdbLaunchDelegate.GDB_DEBUG_MODEL_ID, getLaunchConfiguration(), fSession);
135
                                GdbLaunchDelegate.GDB_DEBUG_MODEL_ID, getLaunchConfiguration(), fSession);
136
                        fSession.registerModelAdapter(IMemoryBlockRetrieval.class, fMemRetrieval);
136
                        fSession.registerModelAdapter(IMemoryBlockRetrieval.class, fMemRetrieval);
137
                        
137
                        
138
                   		IProcessDMContext procDmc = procService.createProcessContext(commandControl.getContext(), MIProcesses.UNIQUE_GROUP_ID);
138
                   		IProcessDMContext procDmc = procService.createProcessContext(commandControl.getContext(), MIProcesses.UNKNOWN_PROCESS_ID);
139
                        IMemoryDMContext memoryDmc = (IMemoryDMContext)procService.createContainerContext(procDmc, MIProcesses.UNIQUE_GROUP_ID);
139
                        IMemoryDMContext memoryDmc = (IMemoryDMContext)procService.createContainerContext(procDmc, MIProcesses.UNIQUE_GROUP_ID);
140
                        fMemRetrieval.initialize(memoryDmc);
140
                        fMemRetrieval.initialize(memoryDmc);
141
                    }
141
                    }
(-)src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses.java (-1 / +1 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.UNKNOWN_PROCESS_ID);
168
		}
168
		}
169
    	return createContainerContext(processDmc, groupId);
169
    	return createContainerContext(processDmc, groupId);
170
    }
170
    }
(-)src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java (-3 / +39 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
			// We treat the UNKNOWN_PROCESS_ID as a wildcard.  Any processId (except null) will be considered
305
			       (((MIProcessDMC)obj).fId == null ? fId == null : ((MIProcessDMC)obj).fId.equals(fId));
305
			// equal to the UNKNOWN_PROCESS_ID.  This is important because before starting a process, we don't
306
			// have a pid yet, but we still need to create a process context, and we must use UNKNOWN_PROCESS_ID.
307
			// Bug 336890 
308
309
			if (!baseEquals(obj)) {
310
				return false;
311
			}
312
313
			MIProcessDMC other = (MIProcessDMC)obj;
314
			if (fId == null || other.fId == null) {
315
				return fId == null && other.fId == null;
316
			}
317
318
			// Now that we know neither is null, check for UNKNOWN_PROCESS_ID wildcard
319
			if (fId.equals(MIProcesses.UNKNOWN_PROCESS_ID) || other.fId.equals(MIProcesses.UNKNOWN_PROCESS_ID)) {
320
				return true;
321
			}
322
			
323
			return fId.equals(other.fId);
306
		}
324
		}
307
325
308
		@Override
326
		@Override
309
		public int hashCode() { return baseHashCode() ^ (fId == null ? 0 : fId.hashCode()); }
327
		public int hashCode() { 
328
			// We cannot use fId in the hashCode.  This is because we support
329
			// the wildCard MIProcesses.UNKNOWN_PROCESS_ID which is equal to any other fId.
330
			// But we also need the hashCode of the wildCard to be the same
331
			// as the one of all other fIds, which is why we need a constant hashCode
332
			// See bug 336890
333
			return baseHashCode(); 
334
		}
310
    }
335
    }
311
    
336
    
312
    /**
337
    /**
Lines 550-555 Link Here
550
	}
575
	}
551
576
552
	/** @since 4.0 */
577
	/** @since 4.0 */
578
	protected int getNumConnected() {
579
		return fNumConnected;
580
	}
581
582
	/** @since 4.0 */
583
	protected void setNumConnected(int num) {
584
		fNumConnected = num;
585
	}
586
587
	/** @since 4.0 */
553
	protected boolean isInitialProcess() {
588
	protected boolean isInitialProcess() {
554
		return fInitialProcess;
589
		return fInitialProcess;
555
	}
590
	}
Lines 631-636 Link Here
631
    	
666
    	
632
    	String pid = getGroupToPidMap().get(groupId);
667
    	String pid = getGroupToPidMap().get(groupId);
633
    	if (pid == null) {
668
    	if (pid == null) {
669
    		// For GDB 7.0 and 7.1, the groupId is the pid, so we can use it directly
634
    		pid = groupId;
670
    		pid = groupId;
635
    	}
671
    	}
636
    	IProcessDMContext processDmc = createProcessContext(controlDmc, pid);
672
    	IProcessDMContext processDmc = createProcessContext(controlDmc, pid);
(-)src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_2.java (+12 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.UNKNOWN_PROCESS_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)
(-)src/org/eclipse/cdt/dsf/mi/service/MIProcesses.java (-4 / +31 lines)
Lines 255-266 Link Here
255
255
256
		@Override
256
		@Override
257
		public boolean equals(Object obj) {
257
		public boolean equals(Object obj) {
258
			return super.baseEquals(obj) && 
258
			// We treat the UNKNOWN_PROCESS_ID as a wildcard.  Any processId (except null) will be considered
259
			       (((MIProcessDMC)obj).fId == null ? fId == null : ((MIProcessDMC)obj).fId.equals(fId));
259
			// equal to the UNKNOWN_PROCESS_ID.  This is important because before starting a process, we don't
260
			// have a pid yet, but we still need to create a process context, and we must use UNKNOWN_PROCESS_ID.
261
			// Bug 336890 
262
263
			if (!baseEquals(obj)) {
264
				return false;
265
			}
266
267
			MIProcessDMC other = (MIProcessDMC)obj;
268
			if (fId == null || other.fId == null) {
269
				return fId == null && other.fId == null;
270
			}
271
272
			// Now that we know neither is null, check for UNKNOWN_PROCESS_ID wildcard
273
			if (fId.equals(UNKNOWN_PROCESS_ID) || other.fId.equals(UNKNOWN_PROCESS_ID)) {
274
				return true;
275
			}
276
			
277
			return fId.equals(other.fId);
260
		}
278
		}
261
279
262
		@Override
280
		@Override
263
		public int hashCode() { return super.baseHashCode() ^ (fId == null ? 0 : fId.hashCode()); }
281
		public int hashCode() { 
282
			// We cannot use fId in the hashCode.  This is because we support
283
			// the wildCard MIProcesses.UNKNOWN_PROCESS_ID which is equal to any other fId.
284
			// But we also need the hashCode of the wildCard to be the same
285
			// as the one of all other fIds, which is why we need a constant hashCode
286
			// See bug 336890
287
			return baseHashCode(); 
288
		}
264
    }
289
    }
265
    
290
    
266
    /*
291
    /*
Lines 315-320 Link Here
315
	private static final String FAKE_THREAD_ID = "0"; //$NON-NLS-1$
340
	private static final String FAKE_THREAD_ID = "0"; //$NON-NLS-1$
316
	// The unique id should be an empty string so that the views know not to display the fake id
341
	// The unique id should be an empty string so that the views know not to display the fake id
317
	public static final String UNIQUE_GROUP_ID = ""; //$NON-NLS-1$
342
	public static final String UNIQUE_GROUP_ID = ""; //$NON-NLS-1$
343
	/** @since 4.0 */
344
	public static final String UNKNOWN_PROCESS_ID = UNIQUE_GROUP_ID;
318
345
319
    public MIProcesses(DsfSession session) {
346
    public MIProcesses(DsfSession session) {
320
    	super(session);
347
    	super(session);
Lines 420-426 Link Here
420
    
447
    
421
    /** @since 4.0 */
448
    /** @since 4.0 */
422
    public IMIContainerDMContext createContainerContextFromGroupId(ICommandControlDMContext controlDmc, String groupId) {
449
    public IMIContainerDMContext createContainerContextFromGroupId(ICommandControlDMContext controlDmc, String groupId) {
423
    	IProcessDMContext processDmc = createProcessContext(controlDmc, groupId);
450
    	IProcessDMContext processDmc = createProcessContext(controlDmc, UNKNOWN_PROCESS_ID);
424
    	return createContainerContext(processDmc, groupId);
451
    	return createContainerContext(processDmc, groupId);
425
    }
452
    }
426
453

Return to bug 336890