blob: c8cf559e49cc4c9087414f302bd02b151f906baf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
/*******************************************************************************
* Copyright (c) 2008, 2009 Wind River Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.examples.dsf.pda.service.commands;
import org.eclipse.cdt.dsf.concurrent.Immutable;
import org.eclipse.cdt.examples.dsf.pda.service.PDAVirtualMachineDMContext;
/**
* Sets a watchpoint on a given variable
*
* <pre>
* C: watch {function}::{variable_name} {watch_operation}
* R: ok
* C: vmresume
* R: vmresumed client
* E: vmsuspended {thread_id} watch {watch_operation} {function}::{variable_name}
* </pre>
*/
@Immutable
public class PDAWatchCommand extends AbstractPDACommand<PDACommandResult> {
public enum WatchOperation { READ, WRITE, BOTH, NONE };
private static int getWatchOperationCode(WatchOperation operation) {
switch (operation) {
case READ:
return 1;
case WRITE:
return 2;
case BOTH:
return 3;
default:
return 0;
}
}
public PDAWatchCommand(PDAVirtualMachineDMContext context, String function, String variable, WatchOperation operation) {
super(context, "watch " + function+ "::" + variable + " " + getWatchOperationCode(operation));
}
@Override
public PDACommandResult createResult(String resultText) {
return new PDACommandResult(resultText);
}
}
|