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

Collapse All | Expand All

(-)src/org/eclipse/cdt/dsf/gdb/service/GDBProcesses_7_0.java (-5 / +16 lines)
Lines 797-809 Link Here
797
		}
797
		}
798
		// END OF WORKAROUND to be removed when GDB 7.2 is available
798
		// END OF WORKAROUND to be removed when GDB 7.2 is available
799
		
799
		
800
		IMIContainerDMContext[] containerDmcs = new IMIContainerDMContext[groups.length];
800
		// With GDB 7.1, we can receive a bogus process when we are not debugging anything
801
		for (int i = 0; i < groups.length; i++) {
801
        // -list-thread-groups
802
			String groupId = groups[i].getGroupId();
802
        // ^done,groups=[{id="0",type="process",pid="0"}]
803
		// As for GDB 7.2, the pid field is missing altogether in this case
804
		// -list-thread-groups
805
		// ^done,groups=[{id="i1",type="process"}]
806
		// Just ignore that entry
807
		List<IMIContainerDMContext> containerDmcs = new ArrayList<IMIContainerDMContext>(groups.length);
808
		for (IThreadGroupInfo group : groups) {
809
			if (group.getPid() == null || 
810
					group.getPid().equals("") || group.getPid().equals("0")) { //$NON-NLS-1$ //$NON-NLS-2$
811
				continue;
812
			}
813
			String groupId = group.getGroupId();
803
			IProcessDMContext procDmc = createProcessContext(controlDmc, groupId); 
814
			IProcessDMContext procDmc = createProcessContext(controlDmc, groupId); 
804
			containerDmcs[i] = createContainerContext(procDmc, groupId);
815
			containerDmcs.add(createContainerContext(procDmc, groupId));
805
		}
816
		}
806
		return containerDmcs;
817
		return containerDmcs.toArray(new IMIContainerDMContext[containerDmcs.size()]);
807
	}
818
	}
