Bundle-Vendor: Samsung Electronics
Require-Bundle: org.eclipse.core.runtime;bundle-version="3.4.0",
org.eclipse.ui;bundle-version="3.4.0",
- com.samsung.slp.common.conn;bundle-version="1.0.0"
+ com.samsung.slp.common.connection;bundle-version="1.0.0",
+ com.samsung.slp.common;bundle-version="1.3.20"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Export-Package: com.samsung.linuxplatform.oprofile.core,
import java.util.ArrayList;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.widgets.Display;
import com.samsung.linuxplatform.oprofile.core.provider.OpcontrolDataProvider;
-import com.samsung.slp.common.conn.device.DeviceManager;
-import com.samsung.slp.common.conn.machine.DeviceMachine;
-import com.samsung.slp.common.conn.machine.IMachine;
-import com.samsung.slp.common.conn.session.ISession;
-import com.samsung.slp.common.conn.session.SessionManager;
+import com.samsung.slp.common.connection.ConnectionPlugin;
public abstract class OprofileComm {
return sb.toString();
}
- // changed by greatim 2011.06.01 for fresh ide
- public static ISession getSession() throws InterruptedException{
- ISession session = null;
- try {
- DeviceMachine selected = DeviceManager.getSelectedDevice();
- if(selected.getMachineType().equals(IMachine.VIRTUAL_DEVICE))
- session = SessionManager.getSession("OPROFILER_CONTROL_VIRTUAL", selected, new NullProgressMonitor());
- else
- session = SessionManager.getSession("OPROFILER_CONTROL_REAL", selected, new NullProgressMonitor());
- } catch (Exception e) {
-
- }
- return session;
- }
+// // changed by greatim 2011.06.01 for fresh ide
+// public static ISession getSession() throws InterruptedException{
+// ISession session = null;
+// try {
+// DeviceMachine selected = DeviceManager.getSelectedDevice();
+// if(selected.getMachineType().equals(IMachine.VIRTUAL_DEVICE))
+// session = SessionManager.getSession("OPROFILER_CONTROL_VIRTUAL", selected, new NullProgressMonitor());
+// else
+// session = SessionManager.getSession("OPROFILER_CONTROL_REAL", selected, new NullProgressMonitor());
+// } catch (Exception e) {
+//
+// }
+// return session;
+// }
// changed by greatim 2011.06.01 for fresh ide
public static boolean checkTarget() {
- boolean reachable = false;
- try {
- reachable = DeviceManager.getSelectedDevice().isReachable();
- } catch (Exception e) {
-
+ if(null != ConnectionPlugin.getDefault().getCurrentDevice()){
+ return true;
}
-
- return reachable;
+ else
+ return false;
}
}
package com.samsung.linuxplatform.oprofile.core.processor.checkevent;
-import org.eclipse.linuxtools.oprofile.core.PathParser;
-
import com.samsung.linuxplatform.oprofile.core.OprofileCommonConstants;
-import com.samsung.slp.common.conn.session.ISession;
+import org.eclipse.linuxtools.oprofile.core.CommandManager;
+public class CheckEventsProcessor {
-public class CheckEventsProcessor{
-
- private ISession session;
-
- public CheckEventsProcessor(ISession session)
- throws InterruptedException{
- if(session==null)
- throw new InterruptedException("Target isn't connected or valid");
+ private final String COMMAND_CHECK_EVENT = OprofileCommonConstants.COMMAND_OPHELP
+ + " -e";
+
+ public void parse(String event, int count, int unitmask, int[] result)
+ throws InterruptedException {
+ String[] resultStr = null;
- this.session = session;
- }
-
- private final String COMMAND_CHECK_EVENT = OprofileCommonConstants.COMMAND_OPHELP+" -e";
-
- public void parse(String event, int count, int unitmask, int[] result)
- throws InterruptedException{
- String resultStr= null;
-
-
try {
- resultStr = session.run(COMMAND_CHECK_EVENT+" "+event+":"+count+":"+unitmask, null);
- resultStr = PathParser.pathParsing(resultStr);
+ // resultStr =
+ // session.run(COMMAND_CHECK_EVENT+" "+event+":"+count+":"+unitmask,
+ // null);
+ resultStr = CommandManager
+ .runCommandReturningResultArray(COMMAND_CHECK_EVENT + " "
+ + event + ":" + count + ":" + unitmask);
} catch (Exception e) {
throw new InterruptedException();
}
-
- if(resultStr!=null&&resultStr.trim().length()>0){
+
+ if (resultStr != null && resultStr.length > 0
+ && resultStr[0].trim().length() > 0) {
try {
- result[0] = Integer.parseInt(resultStr.trim());
+ result[0] = Integer.parseInt(resultStr[0].trim());
} catch (NumberFormatException e) {
result[0] = -1;
}
}
-
}
-
-
+
}
package com.samsung.linuxplatform.oprofile.core.processor.checkkernel;
-import org.eclipse.linuxtools.oprofile.core.PathParser;
+import org.eclipse.linuxtools.oprofile.core.CommandManager;
import com.samsung.linuxplatform.oprofile.core.OprofileCommonConstants;
-import com.samsung.slp.common.conn.session.ISession;
+public class CheckKernelProcessor {
-public class CheckKernelProcessor{
-
- private ISession session;
-
- public CheckKernelProcessor(ISession session)
- throws InterruptedException{
- if(session==null)
- throw new InterruptedException("Target isn't connected or valid");
+ private final String COMMAND_CHECK_KERNEL = "cat "
+ + OprofileCommonConstants.DEV_CPU_TYPE + " 2> /dev/null; echo";
+
+ public void parse(String[] result) throws InterruptedException {
+ String[] resultStr = null;
- this.session = session;
- }
-
- private final String COMMAND_CHECK_KERNEL = "cat "+OprofileCommonConstants.DEV_CPU_TYPE+" 2> /dev/null; echo";
-
- public void parse(String[] result)
- throws InterruptedException{
- String resultStr= null;
-
try {
- resultStr = session.run(COMMAND_CHECK_KERNEL, null);
- resultStr = PathParser.pathParsing(resultStr);
+ // resultStr = session.run(COMMAND_CHECK_KERNEL, null);
+ resultStr = CommandManager
+ .runCommandReturningResultArray(COMMAND_CHECK_KERNEL);
+
} catch (Exception e) {
throw new InterruptedException();
}
-
- if(resultStr!=null&&resultStr.trim().length()>0){
- result[0] = resultStr.trim();
+
+ if (resultStr != null && resultStr.length > 0
+ && resultStr[0].trim().length() > 0) {
+ result[0] = resultStr[0].trim();
}
-
}
-
-
+
}
import java.util.ArrayList;
-import org.eclipse.linuxtools.oprofile.core.PathParser;
+import org.eclipse.linuxtools.oprofile.core.CommandManager;
import org.eclipse.linuxtools.oprofile.core.daemon.OpEvent;
import org.eclipse.linuxtools.oprofile.core.daemon.OpInfo;
import org.eclipse.linuxtools.oprofile.core.daemon.OpUnitMask;
import org.eclipse.linuxtools.oprofile.core.daemon.OpUnitMask.MaskInfo;
import com.samsung.linuxplatform.oprofile.core.OprofileCommonConstants;
-import com.samsung.slp.common.conn.session.ISession;
-
-public class EventListProcessor{
- private ISession session;
+public class EventListProcessor {
private OpInfo info;
- private ArrayList<OpEvent>[] eventList;
-
- public EventListProcessor(ISession session, OpInfo info) throws InterruptedException{
- if(session==null)
- throw new InterruptedException("Target is not connected or invalid");
-
+ private ArrayList<OpEvent>[] eventList;
+
+ public EventListProcessor(OpInfo info) throws InterruptedException {
this.info = info;
- this.session = session;
-
initializeEventList();
}
-
+
private void initializeEventList() {
eventList = new ArrayList[info.getNrCounters()];
- for(int i=0;i<eventList.length;i++){
+ for (int i = 0; i < eventList.length; i++) {
eventList[i] = new ArrayList<OpEvent>();
}
}
- private static final String COMMAND_EVENT_LIST = OprofileCommonConstants.COMMAND_OPCONTROL+" -l 2> /dev/null";
+ private static final String COMMAND_EVENT_LIST = OprofileCommonConstants.COMMAND_OPCONTROL
+ + " -l 2> /dev/null";
private static final String EVENT_PATTERN = "^[A-Z1-9]+.*\\(counter: \\d+.*\\)$";
- private static final String EVENT_DETAIL_PATTERN = "^\\s+.*\\(min count: \\d+\\).*";
- private static final String UNIT_MASK_PATTERN = "^\\s+Unit masks \\(default: 0x..\\)$";
- private static final String MASK_INFO_PATTERN = "^\\s+0x..: .*";
-
- public void parse() throws InterruptedException{
- String resultStr= null;
-
+ //private static final String EVENT_DETAIL_PATTERN = "^\\s+.*\\(min count: \\d+\\).*";
+ private static final String EVENT_DETAIL_PATTERN = ".*\\(min count: \\d+\\).*";
+ private static final String UNIT_MASK_PATTERN = "Unit masks \\(default: 0x..\\)$";
+ private static final String MASK_INFO_PATTERN = "0x..: .*";
+
+ public void parse() throws InterruptedException {
+ String resultStr = null;
+
try {
- resultStr = session.run(COMMAND_EVENT_LIST, null);
- resultStr = PathParser.pathParsing(resultStr);
+ // resultStr = session.run(COMMAND_EVENT_LIST, null);
+ resultStr = CommandManager
+ .runCommandReturningResult(COMMAND_EVENT_LIST);
} catch (Exception e) {
throw new InterruptedException();
}
-
- if(resultStr==null||resultStr.trim().length()==0)
+
+ if (resultStr == null || resultStr.trim().length() == 0)
return;
-
+
String eventStr[] = resultStr.split("\r?\n");
OpEvent event = null;
OpUnitMask unitMask = null;
ArrayList<MaskInfo> maskList = null;
-
+
boolean isDummy = true;
boolean isContinued = false;
String str = null;
String prevStr = null;
-
- for(int i=0;i<eventStr.length;i++){
-
- if(isContinued && !isDummy){
- str = prevStr +eventStr[i].replaceFirst("^\\s*","");;
- }else{
+
+ for (int i = 0; i < eventStr.length; i++) {
+
+ if (isContinued && !isDummy) {
+ str = prevStr + " " + eventStr[i].replaceFirst("^\\s*", "");
+ } else {
str = eventStr[i];
}
-
+
isContinued = false;
-
- if(str.matches(EVENT_PATTERN)){
+
+ if (str.matches(EVENT_PATTERN)) {
setOpUnitMaskList(unitMask, maskList);
-
+
event = new OpEvent();
unitMask = new OpUnitMask();
- setOpEventUnitMask(event,unitMask);
+ setOpEventUnitMask(event, unitMask);
setOpEventName(event, str);
setOpEventCounter(event, str);
-
+
isDummy = false;
- }else if(str.matches(EVENT_DETAIL_PATTERN)){
+ } else if (str.matches(EVENT_DETAIL_PATTERN)) {
setOpEventDescription(event, str);
setOpEventMinCount(event, str);
- }else if(str.matches(UNIT_MASK_PATTERN)){
+ } else if (str.matches(UNIT_MASK_PATTERN)) {
setOpUnitMaskDefault(unitMask, str);
maskList = new ArrayList<MaskInfo>();
- }else if(str.matches(MASK_INFO_PATTERN)){
+ } else if (str.matches(MASK_INFO_PATTERN)) {
addMaskInfo(maskList, str);
- }else{
+ } else {
isContinued = true;
prevStr = eventStr[i];
}
-
+
}
-
+
setOpInfoEventList();
}
- private void setOpUnitMaskList(OpUnitMask unitMask, ArrayList<MaskInfo> maskList) {
- if(unitMask==null|| (unitMask!=null&&maskList==null) )
+ private void setOpUnitMaskList(OpUnitMask unitMask,
+ ArrayList<MaskInfo> maskList) {
+ if (unitMask == null || (unitMask != null && maskList == null))
return;
-
- unitMask._setMaskDescriptions(maskList.toArray(new MaskInfo[maskList.size()]));
-
+
+ unitMask._setMaskDescriptions(maskList.toArray(new MaskInfo[maskList
+ .size()]));
+
boolean hasSameValue = false;
- for(int i=0;i<maskList.size();i++){
+ for (int i = 0; i < maskList.size(); i++) {
MaskInfo info = maskList.get(i);
- if(info.value==unitMask.getMaskValue()){
+ if (info.value == unitMask.getMaskValue()) {
hasSameValue = true;
break;
}
}
-
- unitMask._setType(hasSameValue?OpUnitMask.EXCLUSIVE:OpUnitMask.BITMASK);
+
+ unitMask._setType(hasSameValue ? OpUnitMask.EXCLUSIVE
+ : OpUnitMask.BITMASK);
}
private void addMaskInfo(ArrayList<MaskInfo> maskList, String str) {
int idx = str.indexOf(":");
-
- String desc = str.substring(idx+1,str.length()).trim();
- int val = Integer.parseInt(str.substring(2,idx).trim(),16);
-
+
+ String desc = str.substring(idx + 1, str.length()).trim();
+ int val = Integer.parseInt(str.substring(2, idx).trim(), 16);
+
MaskInfo maskInfo = new MaskInfo();
maskInfo.description = desc;
maskInfo.value = val;
-
+
maskList.add(maskInfo);
- }
-
-
+ }
+
private void setOpInfoEventList() {
- for(int i=0;i<eventList.length;i++){
- info._setEvents(i , eventList[i].toArray(new OpEvent[eventList[i].size()]));
+ for (int i = 0; i < eventList.length; i++) {
+ info._setEvents(i,
+ eventList[i].toArray(new OpEvent[eventList[i].size()]));
}
}
}
private void setOpUnitMaskDefault(OpUnitMask unitMask, String str) {
- String defaultUnitMask = str.substring(str.lastIndexOf("0x")+2, str.lastIndexOf(")"));
+ String defaultUnitMask = str.substring(str.lastIndexOf("0x") + 2,
+ str.lastIndexOf(")"));
unitMask._setDefault(Integer.parseInt(defaultUnitMask, 16));
}
private void setOpEventMinCount(OpEvent event, String str) {
- String minCount = str.substring(str.lastIndexOf(":")+1, str.lastIndexOf(")"));
+ String minCount = str.substring(str.lastIndexOf(":") + 1,
+ str.lastIndexOf(")"));
event._setMinCount(Integer.parseInt(minCount.trim()));
}
}
private void setOpEventCounter(OpEvent event, String str) {
- String counters = str.substring(str.lastIndexOf(":")+1, str.lastIndexOf(")"));
- if(counters==null)
+ String counters = str.substring(str.lastIndexOf(":") + 1,
+ str.lastIndexOf(")"));
+ if (counters == null)
return;
-
- if(counters.trim().equals("all")){
- for(int i=0;i<eventList.length;i++){
+
+ if (counters.trim().equals("all")) {
+ for (int i = 0; i < eventList.length; i++) {
eventList[i].add(event);
}
- }else{
- String[] counter = counters.trim().split(",");
- for(int i=0;i<counter.length;i++){
+ } else {
+ String[] counter = counters.trim().split(",");
+ for (int i = 0; i < counter.length; i++) {
eventList[Integer.parseInt(counter[i].trim())].add(event);
}
}
String eventName = str.substring(0, str.indexOf(":"));
event._setText(eventName.trim());
}
-
- public static void main(String[] args){
+
+ public static void main(String[] args) {
String str = " 500) ";
- String convStr = str.replaceFirst("^\\s*","");
-
- System.out.println("["+str+"]");
- System.out.println("["+convStr+"]");
-
+ String convStr = str.replaceFirst("^\\s*", "");
+
+ System.out.println("[" + str + "]");
+ System.out.println("[" + convStr + "]");
+
}
}
package com.samsung.linuxplatform.oprofile.core.processor.eventinfo;
+import org.eclipse.linuxtools.oprofile.core.CommandManager;
import org.eclipse.linuxtools.oprofile.core.daemon.OpInfo;
-import com.samsung.slp.common.conn.session.ISession;
-import org.eclipse.linuxtools.oprofile.core.PathParser;
-
-
-public class OpInfoProcessor{
- private ISession session;
+public class OpInfoProcessor {
private OpInfo info;
-
- public OpInfoProcessor(ISession session, OpInfo info) throws InterruptedException{
- if(session==null)
- throw new InterruptedException("Target isn't connected or valid");
-
+
+ public OpInfoProcessor(OpInfo info) throws InterruptedException {
this.info = info;
- this.session = session;
}
-
+
private final String COMMAND_COUNTER_NO = "ls -d /dev/oprofile/[0-9] -c1 2> /dev/null";
-
- public void parse() throws InterruptedException{
- String resultStr= null;
-
+
+ public void parse() throws InterruptedException {
+ String[] resultStr = null;
+
try {
- resultStr = session.run(COMMAND_COUNTER_NO, null);
- resultStr = PathParser.pathParsing(resultStr);
+ // resultStr = session.run(COMMAND_COUNTER_NO, null);
+ resultStr = CommandManager.runCommandReturningResultArray(COMMAND_COUNTER_NO);
} catch (Exception e) {
throw new InterruptedException();
}
-
- if(resultStr!=null&&resultStr.trim().length()>5){
-// System.out.println("######## opcontrol -l : "+resultStr);
- int cnt = resultStr.split("\r?\n").length;
+
+ if (resultStr != null && resultStr.length >1) {
+ // System.out.println("######## opcontrol -l : "+resultStr);
+ //int cnt = resultStr.split("\r?\n").length;
+ int cnt = resultStr.length;
info._setNrCounters(cnt);
info._setTimerMode(false);
- }else{
-// System.out.println("######## opcontrol -l : no data");
+ } else {
+ // System.out.println("######## opcontrol -l : no data");
info._setNrCounters(0);
info._setTimerMode(true);
}
-
- //FIXME:jinu removed at 20090620
- //this logic isn't exactly matched with real result
+
+ // FIXME:jinu removed at 20090620
+ // this logic isn't exactly matched with real result
/*
- command = "grep \"cpu MHz\" /proc/cpuinfo";
-
- try {
- resultStr = session.run(command);
- } catch (Exception e) {
- throw new InterruptedException();
- }
-
- if(resultStr!=null&&resultStr.trim().length()>0){
- String speed = resultStr.split(lineSeparator)[0].split(":")[1].trim();
- info._setCPUSpeed(Double.parseDouble(speed));
- }else{
- info._setCPUSpeed(0);
- }
- */
-
+ * command = "grep \"cpu MHz\" /proc/cpuinfo";
+ *
+ * try { resultStr = session.run(command); } catch (Exception e) { throw
+ * new InterruptedException(); }
+ *
+ * if(resultStr!=null&&resultStr.trim().length()>0){ String speed =
+ * resultStr.split(lineSeparator)[0].split(":")[1].trim();
+ * info._setCPUSpeed(Double.parseDouble(speed)); }else{
+ * info._setCPUSpeed(0); }
+ */
+
}
-
-
+
}
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
-import org.eclipse.linuxtools.oprofile.core.PathParser;
+import org.eclipse.linuxtools.oprofile.core.CommandManager;
import org.eclipse.linuxtools.oprofile.core.model.OpModelRoot;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import com.samsung.linuxplatform.oprofile.core.OprofileCommonConstants;
import com.samsung.linuxplatform.oprofile.core.processor.modeldata.handler.OprofileSAXHandler;
-import com.samsung.slp.common.conn.session.ISession;
public class ModelDataProcessor{
- private ISession session;
private OpModelRoot root;
- public ModelDataProcessor(ISession session,OpModelRoot root) throws InterruptedException{
- if(session==null)
- throw new InterruptedException("Target isn't connected or valid");
-
- this.session = session;
+ public ModelDataProcessor(OpModelRoot root) throws InterruptedException{
this.root = root;
}
String resultStr= null;
try {
- resultStr = session.run(COMMAND_SESSION_EVENT, null);
- resultStr = PathParser.pathParsing(resultStr);
+ //resultStr = session.run(COMMAND_SESSION_EVENT, null);
+ resultStr = CommandManager.runCommandReturningResult(COMMAND_SESSION_EVENT);
+
} catch (Exception e) {
throw new InterruptedException();
}
- if(resultStr==null||resultStr.trim().length()==0){
+ if(resultStr==null||resultStr.trim().length() ==0){
// root.reset();
return;
}else{
import java.util.ArrayList;
+import org.eclipse.linuxtools.oprofile.core.CommandManager;
import org.eclipse.linuxtools.oprofile.core.Oprofile;
-import org.eclipse.linuxtools.oprofile.core.PathParser;
import org.eclipse.linuxtools.oprofile.core.model.OpModelEvent;
import org.eclipse.linuxtools.oprofile.core.model.OpModelSession;
import com.samsung.linuxplatform.oprofile.core.OprofileCommonConstants;
-import com.samsung.slp.common.conn.session.ISession;
public class SessionsProcessor{
- private ISession session;
- public SessionsProcessor(ISession session) throws InterruptedException{
- if(session==null)
- throw new InterruptedException("Target isn't connected or valid");
-
- this.session = session;
+ public SessionsProcessor() throws InterruptedException{
}
private final String DEFAULT_SESSION_NAME = "current";
return;
}
- String resultStr= null;
+ String[] resultStr= null;
try {
- resultStr = session.run(COMMAND_SESSION_EVENT, null);
- resultStr = PathParser.pathParsing(resultStr);
+ //resultStr = session.run(COMMAND_SESSION_EVENT, null);
+ resultStr = CommandManager.runCommandReturningResultArray(COMMAND_SESSION_EVENT);
} catch (Exception e) {
throw new InterruptedException();
}
- if(resultStr==null||resultStr.trim().length()==0)
+ if(resultStr==null||resultStr.length == 0 )
return;
- String eventStr[] = resultStr.split("\r?\n");
- for(int i=0;i<eventStr.length;i++){
- String str = eventStr[i];
-
+ for(int i=0;i<resultStr.length;i++){
+ String str = resultStr[i];
addEvent(eventList, str);
}
}
import org.eclipse.linuxtools.oprofile.core.model.OpModelEvent;
import org.eclipse.linuxtools.oprofile.core.model.OpModelRoot;
-import com.samsung.linuxplatform.oprofile.core.OprofileComm;
import com.samsung.linuxplatform.oprofile.core.processor.checkevent.CheckEventsProcessor;
import com.samsung.linuxplatform.oprofile.core.processor.checkkernel.CheckKernelProcessor;
import com.samsung.linuxplatform.oprofile.core.processor.eventinfo.EventListProcessor;
import com.samsung.linuxplatform.oprofile.core.processor.eventinfo.OpInfoProcessor;
import com.samsung.linuxplatform.oprofile.core.processor.modeldata.ModelDataProcessor;
import com.samsung.linuxplatform.oprofile.core.processor.sessions.SessionsProcessor;
-import com.samsung.slp.common.conn.session.ISession;
public abstract class OpcontrolDataProvider{
IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
// if(!OprofileComm.checkTarget()) return;
- ISession session = OprofileComm.getSession();
- new OpInfoProcessor(session, info).parse();
+ new OpInfoProcessor(info).parse();
if(!info.getTimerMode()){
- new EventListProcessor(session, info).parse();
+ new EventListProcessor(info).parse();
}
}
IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
// if(!OprofileComm.checkTarget()) return;
- ISession session = OprofileComm.getSession();
-
- new CheckEventsProcessor(session).parse(event,count, unitmask,result);
+
+ new CheckEventsProcessor().parse(event,count, unitmask,result);
}
};
IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
// if(!OprofileComm.checkTarget()) return;
- ISession session = OprofileComm.getSession();
+ //ISession session = OprofileComm.getSession();
- new SessionsProcessor(session).parse(eventList);
+ new SessionsProcessor().parse(eventList);
}
};
IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
// if(!OprofileComm.checkTarget()) return;
- ISession session = OprofileComm.getSession();
+ //ISession session = OprofileComm.getSession();
try {
- new ModelDataProcessor(session, model).parse();
+ new ModelDataProcessor(model).parse();
} catch (Exception e) {
throw new InterruptedException();
}
IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
// if(!OprofileComm.checkTarget()) return;
- ISession session = OprofileComm.getSession();
+ //ISession session = OprofileComm.getSession();
- new CheckKernelProcessor(session).parse(result);
+ new CheckKernelProcessor().parse(result);
}
};
--- /dev/null
+package org.eclipse.linuxtools.oprofile.core;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import org.eclipse.linuxtools.oprofile.core.CommonReceiver;
+
+import com.samsung.slp.common.connection.ConnectionPlugin;
+import com.samsung.slp.sdblib.IDevice;
+import com.samsung.slp.sdblib.MultiLineReceiver;
+import com.samsung.slp.sdblib.SdbCommandRejectedException;
+import com.samsung.slp.sdblib.SdbShellProcess;
+import com.samsung.slp.sdblib.ShellCommandUnresponsiveException;
+import com.samsung.slp.sdblib.SyncService;
+import com.samsung.slp.sdblib.SyncService.SyncResult;
+import com.samsung.slp.sdblib.TimeoutException;
+
+class CommonReceiver extends MultiLineReceiver {
+
+ private String[] output = null;
+
+ public String[] getOutput() {
+ return output;
+ }
+
+ @Override
+ public void processNewLines(String[] lines) {
+ output = lines;
+ }
+
+}
+
+class OneStringReceiver extends MultiLineReceiver {
+
+ private String output = "";
+
+ public String getOutput() {
+ return output;
+ }
+
+ @Override
+ public void processNewLines(String[] lines) {
+ // output = lines;
+ StringBuilder out = new StringBuilder("");
+ for (int i = 0; i < lines.length; i++) {
+ if (lines[i].equals(""))
+ continue;
+ out.append(lines[i]);
+ out.append("\r\n");
+ }
+ output = output + out.toString();
+ }
+
+}
+
+public class CommandManager {
+ public static void runShell(String command) {
+ IDevice device = ConnectionPlugin.getDefault().getCurrentDevice();
+ SdbShellProcess sdbShellProc = null;
+ BufferedReader br = null;
+ try {
+ sdbShellProc = device.executeShellCommand(command);
+ br = new BufferedReader(new InputStreamReader(
+ sdbShellProc.getInputStream()));
+
+ } catch (IOException e1) {
+ e1.printStackTrace();
+ }
+
+ try {
+ String message;
+ while (null != (message = br.readLine())) {
+ if (message.equals("start_ok")) {
+ break;
+ }
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static String runCommandReturningResult(String command) {
+ IDevice device = ConnectionPlugin.getDefault().getCurrentDevice();
+ OneStringReceiver oneStringReceiver = new OneStringReceiver();
+ try {
+ device.executeShellCommand(command, oneStringReceiver);
+ } catch (TimeoutException e) {
+ e.printStackTrace();
+ } catch (SdbCommandRejectedException e) {
+ e.printStackTrace();
+ } catch (ShellCommandUnresponsiveException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return oneStringReceiver.getOutput();
+ }
+
+ public static String[] runCommandReturningResultArray(String command) {
+ IDevice device = ConnectionPlugin.getDefault().getCurrentDevice();
+ CommonReceiver commonReceiver = new CommonReceiver();
+ try {
+ device.executeShellCommand(command, commonReceiver);
+ } catch (TimeoutException e) {
+ e.printStackTrace();
+ } catch (SdbCommandRejectedException e) {
+ e.printStackTrace();
+ } catch (ShellCommandUnresponsiveException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return commonReceiver.getOutput();
+ }
+
+ public static void runCommand(String command) {
+ try {
+ ConnectionPlugin.getDefault().getCurrentDevice()
+ .executeShellCommand(command);
+ } catch (SdbCommandRejectedException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static boolean pull(String src, String dest) {
+ SyncService syncService = null;
+ try {
+ syncService = ConnectionPlugin.getDefault().getCurrentDevice()
+ .getSyncService();
+ } catch (TimeoutException e) {
+ e.printStackTrace();
+ } catch (SdbCommandRejectedException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ SyncResult result = syncService.pullFile(src, dest,
+ SyncService.getNullProgressMonitor());
+ if (SyncService.RESULT_OK == result.getCode()) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public static boolean push(String src, String dest) {
+ SyncService syncService = null;
+ try {
+ syncService = ConnectionPlugin.getDefault().getCurrentDevice()
+ .getSyncService();
+ } catch (TimeoutException e) {
+ e.printStackTrace();
+ } catch (SdbCommandRejectedException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ SyncResult result = syncService.pushFile(src, dest,
+ SyncService.getNullProgressMonitor());
+ if (SyncService.RESULT_OK == result.getCode()) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public static boolean isPathExist(String path) {
+ String[] result = runCommandReturningResultArray(path);
+ if (null != result && result[0].equals("No such file or directory")) {
+ return false;
+ }
+ return true;
+ }
+
+ public static boolean isEmulator() {
+ return ConnectionPlugin.getDefault().getCurrentDevice().isEmulator();
+ }
+
+ public static boolean isRunSeccessfuly(String[] result) {
+ if (null != result && result.length > 0
+ && !result[result.length - 1].contains("0")) {
+ return false;
+ } else {
+ return true;
+ }
+ }
+}
+++ /dev/null
-package org.eclipse.linuxtools.oprofile.core;
-
-public class PathParser {
- static public String pathParsing(String str){
- if(str.startsWith("/opt/home/root # ")){
- str = str.substring(17,str.length());
- if(str.startsWith("\r\n")){
- str = str.substring(2, str.length());
- }
- }
- return str;
- }
-}
* Contributors:
* Keith Seitz <keiths@redhat.com> - initial API and implementation
* Kent Sebastian <ksebasti@redhat.com>
- *******************************************************************************/
+ *******************************************************************************/
package org.eclipse.linuxtools.oprofile.core.linux;
import java.util.ArrayList;
+import org.eclipse.linuxtools.oprofile.core.CommandManager;
import org.eclipse.linuxtools.oprofile.core.IOpcontrolProvider;
import org.eclipse.linuxtools.oprofile.core.OpcontrolException;
import org.eclipse.linuxtools.oprofile.core.Oprofile;
import com.samsung.linuxplatform.oprofile.core.OprofileComm;
import com.samsung.linuxplatform.oprofile.core.OprofileCommonConstants;
-import com.samsung.slp.common.conn.device.DeviceManager;
-import com.samsung.slp.common.conn.session.ISession;
+import com.samsung.slp.common.connection.ConnectionPlugin;
/**
* A class which encapsulates running opcontrol.
*/
public class LinuxOpcontrolProvider implements IOpcontrolProvider {
// Location of opcontrol security wrapper
-// private static final String _OPCONTROL_REL_PATH = "natives/linux/scripts/opcontrol"; //$NON-NLS-1$
+ // private static final String _OPCONTROL_REL_PATH = "natives/linux/scripts/opcontrol"; //$NON-NLS-1$
private final String OPCONTROL_PROGRAM;
// Initialize the Oprofile kernel module and oprofilefs
private static final String _OPD_INIT_MODULE = "--init"; //$NON-NLS-1$
-
+
// Setup daemon collection arguments
private static final String _OPD_SETUP = "--setup"; //$NON-NLS-1$
private static final String _OPD_SETUP_SEPARATE = "--separate="; //$NON-NLS-1$
private static final String _OPD_SETUP_SEPARATE_SEPARATOR = ","; //$NON-NLS-1$
-// private static final String _OPD_SETUP_SEPARATE_NONE = "none"; //$NON-NLS-1$
+ // private static final String _OPD_SETUP_SEPARATE_NONE = "none"; //$NON-NLS-1$
private static final String _OPD_SETUP_SEPARATE_LIBRARY = "library"; //$NON-NLS-1$
private static final String _OPD_SETUP_SEPARATE_KERNEL = "kernel"; //$NON-NLS-1$
private static final String _OPD_SETUP_SEPARATE_THREAD = "thread"; //$NON-NLS-1$
// Kernel image file options
private static final String _OPD_KERNEL_NONE = "--no-vmlinux"; //$NON-NLS-1$
private static final String _OPD_KERNEL_FILE = "--vmlinux="; //$NON-NLS-1$
-
+
// Logging verbosity
-// private static final String _OPD_VERBOSE_LOGGING = "--verbose="; //$NON-NSL-1$
-// private static final String _OPD_VERBOSE_ALL = "all"; //$NON-NLS-1$
-// private static final String _OPD_VERBOSE_SFILE = "sfile"; //$NON-NLS-1$
-// private static final String _OPD_VERBOSE_ARCS = "arcs"; //$NON-NLS-1$
-// private static final String _OPD_VERBOSE_SAMPLES = "samples"; //$NON-NLS-1$
-// private static final String _OPD_VERBOSE_MODULE = "module"; //$NON-NLS-1$
-// private static final String _OPD_VERBOSE_MISC = "misc"; //$NON-NLS-1$
-
+ // private static final String _OPD_VERBOSE_LOGGING = "--verbose=";
+ // //$NON-NSL-1$
+ // private static final String _OPD_VERBOSE_ALL = "all"; //$NON-NLS-1$
+ // private static final String _OPD_VERBOSE_SFILE = "sfile"; //$NON-NLS-1$
+ // private static final String _OPD_VERBOSE_ARCS = "arcs"; //$NON-NLS-1$
+ // private static final String _OPD_VERBOSE_SAMPLES = "samples"; //$NON-NLS-1$
+ // private static final String _OPD_VERBOSE_MODULE = "module"; //$NON-NLS-1$
+ // private static final String _OPD_VERBOSE_MISC = "misc"; //$NON-NLS-1$
+
// Start the daemon process without starting data collection
private static final String _OPD_START_DAEMON = "--start-daemon"; //$NON-NLS-1$
-
+
// Start collecting profiling data
private static final String _OPD_START_COLLECTION = "--start"; //$NON-NLS-1$
-
+
// Flush the collected profiling data to disk
private static final String _OPD_DUMP = "--dump"; //$NON-NLS-1$
-
+
// Stop data collection
private static final String _OPD_STOP_COLLECTION = "--stop"; //$NON-NLS-1$
-
+
// Stop data collection and stop daemon
private static final String _OPD_SHUTDOWN = "--shutdown"; //$NON-NLS-1$
-
+
// Clear out data from current session
private static final String _OPD_RESET = "--reset"; //$NON-NLS-1$
-
+
// Save data from the current session
private static final String _OPD_SAVE_SESSION = "--save="; //$NON-NLS-1$
-
+
// Unload the oprofile kernel module and oprofilefs
private static final String _OPD_DEINIT_MODULE = "--deinit"; //$NON-NLS-1$
-
+
// Logging verbosity. Specified with setupDaemon.
- //--verbosity=all generates WAY too much stuff in the log
+ // --verbosity=all generates WAY too much stuff in the log
private String _verbosity = ""; //$NON-NLS-1$
-
-
+
public LinuxOpcontrolProvider() throws OpcontrolException {
-// jinu modified at 20090526
-// OPCONTROL_PROGRAM = _findOpcontrol();
+ // jinu modified at 20090526
+ // OPCONTROL_PROGRAM = _findOpcontrol();
OPCONTROL_PROGRAM = OprofileCommonConstants.COMMAND_OPCONTROL;
}
-
+
/**
* Unload the kernel module and oprofilefs
+ *
* @throws OpcontrolException
*/
public void deinitModule() throws OpcontrolException {
_runOpcontrol(_OPD_DEINIT_MODULE);
}
-
+
/**
* Dump collected profiling data
+ *
* @throws OpcontrolException
*/
public void dumpSamples() throws OpcontrolException {
_runOpcontrol(_OPD_DUMP);
}
-
+
/**
* Loads the kernel module and oprofilefs
+ *
* @throws OpcontrolException
*/
public void initModule() throws OpcontrolException {
_runOpcontrol(_OPD_INIT_MODULE);
}
-
+
/**
* Clears out data from current session
+ *
* @throws OpcontrolException
*/
public void reset() throws OpcontrolException {
_runOpcontrol(_OPD_RESET);
}
-
+
/**
* Saves the current ("default") session
- * @param name the name to which to save the session
+ *
+ * @param name
+ * the name to which to save the session
* @throws OpcontrolException
*/
public void saveSession(String name) throws OpcontrolException {
cmd.add(_OPD_SAVE_SESSION + name);
_runOpcontrol(cmd);
}
-
+
/**
* Give setup aruments
- * @param args list of parameters for daemon
+ *
+ * @param args
+ * list of parameters for daemon
* @throws OpcontrolException
*/
- public void setupDaemon(OprofileDaemonOptions options, OprofileDaemonEvent[] events) throws OpcontrolException {
+ public void setupDaemon(OprofileDaemonOptions options,
+ OprofileDaemonEvent[] events) throws OpcontrolException {
// Convert options & events to arguments for opcontrol
ArrayList<String> args = new ArrayList<String>();
args.add(_OPD_SETUP);
}
_runOpcontrol(args);
}
-
- //jinu added at 20090602
- public void setupDaemon(OprofileDaemonOptions options, OprofileDaemonEvent[] events, String defaultEvent) throws OpcontrolException {
+
+ // jinu added at 20090602
+ public void setupDaemon(OprofileDaemonOptions options,
+ OprofileDaemonEvent[] events, String defaultEvent)
+ throws OpcontrolException {
// Convert options & events to arguments for opcontrol
ArrayList<String> args = new ArrayList<String>();
args.add(_OPD_SETUP);
_optionsToArguments(args, options);
if (!Oprofile.getTimerMode()) {
if (events == null || events.length == 0) {
- //jinu modified at 20090602
- //args.add(_OPD_SETUP_EVENT + _OPD_SETUP_EVENT_DEFAULT);
- args.add(defaultEvent);
+ // jinu modified at 20090602
+ // args.add(_OPD_SETUP_EVENT + _OPD_SETUP_EVENT_DEFAULT);
+ if(null != defaultEvent)
+ args.add(defaultEvent);
} else {
for (int i = 0; i < events.length; ++i) {
_eventToArguments(args, events[i]);
}
_runOpcontrol(args);
}
-
+
/**
* Stop data collection and remove daemon
+ *
* @throws OpcontrolException
*/
public void shutdownDaemon() throws OpcontrolException {
_runOpcontrol(_OPD_SHUTDOWN);
}
-
+
/**
* Start data collection (will start daemon if necessary)
+ *
* @throws OpcontrolException
*/
public void startCollection() throws OpcontrolException {
_runOpcontrol(_OPD_START_COLLECTION);
}
-
+
/**
* Start daemon without starting profiling
+ *
* @throws OpcontrolException
*/
public void startDaemon() throws OpcontrolException {
_runOpcontrol(_OPD_START_DAEMON);
}
-
+
/**
* Stop data collection
+ *
* @throws OpcontrolException
*/
public void stopCollection() throws OpcontrolException {
_runOpcontrol(_OPD_STOP_COLLECTION);
}
-
+
// Convenience function
private void _runOpcontrol(String cmd) throws OpcontrolException {
ArrayList<String> list = new ArrayList<String>();
list.add(cmd);
_runOpcontrol(list);
}
-
+
// Will add opcontrol program to beginning of args
- // args: list of opcontrol arguments (not including opcontrol program itself)
- private void _runOpcontrol(ArrayList<String> args) throws OpcontrolException {
+ // args: list of opcontrol arguments (not including opcontrol program
+ // itself)
+ private void _runOpcontrol(ArrayList<String> args)
+ throws OpcontrolException {
args.add(0, OPCONTROL_PROGRAM);
// Verbosity hack. If --start or --start-daemon, add verbosity, if set
String cmd = (String) args.get(1);
- if (_verbosity.length() > 0 && (cmd.equals (_OPD_START_COLLECTION) || cmd.equals(_OPD_START_DAEMON))) {
+ if (_verbosity.length() > 0
+ && (cmd.equals(_OPD_START_COLLECTION) || cmd
+ .equals(_OPD_START_DAEMON))) {
args.add(_verbosity);
}
-
+
String[] cmdArray = new String[args.size()];
args.toArray(cmdArray);
-
- //jinu modified at 20090526
+
+ // jinu modified at 20090526
runCommand(cmdArray);
/*
- Process p = null;
- try {
- p = Runtime.getRuntime().exec(cmdArray);
- } catch (IOException ioe) {
- if (p != null) {
- p.destroy();
- p = null;
- }
-
- throw new OpcontrolException(OprofileCorePlugin.createErrorStatus("opcontrolRun", ioe)); //$NON-NLS-1$
- }
-
- if (p != null) {
- BufferedReader stdout = new BufferedReader(new InputStreamReader(p.getErrorStream()));
- String output = "", s; //$NON-NLS-1$
- try {
- while ((s = stdout.readLine()) != null) {
- output += s;
- }
-
- int ret = p.waitFor();
- if (ret != 0) {
- System.out.println(output);
- throw new OpcontrolException(OprofileCorePlugin.createErrorStatus("opcontrolNonZeroExitCode", null)); //$NON-NLS-1$
- }
- } catch (IOException ioe) {
- ioe.printStackTrace();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- */
+ * Process p = null; try { p = Runtime.getRuntime().exec(cmdArray); }
+ * catch (IOException ioe) { if (p != null) { p.destroy(); p = null; }
+ *
+ * throw new
+ * OpcontrolException(OprofileCorePlugin.createErrorStatus("opcontrolRun"
+ * , ioe)); //$NON-NLS-1$ }
+ *
+ * if (p != null) { BufferedReader stdout = new BufferedReader(new
+ * InputStreamReader(p.getErrorStream())); String output = "", s;
+ * //$NON-NLS-1$ try { while ((s = stdout.readLine()) != null) { output
+ * += s; }
+ *
+ * int ret = p.waitFor(); if (ret != 0) { System.out.println(output);
+ * throw new OpcontrolException(OprofileCorePlugin.createErrorStatus(
+ * "opcontrolNonZeroExitCode", null)); //$NON-NLS-1$ } } catch
+ * (IOException ioe) { ioe.printStackTrace(); } catch
+ * (InterruptedException e) { e.printStackTrace(); } }
+ */
}
-
-// private static String _findOpcontrol() throws OpcontrolException {
-// URL url = FileLocator.find(Platform.getBundle(OprofileCorePlugin.getId()), new Path(_OPCONTROL_REL_PATH), null);
-//
-// if (url != null) {
-// try {
-// return FileLocator.toFileURL(url).getPath();
-// } catch (IOException ignore) { }
-// } else {
-// throw new OpcontrolException(OprofileCorePlugin.createErrorStatus("opcontrolProvider", null)); //$NON-NLS-1$
-// }
-//
-// return null;
-// }
+
+ // private static String _findOpcontrol() throws OpcontrolException {
+ // URL url =
+ // FileLocator.find(Platform.getBundle(OprofileCorePlugin.getId()), new
+ // Path(_OPCONTROL_REL_PATH), null);
+ //
+ // if (url != null) {
+ // try {
+ // return FileLocator.toFileURL(url).getPath();
+ // } catch (IOException ignore) { }
+ // } else {
+ // throw new OpcontrolException(OprofileCorePlugin.createErrorStatus("opcontrolProvider", null)); //$NON-NLS-1$
+ // }
+ //
+ // return null;
+ // }
// Convert the event into arguments for opcontrol
- private void _eventToArguments(ArrayList<String> args, OprofileDaemonEvent event) {
+ private void _eventToArguments(ArrayList<String> args,
+ OprofileDaemonEvent event) {
// Event spec: "EVENT:count:mask:profileKernel:profileUser"
String spec = new String(_OPD_SETUP_EVENT);
spec += event.getEvent().getText();
spec += _OPD_SETUP_EVENT_SEPARATOR;
spec += event.getEvent().getUnitMask().getMaskValue();
spec += _OPD_SETUP_EVENT_SEPARATOR;
- spec += (event.getProfileKernel() ? _OPD_SETUP_EVENT_TRUE : _OPD_SETUP_EVENT_FALSE);
+ spec += (event.getProfileKernel() ? _OPD_SETUP_EVENT_TRUE
+ : _OPD_SETUP_EVENT_FALSE);
spec += _OPD_SETUP_EVENT_SEPARATOR;
- spec += (event.getProfileUser() ? _OPD_SETUP_EVENT_TRUE : _OPD_SETUP_EVENT_FALSE);
+ spec += (event.getProfileUser() ? _OPD_SETUP_EVENT_TRUE
+ : _OPD_SETUP_EVENT_FALSE);
args.add(spec);
}
-
+
// Convert the options into arguments for opcontrol
- private void _optionsToArguments(ArrayList<String> args, OprofileDaemonOptions options) {
+ private void _optionsToArguments(ArrayList<String> args,
+ OprofileDaemonOptions options) {
// Add separate flags
int mask = options.getSeparateProfilesMask();
String separate = new String(_OPD_SETUP_SEPARATE);
-
+
if (mask == OprofileDaemonOptions.SEPARATE_NONE) {
- separate += _OPD_SETUP_SEPARATE_LIBRARY + _OPD_SETUP_SEPARATE_SEPARATOR + _OPD_SETUP_SEPARATE_KERNEL;
- //separate += _OPD_SETUP_SEPARATE_NONE;
+ separate += _OPD_SETUP_SEPARATE_LIBRARY
+ + _OPD_SETUP_SEPARATE_SEPARATOR
+ + _OPD_SETUP_SEPARATE_KERNEL;
+ // separate += _OPD_SETUP_SEPARATE_NONE;
} else {
- //note that opcontrol will nicely ignore the trailing comma
+ // note that opcontrol will nicely ignore the trailing comma
if ((mask & OprofileDaemonOptions.SEPARATE_LIBRARY) != 0)
- separate += _OPD_SETUP_SEPARATE_LIBRARY + _OPD_SETUP_SEPARATE_SEPARATOR;
+ separate += _OPD_SETUP_SEPARATE_LIBRARY
+ + _OPD_SETUP_SEPARATE_SEPARATOR;
if ((mask & OprofileDaemonOptions.SEPARATE_KERNEL) != 0)
- separate += _OPD_SETUP_SEPARATE_KERNEL + _OPD_SETUP_SEPARATE_SEPARATOR;
+ separate += _OPD_SETUP_SEPARATE_KERNEL
+ + _OPD_SETUP_SEPARATE_SEPARATOR;
if ((mask & OprofileDaemonOptions.SEPARATE_THREAD) != 0)
- separate += _OPD_SETUP_SEPARATE_THREAD + _OPD_SETUP_SEPARATE_SEPARATOR;
+ separate += _OPD_SETUP_SEPARATE_THREAD
+ + _OPD_SETUP_SEPARATE_SEPARATOR;
if ((mask & OprofileDaemonOptions.SEPARATE_CPU) != 0)
- separate += _OPD_SETUP_SEPARATE_CPU + _OPD_SETUP_SEPARATE_SEPARATOR;
+ separate += _OPD_SETUP_SEPARATE_CPU
+ + _OPD_SETUP_SEPARATE_SEPARATOR;
}
args.add(separate);
-
+
// Add kernel image
- if (options.getKernelImageFile() == null || options.getKernelImageFile().length() == 0) {
+ if (options.getKernelImageFile() == null
+ || options.getKernelImageFile().length() == 0) {
args.add(_OPD_KERNEL_NONE);
} else {
args.add(_OPD_KERNEL_FILE + options.getKernelImageFile());
}
- //image filter -- always non-null
+ // image filter -- always non-null
args.add(_OPD_SETUP_IMAGE + options.getBinaryImage());
-
- //callgraph depth
+
+ // callgraph depth
args.add(_OPD_CALLGRAPH_DEPTH + options.getCallgraphDepth());
}
-
-
- //jinu added at 20090528
+
+ // jinu added at 20090528
public void removeDaemonSetting() throws OpcontrolException {
- final String[] _OPD_REMOVE_SETTING = {"rm", "-rf", "/root/.oprofile/daemonrc"};
+ final String[] _OPD_REMOVE_SETTING = { "rm", "-rf",
+ "/root/.oprofile/daemonrc" };
runCommand(_OPD_REMOVE_SETTING);
}
-
- //jinu added at 20090528
- private void runCommand(String[] comm) throws OpcontrolException{
-
- if(!OprofileComm.checkTarget()) return;
- ISession session = null;
-
- try {
- session = OprofileComm.getSession();
- } catch (Exception e) {
- e.printStackTrace();
- }
-
+
+ // jinu added at 20090528
+ private void runCommand(String[] comm) throws OpcontrolException {
+
String str = OprofileComm.getCommandString(comm);
-// String result=null;
+ // String result=null;
try {
-// result = session.run(str);
- session.run(str, null);
+ // result = session.run(str);
+ //session.run(str, null);
+ if(str.contains(_OPD_START_COLLECTION)){
+ str = str + " && echo start_ok";
+ }
+ CommandManager.runShell(str);
} catch (Exception e) {
- throw new OpcontrolException(OprofileCorePlugin.createErrorStatus("opcontrolRun (" +
- DeviceManager.getSelectedDevice().getMachineType() + ")", e)); //$NON-NLS-1$
- }
- //-----------------------------------
-
- //jinu removed at 20090616
- /*
- Process p = null;
- try {
- p = Runtime.getRuntime().exec(comm);
- } catch (IOException ioe) {
- if (p != null) {
- p.destroy();
- p = null;
+ String devType = null;
+ if(null == ConnectionPlugin.getDefault().getCurrentDevice()){
+ devType = "";
}
-
- throw new OpcontrolException(OprofileCorePlugin.createErrorStatus("opcontrolRun", ioe)); //$NON-NLS-1$
- }
-
- if (p != null) {
- BufferedReader stdout = new BufferedReader(new InputStreamReader(p.getErrorStream()));
- String output = "", s; //$NON-NLS-1$
- try {
- while ((s = stdout.readLine()) != null) {
- output += s;
- }
-
- int ret = p.waitFor();
- if (ret != 0) {
- System.out.println(output);
- throw new OpcontrolException(OprofileCorePlugin.createErrorStatus("opcontrolNonZeroExitCode", null)); //$NON-NLS-1$
- }
- } catch (IOException ioe) {
- ioe.printStackTrace();
- } catch (InterruptedException e) {
- e.printStackTrace();
+ else if (CommandManager.isEmulator()) {
+ devType = "Emulator";
+ } else {
+ devType = "RealDevice";
}
+ throw new OpcontrolException(OprofileCorePlugin.createErrorStatus(
+ "opcontrolRun (" + devType + ")", e)); //$NON-NLS-1$
}
- */
+ // -----------------------------------
+
+ // jinu removed at 20090616
+ /*
+ * Process p = null; try { p = Runtime.getRuntime().exec(comm); } catch
+ * (IOException ioe) { if (p != null) { p.destroy(); p = null; }
+ *
+ * throw new
+ * OpcontrolException(OprofileCorePlugin.createErrorStatus("opcontrolRun"
+ * , ioe)); //$NON-NLS-1$ }
+ *
+ * if (p != null) { BufferedReader stdout = new BufferedReader(new
+ * InputStreamReader(p.getErrorStream())); String output = "", s;
+ * //$NON-NLS-1$ try { while ((s = stdout.readLine()) != null) { output
+ * += s; }
+ *
+ * int ret = p.waitFor(); if (ret != 0) { System.out.println(output);
+ * throw new OpcontrolException(OprofileCorePlugin.createErrorStatus(
+ * "opcontrolNonZeroExitCode", null)); //$NON-NLS-1$ } } catch
+ * (IOException ioe) { ioe.printStackTrace(); } catch
+ * (InterruptedException e) { e.printStackTrace(); } }
+ */
}
-
+
}
import javax.xml.parsers.SAXParserFactory;
+import org.eclipse.linuxtools.oprofile.core.CommandManager;
import org.eclipse.linuxtools.oprofile.core.OprofileCorePlugin;
import org.eclipse.linuxtools.oprofile.core.OpxmlException;
-import org.eclipse.linuxtools.oprofile.core.PathParser;
import org.eclipse.linuxtools.oprofile.core.opxml.OprofileSAXHandler;
import org.eclipse.linuxtools.oprofile.core.opxml.XMLProcessor;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
import com.samsung.linuxplatform.oprofile.core.OprofileComm;
-import com.samsung.slp.common.conn.session.ISession;
/**
* This class will run opxml.
try {
//jinu added at 20090604 --------------------------
if(!OprofileComm.checkTarget()) return false;
- ISession session =OprofileComm.getSession();
+ //ISession session =OprofileComm.getSession();
String command = OprofileComm.getCommandString(cmdArray)+" | sed 's/^[^<]*//' | sed 's/&//'";
- String str = session.run(command, null);
- str = PathParser.pathParsing(str);
+ //String str = session.run(command, null);
+ String str = CommandManager.runCommandReturningResult(command);
+
reader.parse(new InputSource(new StringReader(str)));
//jinu removed at 20090616
return true;
} catch (SAXException e) {
e.printStackTrace();
- } catch (InterruptedException e) {
- e.printStackTrace();
} catch (IOException e) {
// System.out.println("IOException: " + e.getMessage());
e.printStackTrace();
org.eclipse.debug.ui;bundle-version="3.4.2",\r
org.eclipse.linuxtools.profiling.launch,\r
com.samsung.slp.nativeide;bundle-version="1.0.0",\r
- com.samsung.slp.common.conn;bundle-version="1.0.0",\r
com.samsung.slp.common;bundle-version="1.3.20"\r
Bundle-Vendor: Eclipse Linux Tools\r
Bundle-Version: 1.3.18.qualifier\r
Bundle-SymbolicName: org.eclipse.linuxtools.oprofile.launch.exe;singleton:=true\r
Bundle-RequiredExecutionEnvironment: JavaSE-1.6\r
Bundle-Activator: com.samsung.linuxplatform.oprofile.launch.Activator\r
+Export-Package: com.samsung.linuxplatform.oprofile.launch\r
\r
\r
\r
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.ILaunchesListener2;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-
-import com.samsung.slp.common.conn.device.DeviceManager;
-import com.samsung.slp.common.conn.machine.IMachine;
-import com.samsung.slp.common.conn.session.ISession;
-import com.samsung.slp.common.properties.InstallPathConfig;
-import com.samsung.slp.nativeide.launch.SLPLaunchDelegate;
-import com.samsung.slp.nativeide.launch.SLPLaunchMessages;
-
+import org.eclipse.linuxtools.oprofile.core.CommandManager;
+import org.eclipse.linuxtools.oprofile.core.OpcontrolException;
+import org.eclipse.linuxtools.oprofile.core.Oprofile;
import org.eclipse.linuxtools.oprofile.core.OprofileCorePlugin;
-import org.eclipse.linuxtools.oprofile.core.PathParser;
import org.eclipse.linuxtools.oprofile.core.daemon.OprofileDaemonEvent;
-import org.eclipse.linuxtools.oprofile.core.OpcontrolException;
import org.eclipse.linuxtools.oprofile.launch.OprofileLaunchPlugin;
import org.eclipse.linuxtools.oprofile.launch.configuration.LaunchOptions;
import org.eclipse.linuxtools.oprofile.launch.configuration.OprofileCounter;
import org.eclipse.linuxtools.oprofile.ui.OprofileUiPlugin;
import org.eclipse.linuxtools.oprofile.ui.view.OprofileView;
import org.eclipse.linuxtools.profiling.launch.Messages;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import com.samsung.slp.common.properties.InstallPathConfig;
+import com.samsung.slp.nativeide.launch.SLPLaunchDelegate;
+import com.samsung.slp.nativeide.launch.SLPLaunchMessages;
public class SLPOprofileLaunchDelegate extends SLPLaunchDelegate {
protected static final String PACKAGE_NAME = "oprofile";
protected static final String PACKAGE_FILENAME_ARM = "oprofile_armel.deb";
-
+
@Override
- public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
+ public void launch(ILaunchConfiguration config, String mode,
+ ILaunch launch, IProgressMonitor monitor) throws CoreException {
if (monitor == null)
monitor = new NullProgressMonitor();
try {
+
monitor.beginTask(SLPLaunchMessages.LAUNCH_APPLICATION, 30);
-
+
activateProgressView();
-
+
verifyCProjectConfigurationSettings(config);
- verifyDeviceReachability(getProject(config), new SubProgressMonitor(monitor, 9));
- verifyBuildConfiguration(config, mode, new SubProgressMonitor(monitor, 11));
-
- ISession session = getLaunchSession(config, new SubProgressMonitor(monitor, 1));
-
+ verifyDeviceReachability(getProject(config),
+ new SubProgressMonitor(monitor, 9));
+ verifyBuildConfiguration(config, mode, new SubProgressMonitor(
+ monitor, 11));
+
+ Oprofile.getOpInfo();
+
+ // ISession session = getLaunchSession(config, new
+ // SubProgressMonitor(monitor, 1));
+
if (mode.equals(ILaunchManager.PROFILE_MODE)) {
- deployApplication(session, config, new SubProgressMonitor(monitor, 9));
+ deployApplication(config, new SubProgressMonitor(monitor, 9));
monitor.worked(1);
-
- launchApplicationWithOprofile(session, launch, config, monitor);
+
+ launchApplicationWithOprofile(launch, config, monitor);
} else {
newCoreException(SLPLaunchMessages.CANNOT_LAUNCH, null);
}
}
}
- protected Process launchApplicationWithOprofile(ISession session, ILaunch launch, ILaunchConfiguration config, IProgressMonitor monitor) throws CoreException {
- Process remoteShellProcess = null;
-
+ protected void launchApplicationWithOprofile(ILaunch launch,
+ ILaunchConfiguration config, IProgressMonitor monitor)
+ throws CoreException {
try {
- setEnvironments(config, session);
+ setEnvironments(config);
// check oprofile tool
- checkProfilingTool(monitor, session);
-
- String remoteExePath = getRemoteExePath(config);
+ checkProfilingTool(monitor);
+
+ String remoteExePath = getRemoteExePath(config);
String cmd = "cd " + remoteExePath + CMD_RESULT_CHECK;
- String resultRsp = session.run(cmd, null);
- resultRsp = PathParser.pathParsing(resultRsp);
- if(!resultRsp.contains("0"))
- newCoreException(SLPLaunchMessages.CANNOT_LAUNCH, new Exception("Cannot change to run-directory : " + ". (Return Code: " + resultRsp + ")"));
+ // String resultRsp = session.run(cmd, null);
+ String[] resultRsp = CommandManager
+ .runCommandReturningResultArray(cmd);
+ if (!CommandManager.isRunSeccessfuly(resultRsp))
+ newCoreException(SLPLaunchMessages.CANNOT_LAUNCH,
+ new Exception("Cannot change to run-directory : "
+ + ". (Return Code: " + resultRsp + ")"));
IPath exeFile = CDebugUtils.verifyProgramPath(config);
remoteExePath += exeFile.toFile().getName();
cmd = "ls " + remoteExePath + CMD_RESULT_CHECK;
- resultRsp = session.run(cmd, null);
- resultRsp = PathParser.pathParsing(resultRsp);
- if(!resultRsp.contains("0"))
- newCoreException(SLPLaunchMessages.CANNOT_LAUNCH, new Exception("Executable does not exist on a valid path. You must install your application before running it."));
-
+ // resultRsp = session.run(cmd, null);
+ resultRsp = CommandManager.runCommandReturningResultArray(cmd);
+ if (!CommandManager.isRunSeccessfuly(resultRsp))
+ newCoreException(
+ SLPLaunchMessages.CANNOT_LAUNCH,
+ new Exception(
+ "Executable does not exist on a valid path. You must install your application before running it."));
+
monitor.worked(2);
- preProcedure(config, launch, monitor, remoteExePath);
+ preProcedure(config, launch, monitor, remoteExePath);
- String arguments = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, "");
+ String arguments = config
+ .getAttribute(
+ ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
+ "");
cmd = remoteExePath.trim();
- if(arguments != null && !arguments.equals(""))
+ if (arguments != null && !arguments.equals(""))
cmd += " " + arguments;
-
- remoteShellProcess = session.launch(cmd, null);
-
- DebugPlugin.newProcess(launch, remoteShellProcess, exeFile.toFile().getName());
-
+
+ // remoteShellProcess = session.launch(cmd, null);
+
+ CommandManager.runShell(cmd);
postProcedure(config, launch, monitor);
-
- } catch (CoreException e) {
- if(session != null)
- session.close();
+
+ } catch (CoreException e) {
throw e;
} catch (Exception e) {
- if(remoteShellProcess != null)
- remoteShellProcess.destroy();
- if(session != null)
- session.close();
-
newCoreException(SLPLaunchMessages.CANNOT_LAUNCH, e);
} finally {
- if(monitor.isCanceled())
- {
+ if (monitor.isCanceled()) {
throw new OperationCanceledException();
- }
- else
- {
+ } else {
monitor.done();
}
}
-
- return remoteShellProcess;
}
- private void preProcedure(ILaunchConfiguration config, ILaunch launch, IProgressMonitor monitor, String imagePath) throws CoreException {
- //FIXME: this assumes that project names are always the directory names in the workspace.
- //this assumption may be wrong, but a shallow lookup seems ok
- //jinu removed at 20090603
+ private void preProcedure(ILaunchConfiguration config, ILaunch launch,
+ IProgressMonitor monitor, String imagePath) throws CoreException {
+ // FIXME: this assumes that project names are always the directory names
+ // in the workspace.
+ // this assumption may be wrong, but a shallow lookup seems ok
+ // jinu removed at 20090603
/*
- String workspacePath = ResourcesPlugin.getWorkspace().getRoot().getLocation().toString();
- String imagePath = workspacePath
- + Path.SEPARATOR
- + config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, "") //$NON-NLS-1$
- + Path.SEPARATOR
- + config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, ""); //$NON-NLS-1$
- */
-
- LaunchOptions options = new LaunchOptions(); //default options created in the constructor
+ * String workspacePath =
+ * ResourcesPlugin.getWorkspace().getRoot().getLocation().toString();
+ * String imagePath = workspacePath + Path.SEPARATOR +
+ * config.getAttribute
+ * (ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, "")
+ * //$NON-NLS-1$ + Path.SEPARATOR +
+ * config.getAttribute(ICDTLaunchConfigurationConstants
+ * .ATTR_PROGRAM_NAME, ""); //$NON-NLS-1$
+ */
+
+ LaunchOptions options = new LaunchOptions(); // default options created
+ // in the constructor
options.loadConfiguration(config);
options.setBinaryImage(imagePath);
- //if daemonEvents null or zero size, the default event will be used
+ // if daemonEvents null or zero size, the default event will be used
String defaultEvent = null;
OprofileDaemonEvent[] daemonEvents = null;
- if (!config.getAttribute(OprofileLaunchPlugin.ATTR_USE_DEFAULT_EVENT, false)) {
- //get the events to profile from the counters
+ if (!config.getAttribute(OprofileLaunchPlugin.ATTR_USE_DEFAULT_EVENT,
+ false)) {
+ // get the events to profile from the counters
OprofileCounter[] counters = OprofileCounter.getCounters(config);
ArrayList<OprofileDaemonEvent> events = new ArrayList<OprofileDaemonEvent>();
-
+
for (int i = 0; i < counters.length; ++i) {
if (counters[i].getEnabled())
events.add(counters[i].getDaemonEvent());
}
-
+
daemonEvents = new OprofileDaemonEvent[events.size()];
events.toArray(daemonEvents);
}
- //jinu added at 20090602--------------------------------
+ // jinu added at 20090602--------------------------------
else {
- String keyStr = config.getAttribute(OprofileLaunchPlugin.ATTR_SELECTED_DEFAULT_SETTING,"");
+ String keyStr = config.getAttribute(
+ OprofileLaunchPlugin.ATTR_SELECTED_DEFAULT_SETTING, "");
defaultEvent = DefaultSettingConstants.getSettingValue(keyStr);
}
- //--------------------------------------
-
- //set up and launch the oprofile daemon
+ // --------------------------------------
+
+ // set up and launch the oprofile daemon
try {
-
- //kill the daemon (it shouldn't be running already, but to be safe)
- OprofileCorePlugin.getDefault().getOpcontrolProvider().shutdownDaemon();
-
- //reset data from the (possibly) existing default session,
+
+ // kill the daemon (it shouldn't be running already, but to be safe)
+ OprofileCorePlugin.getDefault().getOpcontrolProvider()
+ .shutdownDaemon();
+
+ // reset data from the (possibly) existing default session,
// otherwise multiple runs will combine samples and results
// won't make much sense
OprofileCorePlugin.getDefault().getOpcontrolProvider().reset();
-
- //setup the events and other parameters
- //jinu modified at 20090603
- //OprofileCorePlugin.getDefault().getOpcontrolProvider().setupDaemon(options.getOprofileDaemonOptions(), daemonEvents);
- OprofileCorePlugin.getDefault().getOpcontrolProvider().setupDaemon(options.getOprofileDaemonOptions(), daemonEvents, defaultEvent);
-
- //start the daemon & collection of samples
- //note: since the daemon is only profiling for the specific image we told
- // it to, no matter to start the daemon before the binary itself is run
- OprofileCorePlugin.getDefault().getOpcontrolProvider().startCollection();
-
-
+
+ // setup the events and other parameters
+ // jinu modified at 20090603
+ // OprofileCorePlugin.getDefault().getOpcontrolProvider().setupDaemon(options.getOprofileDaemonOptions(),
+ // daemonEvents);
+ OprofileCorePlugin
+ .getDefault()
+ .getOpcontrolProvider()
+ .setupDaemon(options.getOprofileDaemonOptions(),
+ daemonEvents, defaultEvent);
+
+ // start the daemon & collection of samples
+ // note: since the daemon is only profiling for the specific image
+ // we told
+ // it to, no matter to start the daemon before the binary itself is
+ // run
+ OprofileCorePlugin.getDefault().getOpcontrolProvider()
+ .startCollection();
+
} catch (OpcontrolException oe) {
OprofileCorePlugin.showErrorDialog("opcontrolProvider", oe); //$NON-NLS-1$
return;
}
}
-
- private void postProcedure(ILaunchConfiguration config, ILaunch launch, IProgressMonitor monitor) throws CoreException {
- ILaunchManager lmgr = DebugPlugin.getDefault().getLaunchManager();
- lmgr.addLaunchListener(new LaunchTerminationWatcher(launch));
+
+ private void postProcedure(ILaunchConfiguration config, ILaunch launch,
+ IProgressMonitor monitor) throws CoreException {
+ // ILaunchManager lmgr = DebugPlugin.getDefault().getLaunchManager();
+ // lmgr.addLaunchListener(new LaunchTerminationWatcher(launch));
+ OprofileCorePlugin.getDefault().getOpcontrolProvider().dumpSamples();
+ OprofileCorePlugin.getDefault().getOpcontrolProvider().shutdownDaemon();
+
+ // need to run this in the ui thread otherwise get SWT Exceptions
+ // based on concurrency issues
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ OprofileView view = OprofileUiPlugin.getDefault()
+ .getOprofileView();
+ if (view != null) {
+ view.refreshView();
+ } else {
+ try {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getActivePage()
+ .showView(OprofileUiPlugin.ID_OPROFILE_VIEW);
+ } catch (PartInitException e) {
+ e.printStackTrace();
+ }
+ OprofileUiPlugin.getDefault().getOprofileView()
+ .refreshView();
+ }
+ }
+ });
}
-
- public static void checkProfilingTool(IProgressMonitor monitor, ISession session) throws Exception {
+ public static void checkProfilingTool(IProgressMonitor monitor)
+ throws Exception {
// find oprofile
String oprofileCmd = "/usr/bin/opcontrol";
- String cmd = "ls " + oprofileCmd + CMD_RESULT_CHECK ;
- String resultRsp = session.run(cmd, null);
- resultRsp = PathParser.pathParsing(resultRsp);
- if(!resultRsp.contains("0"))
- {
- if(DeviceManager.getSelectedDevice().getMachineType().equals(IMachine.VIRTUAL_DEVICE))
- {
- throw new Exception(SLPLaunchMessages.CANNOT_LAUNCH, new Exception("No oprofile in this target (/usr/bin/opcontrol)."));
- }
- else
- {
- transferProfilingToolPackage(monitor, session);
- installProfilingToolPackage(monitor, session);
+ String cmd = "ls " + oprofileCmd + CMD_RESULT_CHECK;
+ // String resultRsp = session.run(cmd, null);
+ String[] resultRsp = CommandManager.runCommandReturningResultArray(cmd);
+ if (!CommandManager.isRunSeccessfuly(resultRsp)) {
+ if (CommandManager.isEmulator()) {
+ throw new Exception(
+ SLPLaunchMessages.CANNOT_LAUNCH,
+ new Exception(
+ "No oprofile in this target (/usr/bin/opcontrol)."));
+ } else {
+ transferProfilingToolPackage(monitor);
+ installProfilingToolPackage(monitor);
}
}
}
-
+
/**
* Transfer oprofile package to the target
*
* @param session
* connection session to the target or simulator
* @return void
- *
+ *
* @exception CoreException
* if unable to transfer a package
*/
- public static void transferProfilingToolPackage(IProgressMonitor monitor, ISession session) throws Exception {
+ public static void transferProfilingToolPackage(IProgressMonitor monitor)
+ throws Exception {
try {
- monitor.beginTask(Messages.getString("ProfileLaunch.TRANSFER_PROFILING_TOOL"), 1);
+ monitor.beginTask(
+ Messages.getString("ProfileLaunch.TRANSFER_PROFILING_TOOL"),
+ 1);
// test whether oprofile package exist or not
String sdkInstallPath = InstallPathConfig.getSDKPath();
- String toolPkgPath = sdkInstallPath + "/SDK/profiling-tool/" + PACKAGE_FILENAME_ARM;
+ String toolPkgPath = sdkInstallPath + "/SDK/profiling-tool/"
+ + PACKAGE_FILENAME_ARM;
File toolPkg = new File(toolPkgPath);
- if(toolPkg == null || !toolPkg.exists())
- throw new Exception(Messages.getString("ProfileLaunch.FAIL_TO_TRANSFER"),
- new Exception("Tool package path (" + toolPkgPath + ") is not available."));
-
+ if (toolPkg == null || !toolPkg.exists())
+ throw new Exception(
+ Messages.getString("ProfileLaunch.FAIL_TO_TRANSFER"),
+ new Exception("Tool package path (" + toolPkgPath
+ + ") is not available."));
+
String destDirectoryPath = TEMPORARY_PKG_PATH;
- if (!session.isPathExist(destDirectoryPath)) {
- String command = MAKE_DIRECTORY_CMD + destDirectoryPath + CMD_RESULT_CHECK;
- String result = session.run(command, null);
- result = PathParser.pathParsing(result);
- if(!result.contains("0"))
- throw new Exception(Messages.getString("ProfileLaunch.FAIL_TO_TRANSFER"),
- new Exception("Destination path (" + destDirectoryPath + ") in not exist."));
+ if (!CommandManager.isPathExist(destDirectoryPath)) {
+ String command = MAKE_DIRECTORY_CMD + destDirectoryPath
+ + CMD_RESULT_CHECK;
+ // String result = session.run(command, null);
+ String[] result = CommandManager
+ .runCommandReturningResultArray(command);
+ if (!CommandManager.isRunSeccessfuly(result))
+ throw new Exception(
+ Messages.getString("ProfileLaunch.FAIL_TO_TRANSFER"),
+ new Exception("Destination path ("
+ + destDirectoryPath + ") in not exist."));
}
String srcFilePath = toolPkg.getAbsoluteFile().getCanonicalPath();
- String destFilePath = destDirectoryPath + toolPkg.getAbsoluteFile().getName();
+ String destFilePath = destDirectoryPath
+ + toolPkg.getAbsoluteFile().getName();
- boolean isSuccess = session.transferFile(srcFilePath, destFilePath);
+ // boolean isSuccess = session.transferFile(srcFilePath,
+ // destFilePath);
+ boolean isSuccess = CommandManager.push(srcFilePath, destFilePath);
if (isSuccess == false)
- throw new Exception(Messages.getString("ProfileLaunch.FAIL_TO_TRANSFER"),
- new Exception("source path (" + srcFilePath + "), dest path (" + destFilePath +")"));
+ throw new Exception(
+ Messages.getString("ProfileLaunch.FAIL_TO_TRANSFER"),
+ new Exception("source path (" + srcFilePath
+ + "), dest path (" + destFilePath + ")"));
} catch (Exception e) {
- throw e;
+ throw e;
} finally {
monitor.done();
}
* @param pkgmgr
* instance which contains resources and control information
* @return void
- *
+ *
* @exception CoreException
* if unable to install a package
*/
- public static void installProfilingToolPackage(IProgressMonitor monitor, ISession session) throws Exception {
+ public static void installProfilingToolPackage(IProgressMonitor monitor)
+ throws Exception {
try {
- monitor.beginTask(Messages.getString("ProfileLaunch.INSTALL_PROFILING_TOOL"), 2);
+ monitor.beginTask(
+ Messages.getString("ProfileLaunch.INSTALL_PROFILING_TOOL"),
+ 2);
String packageDirectory = TEMPORARY_PKG_PATH;
- String command = CHANGE_DIRECTORY_CMD + packageDirectory + CMD_RESULT_CHECK;
- String result = session.run(command, null);
- result = PathParser.pathParsing(result);
- if(!result.contains("0"))
- throw new Exception(Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"), new Exception("command is " + command));
+ String command = CHANGE_DIRECTORY_CMD + packageDirectory
+ + CMD_RESULT_CHECK;
+ // String result = session.run(command, null);
+ String[] result = CommandManager
+ .runCommandReturningResultArray(command);
+ if (!CommandManager.isRunSeccessfuly(result))
+ throw new Exception(
+ Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"),
+ new Exception("command is " + command));
monitor.worked(1);
// remount file system
command = "mount -o remount,rw /" + CMD_RESULT_CHECK;
- result = session.run(command, null);
- result = PathParser.pathParsing(result);
- if(!result.contains("0"))
- throw new Exception(Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"), new Exception("command is " + command));
+ // result = session.run(command, null);
+ result = CommandManager.runCommandReturningResultArray(command);
+ if (!CommandManager.isRunSeccessfuly(result))
+ throw new Exception(
+ Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"),
+ new Exception("command is " + command));
// install new application
- command = PKG_TOOL_CMD + PKG_TOOL_INSTALL_OPTION + PACKAGE_FILENAME_ARM + CMD_RESULT_CHECK;
- result = session.run(command, null);
- result = PathParser.pathParsing(result);
- if(!result.contains("0"))
- throw new Exception(Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"), new Exception("command is " + command));
+ command = PKG_TOOL_CMD + PKG_TOOL_INSTALL_OPTION
+ + PACKAGE_FILENAME_ARM + CMD_RESULT_CHECK;
+ // result = session.run(command, null);
+ result = CommandManager.runCommandReturningResultArray(command);
+ if (!CommandManager.isRunSeccessfuly(result))
+ throw new Exception(
+ Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"),
+ new Exception("command is " + command));
monitor.worked(1);
-
+
// remount file system
command = "mount -o remount,ro /" + CMD_RESULT_CHECK;
- result = session.run(command, null);
- result = PathParser.pathParsing(result);
+ // result = session.run(command, null);
+ CommandManager.runCommand(command);
} catch (Exception e) {
throw e;
} finally {
monitor.done();
}
}
-
+
class LaunchTerminationWatcher implements ILaunchesListener2 {
private ILaunch launch;
-
+
public LaunchTerminationWatcher(ILaunch il) {
launch = il;
}
-
+
public void launchesTerminated(ILaunch[] launches) {
try {
for (ILaunch l : launches) {
/**
- * Dump samples from the daemon,
- * shut down the daemon,
+ * Dump samples from the daemon, shut down the daemon,
* activate the OProfile view (open it if it isn't already),
- * refresh the view (which parses the data/ui model and displays it).
+ * refresh the view (which parses the data/ui model and
+ * displays it).
*/
if (l.equals(launch)) {
- OprofileCorePlugin.getDefault().getOpcontrolProvider().dumpSamples();
- OprofileCorePlugin.getDefault().getOpcontrolProvider().shutdownDaemon();
+ OprofileCorePlugin.getDefault().getOpcontrolProvider()
+ .dumpSamples();
+ OprofileCorePlugin.getDefault().getOpcontrolProvider()
+ .shutdownDaemon();
- //need to run this in the ui thread otherwise get SWT Exceptions
+ // need to run this in the ui thread otherwise get SWT
+ // Exceptions
// based on concurrency issues
Display.getDefault().syncExec(new Runnable() {
public void run() {
- OprofileView view = OprofileUiPlugin.getDefault().getOprofileView();
+ OprofileView view = OprofileUiPlugin
+ .getDefault().getOprofileView();
if (view != null) {
view.refreshView();
} else {
try {
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(OprofileUiPlugin.ID_OPROFILE_VIEW);
+ PlatformUI
+ .getWorkbench()
+ .getActiveWorkbenchWindow()
+ .getActivePage()
+ .showView(
+ OprofileUiPlugin.ID_OPROFILE_VIEW);
} catch (PartInitException e) {
e.printStackTrace();
}
- OprofileUiPlugin.getDefault().getOprofileView().refreshView();
+ OprofileUiPlugin.getDefault()
+ .getOprofileView().refreshView();
}
}
});
}
}
- public void launchesAdded(ILaunch[] launches) { /* dont care */}
- public void launchesChanged(ILaunch[] launches) { /* dont care */ }
- public void launchesRemoved(ILaunch[] launches) { /* dont care */ }
- }
+ public void launchesAdded(ILaunch[] launches) { /* dont care */
+ }
+
+ public void launchesChanged(ILaunch[] launches) { /* dont care */
+ }
+
+ public void launchesRemoved(ILaunch[] launches) { /* dont care */
+ }
+ }
}
import org.eclipse.linuxtools.oprofile.launch.configuration.OprofileEventConfigTab;
import org.eclipse.linuxtools.profiling.launch.ProfileLaunchConfigurationTabGroup;
-import com.samsung.linuxplatform.oprofile.core.OprofileComm;
import com.samsung.linuxplatform.oprofile.launch.SLPOprofileLaunchDelegate;
-import com.samsung.slp.common.conn.session.ISession;
import com.samsung.slp.nativeide.launch.ui.SLPArgumentsTab;
import com.samsung.slp.nativeide.launch.ui.SLPEnvironmentTab;
import com.samsung.slp.nativeide.launch.ui.SLPMainTab;
-import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
-
public class NormalOprofileLaunchConfigurationTabGroup extends ProfileLaunchConfigurationTabGroup {
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
// added by greatim at 20110613
try{
- ISession session = OprofileComm.getSession();
IProgressMonitor monitor = new NullProgressMonitor();
- SLPOprofileLaunchDelegate.checkProfilingTool(monitor, session);
+ SLPOprofileLaunchDelegate.checkProfilingTool(monitor);
} catch(Exception e) {
}
org.eclipse.cdt.launch;bundle-version="5.0.1",\r
org.eclipse.cdt.debug.core;bundle-version="5.0.1",\r
org.eclipse.linuxtools.oprofile.core,\r
- com.samsung.slp.common.conn;bundle-version="1.0.0"\r
+ com.samsung.slp.common;bundle-version="1.3.20",\r
+ com.samsung.slp.common.connection;bundle-version="1.0.0"\r
Bundle-Vendor: Eclipse Linux Tools\r
Bundle-ActivationPolicy: lazy\r
Bundle-Version: 1.3.18.qualifier\r
import org.eclipse.linuxtools.oprofile.core.Oprofile;
-import com.samsung.slp.common.conn.device.DeviceManager;
-import com.samsung.slp.common.conn.device.IDeviceListener;
+import com.samsung.slp.common.connection.ConnectionPlugin;
+import com.samsung.slp.common.connection.ConnectionPlugin.ISelectionListener;
+import com.samsung.slp.sdblib.FileListingService.FileEntry;
-public class OProfileTargetConnectionListener implements IDeviceListener{
+public class OProfileTargetConnectionListener implements ISelectionListener{
- @Override
- public void ConnectionChanged() {
- try {
+// //@Override
+// public void ConnectionChanged() {
+// /*
+// try {
// if(DeviceManager.hasSelectedDevice() == false || !DeviceManager.getSelectedDevice().isReachable())
- {
- Oprofile.initialize();
- }
- } catch (Exception e) {
-
- }
- }
+// {
+// Oprofile.initialize();
+// }
+// } catch (Exception e) {
+//
+// }
+// */
+// Oprofile.initialize();
+// }
+
@Override
- public void SelectionChanged() {
+ public void selectionChanged(FileEntry selectedEntry) {
// TODO Auto-generated method stub
+ if(null == ConnectionPlugin.getDefault().getCurrentDevice()){
+ Oprofile.initialize();
+ }
+
+
}
}
import org.eclipse.ui.IStartup;
-import com.samsung.slp.common.conn.device.DeviceLauncherManager;
+import com.samsung.slp.common.connection.ConnectionPlugin;
public class OprofileStartup implements IStartup {
//
public void earlyStartup() {
mDeviceListener = new OProfileTargetConnectionListener();
- DeviceLauncherManager.addDeviceListener(mDeviceListener);
+ ConnectionPlugin.getDefault().addSelectionListener(mDeviceListener);
}
-
}
org.eclipse.linuxtools.valgrind.launch,\r
org.eclipse.linuxtools.valgrind.ui,\r
com.samsung.slp.nativeide;bundle-version="1.0.0",\r
- com.samsung.slp.common.conn;bundle-version="1.0.0",\r
- com.samsung.slp.common;bundle-version="1.3.20"\r
+ com.samsung.slp.common;bundle-version="1.3.20",\r
+ com.samsung.slp.common.connection;bundle-version="1.0.0"\r
Bundle-Vendor: Eclipse Linux Tools\r
Bundle-Version: 1.3.18.qualifier\r
Bundle-Localization: plugin\r
--- /dev/null
+package org.eclipse.linuxtools.valgrind.launch;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import com.samsung.slp.common.connection.ConnectionPlugin;
+import com.samsung.slp.sdblib.IDevice;
+import com.samsung.slp.sdblib.MultiLineReceiver;
+import com.samsung.slp.sdblib.SdbCommandRejectedException;
+import com.samsung.slp.sdblib.SdbShellProcess;
+import com.samsung.slp.sdblib.ShellCommandUnresponsiveException;
+import com.samsung.slp.sdblib.SyncService;
+import com.samsung.slp.sdblib.SyncService.SyncResult;
+import com.samsung.slp.sdblib.TimeoutException;
+
+class CommonReceiver extends MultiLineReceiver {
+
+ private String[] output;
+
+ public String[] getOutput() {
+ return output;
+ }
+
+ @Override
+ public void processNewLines(String[] lines) {
+ output = lines;
+ }
+}
+
+public class CommandManager {
+ public static String runShell(String command) {
+ IDevice device = ConnectionPlugin.getDefault().getCurrentDevice();
+ SdbShellProcess sdbShellProc = null;
+ BufferedReader br = null;
+ try {
+ sdbShellProc = device.executeShellCommand(command);
+ br = new BufferedReader(new InputStreamReader(
+ sdbShellProc.getInputStream()));
+
+ } catch (IOException e1) {
+ e1.printStackTrace();
+ }
+ String out = null;
+ String lastOut = null;
+ try {
+ while (null != (out = br.readLine())) {
+ lastOut = out;
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return lastOut;
+ }
+
+ public static String[] runCommandReturningResult(String command) {
+ IDevice device = ConnectionPlugin.getDefault().getCurrentDevice();
+ CommonReceiver commonReceiver = new CommonReceiver();
+ try {
+ device.executeShellCommand(command, commonReceiver);
+ } catch (TimeoutException e) {
+ e.printStackTrace();
+ } catch (SdbCommandRejectedException e) {
+ e.printStackTrace();
+ } catch (ShellCommandUnresponsiveException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return commonReceiver.getOutput();
+ }
+
+ public static void runCommand(String command) {
+ try {
+ ConnectionPlugin.getDefault().getCurrentDevice()
+ .executeShellCommand(command);
+ } catch (SdbCommandRejectedException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static boolean pull(String src, String dest) {
+ SyncService syncService = null;
+ try {
+ syncService = ConnectionPlugin.getDefault().getCurrentDevice()
+ .getSyncService();
+ } catch (TimeoutException e) {
+ e.printStackTrace();
+ } catch (SdbCommandRejectedException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ SyncResult result = syncService.pullFile(src, dest,
+ SyncService.getNullProgressMonitor());
+ if (SyncService.RESULT_OK == result.getCode()) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public static boolean push(String src, String dest) {
+ SyncService syncService = null;
+ try {
+ syncService = ConnectionPlugin.getDefault().getCurrentDevice()
+ .getSyncService();
+ } catch (TimeoutException e) {
+ e.printStackTrace();
+ } catch (SdbCommandRejectedException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ SyncResult result = syncService.pushFile(src, dest,
+ SyncService.getNullProgressMonitor());
+ if (SyncService.RESULT_OK == result.getCode()) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public static boolean isPathExist(String path) {
+ String[] result = runCommandReturningResult(path);
+ if (null != result && result[0].equals("No such file or directory")) {
+ return false;
+ }
+ return true;
+ }
+
+ public static boolean isEmulator() {
+ return ConnectionPlugin.getDefault().getCurrentDevice().isEmulator();
+ }
+
+ public static boolean isRunSeccessfuly(String[] result) {
+ if (null != result && result.length > 0
+ && !result[result.length - 1].contains("0")) {
+ return false;
+ } else {
+ return true;
+ }
+
+ }
+}
+++ /dev/null
-package org.eclipse.linuxtools.valgrind.launch;
-
-public class PathParser {
- static public String pathParsing(String str){
- if(str.startsWith("/opt/home/root # ")){
- str = str.substring(17,str.length());
- if(str.startsWith("\r\n")){
- str = str.substring(2, str.length());
- }
- }
- return str;
- }
-}
import java.util.ArrayList;
import java.util.Arrays;
-import org.eclipse.cdt.launch.LaunchUtils;
import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
+import org.eclipse.cdt.launch.LaunchUtils;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-
-import org.eclipse.linuxtools.valgrind.launch.PathParser;
import org.eclipse.linuxtools.profiling.launch.Messages;
-import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin;
import org.eclipse.linuxtools.valgrind.core.ValgrindCommand;
import org.eclipse.linuxtools.valgrind.core.utils.LaunchConfigurationConstants;
+import org.eclipse.linuxtools.valgrind.ui.ValgrindUIPlugin;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
-import com.samsung.slp.common.conn.device.DeviceManager;
-import com.samsung.slp.common.conn.machine.IMachine;
-import com.samsung.slp.common.conn.session.ISession;
import com.samsung.slp.common.properties.InstallPathConfig;
import com.samsung.slp.nativeide.launch.SLPLaunchDelegate;
import com.samsung.slp.nativeide.launch.SLPLaunchMessages;
protected IValgrindLaunchDelegate dynamicDelegate;
protected ValgrindCommand command;
protected String toolID;
- protected IProcess process;
protected static final String EQUALS = "=";
protected static final String EMPTY_STRING = "";
protected static final String PACKAGE_NAME = "valgrind";
protected static final String PACKAGE_FILENAME_ARM = "valgrind_armel.deb";
-
+
@Override
- public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
+ public void launch(ILaunchConfiguration config, String mode,
+ ILaunch launch, IProgressMonitor monitor) throws CoreException {
if (monitor == null)
monitor = new NullProgressMonitor();
try {
monitor.beginTask(SLPLaunchMessages.LAUNCH_APPLICATION, 30);
-
+
activateProgressView();
-
+
verifyCProjectConfigurationSettings(config);
- verifyDeviceReachability(getProject(config), new SubProgressMonitor(monitor, 9));
- verifyBuildConfiguration(config, mode, new SubProgressMonitor(monitor, 11));
-
- ISession session = getLaunchSession(config, new SubProgressMonitor(monitor, 1));
-
+ verifyDeviceReachability(getProject(config),
+ new SubProgressMonitor(monitor, 9));
+ verifyBuildConfiguration(config, mode, new SubProgressMonitor(
+ monitor, 11));
+
+ // getLaunchSession(config, new SubProgressMonitor(monitor, 1));
+
if (mode.equals(ILaunchManager.PROFILE_MODE)) {
- deployApplication(session, config, new SubProgressMonitor(monitor, 9));
+ deployApplication(config, new SubProgressMonitor(monitor, 9));
monitor.worked(1);
-
- launchApplicationWithValgrind(session, launch, config, monitor);
+
+ launchApplicationWithValgrind(launch, config, monitor);
} else {
newCoreException(SLPLaunchMessages.CANNOT_LAUNCH, null);
}
}
- protected Process launchApplicationWithValgrind(ISession session, ILaunch launch, ILaunchConfiguration config, IProgressMonitor monitor) throws CoreException {
- Process remoteShellProcess = null;
-
+ protected void launchApplicationWithValgrind(ILaunch launch,
+ ILaunchConfiguration config, IProgressMonitor monitor)
+ throws CoreException {
+ // Process remoteShellProcess = null;
+
try {
- setEnvironments(config, session);
+ setEnvironments(config);
// find Valgrind
String valgrindCmd = "/usr/bin/valgrind";
- String cmd = "ls " + valgrindCmd + CMD_RESULT_CHECK ;
- String resultRsp = session.run(cmd, null);
- resultRsp = PathParser.pathParsing(resultRsp);
- if(!resultRsp.contains("0"))
- {
- if(DeviceManager.getSelectedDevice().getMachineType().equals(IMachine.VIRTUAL_DEVICE))
- {
- newCoreException(SLPLaunchMessages.CANNOT_LAUNCH, new Exception("No valgrind in this target (/usr/bin/valgrind). "));
- }
- else
- {
- transferProfilingToolPackage(monitor, session);
- installProfilingToolPackage(monitor, session);
+ String cmd = "ls " + valgrindCmd + CMD_RESULT_CHECK;
+ // String resultRsp = session.run(cmd, null);
+ String[] resultRsp = CommandManager.runCommandReturningResult(cmd);
+ if (!CommandManager.isRunSeccessfuly(resultRsp)) {
+ if (CommandManager.isEmulator()) {
+ newCoreException(
+ SLPLaunchMessages.CANNOT_LAUNCH,
+ new Exception(
+ "No valgrind in this target (/usr/bin/valgrind). "));
+ } else {
+ transferProfilingToolPackage(monitor);
+ installProfilingToolPackage(monitor);
}
}
-
- String remoteExePath = getRemoteExePath(config);
+
+ String remoteExePath = getRemoteExePath(config);
cmd = "cd " + remoteExePath + CMD_RESULT_CHECK;
- resultRsp = session.run(cmd, null);
- resultRsp = PathParser.pathParsing(resultRsp);
- if(!resultRsp.contains("0"))
- newCoreException(SLPLaunchMessages.CANNOT_LAUNCH, new Exception("Cannot change to run-directory : " + ". (Return Code: " + resultRsp + ", exepath: " + remoteExePath + ")"));
+ // resultRsp = session.run(cmd, null);
+ resultRsp = CommandManager.runCommandReturningResult(cmd);
+ if (!CommandManager.isRunSeccessfuly(resultRsp))
+ newCoreException(SLPLaunchMessages.CANNOT_LAUNCH,
+ new Exception("Cannot change to run-directory : "
+ + ". (Return Code: " + resultRsp
+ + ", exepath: " + remoteExePath + ")"));
IPath exeFile = CDebugUtils.verifyProgramPath(config);
remoteExePath += exeFile.toFile().getName();
cmd = "ls " + remoteExePath + CMD_RESULT_CHECK;
- resultRsp = session.run(cmd, null);
- resultRsp = PathParser.pathParsing(resultRsp);
- if(!resultRsp.contains("0"))
- newCoreException(SLPLaunchMessages.CANNOT_LAUNCH, new Exception("Executable does not exist on a valid path. You must install your application before running it."));
-
+ // resultRsp = session.run(cmd, null);
+ resultRsp = CommandManager.runCommandReturningResult(cmd);
+ if (!CommandManager.isRunSeccessfuly(resultRsp))
+ newCoreException(
+ SLPLaunchMessages.CANNOT_LAUNCH,
+ new Exception(
+ "Executable does not exist on a valid path. You must install your application before running it."));
+
monitor.worked(3);
-
+
// remove and remake valgrind result directory
- cmd ="rm -rf"+ " "+ ValgrindLaunchPlugin.RESULT_DIR;
- session.run(cmd, null);
- cmd ="mkdir -p"+ " "+ValgrindLaunchPlugin.RESULT_DIR;
- session.run(cmd, null);
+ cmd = "rm -rf" + " " + ValgrindLaunchPlugin.RESULT_DIR;
+ // session.run(cmd, null);
+ CommandManager.runShell(cmd);
+ cmd = "mkdir -p" + " " + ValgrindLaunchPlugin.RESULT_DIR;
+ // session.run(cmd, null);
+ CommandManager.runShell(cmd);
monitor.worked(1);
// ask tool (that was launched) extension for arguments
toolID = getTool(config);
- dynamicDelegate = ValgrindLaunchPlugin.getDefault().getToolDelegate(toolID);
+ dynamicDelegate = ValgrindLaunchPlugin.getDefault()
+ .getToolDelegate(toolID);
String[] opts = getValgrindArgumentsArray(config);
String[] arguments = getProgramArgumentsArray(config);
-
- ArrayList<String> cmdLine = new ArrayList<String>(1 + arguments.length);
+
+ ArrayList<String> cmdLine = new ArrayList<String>(
+ 1 + arguments.length);
cmdLine.add(valgrindCmd);
cmdLine.addAll(Arrays.asList(opts));
cmdLine.add(remoteExePath.toString());
cmdLine.addAll(Arrays.asList(arguments));
- String[] commandArray = (String[]) cmdLine.toArray(new String[cmdLine.size()]);
+ String[] commandArray = (String[]) cmdLine
+ .toArray(new String[cmdLine.size()]);
// compose full command of valgrind
- String fullcommand = "";
- for (int i = 0; i < commandArray.length; i++) {
- fullcommand += commandArray[i] + " ";
+ String fullcommand = "";
+ for (int i = 0; i < commandArray.length; i++) {
+ fullcommand += commandArray[i] + " ";
}
- config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_USE_TERMINAL, ICDTLaunchConfigurationConstants.USE_TERMINAL_DEFAULT); // what is this?
- remoteShellProcess = session.launch(fullcommand, null);
-
+ if (CommandManager.isEmulator()
+ && Platform.getOS().equals(Platform.OS_WIN32)) {
+ Exception te;
+ te = new Exception(
+ "Can not use valgrind, because the host doesn't support Intel VT");
+ throw (te);
+ }
+
+ config.getAttribute(
+ ICDTLaunchConfigurationConstants.ATTR_USE_TERMINAL,
+ ICDTLaunchConfigurationConstants.USE_TERMINAL_DEFAULT); // what
+ // is
+ // this?
+ // remoteShellProcess = session.launch(fullcommand, null);
+ CommandManager.runShell(fullcommand);
+
monitor.worked(2);
- process = DebugPlugin.newProcess(launch, remoteShellProcess, "valgrind");
-
+ // process = DebugPlugin.newProcess(launch, remoteShellProcess,
+ // "valgrind");
+
// create launch summary string to distinguish this launch
String launchStr = createLaunchStr(config);
-
+
// create view
ValgrindUIPlugin.getDefault().createView(launchStr, toolID);
-
+
// pass off control to extender
- command = new ValgrindCommand(new File(ValgrindLaunchPlugin.RESULT_DIR));
- dynamicDelegate.launch(command, config, launch, new SubProgressMonitor(monitor, 15), remoteShellProcess, session);
-
+ command = new ValgrindCommand(new File(
+ ValgrindLaunchPlugin.RESULT_DIR));
+ dynamicDelegate.launch(command, config, launch,
+ new SubProgressMonitor(monitor, 15));
+
// refresh view
ValgrindUIPlugin.getDefault().refreshView();
-
+
Display.getDefault().syncExec(new Runnable() {
public void run() {
try {
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(ValgrindUIPlugin.VIEW_ID);
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getActivePage()
+ .showView(ValgrindUIPlugin.VIEW_ID);
} catch (PartInitException e) {
e.printStackTrace();
}
}
});
- } catch (CoreException e) {
- if(session != null)
- session.close();
+ } catch (CoreException e) {
throw e;
} catch (Exception e) {
- if(remoteShellProcess != null)
- remoteShellProcess.destroy();
- if(session != null)
- session.close();
-
newCoreException(SLPLaunchMessages.CANNOT_LAUNCH, e);
} finally {
- if(monitor.isCanceled())
- {
+ if (monitor.isCanceled()) {
throw new OperationCanceledException();
- }
- else
- {
+ } else {
monitor.done();
}
}
-
- return remoteShellProcess;
}
- private String[] getValgrindArgumentsArray(ILaunchConfiguration config) throws IOException, CoreException {
+ private String[] getValgrindArgumentsArray(ILaunchConfiguration config)
+ throws IOException, CoreException {
ArrayList<String> opts = new ArrayList<String>();
- opts.add(ValgrindCommand.OPT_TOOL + EQUALS + ValgrindLaunchPlugin.getDefault().getToolName(toolID));
-
-// opts.add(ValgrindCommand.OPT_LOGFILE + EQUALS + ValgrindLaunchPlugin.RESULT_DIR + LOG_FILE);
- opts.add(ValgrindCommand.OPT_XMLFILE + EQUALS + ValgrindLaunchPlugin.RESULT_DIR + LOG_FILE);
-// opts.add(ValgrindCommand.OPT_LOGFILE + EQUALS + "/home" + File.separator + LOG_FILE);
-
- opts.add(ValgrindCommand.OPT_TRACECHILD + EQUALS + (config.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_TRACECHILD, false) ? YES : NO));
- opts.add(ValgrindCommand.OPT_CHILDSILENT + EQUALS + YES);//(config.getAttribute(ValgrindLaunchPlugin.ATTR_GENERAL_CHILDSILENT, false) ? YES : NO));
-// opts.add(ValgrindCommand.OPT_TRACKFDS + EQUALS + (config.getAttribute(ValgrindLaunchPlugin.ATTR_GENERAL_TRACKFDS, false) ? YES : NO));
-// opts.add(ValgrindCommand.OPT_TIMESTAMP + EQUALS + (config.getAttribute(ValgrindLaunchPlugin.ATTR_GENERAL_TIMESTAMP, false) ? YES : NO));
- opts.add(ValgrindCommand.OPT_FREERES + EQUALS + (config.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_FREERES, true) ? YES : NO));
-
- opts.add(ValgrindCommand.OPT_DEMANGLE + EQUALS + (config.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_DEMANGLE, true) ? YES : NO));
- opts.add(ValgrindCommand.OPT_NUMCALLERS + EQUALS + config.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_NUMCALLERS, 12));
- opts.add(ValgrindCommand.OPT_ERRLIMIT + EQUALS + (config.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_ERRLIMIT, true) ? YES : NO));
- opts.add(ValgrindCommand.OPT_BELOWMAIN + EQUALS + (config.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_BELOWMAIN, false) ? YES : NO));
- opts.add(ValgrindCommand.OPT_MAXFRAME + EQUALS + config.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_MAXFRAME, 2000000));
-
- String strpath = config.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_SUPPFILE, EMPTY_STRING);
+ opts.add(ValgrindCommand.OPT_TOOL + EQUALS
+ + ValgrindLaunchPlugin.getDefault().getToolName(toolID));
+
+ // opts.add(ValgrindCommand.OPT_LOGFILE + EQUALS +
+ // ValgrindLaunchPlugin.RESULT_DIR + LOG_FILE);
+ opts.add(ValgrindCommand.OPT_XMLFILE + EQUALS
+ + ValgrindLaunchPlugin.RESULT_DIR + LOG_FILE);
+ // opts.add(ValgrindCommand.OPT_LOGFILE + EQUALS + "/home" +
+ // File.separator + LOG_FILE);
+
+ opts.add(ValgrindCommand.OPT_TRACECHILD
+ + EQUALS
+ + (config.getAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_TRACECHILD,
+ false) ? YES : NO));
+ opts.add(ValgrindCommand.OPT_CHILDSILENT + EQUALS + YES);// (config.getAttribute(ValgrindLaunchPlugin.ATTR_GENERAL_CHILDSILENT,
+ // false) ?
+ // YES :
+ // NO));
+ // opts.add(ValgrindCommand.OPT_TRACKFDS + EQUALS +
+ // (config.getAttribute(ValgrindLaunchPlugin.ATTR_GENERAL_TRACKFDS,
+ // false) ? YES : NO));
+ // opts.add(ValgrindCommand.OPT_TIMESTAMP + EQUALS +
+ // (config.getAttribute(ValgrindLaunchPlugin.ATTR_GENERAL_TIMESTAMP,
+ // false) ? YES : NO));
+ opts.add(ValgrindCommand.OPT_FREERES
+ + EQUALS
+ + (config
+ .getAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_FREERES,
+ true) ? YES : NO));
+
+ opts.add(ValgrindCommand.OPT_DEMANGLE
+ + EQUALS
+ + (config.getAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_DEMANGLE,
+ true) ? YES : NO));
+ opts.add(ValgrindCommand.OPT_NUMCALLERS
+ + EQUALS
+ + config.getAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_NUMCALLERS,
+ 12));
+ opts.add(ValgrindCommand.OPT_ERRLIMIT
+ + EQUALS
+ + (config.getAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_ERRLIMIT,
+ true) ? YES : NO));
+ opts.add(ValgrindCommand.OPT_BELOWMAIN
+ + EQUALS
+ + (config.getAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_BELOWMAIN,
+ false) ? YES : NO));
+ opts.add(ValgrindCommand.OPT_MAXFRAME
+ + EQUALS
+ + config.getAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_MAXFRAME,
+ 2000000));
+
+ String strpath = config.getAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_SUPPFILE,
+ EMPTY_STRING);
if (!strpath.equals(EMPTY_STRING)) {
- File suppfile = ValgrindLaunchPlugin.getDefault().parseWSPath(strpath);
+ File suppfile = ValgrindLaunchPlugin.getDefault().parseWSPath(
+ strpath);
if (suppfile != null) {
String escapedPath = null;
try {
- escapedPath = ValgrindLaunchPlugin.getDefault().escapeAndQuote(suppfile.getCanonicalPath());
+ escapedPath = ValgrindLaunchPlugin.getDefault()
+ .escapeAndQuote(suppfile.getCanonicalPath());
} catch (Exception e) {
e.printStackTrace();
}
}
}
- opts.addAll(Arrays.asList(dynamicDelegate.getCommandArray(command, config)));
+ opts.addAll(Arrays.asList(dynamicDelegate.getCommandArray(command,
+ config)));
String[] ret = new String[opts.size()];
return opts.toArray(ret);
}
-
+
protected String getTool(ILaunchConfiguration config) throws CoreException {
- return config.getAttribute(LaunchConfigurationConstants.ATTR_TOOL, ValgrindLaunchPlugin.TOOL_EXT_DEFAULT);
+ return config.getAttribute(LaunchConfigurationConstants.ATTR_TOOL,
+ ValgrindLaunchPlugin.TOOL_EXT_DEFAULT);
}
protected String getPluginID() {
return ValgrindLaunchPlugin.PLUGIN_ID;
}
- public String[] getProgramArgumentsArray(ILaunchConfiguration config) throws CoreException {
+ public String[] getProgramArgumentsArray(ILaunchConfiguration config)
+ throws CoreException {
return LaunchUtils.getProgramArgumentsArray(config);
}
- protected String createLaunchStr(ILaunchConfiguration config) throws CoreException {
- return config.getName() + " [" +ValgrindLaunchPlugin.getDefault().getToolName(toolID)+ "] " + process.getLabel();
+ protected String createLaunchStr(ILaunchConfiguration config)
+ throws CoreException {
+ return config.getName() + " ["
+ + ValgrindLaunchPlugin.getDefault().getToolName(toolID) + "] ";
}
/**
* @param session
* connection session to the target or simulator
* @return void
- *
+ *
* @exception CoreException
* if unable to transfer a package
*/
- public void transferProfilingToolPackage(IProgressMonitor monitor, ISession session) throws CoreException {
+ public void transferProfilingToolPackage(IProgressMonitor monitor)
+ throws CoreException {
try {
- monitor.beginTask(Messages.getString("ProfileLaunch.TRANSFER_PROFILING_TOOL"), 1);
+ monitor.beginTask(
+ Messages.getString("ProfileLaunch.TRANSFER_PROFILING_TOOL"),
+ 1);
// test whether valgrind package exist or not
String sdkInstallPath = InstallPathConfig.getSDKPath();
- String toolPkgPath = sdkInstallPath + "/SDK/profiling-tool/" + PACKAGE_FILENAME_ARM;
+ String toolPkgPath = sdkInstallPath + "/SDK/profiling-tool/"
+ + PACKAGE_FILENAME_ARM;
File toolPkg = new File(toolPkgPath);
- if(toolPkg == null || !toolPkg.exists())
- newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_TRANSFER"),
- new Exception("Tool package path (" + toolPkgPath + ") is not available."));
-
+ if (toolPkg == null || !toolPkg.exists())
+ newCoreException(
+ Messages.getString("ProfileLaunch.FAIL_TO_TRANSFER"),
+ new Exception("Tool package path (" + toolPkgPath
+ + ") is not available."));
+
String destDirectoryPath = TEMPORARY_PKG_PATH;
- if (!session.isPathExist(destDirectoryPath)) {
- String command = MAKE_DIRECTORY_CMD + destDirectoryPath + CMD_RESULT_CHECK;
- String result = session.run(command, null);
- result = PathParser.pathParsing(result);
- if(!result.contains("0"))
- newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_TRANSFER"),
- new Exception("Destination path (" + destDirectoryPath + ") in not exist."));
+ if (!CommandManager.isPathExist(destDirectoryPath)) {
+ String command = MAKE_DIRECTORY_CMD + destDirectoryPath
+ + CMD_RESULT_CHECK;
+ // String result = session.run(command, null);
+ String[] result = CommandManager
+ .runCommandReturningResult(command);
+ if (!CommandManager.isRunSeccessfuly(result))
+ newCoreException(
+ Messages.getString("ProfileLaunch.FAIL_TO_TRANSFER"),
+ new Exception("Destination path ("
+ + destDirectoryPath + ") in not exist."));
}
String srcFilePath = toolPkg.getAbsoluteFile().getCanonicalPath();
- String destFilePath = destDirectoryPath + toolPkg.getAbsoluteFile().getName();
-
- boolean isSuccess = session.transferFile(srcFilePath, destFilePath);
-
+ String destFilePath = destDirectoryPath
+ + toolPkg.getAbsoluteFile().getName();
+
+ // boolean isSuccess = session.transferFile(srcFilePath,
+ // destFilePath);
+ boolean isSuccess = CommandManager.push(srcFilePath, destFilePath);
+
if (isSuccess == false)
- newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_TRANSFER"),
- new Exception("source path (" + srcFilePath + "), dest path (" + destFilePath +")"));
+ newCoreException(
+ Messages.getString("ProfileLaunch.FAIL_TO_TRANSFER"),
+ new Exception("source path (" + srcFilePath
+ + "), dest path (" + destFilePath + ")"));
} catch (CoreException e) {
throw e;
} catch (Exception e) {
- newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_TRANSFER"), e);
+ newCoreException(
+ Messages.getString("ProfileLaunch.FAIL_TO_TRANSFER"), e);
} finally {
monitor.done();
}
* @param pkgmgr
* instance which contains resources and control information
* @return void
- *
+ *
* @exception CoreException
* if unable to install a package
*/
- public void installProfilingToolPackage(IProgressMonitor monitor, ISession session) throws CoreException {
+ public void installProfilingToolPackage(IProgressMonitor monitor)
+ throws CoreException {
try {
- monitor.beginTask(Messages.getString("ProfileLaunch.INSTALL_PROFILING_TOOL"), 2);
+ monitor.beginTask(
+ Messages.getString("ProfileLaunch.INSTALL_PROFILING_TOOL"),
+ 2);
String packageDirectory = TEMPORARY_PKG_PATH;
- String command = CHANGE_DIRECTORY_CMD + packageDirectory + CMD_RESULT_CHECK;
- String result = session.run(command, null);
- result = PathParser.pathParsing(result);
- if(!result.contains("0"))
- newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"),
+ String command = CHANGE_DIRECTORY_CMD + packageDirectory
+ + CMD_RESULT_CHECK;
+ // String result = session.run(command, null);
+ String[] result = CommandManager.runCommandReturningResult(command);
+ if (null != result && result.length > 0 && !result[0].contains("0"))
+ newCoreException(
+ Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"),
new Exception("command is " + command));
monitor.worked(1);
-
+
// remount file system
command = "mount -o remount,rw /" + CMD_RESULT_CHECK;
- result = session.run(command, null);
- result = PathParser.pathParsing(result);
- if(!result.contains("0"))
- newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"),
- new Exception("command is " + command));
+ // result = session.run(command, null);
+ result = CommandManager.runCommandReturningResult(command);
+ if (null != result && result.length > 0 && !result[0].contains("0"))
+ newCoreException(
+ Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"),
+ new Exception("command is " + command));
// install new application
- command = PKG_TOOL_CMD + PKG_TOOL_INSTALL_OPTION + PACKAGE_FILENAME_ARM + CMD_RESULT_CHECK;
- result = session.run(command, null);
- result = PathParser.pathParsing(result);
- if(!result.contains("0"))
- newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"),
- new Exception("command is " + command));
+ command = PKG_TOOL_CMD + PKG_TOOL_INSTALL_OPTION + packageDirectory
+ + PACKAGE_FILENAME_ARM + CMD_RESULT_CHECK;
+ // result = session.run(command, null);
+ String resultStr = CommandManager.runShell(command);
+ if (null != resultStr && resultStr.length() > 0
+ && !resultStr.equals("0"))
+ newCoreException(
+ Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"),
+ new Exception("command is " + command));
monitor.worked(1);
// remount file system
command = "mount -o remount,ro /" + CMD_RESULT_CHECK;
- result = session.run(command, null);
- result = PathParser.pathParsing(result);
+ // result = session.run(command, null);
+ result = CommandManager.runCommandReturningResult(command);
} catch (CoreException e) {
throw e;
} catch (Exception e) {
- newCoreException(Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"), e);
+ newCoreException(
+ Messages.getString("ProfileLaunch.FAIL_TO_INSTALL"), e);
} finally {
monitor.done();
}
}
-
+
}
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.linuxtools.valgrind.core.ValgrindCommand;
-
-import com.samsung.slp.common.conn.session.ISession;
/**
* Interface for declaring a tool-specific delegate for a Valgrind
* <code>LaunchConfiguration</code>.
* @throws CoreException - if this method fails
* @throws Exception
*/
- public void launch(ValgrindCommand command, ILaunchConfiguration config, ILaunch launch, IProgressMonitor monitor,Process remoteShellProcess, ISession session) throws CoreException, Exception;
+ public void launch(ValgrindCommand command, ILaunchConfiguration config, ILaunch launch, IProgressMonitor monitor) throws CoreException, Exception;
/**
* Parses attributes of an <code>ILaunchConfiguration</code> into an array
*
* Contributors:
* Elliott Baron <ebaron@redhat.com> - initial API and implementation
- *******************************************************************************/
+ *******************************************************************************/
package org.eclipse.linuxtools.valgrind.launch;
import java.io.File;
+import javax.swing.ButtonGroup;
+
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.eclipse.ui.views.navigator.ResourceComparator;
-
public class ValgrindOptionsTab extends AbstractLaunchConfigurationTab {
protected static final String EMPTY_STRING = ""; //$NON-NLS-1$
- //Start controls
+ // Start controls
private ScrolledComposite scrContainer;
-
- protected Button collectData1Button;
- protected Button collectData2Button;
- protected Button mempsButton;
-
+
+ protected Button collectData1Button;
+ protected Button collectData2Button;
+ protected Button mempsButton;
+
// General controls
protected Button traceChildrenButton;
protected Button childSilentButton;
- // protected Button trackFdsButton;
- // protected Button timeStampButton;
+ // protected Button trackFdsButton;
+ // protected Button timeStampButton;
protected Button runFreeresButton;
protected Button demangleButton;
protected Spinner numCallersSpinner;
protected Composite top;
protected ScrolledComposite scrollTop;
-
+
protected ILaunchConfigurationWorkingCopy launchConfigurationWorkingCopy;
protected ILaunchConfiguration launchConfiguration;
protected boolean isInitializing = false;
protected boolean initDefaults = false;
- private boolean canInitialize; //bery 20090715
-
+ private boolean canInitialize; // bery 20090715
+
protected SelectionListener selectListener = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
};
protected ModifyListener modifyListener = new ModifyListener() {
public void modifyText(ModifyEvent e) {
- updateLaunchConfigurationDialog();
- }
+ updateLaunchConfigurationDialog();
+ }
};
public void createControl(Composite parent) {
/**
* Scrollable Options tab is implemented .
*/
- scrContainer = new ScrolledComposite( parent, SWT.V_SCROLL | SWT.H_SCROLL );
+ scrContainer = new ScrolledComposite(parent, SWT.V_SCROLL
+ | SWT.H_SCROLL);
FillLayout flayout = new FillLayout();
scrContainer.setLayout(flayout);
GridData gd = new GridData(GridData.FILL_BOTH);
scrContainer.setLayoutData(gd);
scrContainer.setExpandHorizontal(true);
scrContainer.setExpandVertical(true);
-
- top = new Composite( scrContainer, SWT.NONE );
+
+ top = new Composite(scrContainer, SWT.NONE);
setControl(scrContainer);
top.setLayout(new GridLayout());
// changed by greatim at 2011.06.01 for fresh ide
- // TODO : change help context id (temporarily empty string)
+ // TODO : change help context id (temporarily empty string)
PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), ""); //$NON-NLS-1$
-
-// if(TargetConnectionControl.isSimulator()){
- canInitialize = true;
-/*
- }else{
- String error = "The Valgrind does not support the ARM target ";
- String reason = "An error occurred when the real target is selected. Please check whether your target is Simulator(i686)";
- showErrorDialog(error, reason , null); //$NON-NLS-1$
- canInitialize = false;
- // return;
- }
-*/
+
+ // if(TargetConnectionControl.isSimulator()){
+ canInitialize = true;
+ /*
+ * }else{ String error =
+ * "The Valgrind does not support the ARM target "; String reason =
+ * "An error occurred when the real target is selected. Please check whether your target is Simulator(i686)"
+ * ; showErrorDialog(error, reason , null); //$NON-NLS-1$ canInitialize
+ * = false; // return; }
+ */
createVerticalSpacer(top, 1);
createVerticalSpacer(top, 1);
TabFolder optionsFolder = new TabFolder(top, SWT.BORDER);
optionsFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
- //start tab add
+ // start tab add
- TabItem startTab = new TabItem(optionsFolder, SWT.NONE);
- startTab.setText(Messages.getString("ValgrindOptionsTab.Start")); //$NON-NLS-1$
+ TabItem startTab = new TabItem(optionsFolder, SWT.NONE);
+ startTab.setText(Messages.getString("ValgrindOptionsTab.Start")); //$NON-NLS-1$
- Composite startTop = new Composite(optionsFolder, SWT.NONE);
- startTop.setLayout(new GridLayout());
- startTop.setLayoutData(new GridData(GridData.FILL_BOTH));
+ Composite startTop = new Composite(optionsFolder, SWT.NONE);
+ startTop.setLayout(new GridLayout());
+ startTop.setLayoutData(new GridData(GridData.FILL_BOTH));
- createStartOptions(startTop,true);
- createVerticalSpacer(startTop, 1);
- startTab.setControl(startTop);
+ createStartOptions(startTop, true);
+ createVerticalSpacer(startTop, 1);
+ startTab.setControl(startTop);
- //start tab add by bery
+ // start tab add by bery
-
-
// "general" tab
TabItem generalTab = new TabItem(optionsFolder, SWT.NONE);
generalTab.setText(Messages.getString("ValgrindOptionsTab.General")); //$NON-NLS-1$
createVerticalSpacer(generalTop, 1);
- createSuppressionsOption(generalTop);
-
+ createSuppressionsOption(generalTop);
+
generalTab.setControl(generalTop);
// "tool" tab
toolTab.setControl(dynamicTabHolder);
- scrContainer.setContent( top );
-
+ scrContainer.setContent(top);
+
scrContainer.setMinSize(top.computeSize(SWT.DEFAULT, SWT.DEFAULT));
}
+ /*
+ * private void createToolCombo(Composite top) { Composite comboTop = new
+ * Composite(top, SWT.NONE); comboTop.setLayout(new GridLayout(2, false));
+ * Label toolLabel = new Label(comboTop, SWT.NONE);
+ * toolLabel.setText(Messages.getString("ValgrindOptionsTab.Tool_to_run"));
+ * //$NON-NLS-1$ toolsCombo = new Combo(comboTop, SWT.READ_ONLY); tools =
+ * ValgrindLaunchPlugin.getDefault().getRegisteredToolIDs();
+ *
+ * String[] names = new String[tools.length]; for (int i = 0; i <
+ * names.length; i++) { names[i] =
+ * ValgrindLaunchPlugin.getDefault().getToolName(tools[i]); }
+ * toolsCombo.setItems(names);
+ *
+ * toolsCombo.addSelectionListener(new SelectionAdapter() {
+ *
+ * @Override public void widgetDefaultSelected(SelectionEvent e) {
+ * widgetSelected(e); }
+ *
+ * @Override public void widgetSelected(SelectionEvent e) { // user selected
+ * change, set defaults in new tool if (!isInitializing) { initDefaults =
+ * true; int ix = toolsCombo.getSelectionIndex(); tool = tools[ix];
+ * handleToolChanged(); updateLaunchConfigurationDialog(); } } }); }
+ */
+ // bery
+ protected void createStartOptions(Composite top, boolean selected) {
-/*
- private void createToolCombo(Composite top) {
- Composite comboTop = new Composite(top, SWT.NONE);
- comboTop.setLayout(new GridLayout(2, false));
- Label toolLabel = new Label(comboTop, SWT.NONE);
- toolLabel.setText(Messages.getString("ValgrindOptionsTab.Tool_to_run")); //$NON-NLS-1$
- toolsCombo = new Combo(comboTop, SWT.READ_ONLY);
tools = ValgrindLaunchPlugin.getDefault().getRegisteredToolIDs();
- String[] names = new String[tools.length];
+ final String[] names = new String[tools.length];
for (int i = 0; i < names.length; i++) {
names[i] = ValgrindLaunchPlugin.getDefault().getToolName(tools[i]);
}
- toolsCombo.setItems(names);
- toolsCombo.addSelectionListener(new SelectionAdapter() {
+ Group startGroup = new Group(top, SWT.NONE);
+ startGroup.setLayout(new GridLayout());
+ startGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ startGroup.setText(Messages
+ .getString("ValgrindOptionsTab.Collect_Options")); //$NON-NLS-1$
+
+ Composite startTop = new Composite(startGroup, SWT.NONE);
+ startTop.setLayout(new GridLayout(8, false));
+ startTop.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ // Label collectData1Label = new Label(startTop, SWT.NONE);
+ // collectData1Label.setText(Messages.getString("ValgrindOptionsTab.collect_data1")); //$NON-NLS-1$
+ collectData1Button = new Button(startTop, SWT.RADIO);
+ collectData1Button.setText(Messages
+ .getString("ValgrindOptionsTab.collect_data1")); //$NON-NLS-1$
+
+ // collectData1Button.addSelectionListener(selectListener);
+
+ collectData1Button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
widgetSelected(e);
}
+
@Override
public void widgetSelected(SelectionEvent e) {
// user selected change, set defaults in new tool
+ // bery added at 20090715----------------------
+ // if(TargetConnectionControl.isSimulator()){
+ canInitialize = true;
+ /*
+ * }else{ String error =
+ * "The Valgrind does not support the ARM target "; String
+ * reason =
+ * "An error occurred when the real target is selected. Please check whether your target is Simulator(i686)"
+ * ; showErrorDialog(error, reason , null); //$NON-NLS-1$
+ * canInitialize = false; return; }
+ */
+ // --------------------------------------
+ // bery added at 20090715--------------------------------
+ if (!canInitialize) {
+ return;
+ }
+ // --------------------------------------
+
if (!isInitializing) {
- initDefaults = true;
- int ix = toolsCombo.getSelectionIndex();
- tool = tools[ix];
+ // initDefaults = true;
+ tool = "org.eclipse.linuxtools.valgrind.launch.memcheck";
+ // tool = tools[0];
handleToolChanged();
updateLaunchConfigurationDialog();
}
}
});
- }
-*/
- //bery
- protected void createStartOptions(Composite top, boolean selected) {
-
- tools = ValgrindLaunchPlugin.getDefault().getRegisteredToolIDs();
-
-
- final String[] names = new String[tools.length];
- for (int i = 0; i < names.length; i++) {
- names[i] = ValgrindLaunchPlugin.getDefault().getToolName(tools[i]);
- }
-
- Group startGroup = new Group(top, SWT.NONE);
- startGroup.setLayout(new GridLayout());
- startGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- startGroup.setText(Messages.getString("ValgrindOptionsTab.Collect_Options")); //$NON-NLS-1$
-
- Composite startTop = new Composite(startGroup, SWT.NONE );
- startTop.setLayout(new GridLayout(8, false));
- startTop.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
-// Label collectData1Label = new Label(startTop, SWT.NONE);
- // collectData1Label.setText(Messages.getString("ValgrindOptionsTab.collect_data1")); //$NON-NLS-1$
- collectData1Button = new Button(startTop, SWT.RADIO);
- collectData1Button.setText(Messages.getString("ValgrindOptionsTab.collect_data1")); //$NON-NLS-1$
-
-
- // collectData1Button.addSelectionListener(selectListener);
-
- collectData1Button.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- }
- @Override
- public void widgetSelected(SelectionEvent e) {
- // user selected change, set defaults in new tool
- //bery added at 20090715----------------------
-// if(TargetConnectionControl.isSimulator()){
- canInitialize = true;
-/*
- }else{
- String error = "The Valgrind does not support the ARM target ";
- String reason = "An error occurred when the real target is selected. Please check whether your target is Simulator(i686)";
- showErrorDialog(error, reason , null); //$NON-NLS-1$
- canInitialize = false;
- return;
- }
-*/
- //--------------------------------------
- //bery added at 20090715--------------------------------
- if(!canInitialize){
- return;
- }
- //--------------------------------------
-
-
- if (!isInitializing) {
- // initDefaults = true;
- tool = "org.eclipse.linuxtools.valgrind.launch.memcheck";
- //tool = tools[0];
- handleToolChanged();
- updateLaunchConfigurationDialog();
- }
- }
- });
-
- // Must be on to prevent mangled XML output
-// Label collectData2Label = new Label(startTop, SWT.NONE);
- //collectData2Label.setText(Messages.getString("ValgrindOptionsTab.collect_data2")); //$NON-NLS-1$
- collectData2Button = new Button(startTop, SWT.RADIO);
- collectData2Button.setText(Messages.getString("ValgrindOptionsTab.collect_data2")); //$NON-NLS-1$
- // collectData2Button.addSelectionListener(selectListener);
-
- collectData2Button.addSelectionListener(new SelectionAdapter() {
-// @Override
-// public void widgetDefaultSelected(SelectionEvent e) {
-// widgetSelected(e);
-// }
+
+ // Must be on to prevent mangled XML output
+ // Label collectData2Label = new Label(startTop, SWT.NONE);
+ //collectData2Label.setText(Messages.getString("ValgrindOptionsTab.collect_data2")); //$NON-NLS-1$
+ collectData2Button = new Button(startTop, SWT.RADIO);
+ collectData2Button.setText(Messages
+ .getString("ValgrindOptionsTab.collect_data2")); //$NON-NLS-1$
+ // collectData2Button.addSelectionListener(selectListener);
+
+ collectData2Button.addSelectionListener(new SelectionAdapter() {
+ // @Override
+ // public void widgetDefaultSelected(SelectionEvent e) {
+ // widgetSelected(e);
+ // }
@Override
- public void widgetSelected(SelectionEvent e) {
- // user selected change, set defaults in new tool
-
- if (!isInitializing) {
- // initDefaults = false;
- tool = "org.eclipse.linuxtools.valgrind.launch.massif";
- // tool = tools[1];
-
- handleToolChanged();
- updateLaunchConfigurationDialog();
- }
- }
- });
-
-}
+ public void widgetSelected(SelectionEvent e) {
+ // user selected change, set defaults in new tool
-
- protected void createBasicOptions(Composite top) {
+ if (!isInitializing) {
+ // initDefaults = false;
+ tool = "org.eclipse.linuxtools.valgrind.launch.massif";
+ // tool = tools[1];
+
+ handleToolChanged();
+ updateLaunchConfigurationDialog();
+ }
+ }
+ });
+
+ }
+
+ protected void createBasicOptions(Composite top) {
Group basicGroup = new Group(top, SWT.NONE);
basicGroup.setLayout(new GridLayout());
basicGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- basicGroup.setText(Messages.getString("ValgrindOptionsTab.Basic_Options")); //$NON-NLS-1$
+ basicGroup.setText(Messages
+ .getString("ValgrindOptionsTab.Basic_Options")); //$NON-NLS-1$
Composite basicTop = new Composite(basicGroup, SWT.NONE);
basicTop.setLayout(new GridLayout(2, true));
basicTop.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
traceChildrenButton = new Button(basicTop, SWT.CHECK);
- traceChildrenButton.setText(Messages.getString("ValgrindOptionsTab.trace_children")); //$NON-NLS-1$
+ traceChildrenButton.setText(Messages
+ .getString("ValgrindOptionsTab.trace_children")); //$NON-NLS-1$
traceChildrenButton.addSelectionListener(selectListener);
- traceChildrenButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ traceChildrenButton
+ .setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// Must be on to prevent mangled XML output
childSilentButton = new Button(basicTop, SWT.CHECK);
- childSilentButton.setText(Messages.getString("ValgrindOptionsTab.child_silent")); //$NON-NLS-1$
+ childSilentButton.setText(Messages
+ .getString("ValgrindOptionsTab.child_silent")); //$NON-NLS-1$
childSilentButton.setSelection(true);
childSilentButton.setEnabled(false);
childSilentButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
runFreeresButton = new Button(basicTop, SWT.CHECK);
- runFreeresButton.setText(Messages.getString("ValgrindOptionsTab.run_freeres")); //$NON-NLS-1$
+ runFreeresButton.setText(Messages
+ .getString("ValgrindOptionsTab.run_freeres")); //$NON-NLS-1$
runFreeresButton.addSelectionListener(selectListener);
runFreeresButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
-
-
- protected void createErrorOptions(Composite top) {
+ protected void createErrorOptions(Composite top) {
Group errorGroup = new Group(top, SWT.NONE);
errorGroup.setLayout(new GridLayout());
errorGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- errorGroup.setText(Messages.getString("ValgrindOptionsTab.Error_Options")); //$NON-NLS-1$
+ errorGroup.setText(Messages
+ .getString("ValgrindOptionsTab.Error_Options")); //$NON-NLS-1$
Composite errorTop = new Composite(errorGroup, SWT.NONE);
errorTop.setLayout(new GridLayout(2, true));
errorTop.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
demangleButton = new Button(errorTop, SWT.CHECK);
- demangleButton.setText(Messages.getString("ValgrindOptionsTab.demangle")); //$NON-NLS-1$
+ demangleButton.setText(Messages
+ .getString("ValgrindOptionsTab.demangle")); //$NON-NLS-1$
demangleButton.addSelectionListener(selectListener);
demangleButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Composite numCallersTop = new Composite(errorTop, SWT.NONE);
numCallersTop.setLayout(new GridLayout(2, false));
Label numCallersLabel = new Label(numCallersTop, SWT.NONE);
- numCallersLabel.setText(Messages.getString("ValgrindOptionsTab.num_callers")); //$NON-NLS-1$
+ numCallersLabel.setText(Messages
+ .getString("ValgrindOptionsTab.num_callers")); //$NON-NLS-1$
numCallersSpinner = new Spinner(numCallersTop, SWT.BORDER);
numCallersSpinner.setMaximum(50);
numCallersSpinner.addModifyListener(modifyListener);
numCallersSpinner.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
errorLimitButton = new Button(errorTop, SWT.CHECK);
- errorLimitButton.setText(Messages.getString("ValgrindOptionsTab.limit_errors")); //$NON-NLS-1$
+ errorLimitButton.setText(Messages
+ .getString("ValgrindOptionsTab.limit_errors")); //$NON-NLS-1$
errorLimitButton.addSelectionListener(selectListener);
errorLimitButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
showBelowMainButton = new Button(errorTop, SWT.CHECK);
- showBelowMainButton.setText(Messages.getString("ValgrindOptionsTab.show_errors_below_main")); //$NON-NLS-1$
+ showBelowMainButton.setText(Messages
+ .getString("ValgrindOptionsTab.show_errors_below_main")); //$NON-NLS-1$
showBelowMainButton.addSelectionListener(selectListener);
- showBelowMainButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ showBelowMainButton
+ .setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Composite maxStackFrameTop = new Composite(errorTop, SWT.NONE);
maxStackFrameTop.setLayout(new GridLayout(2, false));
Label maxStackFrameLabel = new Label(maxStackFrameTop, SWT.NONE);
- maxStackFrameLabel.setText(Messages.getString("ValgrindOptionsTab.max_size_of_stack_frame")); //$NON-NLS-1$
+ maxStackFrameLabel.setText(Messages
+ .getString("ValgrindOptionsTab.max_size_of_stack_frame")); //$NON-NLS-1$
maxStackFrameSpinner = new Spinner(maxStackFrameTop, SWT.BORDER);
maxStackFrameSpinner.setMaximum(Integer.MAX_VALUE);
- maxStackFrameSpinner.addModifyListener(modifyListener);
- maxStackFrameSpinner.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ maxStackFrameSpinner.addModifyListener(modifyListener);
+ maxStackFrameSpinner.setLayoutData(new GridData(
+ GridData.FILL_HORIZONTAL));
}
-
-
- protected void createSuppressionsOption(Composite top) {
+ protected void createSuppressionsOption(Composite top) {
Group suppGroup = new Group(top, SWT.NONE);
suppGroup.setLayout(new GridLayout());
suppGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- suppGroup.setText(Messages.getString("ValgrindOptionsTab.Suppressions")); //$NON-NLS-1$
-
- Composite browseTop = new Composite(suppGroup, SWT.NONE);
+ suppGroup
+ .setText(Messages.getString("ValgrindOptionsTab.Suppressions")); //$NON-NLS-1$
+
+ Composite browseTop = new Composite(suppGroup, SWT.NONE);
browseTop.setLayout(new GridLayout(4, false));
GridData browseData = new GridData(GridData.FILL_HORIZONTAL);
browseTop.setLayoutData(browseData);
Label suppFileLabel = new Label(browseTop, SWT.NONE);
- suppFileLabel.setText(Messages.getString("ValgrindOptionsTab.suppressions_file")); //$NON-NLS-1$
-
+ suppFileLabel.setText(Messages
+ .getString("ValgrindOptionsTab.suppressions_file")); //$NON-NLS-1$
+
suppFileText = new Text(browseTop, SWT.BORDER);
suppFileText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
suppFileText.addModifyListener(modifyListener);
- Button workspaceBrowseButton = createPushButton(browseTop, Messages.getString("ValgrindOptionsTab.Workspace"), null); //$NON-NLS-1$
+ Button workspaceBrowseButton = createPushButton(browseTop,
+ Messages.getString("ValgrindOptionsTab.Workspace"), null); //$NON-NLS-1$
workspaceBrowseButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
- ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(getShell(), new WorkbenchLabelProvider(), new WorkbenchContentProvider());
- dialog.setTitle(Messages.getString("ValgrindOptionsTab.Select_a_Resource")); //$NON-NLS-1$
- dialog.setMessage(Messages.getString("ValgrindOptionsTab.Select_a_Suppressions_File")); //$NON-NLS-1$
- dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
- dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
+ ElementTreeSelectionDialog dialog = new ElementTreeSelectionDialog(
+ getShell(), new WorkbenchLabelProvider(),
+ new WorkbenchContentProvider());
+ dialog.setTitle(Messages
+ .getString("ValgrindOptionsTab.Select_a_Resource")); //$NON-NLS-1$
+ dialog.setMessage(Messages
+ .getString("ValgrindOptionsTab.Select_a_Suppressions_File")); //$NON-NLS-1$
+ dialog.setInput(ResourcesPlugin.getWorkspace().getRoot());
+ dialog.setComparator(new ResourceComparator(
+ ResourceComparator.NAME));
if (dialog.open() == IDialogConstants.OK_ID) {
IResource resource = (IResource) dialog.getFirstResult();
String arg = resource.getFullPath().toString();
- String fileLoc = VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression("workspace_loc", arg); //$NON-NLS-1$
+ String fileLoc = VariablesPlugin.getDefault()
+ .getStringVariableManager()
+ .generateVariableExpression("workspace_loc", arg); //$NON-NLS-1$
suppFileText.setText(fileLoc);
}
}
});
- Button fileBrowseButton = createPushButton(browseTop, Messages.getString("ValgrindOptionsTab.File_System"), null); //$NON-NLS-1$
+ Button fileBrowseButton = createPushButton(browseTop,
+ Messages.getString("ValgrindOptionsTab.File_System"), null); //$NON-NLS-1$
fileBrowseButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
String filePath = suppFileText.getText();
}
});
}
+
protected void handleToolChanged() {
try {
// create dynamicTab
if (launchConfiguration.isWorkingCopy()) {
launchConfigurationWorkingCopy = (ILaunchConfigurationWorkingCopy) launchConfiguration;
} else {
- launchConfigurationWorkingCopy = launchConfiguration.getWorkingCopy();
+ launchConfigurationWorkingCopy = launchConfiguration
+ .getWorkingCopy();
}
}
// user changed tool, not just restoring state
if (initDefaults) {
dynamicTab.setDefaults(launchConfigurationWorkingCopy);
- }
+ }
initDefaults = false;
dynamicTab.initializeFrom(launchConfigurationWorkingCopy);
} catch (CoreException e) {
dynamicTab = ValgrindLaunchPlugin.getDefault().getToolPage(tool);
if (dynamicTab == null) {
- throw new CoreException(new Status(IStatus.ERROR, ValgrindLaunchPlugin.PLUGIN_ID, Messages.getString("ValgrindOptionsTab.No_options_tab_found") + tool)); //$NON-NLS-1$
+ throw new CoreException(
+ new Status(
+ IStatus.ERROR,
+ ValgrindLaunchPlugin.PLUGIN_ID,
+ Messages.getString("ValgrindOptionsTab.No_options_tab_found") + tool)); //$NON-NLS-1$
}
dynamicTab.setLaunchConfigurationDialog(getLaunchConfigurationDialog());
dynamicTab.createControl(dynamicTabHolder);
@Override
public Image getImage() {
- return ValgrindLaunchPlugin.imageDescriptorFromPlugin(ValgrindLaunchPlugin.PLUGIN_ID, "icons/valgrind-icon.png").createImage(); //$NON-NLS-1$
+ return ValgrindLaunchPlugin
+ .imageDescriptorFromPlugin(ValgrindLaunchPlugin.PLUGIN_ID,
+ "icons/valgrind-icon.png").createImage(); //$NON-NLS-1$
}
public void initializeFrom(ILaunchConfiguration configuration) {
-
+
isInitializing = true;
getControl().setRedraw(false);
launchConfiguration = configuration;
launchConfigurationWorkingCopy = null;
-
try {
- tool = configuration.getAttribute(LaunchConfigurationConstants.ATTR_TOOL, ValgrindLaunchPlugin.TOOL_EXT_DEFAULT);
-
+ tool = configuration.getAttribute(
+ LaunchConfigurationConstants.ATTR_TOOL,
+ ValgrindLaunchPlugin.TOOL_EXT_DEFAULT);
+
int select = -1;
- if (tool.contains("memcheck") ) {
+ if (tool.contains("memcheck")) {
select = 0;
- }else if (tool.contains("massif")) {
+ } else if (tool.contains("massif")) {
select = 1;
}
- if (select ==0) {
+ if (select == 0) {
collectData1Button.setSelection(true);
- }else if (select ==1){
+ collectData2Button.setSelection(false);
+ } else if (select == 1) {
collectData2Button.setSelection(true);
- }
+ collectData1Button.setSelection(false);
+
+ }
handleToolChanged();
initializeGeneral(configuration);
isInitializing = false;
}
- protected void initializeGeneral(ILaunchConfiguration configuration) throws CoreException {
-
-
- traceChildrenButton.setSelection(configuration.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_TRACECHILD, false));
- // childSilentButton.setSelection(configuration.getAttribute(ValgrindLaunchPlugin.ATTR_GENERAL_CHILDSILENT, false));
- // trackFdsButton.setSelection(configuration.getAttribute(ValgrindLaunchPlugin.ATTR_GENERAL_TRACKFDS, false));
- // timeStampButton.setSelection(configuration.getAttribute(ValgrindLaunchPlugin.ATTR_GENERAL_TIMESTAMP, false));
- runFreeresButton.setSelection(configuration.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_FREERES, true));
- demangleButton.setSelection(configuration.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_DEMANGLE, true));
- numCallersSpinner.setSelection(configuration.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_NUMCALLERS, 12));
- errorLimitButton.setSelection(configuration.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_ERRLIMIT, true));
- showBelowMainButton.setSelection(configuration.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_BELOWMAIN, false));
- maxStackFrameSpinner.setSelection(configuration.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_MAXFRAME, 2000000));
- suppFileText.setText(configuration.getAttribute(LaunchConfigurationConstants.ATTR_GENERAL_SUPPFILE, EMPTY_STRING));
+ protected void initializeGeneral(ILaunchConfiguration configuration)
+ throws CoreException {
+
+ traceChildrenButton.setSelection(configuration.getAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_TRACECHILD, false));
+ // childSilentButton.setSelection(configuration.getAttribute(ValgrindLaunchPlugin.ATTR_GENERAL_CHILDSILENT,
+ // false));
+ // trackFdsButton.setSelection(configuration.getAttribute(ValgrindLaunchPlugin.ATTR_GENERAL_TRACKFDS,
+ // false));
+ // timeStampButton.setSelection(configuration.getAttribute(ValgrindLaunchPlugin.ATTR_GENERAL_TIMESTAMP,
+ // false));
+ runFreeresButton.setSelection(configuration.getAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_FREERES, true));
+ demangleButton.setSelection(configuration.getAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_DEMANGLE, true));
+ numCallersSpinner.setSelection(configuration.getAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_NUMCALLERS, 12));
+ errorLimitButton.setSelection(configuration.getAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_ERRLIMIT, true));
+ showBelowMainButton.setSelection(configuration.getAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_BELOWMAIN, false));
+ maxStackFrameSpinner.setSelection(configuration.getAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_MAXFRAME, 2000000));
+ suppFileText.setText(configuration.getAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_SUPPFILE,
+ EMPTY_STRING));
}
@Override
public boolean isValid(ILaunchConfiguration launchConfig) {
-
+
setErrorMessage(null);
boolean result = false;
boolean result = false;
if (strpath.equals(EMPTY_STRING)) {
result = true;
- }
- else {
+ } else {
try {
- File suppfile = ValgrindLaunchPlugin.getDefault().parseWSPath(strpath);
+ File suppfile = ValgrindLaunchPlugin.getDefault().parseWSPath(
+ strpath);
if (suppfile != null && suppfile.exists()) {
result = true;
}
e.printStackTrace();
}
}
-
+
if (!result) {
- setErrorMessage(NLS.bind(Messages.getString("ValgrindOptionsTab.suppressions_file_doesnt_exist"), strpath)); //$NON-NLS-1$
+ setErrorMessage(NLS
+ .bind(Messages
+ .getString("ValgrindOptionsTab.suppressions_file_doesnt_exist"), strpath)); //$NON-NLS-1$
}
return result;
}
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
- configuration.setAttribute(LaunchConfigurationConstants.ATTR_TOOL, tool);
+ configuration
+ .setAttribute(LaunchConfigurationConstants.ATTR_TOOL, tool);
// commented by greatim at 2011.06.01 for fresh ide
-// configuration.setAttribute(ISMLCDTLaunchConstants.ATTR_LAUNCH_MODE, "valgrind" );
+ // configuration.setAttribute(ISMLCDTLaunchConstants.ATTR_LAUNCH_MODE,
+ // "valgrind" );
applyGeneralAttributes(configuration);
if (dynamicTab != null) {
dynamicTab.performApply(configuration);
protected void applyGeneralAttributes(
ILaunchConfigurationWorkingCopy configuration) {
- configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_TRACECHILD, traceChildrenButton.getSelection());
- // configuration.setAttribute(ValgrindLaunchPlugin.ATTR_GENERAL_CHILDSILENT, childSilentButton.getSelection());
- // configuration.setAttribute(ValgrindLaunchPlugin.ATTR_GENERAL_TRACKFDS, trackFdsButton.getSelection());
- // configuration.setAttribute(ValgrindLaunchPlugin.ATTR_GENERAL_TIMESTAMP, timeStampButton.getSelection());
- configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_FREERES, runFreeresButton.getSelection());
-
- configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_DEMANGLE, demangleButton.getSelection());
- configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_NUMCALLERS, numCallersSpinner.getSelection());
- configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_ERRLIMIT, errorLimitButton.getSelection());
- configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_BELOWMAIN, showBelowMainButton.getSelection());
- configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_MAXFRAME, maxStackFrameSpinner.getSelection());
- configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_SUPPFILE, suppFileText.getText());
+ configuration.setAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_TRACECHILD,
+ traceChildrenButton.getSelection());
+ // configuration.setAttribute(ValgrindLaunchPlugin.ATTR_GENERAL_CHILDSILENT,
+ // childSilentButton.getSelection());
+ // configuration.setAttribute(ValgrindLaunchPlugin.ATTR_GENERAL_TRACKFDS,
+ // trackFdsButton.getSelection());
+ // configuration.setAttribute(ValgrindLaunchPlugin.ATTR_GENERAL_TIMESTAMP,
+ // timeStampButton.getSelection());
+ configuration.setAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_FREERES,
+ runFreeresButton.getSelection());
+
+ configuration.setAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_DEMANGLE,
+ demangleButton.getSelection());
+ configuration.setAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_NUMCALLERS,
+ numCallersSpinner.getSelection());
+ configuration.setAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_ERRLIMIT,
+ errorLimitButton.getSelection());
+ configuration.setAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_BELOWMAIN,
+ showBelowMainButton.getSelection());
+ configuration.setAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_MAXFRAME,
+ maxStackFrameSpinner.getSelection());
+ configuration.setAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_SUPPFILE,
+ suppFileText.getText());
}
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
launchConfigurationWorkingCopy = configuration;
-
+
setDefaultGeneralAttributes(configuration);
if (dynamicTab != null) {
dynamicTab.setDefaults(configuration);
public static void setDefaultGeneralAttributes(
ILaunchConfigurationWorkingCopy configuration) {
-
+
// commented by greatim at 2011.06.01 for fresh ide
-// configuration.setAttribute(ISMLCDTLaunchConstants.ATTR_LAUNCH_MODE, "valgrind");
-
- configuration.setAttribute(LaunchConfigurationConstants.ATTR_TOOL, ValgrindLaunchPlugin.TOOL_EXT_DEFAULT);
- configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_TRACECHILD, false);
- // configuration.setAttribute(ValgrindLaunchPlugin.ATTR_GENERAL_CHILDSILENT, false);
- // configuration.setAttribute(ValgrindLaunchPlugin.ATTR_GENERAL_TRACKFDS, false);
- // configuration.setAttribute(ValgrindLaunchPlugin.ATTR_GENERAL_TIMESTAMP, false);
- configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_FREERES, true);
-
- configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_DEMANGLE, true);
- configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_NUMCALLERS, 12);
- configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_ERRLIMIT, true);
- configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_BELOWMAIN, false);
- configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_MAXFRAME, 2000000);
- configuration.setAttribute(LaunchConfigurationConstants.ATTR_GENERAL_SUPPFILE, EMPTY_STRING);
+ // configuration.setAttribute(ISMLCDTLaunchConstants.ATTR_LAUNCH_MODE,
+ // "valgrind");
+
+ configuration.setAttribute(LaunchConfigurationConstants.ATTR_TOOL,
+ ValgrindLaunchPlugin.TOOL_EXT_DEFAULT);
+ configuration.setAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_TRACECHILD, false);
+ // configuration.setAttribute(ValgrindLaunchPlugin.ATTR_GENERAL_CHILDSILENT,
+ // false);
+ // configuration.setAttribute(ValgrindLaunchPlugin.ATTR_GENERAL_TRACKFDS,
+ // false);
+ // configuration.setAttribute(ValgrindLaunchPlugin.ATTR_GENERAL_TIMESTAMP,
+ // false);
+ configuration.setAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_FREERES, true);
+
+ configuration.setAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_DEMANGLE, true);
+ configuration.setAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_NUMCALLERS, 12);
+ configuration.setAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_ERRLIMIT, true);
+ configuration.setAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_BELOWMAIN, false);
+ configuration.setAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_MAXFRAME, 2000000);
+ configuration.setAttribute(
+ LaunchConfigurationConstants.ATTR_GENERAL_SUPPFILE,
+ EMPTY_STRING);
}
@Override
protected void updateLaunchConfigurationDialog() {
if (!isInitializing) {
super.updateLaunchConfigurationDialog();
- }
+ }
}
- public static void showErrorDialog(final String errorMessage, final String reasonMessage, final Exception ex) {
-
+
+ public static void showErrorDialog(final String errorMessage,
+ final String reasonMessage, final Exception ex) {
+
final String dialogTitle = "Valgrind Error";
final String toolname = Messages.getString("ValgrindOptionsTab.Tool");
- final IStatus status = new Status(IStatus.ERROR, toolname, IStatus.OK, reasonMessage, ex);
-
+ final IStatus status = new Status(IStatus.ERROR, toolname, IStatus.OK,
+ reasonMessage, ex);
+
Display.getDefault().syncExec(new Runnable() {
public void run() {
ErrorDialog.openError(null, dialogTitle, errorMessage, status);
org.eclipse.linuxtools.valgrind.launch,
org.eclipse.linuxtools.valgrind.ui,
com.samsung.slp.nativeide;bundle-version="1.0.0",
- com.samsung.slp.common.conn;bundle-version="1.0.0"
+ org.eclipse.linuxtools.valgrind.launch.exe;bundle-version="1.3.18"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
*
* Contributors:
* Elliott Baron <ebaron@redhat.com> - initial API and implementation
- *******************************************************************************/
+ *******************************************************************************/
package org.eclipse.linuxtools.valgrind.massif;
import java.io.File;
import org.eclipse.linuxtools.valgrind.launch.ValgrindLaunchPlugin;
import org.eclipse.linuxtools.valgrind.ui.*;
-import com.samsung.slp.common.conn.session.ISession;
import com.samsung.slp.nativeide.launch.SLPLaunchDelegate;
+import org.eclipse.linuxtools.valgrind.launch.CommandManager;
+
+public class MassifLaunchDelegate extends SLPLaunchDelegate implements
+ IValgrindLaunchDelegate {
+ // valgrind
-public class MassifLaunchDelegate extends SLPLaunchDelegate implements IValgrindLaunchDelegate {
- //valgrind
-
protected static final String EMPTY_STRING = ""; //$NON-NLS-1$
protected static final String NO = "no"; //$NON-NLS-1$
protected static final String YES = "yes"; //$NON-NLS-1$
protected static final String LOG_FILE = LOG_PREFIX + "%p.xml"; //$NON-NLS-1$
protected static final FileFilter LOG_FILTER = new FileFilter() {
public boolean accept(File pathname) {
- //return pathname.getName().startsWith(LOG_PREFIX);
+ // return pathname.getName().startsWith(LOG_PREFIX);
return pathname.getName().endsWith("xml");
-
+
}
};
-
- protected static final String OUT_PREFIX = "massif_"; //$NON-NLS-1$
+
+ protected static final String OUT_PREFIX = "massif_"; //$NON-NLS-1$
//protected static final String OUT_FILE = OUT_PREFIX + "%p.txt"; //$NON-NLS-1$
protected static final String OUT_FILE = "massif_000.txt"; //$NON-NLS-1$
protected static final FileFilter MASSIF_FILTER = new FileFilter() {
protected MassifOutput output;
- public void launch(ValgrindCommand command, ILaunchConfiguration config, ILaunch launch, IProgressMonitor monitor, Process remoteShellProcess,ISession session)
- throws Exception {
+ public void launch(ValgrindCommand command, ILaunchConfiguration config,
+ ILaunch launch, IProgressMonitor monitor) throws Exception {
MassifPlugin.getDefault().setConfig(config);
MassifPlugin.getDefault().setSourceLocator(launch.getSourceLocator());
try {
- //command.getProcess().waitFor();
-
- remoteShellProcess.waitFor();
-
- String ValgrindHostdir = ValgrindUIPlugin.getDefault().getStateLocation().append("Valgrind_XML").toOSString();
- String targetlog_massif=ValgrindLaunchPlugin.RESULT_DIR + OUT_FILE;
- String hostlog_massif =ValgrindHostdir+File.separator+OUT_FILE;
- //--bery sftp dowonload
- session.downloadFile(targetlog_massif,hostlog_massif);
-
+ // command.getProcess().waitFor();
+
+ // remoteShellProcess.waitFor();
+
+ String ValgrindHostdir = ValgrindUIPlugin.getDefault()
+ .getStateLocation().toOSString();
+ String targetlog_massif = ValgrindLaunchPlugin.RESULT_DIR
+ + OUT_FILE;
+ String hostlog_massif = ValgrindHostdir + File.separator + OUT_FILE;
+ // --bery sftp dowonload
+ // session.downloadFile(targetlog_massif,hostlog_massif);
+ File file = new File(hostlog_massif);
+ if (file.exists()) {
+ file.delete();
+ }
+ CommandManager.pull(targetlog_massif, hostlog_massif);
parseOutput(hostlog_massif);
- } catch (InterruptedException e) {
} catch (IOException e) {
e.printStackTrace();
- abort(Messages.getString("MassifLaunchDelegate.Error_parsing_output"), e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); //$NON-NLS-1$
+ abort(Messages
+ .getString("MassifLaunchDelegate.Error_parsing_output"), e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); //$NON-NLS-1$
}
}
protected void parseOutput(String hostlog_massif) throws IOException {
output = new MassifOutput();
- // for (File file : hostlog_massif) {
- MassifParser parser = new MassifParser(hostlog_massif);
- output.putSnapshots(parser.getPid(), parser.getSnapshots());
- //}
-
+ // for (File file : hostlog_massif) {
+ MassifParser parser = new MassifParser(hostlog_massif);
+ output.putSnapshots(parser.getPid(), parser.getSnapshots());
+ // }
+
ValgrindViewPart view = ValgrindUIPlugin.getDefault().getView();
IValgrindToolView massifPart = view.getDynamicView();
if (massifPart instanceof MassifViewPart) {
}
}
- public String[] getCommandArray(ValgrindCommand command, ILaunchConfiguration config)
- throws CoreException {
+ public String[] getCommandArray(ValgrindCommand command,
+ ILaunchConfiguration config) throws CoreException {
ArrayList<String> opts = new ArrayList<String>();
- opts.add(OPT_MASSIF_OUTFILE + EQUALS + ValgrindLaunchPlugin.RESULT_DIR + OUT_FILE);
-
- opts.add(OPT_HEAP + EQUALS + (config.getAttribute(MassifToolPage.ATTR_MASSIF_HEAP, true) ? YES : NO));
- opts.add(OPT_HEAPADMIN + EQUALS + config.getAttribute(MassifToolPage.ATTR_MASSIF_HEAPADMIN, 8));
- opts.add(OPT_STACKS + EQUALS + (config.getAttribute(MassifToolPage.ATTR_MASSIF_STACKS, false) ? YES : NO));
- opts.add(OPT_DEPTH + EQUALS + config.getAttribute(MassifToolPage.ATTR_MASSIF_DEPTH, 30));
- List<String> allocFns = config.getAttribute(MassifToolPage.ATTR_MASSIF_ALLOCFN, Collections.EMPTY_LIST);
+ opts.add(OPT_MASSIF_OUTFILE + EQUALS + ValgrindLaunchPlugin.RESULT_DIR
+ + OUT_FILE);
+
+ opts.add(OPT_HEAP
+ + EQUALS
+ + (config.getAttribute(MassifToolPage.ATTR_MASSIF_HEAP, true) ? YES
+ : NO));
+ opts.add(OPT_HEAPADMIN + EQUALS
+ + config.getAttribute(MassifToolPage.ATTR_MASSIF_HEAPADMIN, 8));
+ opts.add(OPT_STACKS
+ + EQUALS
+ + (config
+ .getAttribute(MassifToolPage.ATTR_MASSIF_STACKS, false) ? YES
+ : NO));
+ opts.add(OPT_DEPTH + EQUALS
+ + config.getAttribute(MassifToolPage.ATTR_MASSIF_DEPTH, 30));
+ List<String> allocFns = config.getAttribute(
+ MassifToolPage.ATTR_MASSIF_ALLOCFN, Collections.EMPTY_LIST);
for (String func : allocFns) {
opts.add(OPT_ALLOCFN + EQUALS + func);
}
- opts.add(OPT_THRESHOLD + EQUALS + config.getAttribute(MassifToolPage.ATTR_MASSIF_THRESHOLD, 10) / 10.0);
- opts.add(OPT_PEAKINACCURACY + EQUALS + config.getAttribute(MassifToolPage.ATTR_MASSIF_PEAKINACCURACY, 10) / 10.0);
- opts.add(OPT_TIMEUNIT + EQUALS + config.getAttribute(MassifToolPage.ATTR_MASSIF_TIMEUNIT, MassifToolPage.TIME_I));
- opts.add(OPT_DETAILEDFREQ + EQUALS + config.getAttribute(MassifToolPage.ATTR_MASSIF_DETAILEDFREQ, 10));
- opts.add(OPT_MAXSNAPSHOTS + EQUALS + config.getAttribute(MassifToolPage.ATTR_MASSIF_MAXSNAPSHOTS, 100));
- opts.add(OPT_ALIGNMENT + EQUALS + config.getAttribute(MassifToolPage.ATTR_MASSIF_ALIGNMENT, 8));
+ opts.add(OPT_THRESHOLD + EQUALS
+ + config.getAttribute(MassifToolPage.ATTR_MASSIF_THRESHOLD, 10)
+ / 10.0);
+ opts.add(OPT_PEAKINACCURACY
+ + EQUALS
+ + config.getAttribute(
+ MassifToolPage.ATTR_MASSIF_PEAKINACCURACY, 10) / 10.0);
+ opts.add(OPT_TIMEUNIT
+ + EQUALS
+ + config.getAttribute(MassifToolPage.ATTR_MASSIF_TIMEUNIT,
+ MassifToolPage.TIME_I));
+ opts.add(OPT_DETAILEDFREQ
+ + EQUALS
+ + config.getAttribute(MassifToolPage.ATTR_MASSIF_DETAILEDFREQ,
+ 10));
+ opts.add(OPT_MAXSNAPSHOTS
+ + EQUALS
+ + config.getAttribute(MassifToolPage.ATTR_MASSIF_MAXSNAPSHOTS,
+ 100));
+ opts.add(OPT_ALIGNMENT + EQUALS
+ + config.getAttribute(MassifToolPage.ATTR_MASSIF_ALIGNMENT, 8));
return opts.toArray(new String[opts.size()]);
}
-// public void restoreState(HistoryEntry entry) throws CoreException {
-// try {
-// Map<?, ?> config = entry.getAttributes();
-// MassifPlugin.getDefault().setConfig(config);
-//
-// // retrieve or create sourceLocator
-// ILaunch launch = new Launch(config, ILaunchManager.PROFILE_MODE, null);
-// setDefaultSourceLocator(launch, config);
-// MassifPlugin.getDefault().setSourceLocator(launch.getSourceLocator());
-//
-// File[] massifOutputs = entry.getDatadir().listFiles(MASSIF_FILTER);
-// parseOutput(massifOutputs);
-// } catch (IOException e) {
-// e.printStackTrace();
-// abort(Messages.getString("MassifLaunchDelegate.Error_parsing_output"), e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); //$NON-NLS-1$
-// }
-// }
-//
-// public void saveState(HistoryEntry entry) throws CoreException {
-// }
+ // public void restoreState(HistoryEntry entry) throws CoreException {
+ // try {
+ // Map<?, ?> config = entry.getAttributes();
+ // MassifPlugin.getDefault().setConfig(config);
+ //
+ // // retrieve or create sourceLocator
+ // ILaunch launch = new Launch(config, ILaunchManager.PROFILE_MODE, null);
+ // setDefaultSourceLocator(launch, config);
+ // MassifPlugin.getDefault().setSourceLocator(launch.getSourceLocator());
+ //
+ // File[] massifOutputs = entry.getDatadir().listFiles(MASSIF_FILTER);
+ // parseOutput(massifOutputs);
+ // } catch (IOException e) {
+ // e.printStackTrace();
+ // abort(Messages.getString("MassifLaunchDelegate.Error_parsing_output"), e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); //$NON-NLS-1$
+ // }
+ // }
+ //
+ // public void saveState(HistoryEntry entry) throws CoreException {
+ // }
}
org.eclipse.linuxtools.valgrind.launch,
org.eclipse.linuxtools.valgrind.ui,
com.samsung.slp.nativeide;bundle-version="1.0.0",
- com.samsung.slp.common.conn;bundle-version="1.0.0",
- com.samsung.slp.common;bundle-version="1.3.20"
+ com.samsung.slp.common;bundle-version="1.3.20",
+ org.eclipse.linuxtools.valgrind.launch.exe;bundle-version="1.3.18"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-Localization: plugin
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.linuxtools.valgrind.core.ValgrindCommand;
+import org.eclipse.linuxtools.valgrind.launch.CommandManager;
import org.eclipse.linuxtools.valgrind.launch.IValgrindLaunchDelegate;
import org.eclipse.linuxtools.valgrind.launch.ValgrindLaunchPlugin;
import org.eclipse.linuxtools.valgrind.ui.IValgrindToolView;
import org.eclipse.linuxtools.valgrind.ui.ValgrindViewPart;
import org.xml.sax.SAXException;
-import com.samsung.slp.common.conn.device.DeviceManager;
-import com.samsung.slp.common.conn.machine.IMachine;
-import com.samsung.slp.common.conn.session.ISession;
-import com.samsung.slp.common.util.DialogUtil;
import com.samsung.slp.nativeide.launch.SLPLaunchDelegate;
public class MemcheckLaunchDelegate extends SLPLaunchDelegate implements IValgrindLaunchDelegate {
protected ValgrindError error;
@Override
- public void launch(ValgrindCommand command, ILaunchConfiguration config, ILaunch launch, IProgressMonitor monitor,Process remoteShellProcess, ISession session) throws Exception {
+ public void launch(ValgrindCommand command, ILaunchConfiguration config, ILaunch launch, IProgressMonitor monitor) throws Exception {
// wait for Valgrind to exit
try {
- //command.getProcess().waitFor();
- if( remoteShellProcess.waitFor() != 0) {
- DialogUtil.openErrorDialog("Application is terminated forcefully. Profiling cannot complete.");
- return;
- }
- if (DeviceManager.getSelectedDevice().getMachineType()
- .equals(IMachine.VIRTUAL_DEVICE)
- && Platform.getOS().equals(Platform.OS_WIN32)) {
- Exception te;
- te = new Exception(
- "Can not use valgrind, because the host doesn't support Intel VT");
- throw (te);
- }
- String ValgrindHostdir = ValgrindUIPlugin.getDefault().getStateLocation().append("Valgrind_XML").toOSString();
+ //String ValgrindHostdir = ValgrindUIPlugin.getDefault().getStateLocation().append("Valgrind_XML").toOSString();
+ String ValgrindHostdir = ValgrindUIPlugin.getDefault().getStateLocation().toOSString();
String targetlog=ValgrindLaunchPlugin.RESULT_DIR +"valgrind.xml";
- String hostlog =ValgrindHostdir + File.separator + "valgrind_out.xml";
+ String hostlog =ValgrindHostdir + /*File.separator +*/ "valgrind_out.xml";
//--bery sftp dowonload
- session.downloadFile(targetlog,hostlog);
+ File file = new File(hostlog);
+ if(file.exists()){
+ file.delete();
+ }
+ CommandManager.pull(targetlog, hostlog);
//----bery parsing the xml output file
- parseOutput(hostlog);
-
+ parseOutput(hostlog);
} catch (ParserConfigurationException e) {
abort(Messages.getString("MemcheckLaunchDelegate.Error_parsing_output"), e, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); //$NON-NLS-1$
e.printStackTrace();
e.printStackTrace();
} catch (SAXException e) {
Exception te;
- if(DeviceManager.getSelectedDevice().getMachineType().equals(IMachine.REAL_DEVICE))
+ if(!CommandManager.isEmulator())
{
te = new Exception("Currently valgrind profiling is not supported in 'Real Device'. Please use valgrind profiling in 'Emulator'.");
throw(te);
abort(Messages.getString("MemcheckLaunchDelegate.Error_parsing_output"), te, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR); //$NON-NLS-1$
e.printStackTrace();
- } catch (InterruptedException e) {
}
}