Commit | Line | Data |
---|---|---|
eb1bab5b BH |
1 | /********************************************************************** |
2 | * Copyright (c) 2012 Ericsson | |
cfdb727a | 3 | * |
eb1bab5b BH |
4 | * All rights reserved. This program and the accompanying materials are |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
cfdb727a AM |
8 | * |
9 | * Contributors: | |
eb1bab5b BH |
10 | * Bernd Hufmann - Initial API and implementation |
11 | **********************************************************************/ | |
115b4a01 | 12 | package org.eclipse.linuxtools.internal.lttng2.ui.views.control.service; |
eb1bab5b BH |
13 | |
14 | import java.util.ArrayList; | |
bbb3538a | 15 | import java.util.Iterator; |
eb1bab5b BH |
16 | import java.util.List; |
17 | import java.util.regex.Matcher; | |
eb1bab5b BH |
18 | |
19 | import org.eclipse.core.commands.ExecutionException; | |
20 | import org.eclipse.core.runtime.IProgressMonitor; | |
21 | import org.eclipse.core.runtime.NullProgressMonitor; | |
9315aeee BH |
22 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.IBaseEventInfo; |
23 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.IChannelInfo; | |
24 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.IDomainInfo; | |
25 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.IEventInfo; | |
d4514365 | 26 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.IFieldInfo; |
9315aeee BH |
27 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.IProbeEventInfo; |
28 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.ISessionInfo; | |
29 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.IUstProviderInfo; | |
30 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.LogLevelType; | |
31 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceEventType; | |
32 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceLogLevel; | |
33 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.BaseEventInfo; | |
34 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.ChannelInfo; | |
35 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.DomainInfo; | |
36 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.EventInfo; | |
d4514365 | 37 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.FieldInfo; |
9315aeee BH |
38 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.ProbeEventInfo; |
39 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.SessionInfo; | |
40 | import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.UstProviderInfo; | |
afe13e7a | 41 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.logging.ControlCommandLogger; |
9315aeee | 42 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.messages.Messages; |
afe13e7a | 43 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.preferences.ControlPreferences; |
9315aeee BH |
44 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.ICommandResult; |
45 | import org.eclipse.linuxtools.internal.lttng2.ui.views.control.remote.ICommandShell; | |
d4514365 | 46 | import org.osgi.framework.Version; |
4775bcbf | 47 | |
eb1bab5b | 48 | /** |
eb1bab5b BH |
49 | * <p> |
50 | * Service for sending LTTng trace control commands to remote host. | |
51 | * </p> | |
cfdb727a | 52 | * |
dbd4432d | 53 | * @author Bernd Hufmann |
eb1bab5b BH |
54 | */ |
55 | public class LTTngControlService implements ILttngControlService { | |
cfdb727a | 56 | |
eb1bab5b BH |
57 | // ------------------------------------------------------------------------ |
58 | // Attributes | |
59 | // ------------------------------------------------------------------------ | |
60 | /** | |
61 | * The command shell implementation | |
62 | */ | |
276c17e7 | 63 | protected ICommandShell fCommandShell = null; |
cfdb727a | 64 | |
c5f68877 BH |
65 | /** |
66 | * The version string. | |
67 | */ | |
d4514365 | 68 | protected Version fVersion = null; |
eb1bab5b BH |
69 | |
70 | // ------------------------------------------------------------------------ | |
71 | // Constructors | |
72 | // ------------------------------------------------------------------------ | |
73 | ||
74 | /** | |
75 | * Constructor | |
cfdb727a | 76 | * |
4775bcbf BH |
77 | * @param shell |
78 | * - the command shell implementation to use | |
eb1bab5b BH |
79 | */ |
80 | public LTTngControlService(ICommandShell shell) { | |
81 | fCommandShell = shell; | |
82 | } | |
4775bcbf | 83 | |
276c17e7 BH |
84 | // ------------------------------------------------------------------------ |
85 | // Accessors | |
86 | // ------------------------------------------------------------------------ | |
87 | /* | |
88 | * (non-Javadoc) | |
89 | * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#getVersion() | |
90 | */ | |
91 | @Override | |
92 | public String getVersion() { | |
d4514365 BH |
93 | if (fVersion == null) { |
94 | return "Unknown"; //$NON-NLS-1$ | |
95 | } | |
96 | return fVersion.toString(); | |
276c17e7 | 97 | } |
cfdb727a | 98 | |
c5f68877 | 99 | /** |
cfdb727a | 100 | * Sets the version of the LTTng 2.0 control service. |
c5f68877 BH |
101 | * @param version - a version to set |
102 | */ | |
276c17e7 | 103 | public void setVersion(String version) { |
d4514365 | 104 | fVersion = new Version(version); |
276c17e7 | 105 | } |
d4514365 BH |
106 | |
107 | /* | |
108 | * (non-Javadoc) | |
109 | * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#isVersionSupported(java.lang.String) | |
110 | */ | |
111 | @Override | |
112 | public boolean isVersionSupported(String version) { | |
113 | Version tmp = new Version(version); | |
114 | return (fVersion != null && fVersion.compareTo(tmp) >= 0) ? true : false; | |
115 | } | |
116 | ||
eb1bab5b BH |
117 | // ------------------------------------------------------------------------ |
118 | // Operations | |
4775bcbf | 119 | // ------------------------------------------------------------------------ |
cfdb727a | 120 | |
eb1bab5b BH |
121 | /* |
122 | * (non-Javadoc) | |
cfdb727a | 123 | * |
4775bcbf | 124 | * @see |
115b4a01 | 125 | * org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService |
4775bcbf | 126 | * #getSessionNames(org.eclipse.core.runtime.IProgressMonitor) |
eb1bab5b BH |
127 | */ |
128 | @Override | |
129 | public String[] getSessionNames(IProgressMonitor monitor) throws ExecutionException { | |
276c17e7 | 130 | StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_LIST); |
eb1bab5b | 131 | |
afe13e7a | 132 | ICommandResult result = executeCommand(command.toString(), monitor); |
4775bcbf BH |
133 | |
134 | // Output: | |
135 | // Available tracing sessions: | |
d4514365 BH |
136 | // 1) mysession1 (/home/user/lttng-traces/mysession1-20120123-083928) [inactive] |
137 | // 2) mysession (/home/user/lttng-traces/mysession-20120123-083318) [inactive] | |
4775bcbf BH |
138 | // |
139 | // Use lttng list <session_name> for more details | |
140 | ||
141 | ArrayList<String> retArray = new ArrayList<String>(); | |
142 | int index = 0; | |
143 | while (index < result.getOutput().length) { | |
144 | String line = result.getOutput()[index]; | |
276c17e7 | 145 | Matcher matcher = LTTngControlServiceConstants.SESSION_PATTERN.matcher(line); |
4775bcbf BH |
146 | if (matcher.matches()) { |
147 | retArray.add(matcher.group(2).trim()); | |
148 | } | |
149 | index++; | |
150 | } | |
151 | return retArray.toArray(new String[retArray.size()]); | |
eb1bab5b BH |
152 | } |
153 | ||
eb1bab5b BH |
154 | /* |
155 | * (non-Javadoc) | |
cfdb727a | 156 | * |
4775bcbf | 157 | * @see |
115b4a01 | 158 | * org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService |
4775bcbf | 159 | * #getSession(java.lang.String, org.eclipse.core.runtime.IProgressMonitor) |
eb1bab5b BH |
160 | */ |
161 | @Override | |
162 | public ISessionInfo getSession(String sessionName, IProgressMonitor monitor) throws ExecutionException { | |
276c17e7 | 163 | StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_LIST, sessionName); |
afe13e7a | 164 | ICommandResult result = executeCommand(command.toString(), monitor); |
eb1bab5b BH |
165 | |
166 | int index = 0; | |
167 | ||
168 | // Output: | |
4775bcbf BH |
169 | // Tracing session mysession2: [inactive] |
170 | // Trace path: /home/eedbhu/lttng-traces/mysession2-20120123-110330 | |
eb1bab5b BH |
171 | ISessionInfo sessionInfo = new SessionInfo(sessionName); |
172 | ||
4775bcbf BH |
173 | while (index < result.getOutput().length) { |
174 | // Tracing session mysession2: [inactive] | |
175 | // Trace path: /home/eedbhu/lttng-traces/mysession2-20120123-110330 | |
176 | // | |
177 | // === Domain: Kernel === | |
178 | // | |
179 | String line = result.getOutput()[index]; | |
276c17e7 | 180 | Matcher matcher = LTTngControlServiceConstants.TRACE_SESSION_PATTERN.matcher(line); |
4775bcbf BH |
181 | if (matcher.matches()) { |
182 | sessionInfo.setSessionState(matcher.group(2)); | |
183 | index++; | |
184 | continue; | |
185 | } | |
186 | ||
276c17e7 | 187 | matcher = LTTngControlServiceConstants.TRACE_SESSION_PATH_PATTERN.matcher(line); |
4775bcbf BH |
188 | if (matcher.matches()) { |
189 | sessionInfo.setSessionPath(matcher.group(1).trim()); | |
190 | index++; | |
191 | continue; | |
192 | } | |
eb1bab5b | 193 | |
276c17e7 | 194 | matcher = LTTngControlServiceConstants.DOMAIN_KERNEL_PATTERN.matcher(line); |
4775bcbf BH |
195 | if (matcher.matches()) { |
196 | // Create Domain | |
197 | IDomainInfo domainInfo = new DomainInfo(Messages.TraceControl_KernelDomainDisplayName); | |
198 | sessionInfo.addDomain(domainInfo); | |
eb1bab5b | 199 | |
4775bcbf BH |
200 | // in domain kernel |
201 | ArrayList<IChannelInfo> channels = new ArrayList<IChannelInfo>(); | |
202 | index = parseDomain(result.getOutput(), index, channels); | |
eb1bab5b | 203 | |
4775bcbf BH |
204 | // set channels |
205 | domainInfo.setChannels(channels); | |
cfdb727a | 206 | |
bbb3538a BH |
207 | // set kernel flag |
208 | domainInfo.setIsKernel(true); | |
4775bcbf BH |
209 | continue; |
210 | } | |
eb1bab5b | 211 | |
276c17e7 | 212 | matcher = LTTngControlServiceConstants.DOMAIN_UST_GLOBAL_PATTERN.matcher(line); |
4775bcbf BH |
213 | if (matcher.matches()) { |
214 | IDomainInfo domainInfo = new DomainInfo(Messages.TraceControl_UstGlobalDomainDisplayName); | |
215 | sessionInfo.addDomain(domainInfo); | |
eb1bab5b | 216 | |
bbb3538a | 217 | // in domain UST |
4775bcbf BH |
218 | ArrayList<IChannelInfo> channels = new ArrayList<IChannelInfo>(); |
219 | index = parseDomain(result.getOutput(), index, channels); | |
220 | ||
221 | // set channels | |
222 | domainInfo.setChannels(channels); | |
cfdb727a | 223 | |
bbb3538a BH |
224 | // set kernel flag |
225 | domainInfo.setIsKernel(false); | |
4775bcbf | 226 | continue; |
eb1bab5b | 227 | } |
4775bcbf BH |
228 | index++; |
229 | } | |
eb1bab5b BH |
230 | return sessionInfo; |
231 | } | |
4775bcbf | 232 | |
eb1bab5b BH |
233 | /* |
234 | * (non-Javadoc) | |
cfdb727a | 235 | * |
4775bcbf | 236 | * @see |
115b4a01 | 237 | * org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService |
4775bcbf | 238 | * #getKernelProvider(org.eclipse.core.runtime.IProgressMonitor) |
eb1bab5b BH |
239 | */ |
240 | @Override | |
241 | public List<IBaseEventInfo> getKernelProvider(IProgressMonitor monitor) throws ExecutionException { | |
276c17e7 | 242 | StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_LIST_KERNEL); |
a07c7629 BH |
243 | ICommandResult result = executeCommand(command.toString(), monitor, false); |
244 | ||
245 | List<IBaseEventInfo> events = new ArrayList<IBaseEventInfo>(); | |
246 | ||
247 | if (result.getOutput() != null) { | |
248 | // Ignore the following 2 cases: | |
249 | // Spawning a session daemon | |
250 | // Error: Unable to list kernel events | |
251 | // or: | |
252 | // Error: Unable to list kernel events | |
1c5303c6 | 253 | // |
a07c7629 | 254 | |
1c5303c6 | 255 | if ((result.getOutput().length > 0) && (LTTngControlServiceConstants.LIST_KERNEL_NO_KERNEL_PROVIDER_PATTERN.matcher(result.getOutput()[0]).matches()) || |
a07c7629 BH |
256 | ((result.getOutput().length > 1) && (LTTngControlServiceConstants.LIST_KERNEL_NO_KERNEL_PROVIDER_PATTERN.matcher(result.getOutput()[1]).matches()))) { |
257 | return events; | |
258 | } | |
259 | } | |
260 | ||
261 | if (isError(result)) { | |
262 | throw new ExecutionException(Messages.TraceControl_CommandError + " " + command.toString() + "\n" + formatOutput(result)); //$NON-NLS-1$ //$NON-NLS-2$ | |
263 | } | |
4775bcbf BH |
264 | |
265 | // Kernel events: | |
266 | // ------------- | |
267 | // sched_kthread_stop (type: tracepoint) | |
eb1bab5b BH |
268 | getProviderEventInfo(result.getOutput(), 0, events); |
269 | return events; | |
270 | } | |
271 | ||
272 | /* | |
273 | * (non-Javadoc) | |
cfdb727a | 274 | * |
4775bcbf | 275 | * @see |
115b4a01 | 276 | * org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService |
4775bcbf | 277 | * #getUstProvider() |
eb1bab5b BH |
278 | */ |
279 | @Override | |
280 | public List<IUstProviderInfo> getUstProvider() throws ExecutionException { | |
281 | return getUstProvider(new NullProgressMonitor()); | |
282 | } | |
4775bcbf | 283 | |
eb1bab5b BH |
284 | /* |
285 | * (non-Javadoc) | |
cfdb727a | 286 | * |
4775bcbf | 287 | * @see |
115b4a01 | 288 | * org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService |
4775bcbf | 289 | * #getUstProvider(org.eclipse.core.runtime.IProgressMonitor) |
eb1bab5b BH |
290 | */ |
291 | @Override | |
292 | public List<IUstProviderInfo> getUstProvider(IProgressMonitor monitor) throws ExecutionException { | |
276c17e7 | 293 | StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_LIST_UST); |
eb1bab5b | 294 | |
d4514365 BH |
295 | if (isVersionSupported("2.1.0")) { //$NON-NLS-1$ |
296 | command.append(LTTngControlServiceConstants.OPTION_FIELDS); | |
297 | } | |
298 | ||
afe13e7a | 299 | ICommandResult result = executeCommand(command.toString(), monitor); |
4775bcbf | 300 | |
d4514365 BH |
301 | // Note that field print-outs exists for version >= 2.1.0 |
302 | // | |
4775bcbf BH |
303 | // UST events: |
304 | // ------------- | |
305 | // | |
306 | // PID: 3635 - Name: | |
307 | // /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello | |
308 | // ust_tests_hello:tptest_sighandler (loglevel: TRACE_EMERG0) (type: | |
309 | // tracepoint) | |
310 | // ust_tests_hello:tptest (loglevel: TRACE_EMERG0) (type: tracepoint) | |
d4514365 BH |
311 | // field: doublefield (float) |
312 | // field: floatfield (float) | |
313 | // field: stringfield (string) | |
4775bcbf BH |
314 | // |
315 | // PID: 6459 - Name: | |
316 | // /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello | |
317 | // ust_tests_hello:tptest_sighandler (loglevel: TRACE_EMERG0) (type: | |
318 | // tracepoint) | |
319 | // ust_tests_hello:tptest (loglevel: TRACE_EMERG0) (type: tracepoint) | |
d4514365 BH |
320 | // field: doublefield (float) |
321 | // field: floatfield (float) | |
322 | // field: stringfield (string) | |
eb1bab5b BH |
323 | |
324 | List<IUstProviderInfo> allProviders = new ArrayList<IUstProviderInfo>(); | |
325 | IUstProviderInfo provider = null; | |
4775bcbf | 326 | |
eb1bab5b BH |
327 | int index = 0; |
328 | while (index < result.getOutput().length) { | |
329 | String line = result.getOutput()[index]; | |
276c17e7 | 330 | Matcher matcher = LTTngControlServiceConstants.UST_PROVIDER_PATTERN.matcher(line); |
4775bcbf | 331 | if (matcher.matches()) { |
4775bcbf BH |
332 | provider = new UstProviderInfo(matcher.group(2).trim()); |
333 | provider.setPid(Integer.valueOf(matcher.group(1).trim())); | |
334 | List<IBaseEventInfo> events = new ArrayList<IBaseEventInfo>(); | |
335 | index = getProviderEventInfo(result.getOutput(), ++index, events); | |
336 | provider.setEvents(events); | |
337 | allProviders.add(provider); | |
eb1bab5b BH |
338 | } else { |
339 | index++; | |
340 | } | |
4775bcbf | 341 | |
eb1bab5b BH |
342 | } |
343 | return allProviders; | |
344 | } | |
345 | ||
bbb3538a BH |
346 | /* |
347 | * (non-Javadoc) | |
115b4a01 | 348 | * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#createSession(java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor) |
bbb3538a BH |
349 | */ |
350 | @Override | |
351 | public ISessionInfo createSession(String sessionName, String sessionPath, IProgressMonitor monitor) throws ExecutionException { | |
352 | ||
353 | String newName = formatParameter(sessionName); | |
354 | String newPath = formatParameter(sessionPath); | |
355 | ||
276c17e7 | 356 | StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_CREATE_SESSION, newName); |
c56972bb | 357 | |
bbb3538a | 358 | if (newPath != null && !"".equals(newPath)) { //$NON-NLS-1$ |
276c17e7 | 359 | command.append(LTTngControlServiceConstants.OPTION_OUTPUT_PATH); |
c56972bb | 360 | command.append(newPath); |
bbb3538a BH |
361 | } |
362 | ||
afe13e7a BH |
363 | ICommandResult result = executeCommand(command.toString(), monitor); |
364 | ||
bbb3538a BH |
365 | //Session myssession2 created. |
366 | //Traces will be written in /home/user/lttng-traces/myssession2-20120209-095418 | |
367 | String[] output = result.getOutput(); | |
cfdb727a | 368 | |
bbb3538a | 369 | // Get and verify session name |
276c17e7 | 370 | Matcher matcher = LTTngControlServiceConstants.CREATE_SESSION_NAME_PATTERN.matcher(output[0]); |
bbb3538a BH |
371 | String name = null; |
372 | ||
373 | if (matcher.matches()) { | |
374 | name = String.valueOf(matcher.group(1).trim()); | |
375 | } else { | |
376 | // Output format not expected | |
cfdb727a AM |
377 | throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ |
378 | Messages.TraceControl_UnexpectedCommandOutputFormat + ":\n" + //$NON-NLS-1$ | |
379 | formatOutput(result)); | |
bbb3538a BH |
380 | } |
381 | ||
382 | if ((name == null) || (!name.equals(sessionName))) { | |
383 | // Unexpected name returned | |
cfdb727a AM |
384 | throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ |
385 | Messages.TraceControl_UnexpectedNameError + ": " + name); //$NON-NLS-1$ | |
bbb3538a | 386 | } |
cfdb727a | 387 | |
bbb3538a | 388 | // Get and verify session path |
276c17e7 | 389 | matcher = LTTngControlServiceConstants.CREATE_SESSION_PATH_PATTERN.matcher(output[1]); |
bbb3538a | 390 | String path = null; |
cfdb727a | 391 | |
bbb3538a BH |
392 | if (matcher.matches()) { |
393 | path = String.valueOf(matcher.group(1).trim()); | |
394 | } else { | |
395 | // Output format not expected | |
cfdb727a AM |
396 | throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ |
397 | Messages.TraceControl_UnexpectedCommandOutputFormat + ":\n" + //$NON-NLS-1$ | |
398 | formatOutput(result)); | |
bbb3538a BH |
399 | } |
400 | ||
401 | if ((path == null) || ((sessionPath != null) && (!path.contains(sessionPath)))) { | |
402 | // Unexpected path | |
cfdb727a | 403 | throw new ExecutionException(Messages.TraceControl_CommandError + " " + command + "\n" + //$NON-NLS-1$ //$NON-NLS-2$ |
bbb3538a BH |
404 | Messages.TraceControl_UnexpectedPathError + ": " + name); //$NON-NLS-1$ |
405 | } | |
cfdb727a | 406 | |
bbb3538a BH |
407 | SessionInfo sessionInfo = new SessionInfo(name); |
408 | sessionInfo.setSessionPath(path); | |
409 | ||
410 | return sessionInfo; | |
411 | } | |
cfdb727a | 412 | |
bbb3538a BH |
413 | @Override |
414 | public void destroySession(String sessionName, IProgressMonitor monitor) throws ExecutionException { | |
415 | String newName = formatParameter(sessionName); | |
bbb3538a | 416 | |
276c17e7 | 417 | StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_DESTROY_SESSION, newName); |
afe13e7a BH |
418 | |
419 | ICommandResult result = executeCommand(command.toString(), monitor, false); | |
bbb3538a | 420 | String[] output = result.getOutput(); |
cfdb727a | 421 | |
276c17e7 | 422 | if (isError(result) && ((output == null) || (!LTTngControlServiceConstants.SESSION_NOT_FOUND_ERROR_PATTERN.matcher(output[0]).matches()))) { |
afe13e7a | 423 | throw new ExecutionException(Messages.TraceControl_CommandError + " " + command.toString() + "\n" + formatOutput(result)); //$NON-NLS-1$ //$NON-NLS-2$ |
c56972bb | 424 | } |
bbb3538a BH |
425 | //Session <sessionName> destroyed |
426 | } | |
cfdb727a | 427 | |
bbb3538a BH |
428 | /* |
429 | * (non-Javadoc) | |
115b4a01 | 430 | * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#startSession(java.lang.String, org.eclipse.core.runtime.IProgressMonitor) |
bbb3538a BH |
431 | */ |
432 | @Override | |
433 | public void startSession(String sessionName, IProgressMonitor monitor) throws ExecutionException { | |
434 | ||
435 | String newSessionName = formatParameter(sessionName); | |
436 | ||
276c17e7 | 437 | StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_START_SESSION, newSessionName); |
bbb3538a | 438 | |
afe13e7a | 439 | executeCommand(command.toString(), monitor); |
bbb3538a | 440 | |
bbb3538a BH |
441 | //Session <sessionName> started |
442 | } | |
443 | ||
444 | /* | |
445 | * (non-Javadoc) | |
115b4a01 | 446 | * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#stopSession(java.lang.String, org.eclipse.core.runtime.IProgressMonitor) |
bbb3538a BH |
447 | */ |
448 | @Override | |
449 | public void stopSession(String sessionName, IProgressMonitor monitor) throws ExecutionException { | |
450 | String newSessionName = formatParameter(sessionName); | |
276c17e7 | 451 | StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_STOP_SESSION, newSessionName); |
bbb3538a | 452 | |
afe13e7a | 453 | executeCommand(command.toString(), monitor); |
bbb3538a | 454 | |
bbb3538a | 455 | //Session <sessionName> stopped |
cfdb727a | 456 | |
bbb3538a | 457 | } |
cfdb727a | 458 | |
bbb3538a BH |
459 | /* |
460 | * (non-Javadoc) | |
115b4a01 | 461 | * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#enableChannel(java.lang.String, java.util.List, boolean, org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.IChannelInfo, org.eclipse.core.runtime.IProgressMonitor) |
bbb3538a BH |
462 | */ |
463 | @Override | |
498704b3 | 464 | public void enableChannels(String sessionName, List<String> channelNames, boolean isKernel, IChannelInfo info, IProgressMonitor monitor) throws ExecutionException { |
bbb3538a BH |
465 | |
466 | // no channels to enable | |
c56972bb | 467 | if (channelNames.isEmpty()) { |
bbb3538a BH |
468 | return; |
469 | } | |
470 | ||
276c17e7 | 471 | StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_ENABLE_CHANNEL); |
bbb3538a BH |
472 | |
473 | for (Iterator<String> iterator = channelNames.iterator(); iterator.hasNext();) { | |
cfdb727a | 474 | String channel = iterator.next(); |
bbb3538a BH |
475 | command.append(channel); |
476 | if (iterator.hasNext()) { | |
c56972bb | 477 | command.append(','); |
bbb3538a BH |
478 | } |
479 | } | |
480 | ||
481 | if (isKernel) { | |
276c17e7 | 482 | command.append(LTTngControlServiceConstants.OPTION_KERNEL); |
bbb3538a | 483 | } else { |
276c17e7 | 484 | command.append(LTTngControlServiceConstants.OPTION_UST); |
bbb3538a BH |
485 | } |
486 | ||
afe13e7a | 487 | String newSessionName = formatParameter(sessionName); |
276c17e7 | 488 | command.append(LTTngControlServiceConstants.OPTION_SESSION); |
bbb3538a BH |
489 | command.append(newSessionName); |
490 | ||
491 | if (info != null) { | |
492 | // --discard Discard event when buffers are full (default) | |
bbb3538a BH |
493 | |
494 | // --overwrite Flight recorder mode | |
495 | if (info.isOverwriteMode()) { | |
276c17e7 | 496 | command.append(LTTngControlServiceConstants.OPTION_OVERWRITE); |
bbb3538a BH |
497 | } |
498 | // --subbuf-size SIZE Subbuffer size in bytes | |
499 | // (default: 4096, kernel default: 262144) | |
276c17e7 | 500 | command.append(LTTngControlServiceConstants.OPTION_SUB_BUFFER_SIZE); |
bbb3538a BH |
501 | command.append(String.valueOf(info.getSubBufferSize())); |
502 | ||
503 | // --num-subbuf NUM Number of subbufers | |
504 | // (default: 8, kernel default: 4) | |
276c17e7 | 505 | command.append(LTTngControlServiceConstants.OPTION_NUM_SUB_BUFFERS); |
bbb3538a | 506 | command.append(String.valueOf(info.getNumberOfSubBuffers())); |
cfdb727a | 507 | |
bbb3538a | 508 | // --switch-timer USEC Switch timer interval in usec (default: 0) |
276c17e7 | 509 | command.append(LTTngControlServiceConstants.OPTION_SWITCH_TIMER); |
bbb3538a BH |
510 | command.append(String.valueOf(info.getSwitchTimer())); |
511 | ||
512 | // --read-timer USEC Read timer interval in usec (default: 200) | |
276c17e7 | 513 | command.append(LTTngControlServiceConstants.OPTION_READ_TIMER); |
bbb3538a | 514 | command.append(String.valueOf(info.getReadTimer())); |
cfdb727a | 515 | } |
bbb3538a | 516 | |
afe13e7a | 517 | executeCommand(command.toString(), monitor); |
cfdb727a | 518 | |
bbb3538a BH |
519 | } |
520 | ||
521 | /* | |
522 | * (non-Javadoc) | |
115b4a01 | 523 | * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#disableChannel(java.lang.String, java.util.List, org.eclipse.core.runtime.IProgressMonitor) |
bbb3538a BH |
524 | */ |
525 | @Override | |
498704b3 | 526 | public void disableChannels(String sessionName, List<String> channelNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException { |
cfdb727a | 527 | |
bbb3538a | 528 | // no channels to enable |
c56972bb | 529 | if (channelNames.isEmpty()) { |
bbb3538a BH |
530 | return; |
531 | } | |
532 | ||
276c17e7 | 533 | StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_DISABLE_CHANNEL); |
bbb3538a BH |
534 | |
535 | for (Iterator<String> iterator = channelNames.iterator(); iterator.hasNext();) { | |
cfdb727a | 536 | String channel = iterator.next(); |
bbb3538a BH |
537 | command.append(channel); |
538 | if (iterator.hasNext()) { | |
c56972bb | 539 | command.append(','); |
bbb3538a BH |
540 | } |
541 | } | |
542 | ||
543 | if (isKernel) { | |
276c17e7 | 544 | command.append(LTTngControlServiceConstants.OPTION_KERNEL); |
6503ae0f | 545 | } else { |
276c17e7 | 546 | command.append(LTTngControlServiceConstants.OPTION_UST); |
6503ae0f BH |
547 | } |
548 | ||
afe13e7a | 549 | String newSessionName = formatParameter(sessionName); |
276c17e7 | 550 | command.append(LTTngControlServiceConstants.OPTION_SESSION); |
6503ae0f BH |
551 | command.append(newSessionName); |
552 | ||
afe13e7a | 553 | executeCommand(command.toString(), monitor); |
6503ae0f | 554 | } |
cfdb727a | 555 | |
6503ae0f BH |
556 | /* |
557 | * (non-Javadoc) | |
d4514365 | 558 | * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#enableEvents(java.lang.String, java.lang.String, java.util.List, boolean, java.lang.String, org.eclipse.core.runtime.IProgressMonitor) |
6503ae0f BH |
559 | */ |
560 | @Override | |
d4514365 | 561 | public void enableEvents(String sessionName, String channelName, List<String> eventNames, boolean isKernel, String filterExpression, IProgressMonitor monitor) throws ExecutionException { |
6503ae0f | 562 | |
276c17e7 | 563 | StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_ENABLE_EVENT); |
6503ae0f | 564 | |
c56972bb | 565 | if (eventNames == null || eventNames.isEmpty()) { |
276c17e7 | 566 | command.append(LTTngControlServiceConstants.OPTION_ALL); |
3e91c9c0 | 567 | } else { |
3e91c9c0 | 568 | |
7a6e4bfd | 569 | StringBuffer eventNameParameter = new StringBuffer(); |
3e91c9c0 | 570 | for (Iterator<String> iterator = eventNames.iterator(); iterator.hasNext();) { |
cfdb727a | 571 | String event = iterator.next(); |
7a6e4bfd | 572 | eventNameParameter.append(event); |
3e91c9c0 | 573 | if (iterator.hasNext()) { |
7a6e4bfd | 574 | eventNameParameter.append(','); |
3e91c9c0 | 575 | } |
6503ae0f | 576 | } |
7a6e4bfd | 577 | command.append(formatParameter(eventNameParameter.toString())); |
6503ae0f BH |
578 | } |
579 | ||
580 | if (isKernel) { | |
276c17e7 | 581 | command.append(LTTngControlServiceConstants.OPTION_KERNEL); |
bbb3538a | 582 | } else { |
276c17e7 | 583 | command.append(LTTngControlServiceConstants.OPTION_UST); |
bbb3538a BH |
584 | } |
585 | ||
afe13e7a BH |
586 | String newSessionName = formatParameter(sessionName); |
587 | ||
276c17e7 | 588 | command.append(LTTngControlServiceConstants.OPTION_SESSION); |
bbb3538a BH |
589 | command.append(newSessionName); |
590 | ||
6503ae0f | 591 | if (channelName != null) { |
276c17e7 | 592 | command.append(LTTngControlServiceConstants.OPTION_CHANNEL); |
6503ae0f BH |
593 | command.append(channelName); |
594 | } | |
cfdb727a | 595 | |
276c17e7 | 596 | command.append(LTTngControlServiceConstants.OPTION_TRACEPOINT); |
cfdb727a | 597 | |
d4514365 BH |
598 | if (filterExpression != null) { |
599 | command.append(LTTngControlServiceConstants.OPTION_FILTER); | |
600 | command.append('\''); | |
601 | command.append(filterExpression); | |
602 | command.append('\''); | |
603 | } | |
604 | ||
afe13e7a | 605 | executeCommand(command.toString(), monitor); |
cfdb727a | 606 | |
498704b3 | 607 | } |
6503ae0f | 608 | |
498704b3 BH |
609 | /* |
610 | * (non-Javadoc) | |
115b4a01 | 611 | * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#enableSyscalls(java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor) |
498704b3 BH |
612 | */ |
613 | @Override | |
614 | public void enableSyscalls(String sessionName, String channelName, IProgressMonitor monitor) throws ExecutionException { | |
afe13e7a | 615 | |
276c17e7 | 616 | StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_ENABLE_EVENT); |
498704b3 | 617 | |
276c17e7 BH |
618 | command.append(LTTngControlServiceConstants.OPTION_ALL); |
619 | command.append(LTTngControlServiceConstants.OPTION_KERNEL); | |
498704b3 | 620 | |
afe13e7a BH |
621 | String newSessionName = formatParameter(sessionName); |
622 | ||
276c17e7 | 623 | command.append(LTTngControlServiceConstants.OPTION_SESSION); |
498704b3 BH |
624 | command.append(newSessionName); |
625 | ||
626 | if (channelName != null) { | |
276c17e7 | 627 | command.append(LTTngControlServiceConstants.OPTION_CHANNEL); |
498704b3 BH |
628 | command.append(channelName); |
629 | } | |
cfdb727a | 630 | |
276c17e7 | 631 | command.append(LTTngControlServiceConstants.OPTION_SYSCALL); |
cfdb727a | 632 | |
afe13e7a | 633 | executeCommand(command.toString(), monitor); |
498704b3 | 634 | } |
cfdb727a | 635 | |
498704b3 BH |
636 | /* |
637 | * (non-Javadoc) | |
115b4a01 | 638 | * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#enableProbe(java.lang.String, java.lang.String, java.lang.String, java.lang.String, org.eclipse.core.runtime.IProgressMonitor) |
498704b3 BH |
639 | */ |
640 | @Override | |
d132bcc7 | 641 | public void enableProbe(String sessionName, String channelName, String eventName, boolean isFunction, String probe, IProgressMonitor monitor) throws ExecutionException { |
276c17e7 | 642 | StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_ENABLE_EVENT); |
498704b3 BH |
643 | |
644 | command.append(eventName); | |
276c17e7 | 645 | command.append(LTTngControlServiceConstants.OPTION_KERNEL); |
498704b3 | 646 | |
afe13e7a | 647 | String newSessionName = formatParameter(sessionName); |
276c17e7 | 648 | command.append(LTTngControlServiceConstants.OPTION_SESSION); |
498704b3 BH |
649 | command.append(newSessionName); |
650 | ||
651 | if (channelName != null) { | |
276c17e7 | 652 | command.append(LTTngControlServiceConstants.OPTION_CHANNEL); |
498704b3 | 653 | command.append(channelName); |
bbb3538a | 654 | } |
d132bcc7 | 655 | if (isFunction) { |
276c17e7 | 656 | command.append(LTTngControlServiceConstants.OPTION_FUNCTION_PROBE); |
d132bcc7 | 657 | } else { |
276c17e7 | 658 | command.append(LTTngControlServiceConstants.OPTION_PROBE); |
498704b3 | 659 | } |
cfdb727a | 660 | |
498704b3 | 661 | command.append(probe); |
cfdb727a | 662 | |
afe13e7a | 663 | executeCommand(command.toString(), monitor); |
498704b3 | 664 | } |
ccc66d01 BH |
665 | |
666 | /* | |
667 | * (non-Javadoc) | |
d4514365 | 668 | * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#enableLogLevel(java.lang.String, java.lang.String, java.lang.String, org.eclipse.linuxtools.internal.lttng2.core.control.model.LogLevelType, org.eclipse.linuxtools.internal.lttng2.core.control.model.TraceLogLevel, java.lang.String, org.eclipse.core.runtime.IProgressMonitor) |
ccc66d01 BH |
669 | */ |
670 | @Override | |
d4514365 | 671 | public void enableLogLevel(String sessionName, String channelName, String eventName, LogLevelType logLevelType, TraceLogLevel level, String filterExpression, IProgressMonitor monitor) throws ExecutionException { |
276c17e7 | 672 | StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_ENABLE_EVENT); |
ccc66d01 BH |
673 | |
674 | command.append(eventName); | |
276c17e7 | 675 | command.append(LTTngControlServiceConstants.OPTION_UST); |
ccc66d01 | 676 | |
afe13e7a | 677 | String newSessionName = formatParameter(sessionName); |
276c17e7 | 678 | command.append(LTTngControlServiceConstants.OPTION_SESSION); |
ccc66d01 BH |
679 | command.append(newSessionName); |
680 | ||
681 | if (channelName != null) { | |
276c17e7 | 682 | command.append(LTTngControlServiceConstants.OPTION_CHANNEL); |
ccc66d01 BH |
683 | command.append(channelName); |
684 | } | |
cfdb727a | 685 | |
ccc66d01 | 686 | if (logLevelType == LogLevelType.LOGLEVEL) { |
276c17e7 | 687 | command.append(LTTngControlServiceConstants.OPTION_LOGLEVEL); |
ccc66d01 | 688 | } else if (logLevelType == LogLevelType.LOGLEVEL_ONLY) { |
276c17e7 | 689 | command.append(LTTngControlServiceConstants.OPTION_LOGLEVEL_ONLY); |
cfdb727a | 690 | |
ccc66d01 BH |
691 | } else { |
692 | return; | |
693 | } | |
694 | command.append(level.getInName()); | |
cfdb727a | 695 | |
afe13e7a | 696 | executeCommand(command.toString(), monitor); |
ccc66d01 BH |
697 | } |
698 | ||
d4514365 BH |
699 | |
700 | ||
6503ae0f BH |
701 | /* |
702 | * (non-Javadoc) | |
115b4a01 | 703 | * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#disableEvent(java.lang.String, java.lang.String, java.util.List, boolean, org.eclipse.core.runtime.IProgressMonitor) |
6503ae0f BH |
704 | */ |
705 | @Override | |
706 | public void disableEvent(String sessionName, String channelName, List<String> eventNames, boolean isKernel, IProgressMonitor monitor) throws ExecutionException { | |
276c17e7 | 707 | StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_DISABLE_EVENT); |
6503ae0f | 708 | |
3e91c9c0 | 709 | if (eventNames == null) { |
276c17e7 | 710 | command.append(LTTngControlServiceConstants.OPTION_ALL); |
3e91c9c0 | 711 | } else { |
7a6e4bfd | 712 | // no events to disable |
c56972bb | 713 | if (eventNames.isEmpty()) { |
3e91c9c0 BH |
714 | return; |
715 | } | |
6503ae0f | 716 | |
7a6e4bfd | 717 | StringBuffer eventNameParameter = new StringBuffer(); |
3e91c9c0 | 718 | for (Iterator<String> iterator = eventNames.iterator(); iterator.hasNext();) { |
cfdb727a | 719 | String event = iterator.next(); |
7a6e4bfd | 720 | eventNameParameter.append(event); |
3e91c9c0 | 721 | if (iterator.hasNext()) { |
7a6e4bfd | 722 | eventNameParameter.append(','); |
3e91c9c0 | 723 | } |
6503ae0f | 724 | } |
7a6e4bfd | 725 | command.append(formatParameter(eventNameParameter.toString())); |
6503ae0f BH |
726 | } |
727 | ||
728 | if (isKernel) { | |
276c17e7 | 729 | command.append(LTTngControlServiceConstants.OPTION_KERNEL); |
6503ae0f | 730 | } else { |
276c17e7 | 731 | command.append(LTTngControlServiceConstants.OPTION_UST); |
6503ae0f BH |
732 | } |
733 | ||
afe13e7a | 734 | String newSessionName = formatParameter(sessionName); |
276c17e7 | 735 | command.append(LTTngControlServiceConstants.OPTION_SESSION); |
6503ae0f BH |
736 | command.append(newSessionName); |
737 | ||
738 | if (channelName != null) { | |
276c17e7 | 739 | command.append(LTTngControlServiceConstants.OPTION_CHANNEL); |
6503ae0f BH |
740 | command.append(channelName); |
741 | } | |
742 | ||
afe13e7a | 743 | executeCommand(command.toString(), monitor); |
6503ae0f | 744 | } |
b793fbe1 BH |
745 | |
746 | /* | |
747 | * (non-Javadoc) | |
748 | * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#getContexts(org.eclipse.core.runtime.IProgressMonitor) | |
749 | */ | |
750 | @Override | |
751 | public List<String> getContextList(IProgressMonitor monitor) throws ExecutionException { | |
752 | ||
276c17e7 | 753 | StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_ADD_CONTEXT, LTTngControlServiceConstants.OPTION_HELP); |
b793fbe1 | 754 | |
afe13e7a | 755 | ICommandResult result = executeCommand(command.toString(), monitor); |
b793fbe1 | 756 | |
cfdb727a AM |
757 | String[] output = result.getOutput(); |
758 | ||
b793fbe1 | 759 | List<String> contexts = new ArrayList<String>(0); |
cfdb727a | 760 | |
b793fbe1 BH |
761 | int index = 0; |
762 | boolean inList = false; | |
763 | while (index < output.length) { | |
764 | String line = result.getOutput()[index]; | |
cfdb727a | 765 | |
276c17e7 BH |
766 | Matcher startMatcher = LTTngControlServiceConstants.ADD_CONTEXT_HELP_CONTEXTS_INTRO.matcher(line); |
767 | Matcher endMatcher = LTTngControlServiceConstants.ADD_CONTEXT_HELP_CONTEXTS_END_LINE.matcher(line); | |
b793fbe1 BH |
768 | |
769 | if (startMatcher.matches()) { | |
770 | inList = true; | |
771 | } else if (endMatcher.matches()) { | |
772 | break; | |
773 | } else if (inList == true) { | |
774 | String[] tmp = line.split(","); //$NON-NLS-1$ | |
775 | for (int i = 0; i < tmp.length; i++) { | |
776 | contexts.add(tmp[i].trim()); | |
777 | } | |
778 | } | |
779 | index++; | |
780 | } | |
781 | return contexts; | |
782 | } | |
783 | ||
784 | /* | |
785 | * (non-Javadoc) | |
786 | * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#addContexts(java.lang.String, java.lang.String, java.lang.String, boolean, java.util.List, org.eclipse.core.runtime.IProgressMonitor) | |
787 | */ | |
788 | @Override | |
789 | public void addContexts(String sessionName, String channelName, String eventName, boolean isKernel, List<String> contextNames, IProgressMonitor monitor) throws ExecutionException { | |
276c17e7 | 790 | StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_ADD_CONTEXT); |
b793fbe1 | 791 | |
afe13e7a | 792 | String newSessionName = formatParameter(sessionName); |
276c17e7 | 793 | command.append(LTTngControlServiceConstants.OPTION_SESSION); |
b793fbe1 | 794 | command.append(newSessionName); |
cfdb727a | 795 | |
b793fbe1 | 796 | if (channelName != null) { |
276c17e7 | 797 | command.append(LTTngControlServiceConstants.OPTION_CHANNEL); |
b793fbe1 BH |
798 | command.append(channelName); |
799 | } | |
800 | ||
801 | if (eventName != null) { | |
276c17e7 | 802 | command.append(LTTngControlServiceConstants.OPTION_EVENT); |
b793fbe1 BH |
803 | command.append(eventName); |
804 | } | |
805 | ||
806 | if (isKernel) { | |
276c17e7 | 807 | command.append(LTTngControlServiceConstants.OPTION_KERNEL); |
b793fbe1 | 808 | } else { |
276c17e7 | 809 | command.append(LTTngControlServiceConstants.OPTION_UST); |
b793fbe1 | 810 | } |
cfdb727a | 811 | |
b793fbe1 | 812 | for (Iterator<String> iterator = contextNames.iterator(); iterator.hasNext();) { |
cfdb727a | 813 | String context = iterator.next(); |
276c17e7 | 814 | command.append(LTTngControlServiceConstants.OPTION_CONTEXT_TYPE); |
b793fbe1 BH |
815 | command.append(context); |
816 | } | |
817 | ||
afe13e7a | 818 | executeCommand(command.toString(), monitor); |
cfdb727a | 819 | |
b793fbe1 BH |
820 | } |
821 | ||
b720ac44 BH |
822 | /* |
823 | * (non-Javadoc) | |
824 | * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService#calibrate(boolean, org.eclipse.core.runtime.IProgressMonitor) | |
825 | */ | |
826 | @Override | |
827 | public void calibrate(boolean isKernel, IProgressMonitor monitor) throws ExecutionException { | |
828 | // String newSessionName = formatParameter(sessionName); | |
276c17e7 | 829 | StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_CALIBRATE); |
b720ac44 BH |
830 | // |
831 | // command.append(OPTION_SESSION); | |
832 | // command.append(newSessionName); | |
833 | ||
834 | if (isKernel) { | |
276c17e7 | 835 | command.append(LTTngControlServiceConstants.OPTION_KERNEL); |
b720ac44 | 836 | } else { |
276c17e7 | 837 | command.append(LTTngControlServiceConstants.OPTION_UST); |
b720ac44 BH |
838 | } |
839 | ||
276c17e7 | 840 | command.append(LTTngControlServiceConstants.OPTION_FUNCTION_PROBE); |
b720ac44 | 841 | |
afe13e7a | 842 | executeCommand(command.toString(), monitor); |
b720ac44 | 843 | } |
cfdb727a | 844 | |
eb1bab5b BH |
845 | // ------------------------------------------------------------------------ |
846 | // Helper methods | |
847 | // ------------------------------------------------------------------------ | |
848 | /** | |
849 | * Checks if command result is an error result. | |
cfdb727a | 850 | * |
4775bcbf BH |
851 | * @param result |
852 | * - the command result to check | |
eb1bab5b BH |
853 | * @return true if error else false |
854 | */ | |
276c17e7 BH |
855 | protected boolean isError(ICommandResult result) { |
856 | if ((result.getResult()) != 0 || (result.getOutput().length < 1 || LTTngControlServiceConstants.ERROR_PATTERN.matcher(result.getOutput()[0]).matches())) { | |
eb1bab5b BH |
857 | return true; |
858 | } | |
859 | return false; | |
860 | } | |
4775bcbf | 861 | |
eb1bab5b BH |
862 | /** |
863 | * Formats the output string as single string. | |
cfdb727a | 864 | * |
ea21cd65 | 865 | * @param result |
4775bcbf | 866 | * - output array |
eb1bab5b BH |
867 | * @return - the formatted output |
868 | */ | |
7a6e4bfd | 869 | public static String formatOutput(ICommandResult result) { |
afe13e7a | 870 | if ((result == null) || result.getOutput() == null || result.getOutput().length == 0) { |
eb1bab5b BH |
871 | return ""; //$NON-NLS-1$ |
872 | } | |
afe13e7a | 873 | String[] output = result.getOutput(); |
eb1bab5b | 874 | StringBuffer ret = new StringBuffer(); |
afe13e7a BH |
875 | ret.append("Return Value: "); //$NON-NLS-1$ |
876 | ret.append(result.getResult()); | |
877 | ret.append("\n"); //$NON-NLS-1$ | |
eb1bab5b BH |
878 | for (int i = 0; i < output.length; i++) { |
879 | ret.append(output[i] + "\n"); //$NON-NLS-1$ | |
880 | } | |
881 | return ret.toString(); | |
882 | } | |
4775bcbf | 883 | |
eb1bab5b BH |
884 | /** |
885 | * Parses the domain information. | |
cfdb727a | 886 | * |
4775bcbf BH |
887 | * @param output |
888 | * - a command output array | |
889 | * @param currentIndex | |
890 | * - current index in command output array | |
891 | * @param channels | |
892 | * - list for returning channel information | |
893 | * @return the new current index in command output array | |
eb1bab5b | 894 | */ |
276c17e7 | 895 | protected int parseDomain(String[] output, int currentIndex, List<IChannelInfo> channels) { |
eb1bab5b BH |
896 | int index = currentIndex; |
897 | ||
4775bcbf BH |
898 | // Channels: |
899 | // ------------- | |
900 | // - channnel1: [enabled] | |
901 | // | |
902 | // Attributes: | |
903 | // overwrite mode: 0 | |
904 | // subbufers size: 262144 | |
905 | // number of subbufers: 4 | |
906 | // switch timer interval: 0 | |
907 | // read timer interval: 200 | |
908 | // output: splice() | |
909 | ||
eb1bab5b BH |
910 | while (index < output.length) { |
911 | String line = output[index]; | |
4775bcbf | 912 | |
276c17e7 | 913 | Matcher outerMatcher = LTTngControlServiceConstants.CHANNELS_SECTION_PATTERN.matcher(line); |
4775bcbf | 914 | if (outerMatcher.matches()) { |
eb1bab5b BH |
915 | IChannelInfo channelInfo = null; |
916 | while (index < output.length) { | |
917 | String subLine = output[index]; | |
4775bcbf | 918 | |
276c17e7 | 919 | Matcher innerMatcher = LTTngControlServiceConstants.CHANNEL_PATTERN.matcher(subLine); |
4775bcbf | 920 | if (innerMatcher.matches()) { |
eb1bab5b | 921 | channelInfo = new ChannelInfo(""); //$NON-NLS-1$ |
4775bcbf BH |
922 | // get channel name |
923 | channelInfo.setName(innerMatcher.group(1)); | |
924 | ||
925 | // get channel enablement | |
926 | channelInfo.setState(innerMatcher.group(2)); | |
927 | ||
928 | // add channel | |
929 | channels.add(channelInfo); | |
930 | ||
276c17e7 | 931 | } else if (LTTngControlServiceConstants.OVERWRITE_MODE_ATTRIBUTE.matcher(subLine).matches()) { |
eb1bab5b | 932 | String value = getAttributeValue(subLine); |
64636df8 BH |
933 | if (channelInfo != null) { |
934 | channelInfo.setOverwriteMode(!LTTngControlServiceConstants.OVERWRITE_MODE_ATTRIBUTE_FALSE.equals(value)); | |
935 | } | |
276c17e7 | 936 | } else if (LTTngControlServiceConstants.SUBBUFFER_SIZE_ATTRIBUTE.matcher(subLine).matches()) { |
64636df8 BH |
937 | if (channelInfo != null) { |
938 | channelInfo.setSubBufferSize(Long.valueOf(getAttributeValue(subLine))); | |
939 | } | |
4775bcbf | 940 | |
276c17e7 | 941 | } else if (LTTngControlServiceConstants.NUM_SUBBUFFERS_ATTRIBUTE.matcher(subLine).matches()) { |
64636df8 BH |
942 | if (channelInfo != null) { |
943 | channelInfo.setNumberOfSubBuffers(Integer.valueOf(getAttributeValue(subLine))); | |
944 | } | |
4775bcbf | 945 | |
276c17e7 | 946 | } else if (LTTngControlServiceConstants.SWITCH_TIMER_ATTRIBUTE.matcher(subLine).matches()) { |
64636df8 BH |
947 | if (channelInfo != null) { |
948 | channelInfo.setSwitchTimer(Long.valueOf(getAttributeValue(subLine))); | |
949 | } | |
4775bcbf | 950 | |
276c17e7 | 951 | } else if (LTTngControlServiceConstants.READ_TIMER_ATTRIBUTE.matcher(subLine).matches()) { |
64636df8 BH |
952 | if (channelInfo != null) { |
953 | channelInfo.setReadTimer(Long.valueOf(getAttributeValue(subLine))); | |
954 | } | |
4775bcbf | 955 | |
276c17e7 | 956 | } else if (LTTngControlServiceConstants.OUTPUT_ATTRIBUTE.matcher(subLine).matches()) { |
64636df8 BH |
957 | if (channelInfo != null) { |
958 | channelInfo.setOutputType(getAttributeValue(subLine)); | |
959 | } | |
4775bcbf | 960 | |
276c17e7 | 961 | } else if (LTTngControlServiceConstants.EVENT_SECTION_PATTERN.matcher(subLine).matches()) { |
4775bcbf | 962 | List<IEventInfo> events = new ArrayList<IEventInfo>(); |
eb1bab5b | 963 | index = parseEvents(output, index, events); |
64636df8 BH |
964 | if (channelInfo != null) { |
965 | channelInfo.setEvents(events); | |
966 | } | |
4775bcbf BH |
967 | // we want to stay at the current index to be able to |
968 | // exit the domain | |
eb1bab5b | 969 | continue; |
276c17e7 | 970 | } else if (LTTngControlServiceConstants.DOMAIN_KERNEL_PATTERN.matcher(subLine).matches()) { |
eb1bab5b BH |
971 | return index; |
972 | ||
276c17e7 | 973 | } else if (LTTngControlServiceConstants.DOMAIN_UST_GLOBAL_PATTERN.matcher(subLine).matches()) { |
eb1bab5b BH |
974 | return index; |
975 | } | |
976 | index++; | |
977 | } | |
978 | } | |
979 | index++; | |
980 | } | |
981 | return index; | |
982 | } | |
983 | ||
984 | /** | |
985 | * Parses the event information within a domain. | |
cfdb727a | 986 | * |
4775bcbf BH |
987 | * @param output |
988 | * - a command output array | |
989 | * @param currentIndex | |
990 | * - current index in command output array | |
991 | * @param events | |
992 | * - list for returning event information | |
eb1bab5b | 993 | * @return the new current index in command output array |
eb1bab5b | 994 | */ |
276c17e7 | 995 | protected int parseEvents(String[] output, int currentIndex, List<IEventInfo> events) { |
eb1bab5b BH |
996 | int index = currentIndex; |
997 | ||
998 | while (index < output.length) { | |
999 | String line = output[index]; | |
276c17e7 | 1000 | if (LTTngControlServiceConstants.CHANNEL_PATTERN.matcher(line).matches()) { |
eb1bab5b BH |
1001 | // end of channel |
1002 | return index; | |
276c17e7 | 1003 | } else if (LTTngControlServiceConstants.DOMAIN_KERNEL_PATTERN.matcher(line).matches()) { |
eb1bab5b BH |
1004 | // end of domain |
1005 | return index; | |
276c17e7 | 1006 | } else if (LTTngControlServiceConstants.DOMAIN_UST_GLOBAL_PATTERN.matcher(line).matches()) { |
eb1bab5b BH |
1007 | // end of domain |
1008 | return index; | |
cfdb727a | 1009 | } |
4775bcbf | 1010 | |
276c17e7 BH |
1011 | Matcher matcher = LTTngControlServiceConstants.EVENT_PATTERN.matcher(line); |
1012 | Matcher matcher2 = LTTngControlServiceConstants.WILDCARD_EVENT_PATTERN.matcher(line); | |
4775bcbf BH |
1013 | |
1014 | if (matcher.matches()) { | |
1015 | IEventInfo eventInfo = new EventInfo(matcher.group(1).trim()); | |
1016 | eventInfo.setLogLevel(matcher.group(2).trim()); | |
1017 | eventInfo.setEventType(matcher.group(3).trim()); | |
1018 | eventInfo.setState(matcher.group(4)); | |
d4514365 BH |
1019 | String filter = matcher.group(5); |
1020 | if (filter != null) { | |
1021 | filter = filter.substring(1, filter.length() - 1); // remove '[' and ']' | |
1022 | eventInfo.setFilterExpression(filter); | |
1023 | } | |
4775bcbf | 1024 | events.add(eventInfo); |
d132bcc7 | 1025 | index++; |
4775bcbf BH |
1026 | } else if (matcher2.matches()) { |
1027 | IEventInfo eventInfo = new EventInfo(matcher2.group(1).trim()); | |
1028 | eventInfo.setLogLevel(TraceLogLevel.LEVEL_UNKNOWN); | |
1029 | eventInfo.setEventType(matcher2.group(2).trim()); | |
1030 | eventInfo.setState(matcher2.group(3)); | |
d4514365 BH |
1031 | String filter = matcher2.group(4); |
1032 | if (filter != null) { | |
1033 | filter = filter.substring(1, filter.length() - 1); // remove '[' and ']' | |
1034 | eventInfo.setFilterExpression(filter); | |
1035 | } | |
cfdb727a | 1036 | |
d132bcc7 BH |
1037 | if (eventInfo.getEventType() == TraceEventType.PROBE) { |
1038 | IProbeEventInfo probeEvent = new ProbeEventInfo(eventInfo.getName()); | |
1039 | probeEvent.setLogLevel(eventInfo.getLogLevel()); | |
1040 | probeEvent.setEventType(eventInfo.getEventType()); | |
1041 | probeEvent.setState(eventInfo.getState()); | |
1042 | ||
1043 | // Overwrite eventinfo | |
1044 | eventInfo = probeEvent; | |
1045 | ||
1046 | // myevent2 (type: probe) [enabled] | |
1047 | // addr: 0xc0101340 | |
1048 | // myevent0 (type: probe) [enabled] | |
1049 | // offset: 0x0 | |
1050 | // symbol: init_post | |
1051 | index++; | |
1052 | while (index < output.length) { | |
1053 | String probeLine = output[index]; | |
1054 | // parse probe | |
276c17e7 BH |
1055 | Matcher addrMatcher = LTTngControlServiceConstants.PROBE_ADDRESS_PATTERN.matcher(probeLine); |
1056 | Matcher offsetMatcher = LTTngControlServiceConstants.PROBE_OFFSET_PATTERN.matcher(probeLine); | |
1057 | Matcher symbolMatcher = LTTngControlServiceConstants.PROBE_SYMBOL_PATTERN.matcher(probeLine); | |
d132bcc7 BH |
1058 | if (addrMatcher.matches()) { |
1059 | String addr = addrMatcher.group(2).trim(); | |
1060 | probeEvent.setAddress(addr); | |
1061 | } else if (offsetMatcher.matches()) { | |
1062 | String offset = offsetMatcher.group(2).trim(); | |
1063 | probeEvent.setOffset(offset); | |
1064 | } else if (symbolMatcher.matches()) { | |
1065 | String symbol = symbolMatcher.group(2).trim(); | |
1066 | probeEvent.setSymbol(symbol); | |
276c17e7 | 1067 | } else if ((LTTngControlServiceConstants.EVENT_PATTERN.matcher(probeLine).matches()) || (LTTngControlServiceConstants.WILDCARD_EVENT_PATTERN.matcher(probeLine).matches())) { |
d132bcc7 | 1068 | break; |
276c17e7 | 1069 | } else if (LTTngControlServiceConstants.CHANNEL_PATTERN.matcher(probeLine).matches()) { |
d132bcc7 | 1070 | break; |
276c17e7 | 1071 | } else if (LTTngControlServiceConstants.DOMAIN_KERNEL_PATTERN.matcher(probeLine).matches()) { |
d132bcc7 BH |
1072 | // end of domain |
1073 | break; | |
276c17e7 | 1074 | } else if (LTTngControlServiceConstants.DOMAIN_UST_GLOBAL_PATTERN.matcher(probeLine).matches()) { |
d132bcc7 BH |
1075 | // end of domain |
1076 | break; | |
1077 | } | |
1078 | index++; | |
1079 | } | |
1080 | events.add(eventInfo); | |
1081 | } else { | |
1082 | events.add(eventInfo); | |
1083 | index++; | |
1084 | continue; | |
1085 | } | |
1086 | } else { | |
1087 | index++; | |
eb1bab5b BH |
1088 | } |
1089 | // else if (line.matches(EVENT_NONE_PATTERN)) { | |
1090 | // do nothing | |
cfdb727a | 1091 | // } else |
d132bcc7 | 1092 | |
eb1bab5b BH |
1093 | } |
1094 | ||
1095 | return index; | |
1096 | } | |
1097 | ||
1098 | /** | |
1099 | * Parses a line with attributes: <attribute Name>: <attribute value> | |
cfdb727a | 1100 | * |
4775bcbf BH |
1101 | * @param line |
1102 | * - attribute line to parse | |
eb1bab5b | 1103 | * @return the attribute value as string |
eb1bab5b | 1104 | */ |
276c17e7 | 1105 | protected String getAttributeValue(String line) { |
eb1bab5b BH |
1106 | String[] temp = line.split("\\: "); //$NON-NLS-1$ |
1107 | return temp[1]; | |
1108 | } | |
1109 | ||
1110 | /** | |
4775bcbf | 1111 | * Parses the event information within a provider. |
cfdb727a | 1112 | * |
4775bcbf BH |
1113 | * @param output |
1114 | * - a command output array | |
1115 | * @param currentIndex | |
1116 | * - current index in command output array | |
1117 | * @param events | |
1118 | * - list for returning event information | |
eb1bab5b BH |
1119 | * @return the new current index in command output array |
1120 | */ | |
276c17e7 | 1121 | protected int getProviderEventInfo(String[] output, int currentIndex, List<IBaseEventInfo> events) { |
eb1bab5b | 1122 | int index = currentIndex; |
d4514365 | 1123 | IBaseEventInfo eventInfo = null; |
eb1bab5b BH |
1124 | while (index < output.length) { |
1125 | String line = output[index]; | |
276c17e7 | 1126 | Matcher matcher = LTTngControlServiceConstants.PROVIDER_EVENT_PATTERN.matcher(line); |
4775bcbf | 1127 | if (matcher.matches()) { |
d4514365 BH |
1128 | // sched_kthread_stop (loglevel: TRACE_EMERG0) (type: tracepoint) |
1129 | eventInfo = new BaseEventInfo(matcher.group(1).trim()); | |
4775bcbf BH |
1130 | eventInfo.setLogLevel(matcher.group(2).trim()); |
1131 | eventInfo.setEventType(matcher.group(3).trim()); | |
1132 | events.add(eventInfo); | |
d4514365 BH |
1133 | index++; |
1134 | } else if (LTTngControlServiceConstants.EVENT_FIELD_PATTERN.matcher(line).matches()) { | |
1135 | if (eventInfo != null) { | |
1136 | List<IFieldInfo> fields = new ArrayList<IFieldInfo>(); | |
1137 | index = getFieldInfo(output, index, fields); | |
1138 | eventInfo.setFields(fields); | |
1139 | } else { | |
1140 | index++; | |
1141 | } | |
1142 | } | |
1143 | else if (LTTngControlServiceConstants.UST_PROVIDER_PATTERN.matcher(line).matches()) { | |
1144 | return index; | |
1145 | } else { | |
1146 | index++; | |
1147 | } | |
1148 | } | |
1149 | return index; | |
1150 | } | |
1151 | ||
1152 | ||
1153 | protected int getFieldInfo(String[] output, int currentIndex, List<IFieldInfo> fields) { | |
1154 | int index = currentIndex; | |
1155 | IFieldInfo fieldInfo = null; | |
1156 | while (index < output.length) { | |
1157 | String line = output[index]; | |
1158 | Matcher matcher = LTTngControlServiceConstants.EVENT_FIELD_PATTERN.matcher(line); | |
1159 | if (matcher.matches()) { | |
1160 | // field: content (string) | |
1161 | fieldInfo = new FieldInfo(matcher.group(2).trim()); | |
1162 | fieldInfo.setFieldType(matcher.group(3).trim()); | |
1163 | fields.add(fieldInfo); | |
1164 | } else if (LTTngControlServiceConstants.PROVIDER_EVENT_PATTERN.matcher(line).matches()) { | |
1165 | return index; | |
276c17e7 | 1166 | } else if (LTTngControlServiceConstants.UST_PROVIDER_PATTERN.matcher(line).matches()) { |
eb1bab5b BH |
1167 | return index; |
1168 | } | |
1169 | index++; | |
1170 | } | |
1171 | return index; | |
1172 | } | |
1173 | ||
d4514365 BH |
1174 | |
1175 | ||
bbb3538a | 1176 | /** |
cfdb727a | 1177 | * Formats a command parameter for the command execution i.e. adds quotes |
bbb3538a BH |
1178 | * at the beginning and end if necessary. |
1179 | * @param parameter - parameter to format | |
1180 | * @return formated parameter | |
1181 | */ | |
276c17e7 | 1182 | protected String formatParameter(String parameter) { |
bbb3538a | 1183 | if (parameter != null) { |
c56972bb BH |
1184 | StringBuffer newString = new StringBuffer(); |
1185 | newString.append(parameter); | |
bbb3538a | 1186 | |
7a6e4bfd | 1187 | if (parameter.contains(" ") || parameter.contains("*")) { //$NON-NLS-1$ //$NON-NLS-2$ |
c56972bb BH |
1188 | newString.insert(0, "\""); //$NON-NLS-1$ |
1189 | newString.append("\""); //$NON-NLS-1$ | |
bbb3538a | 1190 | } |
c56972bb | 1191 | return newString.toString(); |
bbb3538a BH |
1192 | } |
1193 | return null; | |
1194 | } | |
afe13e7a BH |
1195 | |
1196 | /** | |
1197 | * @param strings array of string that makes up a command line | |
1198 | * @return string buffer with created command line | |
1199 | */ | |
276c17e7 | 1200 | protected StringBuffer createCommand(String... strings) { |
afe13e7a | 1201 | StringBuffer command = new StringBuffer(); |
276c17e7 | 1202 | command.append(LTTngControlServiceConstants.CONTROL_COMMAND); |
afe13e7a BH |
1203 | command.append(getTracingGroupOption()); |
1204 | command.append(getVerboseOption()); | |
1205 | for (String string : strings) { | |
1206 | command.append(string); | |
1207 | } | |
1208 | return command; | |
1209 | } | |
1210 | ||
1211 | /** | |
1212 | * @return the tracing group option if configured in the preferences | |
1213 | */ | |
276c17e7 | 1214 | protected String getTracingGroupOption() { |
afe13e7a | 1215 | if (!ControlPreferences.getInstance().isDefaultTracingGroup() && !ControlPreferences.getInstance().getTracingGroup().equals("")) { //$NON-NLS-1$ |
276c17e7 | 1216 | return LTTngControlServiceConstants.OPTION_TRACING_GROUP + ControlPreferences.getInstance().getTracingGroup(); |
afe13e7a BH |
1217 | } |
1218 | return ""; //$NON-NLS-1$ | |
1219 | } | |
1220 | ||
1221 | /** | |
1222 | * @return the verbose option as configured in the preferences | |
1223 | */ | |
276c17e7 | 1224 | protected String getVerboseOption() { |
afe13e7a BH |
1225 | if (ControlPreferences.getInstance().isLoggingEnabled()) { |
1226 | String level = ControlPreferences.getInstance().getVerboseLevel(); | |
1227 | if (ControlPreferences.TRACE_CONTROL_VERBOSE_LEVEL_VERBOSE.equals(level)) { | |
276c17e7 | 1228 | return LTTngControlServiceConstants.OPTION_VERBOSE; |
afe13e7a BH |
1229 | } |
1230 | if (ControlPreferences.TRACE_CONTROL_VERBOSE_LEVEL_V_VERBOSE.equals(level)) { | |
276c17e7 | 1231 | return LTTngControlServiceConstants.OPTION_VERY_VERBOSE; |
cfdb727a | 1232 | } |
afe13e7a | 1233 | if (ControlPreferences.TRACE_CONTROL_VERBOSE_LEVEL_V_V_VERBOSE.equals(level)) { |
276c17e7 | 1234 | return LTTngControlServiceConstants.OPTION_VERY_VERY_VERBOSE; |
afe13e7a BH |
1235 | } |
1236 | } | |
1237 | return ""; //$NON-NLS-1$ | |
1238 | } | |
1239 | ||
1240 | /** | |
cfdb727a AM |
1241 | * Method that logs the command and command result if logging is enabled as |
1242 | * well as forwards the command execution to the shell. | |
1243 | * | |
1244 | * @param command | |
1245 | * - the command to execute | |
1246 | * @param monitor | |
1247 | * - a progress monitor | |
afe13e7a BH |
1248 | * @return the command result |
1249 | * @throws ExecutionException | |
6f4e8ec0 | 1250 | * If the command fails |
afe13e7a | 1251 | */ |
cfdb727a AM |
1252 | protected ICommandResult executeCommand(String command, |
1253 | IProgressMonitor monitor) throws ExecutionException { | |
afe13e7a BH |
1254 | return executeCommand(command, monitor, true); |
1255 | } | |
cfdb727a | 1256 | |
afe13e7a | 1257 | /** |
cfdb727a AM |
1258 | * Method that logs the command and command result if logging is enabled as |
1259 | * well as forwards the command execution to the shell. | |
1260 | * | |
1261 | * @param command | |
1262 | * - the command to execute | |
1263 | * @param monitor | |
1264 | * - a progress monitor | |
1265 | * @param checkForError | |
1266 | * - true to verify command result, else false | |
afe13e7a | 1267 | * @return the command result |
cfdb727a AM |
1268 | * @throws ExecutionException |
1269 | * in case of error result | |
afe13e7a | 1270 | */ |
cfdb727a AM |
1271 | protected ICommandResult executeCommand(String command, |
1272 | IProgressMonitor monitor, boolean checkForError) | |
1273 | throws ExecutionException { | |
afe13e7a BH |
1274 | if (ControlPreferences.getInstance().isLoggingEnabled()) { |
1275 | ControlCommandLogger.log(command); | |
1276 | } | |
1277 | ||
cfdb727a AM |
1278 | ICommandResult result = fCommandShell.executeCommand( |
1279 | command.toString(), monitor); | |
1280 | ||
afe13e7a BH |
1281 | if (ControlPreferences.getInstance().isLoggingEnabled()) { |
1282 | ControlCommandLogger.log(formatOutput(result)); | |
1283 | } | |
1284 | ||
a07c7629 | 1285 | if (checkForError && isError(result)) { |
cfdb727a AM |
1286 | throw new ExecutionException(Messages.TraceControl_CommandError |
1287 | + " " + command.toString() + "\n" + formatOutput(result)); //$NON-NLS-1$ //$NON-NLS-2$ | |
afe13e7a | 1288 | } |
cfdb727a | 1289 | |
afe13e7a BH |
1290 | return result; |
1291 | } | |
eb1bab5b | 1292 | } |