808
819
809
	public void getRunningProcesses(final IDMContext dmc, final DataRequestMonitor<IProcessDMContext[]> rm) {
820
	public void getRunningProcesses(final IDMContext dmc, final DataRequestMonitor<IProcessDMContext[]> rm) {
(-)src/org/eclipse/cdt/dsf/mi/service/command/output/MIListThreadGroupsInfo.java (-4 / +72 lines)
Lines 34-39 Link Here
34
 *  list-thread-groups GROUPID, in the case of a running thread or a stopped thread:
34
 *  list-thread-groups GROUPID, in the case of a running thread or a stopped thread:
35
 *  ^done,threads=[{id="1",target-id="Thread 162.32942",details="JUnitProcess_PT (Ready) 1030373359 44441",frame={level="0",addr="0x00000000",func="??",args=[]},state="stopped"}]
35
 *  ^done,threads=[{id="1",target-id="Thread 162.32942",details="JUnitProcess_PT (Ready) 1030373359 44441",frame={level="0",addr="0x00000000",func="??",args=[]},state="stopped"}]
36
 *  ^done,threads=[{id="1",target-id="Thread 162.32942",details="JUnitProcess_PT Idle 981333916 42692",state="running"}]
36
 *  ^done,threads=[{id="1",target-id="Thread 162.32942",details="JUnitProcess_PT Idle 981333916 42692",state="running"}]
37
 *      
38
 * Example of outputs by version on Linux
39
 * 
40
 * GDB 7.0
41
 *  
42
 *  (when no inferior is running)
43
 * -list-thread-groups
44
 * ^done,groups=[]
45
 *
46
 * (with an inferior running)
47
 * -list-thread-groups
48
 * ^done,groups=[{id="19386",type="process",pid="19386"}]
49
 * 
50
 * -list-thread-groups 19386
51
 * ^done,threads=[{id="1",target-id="process 19386",frame={level="0",addr="0x08048618",func="main",args=[],file="a.cc",fullname="/local/lmckhou/testing/a.cc",line="9"},state="stopped"}]
52
 * 
53
 * -list-thread-groups --available 
54
 * ^done,groups=[{id="19371",type="process",description="gdb.7.0 -i mi testing/a.out",user="lmckhou"},{id="19386",type="process",description="/local/lmckhou/testing/a.out",user="lmckhou"},{id="19413",type="process",description="sleep 5",user="lmckhou"}]
55
 * 
56
 * GDB 7.1
57
 * 
58
 * (when no inferior is running)
59
 * -list-thread-groups
60
 * ^done,groups=[{id="0",type="process",pid="0"}]
61
 * 
62
 * (with an inferior running)
63
 * -list-thread-groups
64
 * ^done,groups=[{id="19424",type="process",pid="19424",cores=["3"]}]
65
 * 
66
 * -list-thread-groups 19424
67
 * ^done,threads=[{id="1",target-id="process 19424",frame={level="0",addr="0x08048618",func="main",args=[],file="a.cc",fullname="/local/lmckhou/testing/a.cc",line="9"},state="stopped",core="3"}]
68
 * 
69
 * -list-thread-groups --available
70
 * ^done,groups=[{id="19418",type="process",description="gdb.7.1 -i mi testing/a.out",user="lmckhou"},{id="19424",type="process",description="/local/lmckhou/testing/a.out",user="lmckhou"},{id="19438",type="process",description="sleep 5",user="lmckhou"}]
71
 * 
72
 * GDB 7.2
73
 * 
74
 * (when no inferior is running)
75
 * -list-thread-groups
76
 * ^done,groups=[{id="i1",type="process",executable="/local/lmckhou/testing/a.out"}]
77
 * 
78
 * (with an inferior running)
79
 * -list-thread-groups
80
 * ^done,groups=[{id="i1",type="process",pid="19451",executable="/local/lmckhou/testing/a.out",cores=["2"]}]
81
 * 
82
 * -list-thread-groups i1
83
 * ^done,threads=[{id="1",target-id="process 19451",frame={level="0",addr="0x08048618",func="main",args=[],file="a.cc",fullname="/local/lmckhou/testing/a.cc",line="9"},state="stopped",core="2"}]
84
 * 
85
 * -list-thread-groups --available
86
 * ^done,groups=[{id="19445",type="process",description="gdb.7.2 -i mi testing/a.out",user="lmckhou"},{id="19451",type="process",description="/local/lmckhou/testing/a.out",user="lmckhou"},{id="19462",type="process",description="sleep 5",user="lmckhou"}]
87
 *
37
 * @since 1.1
88
 * @since 1.1
38
 */
89
 */
39
public class MIListThreadGroupsInfo extends MIInfo {
90
public class MIListThreadGroupsInfo extends MIInfo {
Lines 50-59 Link Here
50
		final String fGroupId;
101
		final String fGroupId;
51
		final String fDescription;
102
		final String fDescription;
52
		final String fName;
103
		final String fName;
104
		final String fPid;
53
		
105
		
54
		public ThreadGroupInfo(String id, String description) {
106
		public ThreadGroupInfo(String id, String description, String pid) {
55
			fGroupId = id;
107
			fGroupId = id;
56
			fDescription = description;
108
			fDescription = description;
109
			fPid = pid;
57
110
58
			fName = parseName(fDescription);
111
			fName = parseName(fDescription);
59
		}
112
		}
Lines 77-83 Link Here
77
		}
130
		}
78
		
131
		
79
		public String getGroupId() { return fGroupId; }
132
		public String getGroupId() { return fGroupId; }
80
		public String getPid() { return fGroupId; }
133
		public String getPid() { return fPid; }
81
134
82
		public String getName() { return fName;	}
135
		public String getName() { return fName;	}
83
136
Lines 129-135 Link Here
129
		fGroupList = new IThreadGroupInfo[values.length];
182
		fGroupList = new IThreadGroupInfo[values.length];
130
		for (int i = 0; i < values.length; i++) {
183
		for (int i = 0; i < values.length; i++) {
131
			MIResult[] results = ((MITuple)values[i]).getMIResults();
184
			MIResult[] results = ((MITuple)values[i]).getMIResults();
132
			String id = "", desc = "";//$NON-NLS-1$//$NON-NLS-2$
185
			String id, desc, pid;
186
			id = desc = pid = "";//$NON-NLS-1$
133
			
187
			
134
			for (MIResult result : results) {
188
			for (MIResult result : results) {
135
				String var = result.getVariable();
189
				String var = result.getVariable();
Lines 146-154 Link Here
146
						desc = str.trim();
200
						desc = str.trim();
147
201
148
					}
202
					}
203
				} else if (var.equals("pid")) { //$NON-NLS-1$
204
					MIValue value = result.getMIValue();
205
					if (value instanceof MIConst) {
206
						String str = ((MIConst)value).getCString();
207
						pid = str.trim();
208
					}
149
				}
209
				}
150
			}
210
			}
151
			fGroupList[i] = new ThreadGroupInfo(id, desc);
211
			// In the case of -list-thread-groups --available, the pid field is not present, but the
212
			// pid is used as the main id.  To know we are in this case, we check that we have
213
			// a description, that only happens for -list-thread-groups --available
214
			// We must check this because with GDB 7.2, there will be no pid field as a result
215
			// of -list-thread-groups, if no process is actually running yet.
216
			if (pid.equals("") && !desc.equals("")) { //$NON-NLS-1$ //$NON-NLS-2$
217
				pid = id;
218
			}
219
			fGroupList[i] = new ThreadGroupInfo(id, desc, pid);
152
		}
220
		}
153
	}
221
	}
154
}
222
}

Return to bug 311965