Commit c3b3f877 authored by Andrey Filippov's avatar Andrey Filippov

Debugging tool sequencing

parent cf2d0868
......@@ -46,6 +46,7 @@ import com.elphel.vdt.Txt;
import com.elphel.vdt.VDT;
//import com.elphel.vdt.VDTPlugin;
import com.elphel.vdt.veditor.VerilogPlugin;
import com.elphel.vdt.veditor.preference.PreferenceStrings;
import com.elphel.vdt.core.options.OptionsCore;
import com.elphel.vdt.core.tools.contexts.Context;
import com.elphel.vdt.core.tools.contexts.PackageContext;
......@@ -360,7 +361,7 @@ public class LaunchCore {
DebugPlugin.getDefault().getLaunchManager().addLaunch(launch);
// VDTRunner runner = VDTLaunchUtil.getRunner();
VDTProgramRunner runner = configuration.getProgramRunner();
int numItem=configuration.getBuildStep();
int numItem=configuration.getPrevBuildStep();
//getProgramRunner
// Probably wrong thing to launch - what if it starts with console?
......@@ -385,7 +386,8 @@ public class LaunchCore {
*/
protected static boolean saveAllEditors(boolean confirm) {
if (VerilogPlugin.getActiveWorkbenchWindow() == null) {
System.out.println("VerilogPlugin.getActiveWorkbenchWindow() == null");
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING))
System.out.println("VerilogPlugin.getActiveWorkbenchWindow() == null");
return true; // false;
}
return PlatformUI.getWorkbench().saveAllEditors(confirm);
......
......@@ -174,7 +174,9 @@ public class RunningBuilds {
}
public VDTRunnerConfiguration resumeConfiguration(String consoleName){
System.out.println("VDTRunnerConfiguration#resumeConfiguration("+consoleName+")");
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING)) {
System.out.println("VDTRunnerConfiguration#resumeConfiguration("+consoleName+")");
}
VDTRunnerConfiguration conf=unfinishedBuilds.get(consoleName);
// unfinishedBuilds.remove(consoleName); //
return conf;
......@@ -293,6 +295,7 @@ public class RunningBuilds {
if (toolName.equals(runConfig.getToolName())){
Tool tool=ToolsCore.getTool(runConfig.getToolName());
// tool.setRunning(false);
System.out.println("RunningBuilds#isAlreadyOpen("+toolName+"), state="+tool.getState()+" threadID="+Thread.currentThread().getId());
tool.setMode(TOOL_MODE.STOP);
tool.toolFinished();
if (tool.getState()==TOOL_STATE.KEPT_OPEN) {
......
......@@ -58,7 +58,7 @@ public class VDTConsolePlayback{
) throws CoreException{
final boolean debugPrint=VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING);
VDTProgramRunner programRunner = runConfig.getProgramRunner();
int numItem=runConfig.getBuildStep();
int numItem=runConfig.getPrevBuildStep(); // current is already icremented
// TODO: process - null- normal run, "" - playback latest log, or timestamp - play selected log file(s)
String playBackStamp=runConfig.getPlayBackStamp();
......@@ -126,7 +126,7 @@ public class VDTConsolePlayback{
((buildParamsItem.getLogName()!=null)?(" ("+buildParamsItem.getLogName()+")"):"")+
((playBackStamp.length()>0)?(" timestamp: "+playBackStamp):"");
runner.log(msg, null, null, false, true); // Appears in the console of the target Eclipse (may be immediately erased)
runner.log(msg, null, null, false, false); // Appears in the console of the parent Eclipse
if (debugPrint) runner.log(msg, null, null, false, false); // Appears in the console of the parent Eclipse
IProcess processErr=null;
IProcess processOut=null;
......
......@@ -87,7 +87,7 @@ public class VDTConsoleRunner{
final boolean debugPrint=VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING);
VDTRunner runner = VDTLaunchUtil.getRunner();
VDTProgramRunner programRunner = runConfig.getProgramRunner();
int numItem=runConfig.getBuildStep();
int numItem=runConfig.getPrevBuildStep();
// TODO: process - null- normal run, "" - playback latest log, or timestamp - play selected log file(s)
String playBackStamp=runConfig.getPlayBackStamp();
......@@ -128,7 +128,7 @@ public class VDTConsoleRunner{
}
}
runner.log("Writing to console "+iCons.getName()+":", arguments, null, false, true); // Appears in the console of the target Eclipse (may be immediately erased)
runner.log("Writing to console "+iCons.getName()+":", arguments, null, false, false); // Appears in the console of the parent Eclipse
if (debugPrint) runner.log("Writing to console "+iCons.getName()+":", arguments, null, false, false); // Appears in the console of the parent Eclipse
IOConsoleOutputStream outStream= iCons.newOutputStream();
IProcess process=((ProcessConsole)iCons).getProcess();
consoleInStreamProxy= (IStreamsProxy2)process.getStreamsProxy();
......@@ -191,7 +191,7 @@ public class VDTConsoleRunner{
boolean keepOpen= buildParamsItem.keepOpen();
if (keepOpen){
// TODO: Reuse keepOpen for other meaning?
MessageUI.error("keep-open is not supported for termonal scripts (it always keeps it open, ignoring");
MessageUI.error("keep-open is not supported for terminal scripts (it always keeps it open, ignoring");
}
if (debugPrint) {
......@@ -389,7 +389,8 @@ public class VDTConsoleRunner{
}
}
int thisStep=runConfig.getBuildStep();
// int thisStep=runConfig.getAndIncBuildStep(); // points to current, increments pointer
int thisStep=runConfig.getPrevBuildStep(); // points to current, increments pointer
if (debugPrint) System.out.println("Finished console task, step was "+thisStep);
// Update tool status - until it is running there will be no actual changes on the icon view - will still spin
Tool tool=ToolsCore.getTool(runConfig.getToolName());
......@@ -419,10 +420,11 @@ public class VDTConsoleRunner{
}
// Go on, continue with the sequence (maybe nothing is left
runConfig.setBuildStep(thisStep+1); // next task to run
// runConfig.setBuildStep(thisStep+1); // next task to run
// runConfig.updateBuildStep(); // set buildstep to incremented AtomicInteger, enable continuation;
VDTLaunchUtil.getRunner().getRunningBuilds().saveUnfinished(runConfig.getOriginalConsoleName(), runConfig );
try {
VDTLaunchUtil.getRunner().resumeLaunch(runConfig.getOriginalConsoleName()); // replace with console
VDTLaunchUtil.getRunner().resumeLaunch(runConfig.getOriginalConsoleName(),thisStep+1); // replace with console
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
......
......@@ -32,6 +32,8 @@ import org.eclipse.swt.widgets.Display;
import com.elphel.vdt.Txt;
import com.elphel.vdt.core.tools.contexts.BuildParamsItem;
import com.elphel.vdt.ui.MessageUI;
import com.elphel.vdt.veditor.VerilogPlugin;
import com.elphel.vdt.veditor.preference.PreferenceStrings;
/**
......@@ -98,7 +100,7 @@ public class VDTLaunchConfigurationDelegate implements ILaunchConfigurationDeleg
monitor.worked(3);
// resolve arguments, save them
runConfig.setArgumentsItemsArray(VDTLaunchUtil.getArguments(configuration)); // calculates all parameters
runConfig.setArgumentsItemsArray(VDTLaunchUtil.getArguments(configuration)); // calculates all parameters modifies the tool parameters!
runConfig.setIsShell(VDTLaunchUtil.getIsShell(configuration));
runConfig.setPatternErrors(VDTLaunchUtil.getPatternErrors(configuration));
runConfig.setToolName(VDTLaunchUtil.getToolName(configuration));
......@@ -107,7 +109,10 @@ public class VDTLaunchConfigurationDelegate implements ILaunchConfigurationDeleg
runConfig.setToolLogDir(VDTLaunchUtil.getToolLogDir(configuration));
runConfig.setToolProjectPath(VDTLaunchUtil.getToolProjectPath(configuration));
runConfig.setBuildStep(0);
// runConfig.setBuildStep(0);
runConfig.resetBuildStep();
List<String> controlFiles = VDTLaunchUtil.getControlFiles(configuration);
runConfig.setControlFiles((String[])controlFiles.toArray(new String[controlFiles.size()]));
// String consoleName=VDTRunner.renderProcessLabel(runConfig.getToolName());
......@@ -125,7 +130,9 @@ public class VDTLaunchConfigurationDelegate implements ILaunchConfigurationDeleg
Display.getDefault().syncExec(new Runnable() {
public void run() {
try {
VDTLaunchUtil.getRunner().resumeLaunch(consoleName);
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING))
System.out.println("VDTLaunchConfigurationDelegate#doLaunch("+consoleName+"), threadID="+Thread.currentThread().getId());
VDTLaunchUtil.getRunner().resumeLaunch(consoleName,0);
} catch (CoreException e) {
System.out.println("Failed to resumeLaunch");
} //, fiCons, this); // replace with console
......@@ -133,7 +140,8 @@ public class VDTLaunchConfigurationDelegate implements ILaunchConfigurationDeleg
});
} else {
runConfig.setBuildStep(-1); // to cause errors if will try to continue
runConfig.invalidateBuildStep();
// runConfig.setBuildStep(-1); // to cause errors if will try to continue
runner.logPlaybackLaunch(consoleName); // tool logs playback with parsing
}
return;
......
......@@ -136,11 +136,13 @@ public class VDTLaunchUtil {
// public static List<String> getArguments(ILaunchConfiguration configuration) throws CoreException {
public static BuildParamsItem[] getArguments(ILaunchConfiguration configuration) throws CoreException {
Tool tool = obtainTool(configuration);
// Replaces tool parameter values with the ones passed through configuration, then uses tool.buildParams;
// that causes conflicts in multi-threaded operation. Or is it just a working copy?
for (Iterator i = tool.getParams().iterator(); i.hasNext(); ) {
Parameter param = (Parameter)i.next();
String valueAttrName = LaunchCore.getValueAttributeName(param);
String valueAttrName = LaunchCore.getValueAttributeName(param); // "ATTR_VALUE_" + toolParameter.getID();
try {
if(param.getType().isList()) {
List<String> value =
......
......@@ -161,7 +161,7 @@ public class VDTProgramRunner {
}
String[] controlFiles = runConfig.getControlFiles();
runner.log(null,cmdLine, controlFiles, false, true); /* Appears in the console of the target Eclipse (immediately erased) */
runner.log(null,cmdLine, controlFiles, false, false); /* Appears in the console of the parent Eclipse */
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING)) runner.log(null,cmdLine, controlFiles, false, false); /* Appears in the console of the parent Eclipse */
String[] envp = runConfig.getEnvironment();
......
......@@ -71,6 +71,8 @@ import com.elphel.vdt.veditor.preference.PreferenceStrings;
//import com.elphel.vdt.core.Utils;
import org.eclipse.ui.console.IConsoleListener;
......@@ -97,6 +99,7 @@ public class VDTRunner {
tool.setDirty(false);
tool.setState(TOOL_STATE.FAILURE);
// tool.setRunning(false);
System.out.println("VDTRunner#abortLaunch("+consoleName+"), tool="+tool.getName()+" "+tool.toString()+" state="+tool.getState()+" threadID="+Thread.currentThread().getId());
tool.setMode(TOOL_MODE.STOP);
// tool.setTimeStamp(); // will set at start
tool.toolFinished();
......@@ -104,9 +107,11 @@ public class VDTRunner {
runningBuilds.removeConfiguration(runConfig.getOriginalConsoleName());
}
public void resumeLaunch(String consoleName) throws CoreException {
public void resumeLaunch(String consoleName, int expectedStep) throws CoreException {
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING))
System.out.println("VDTRunner#resumeLaunch("+consoleName+"), threadID="+Thread.currentThread().getId());
try {
doResumeLaunch(consoleName);
doResumeLaunch(consoleName, expectedStep);
} catch(Exception e) {
MessageUI.error(e);
......@@ -115,33 +120,44 @@ public class VDTRunner {
}
}
// make call it when console is closed
private void doResumeLaunch(String consoleName ) throws CoreException {
private void doResumeLaunch(String consoleName, int numItem) throws CoreException {
final VDTRunnerConfiguration runConfig=runningBuilds.resumeConfiguration(consoleName);
final boolean debugPrint=VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING);
if (runConfig==null){
System.out.println("Turned out nothing to do. Probably a bug");
MessageUI.error("Turned out nothing to do. Probably a bug");
abortLaunch(consoleName);
return;
}
if (!runConfig.isStepValid()){
System.out.println("Invalid build step (probably configuration is for console playback)");
MessageUI.error("Invalid build step (probably configuration is for console playback)");
abortLaunch(consoleName);
return;
}
if (!runConfig.acquireBuildStep(numItem)){
System.out.println("Missed a lock on runConfig for "+consoleName+" expected step was "+
numItem+", current step="+(runConfig.getPrevBuildStep()+1));
return;
}
final boolean debugPrint=VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING);
String playBackStamp=runConfig.getPlayBackStamp();
if (playBackStamp!=null){
System.out.println("doResumeLaunch(): wrong, it should be playback, not run, as playBackStamp = "+playBackStamp+ "(not null)");
abortLaunch(consoleName);
return;
}
BuildParamsItem[] argumentsItemsArray = runConfig.getArgumentsItemsArray(); // uses already calculated
runConfig.canceTimers(); // If some timers were set, but a task finished earlier
int numItem=runConfig.getBuildStep();
//// int numItem=runConfig.getBuildStep();
if (debugPrint) System.out.println("--------- resuming "+ consoleName+", numItem="+numItem+" ------------");
ILaunch launch=runConfig.getLaunch();
IProgressMonitor monitor=runConfig.getMonitor();
for (;numItem<argumentsItemsArray.length;numItem++){
runConfig.setBuildStep(numItem); // was not updated if was not sleeping
// for (;numItem<argumentsItemsArray.length;numItem++){
for (;numItem<argumentsItemsArray.length;numItem=runConfig.getAndIncBuildStep()){
// runConfig.setBuildStep(numItem); // was not updated if was not sleeping
List<String> toolArguments = new ArrayList<String>();
List<String> arguments=argumentsItemsArray[numItem].getParamsAsList();
if (arguments != null)
......@@ -191,8 +207,10 @@ public class VDTRunner {
continue; // proceed with the next item without pausing
}
/* Prepare to postpone next commands to be resumed by event*/
runConfig.setBuildStep(numItem+1);
//// runConfig.setBuildStep(numItem+1); // already incremented
runningBuilds.saveUnfinished(consoleName, runConfig );
final int fExpectedStep=numItem+1;
final IPropertyChangeListener fListener =new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
......@@ -200,7 +218,9 @@ public class VDTRunner {
fiCons.removePropertyChangeListener(this);
if (debugPrint) System.out.println(">>> "+fConsoleName+" -> "+fiCons.getName());
try {
resumeLaunch(fConsoleName); //, fiCons, this); // replace with console
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING))
System.out.println("VDTRunner#doResumeLaunch(), IPropertyChangeListener: "+fConsoleName+", threadID="+Thread.currentThread().getId());
resumeLaunch(fConsoleName,fExpectedStep); //, fiCons, this); // replace with console
} catch (CoreException e) {
System.out.println ("Failed to resume launch sequence");
}
......@@ -230,7 +250,8 @@ public class VDTRunner {
final int fTimeout = timeout;
final IProcess fProcess=process;
// new Timer().schedule(new TimerTask() {
System.out.println("VDTRunner(): setting old timer "+fTimeout*1000);
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING))
System.out.println("VDTRunner(): setting old timer "+fTimeout*1000);
argumentsItemsArray[numItem].getTimer().schedule(new TimerTask() {
@Override
public void run() {
......@@ -241,7 +262,9 @@ public class VDTRunner {
Display.getDefault().syncExec(new Runnable() {
public void run() {
try {
resumeLaunch(fConsoleName);
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING))
System.out.println("VDTRunner#doResumeLaunch(), Timeout: "+fConsoleName+", threadID="+Thread.currentThread().getId());
resumeLaunch(fConsoleName,fExpectedStep);
} catch (CoreException e) {
System.out.println("Failed to resumeLaunch after timer"+fConsoleName);
} //, fiCons, this); // replace with console
......@@ -268,13 +291,17 @@ public class VDTRunner {
monitor.done();
Tool tool=ToolsCore.getTool(runConfig.getToolName());
// tool.setRunning(false);
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING))
System.out.println("VDTRunner#doResumeLaunch("+consoleName+"), tool="+tool.getName()+" "+tool.toString()+" state="+tool.getState()+" threadID="+Thread.currentThread().getId());
tool.setMode(TOOL_MODE.STOP);
// tool.setTimeStamp(); //will set at start
if ((tool.getState()==TOOL_STATE.SUCCESS) && runConfig.isKeptOpen()) {
tool.setState(TOOL_STATE.KEPT_OPEN);
} else { // failure on not
runningBuilds.removeConfiguration(consoleName);
runningBuilds.removeConfiguration(consoleName);
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING))
System.out.println("VDTRunner#doResumeLaunch("+consoleName+") - removed configuartion, tool="+tool.getName()+" "+tool.toString()+" state="+tool.getState()+" threadID="+Thread.currentThread().getId());
}
tool.toolFinished();
}
......@@ -310,12 +337,13 @@ public class VDTRunner {
// int numItem=runConfig.getBuildStep();
// made buildStep for logs negative (it does not need to sleep and does everything in one call)
// to catch stray resumes
runConfig.resetBuildStep();
int numItem=0; //runConfig.getBuildStep();
if (debugPrint) System.out.println("--------- re-playing log from "+ consoleName+", numItem="+numItem+" ------------");
ILaunch launch=runConfig.getLaunch();
IProgressMonitor monitor=runConfig.getMonitor();
for (;numItem<argumentsItemsArray.length;numItem++){
runConfig.setBuildStep(numItem); // was not updated if was not sleeping
for (;numItem<argumentsItemsArray.length;numItem=runConfig.getAndIncBuildStep()){
// runConfig.setBuildStep(numItem); // was not updated if was not sleeping
List<String> toolArguments = new ArrayList<String>();
List<String> arguments=argumentsItemsArray[numItem].getParamsAsList();
if (arguments != null)
......@@ -334,7 +362,7 @@ public class VDTRunner {
}
if (debugPrint) System.out.println("Skipping program runner as playback is not implemented, arguments were "+argumentsItemsArray[numItem].getNameAsParser());
} //for (;numItem<argumentsItemsArray.length;numItem++){
System.out.println("All playbacks finished");
if (debugPrint) System.out.println("All playbacks finished");
monitor.done();
// ToolsCore.getTool(runConfig.getToolName()).setRunning(false);
ToolsCore.getTool(runConfig.getToolName()).setMode(TOOL_MODE.STOP);
......
......@@ -22,6 +22,7 @@ import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
......@@ -36,6 +37,8 @@ import org.eclipse.ui.console.IConsole;
import com.elphel.vdt.Txt;
import com.elphel.vdt.core.tools.contexts.BuildParamsItem;
import com.elphel.vdt.ui.MessageUI;
import com.elphel.vdt.veditor.VerilogPlugin;
import com.elphel.vdt.veditor.preference.PreferenceStrings;
/**
......@@ -88,7 +91,9 @@ public class VDTRunnerConfiguration {
private String toolInfo;
private String toolLogDir;
private int buildStep;
// private int buildStep;
private AtomicInteger nextBuildStep;
private int prevBuildStep=0;
private ILaunchConfiguration configuration;
private ILaunch launch;
private IProgressMonitor monitor;
......@@ -136,7 +141,8 @@ public class VDTRunnerConfiguration {
}
public void canceTimers(){
if (argumentsItemsArray!=null) for (int i=0;i<buildStep;i++){
// if (argumentsItemsArray!=null) for (int i=0;i<buildStep;i++){
if (argumentsItemsArray!=null) for (int i=0;i<getPrevBuildStep();i++){
argumentsItemsArray[i].cancelTimer();
}
}
......@@ -171,7 +177,63 @@ public class VDTRunnerConfiguration {
this.consolePlayback=new VDTConsolePlayback(this);
this.keptOpen=false;
this.iConsole=null;
this.nextBuildStep=new AtomicInteger(0);
prevBuildStep=0;
}
public int getPrevBuildStep(){
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING))
System.out.println("getPrevBuildStep(): prevBuildStep=" +prevBuildStep+ ", nextBuildStep=" +nextBuildStep.get());
return prevBuildStep;
}
public int getAndIncBuildStep(){
prevBuildStep=nextBuildStep.getAndIncrement();
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING))
System.out.println("getAndIncBuildStep(): prevBuildStep=" +prevBuildStep+ ", nextBuildStep=" +nextBuildStep.get());
return prevBuildStep;
}
public void resetBuildStep(){
nextBuildStep=new AtomicInteger(0);
prevBuildStep=0;
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING))
System.out.println("resetBuildStep(): prevBuildStep=" +prevBuildStep+ ", nextBuildStep=" +nextBuildStep.get());
// updateBuildStep();
}
public void invalidateBuildStep(){
nextBuildStep=null;
}
public boolean acquireBuildStep (int expected){
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING))
System.out.println("acquireBuildStep(): prevBuildStep=" +prevBuildStep+ ", nextBuildStep=" +nextBuildStep.get()+" expected="+expected);
if (nextBuildStep.compareAndSet(expected, expected+1)){
prevBuildStep=expected;
return true;
}
return false;
}
public boolean isStepValid(){
return (nextBuildStep!=null);
}
/**
* Verify to have a lock on the runner
* @return true if got a lock, false (normally should not happen) - duplicate (i.e. timeout+listener)
*/
// public boolean gotFirst(){
// return (nextBuildStep.compareAndSet(buildStep, buildStep+1));
// }
/**
* Called before exiting - enables next step
*/
// public void updateBuildStep(){
// buildStep=nextBuildStep.get();
// }
public void setKeptOpen(boolean keepOpen){
this.keptOpen=keepOpen;
}
......@@ -378,13 +440,6 @@ public class VDTRunnerConfiguration {
toolArgs= args;
}
public void setBuildStep(int buildStep){
this.buildStep=buildStep;
}
public int getBuildStep(){
return buildStep;
}
public void setIsShell(boolean isShell) {
......
......@@ -22,6 +22,9 @@ import java.util.Timer;
import java.util.TimerTask;
import java.util.List;
import com.elphel.vdt.veditor.VerilogPlugin;
import com.elphel.vdt.veditor.preference.PreferenceStrings;
public class BuildParamsItem implements Cloneable{
private String [] params;
private String consoleName; // null for external tools running in a new console
......@@ -161,7 +164,8 @@ public class BuildParamsItem implements Cloneable{
public Timer getTimer(){
if (timer==null){
timer=new Timer();
System.out.println("BuildParamsitem(): : making new timer");
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING))
System.out.println("BuildParamsitem(): : making new timer");
}
return timer;
}
......@@ -169,7 +173,8 @@ public class BuildParamsItem implements Cloneable{
if (timer==null) return;
timer.cancel();
timer=null;
System.out.println("BuildParamsitem(): canceled and nulled timer");
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING))
System.out.println("BuildParamsitem(): canceled and nulled timer");
}
public void finalize() throws Throwable{
......
......@@ -230,26 +230,28 @@ public abstract class Context {
}
return consoleList;
}
// currently - for all tools, skip generation of control files, ignore errors
public void recalcHashCodes(){
System.out.println("Context.java(): RECALC HASH CODES");
// called from ContextOptionsDialog.okPressed() line: 89
// all context parameters are already recalculated (buildParams() ), so now we just go through all tool contexts,
// calling them with dryRun=true;
for (Tool tool : ToolsCore.getConfig().getContextManager().getToolList()){
try {
tool.buildParams(false);
if (tool.hashMatch()) System.out.println("recalcHashCodes(): "+tool.getName()+
" hashMatch()="+tool.hashMatch()+
" getCurrentHash()="+tool.getCurrentHash()+
" getLastRunHash()="+tool.getLastRunHash());
} catch (ToolException e) {
System.out.println("failed buildParams(false) on tool="+tool.getName()+", e="+e.toString());
}
}
}
// currently - for all tools, skip generation of control files, ignore errors
public void recalcHashCodes(){
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) {
System.out.println("Context.java(): RECALC HASH CODES");
}
// called from ContextOptionsDialog.okPressed() line: 89
// all context parameters are already recalculated (buildParams() ), so now we just go through all tool contexts,
// calling them with dryRun=true;
for (Tool tool : ToolsCore.getConfig().getContextManager().getToolList()){
try {
tool.buildParams(false);
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) {
if (tool.hashMatch()) System.out.println("recalcHashCodes(): "+tool.getName()+
" hashMatch()="+tool.hashMatch()+
" getCurrentHash()="+tool.getCurrentHash()+
" getLastRunHash()="+tool.getLastRunHash());
}
} catch (ToolException e) {
System.out.println("failed buildParams(false) on tool="+tool.getName()+", e="+e.toString());
}
}
}
public BuildParamsItem[] buildParams() throws ToolException {
return buildParams(false);
......@@ -419,7 +421,9 @@ public abstract class Context {
// }
if (proto!=null){
if (proto!=this){
System.out.println("++++ Updating tool's currentHash from working copy, name="+name);
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_TOOL_SEQUENCE)) {
System.out.println("++++ Updating tool's currentHash from working copy, name="+name);
}
proto.setCurrentHash(currentHash);
}
......
......@@ -21,6 +21,7 @@ import java.util.*;
import com.elphel.vdt.core.tools.params.FormatProcessor;
import com.elphel.vdt.core.tools.params.Parameter;
import com.elphel.vdt.ui.MessageUI;
public class ValueGenerator extends AbstractGenerator {
private Parameter param;
......@@ -55,7 +56,14 @@ public class ValueGenerator extends AbstractGenerator {
System.out.println("BUG in ValueGenerator.java#generate: param.getValue() isEmpty for "+param.getID());
return new String[]{prefix + "" + suffix};
} else {
return new String[]{prefix + rslt.get(0) + suffix};
try{
return new String[]{prefix + rslt.get(0) + suffix};
} catch (Exception e){
System.out.println("**** Error in ValueGenerator while processing parameter "+param.getID());
System.out.println("rslt="+rslt.toString());
MessageUI.error("**** Error in ValueGenerator while processing parameter "+param.getID());
return new String[]{prefix + "" + suffix};
}
}
// return new String[]{prefix + param.getValue(topProcessor).get(0) + suffix};
}
......@@ -63,3 +71,27 @@ public class ValueGenerator extends AbstractGenerator {
return super.generate();
}
}
/*
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:604)
at java.util.ArrayList.get(ArrayList.java:382)
at com.elphel.vdt.core.tools.generators.ValueGenerator.generate(ValueGenerator.java:58)
at com.elphel.vdt.core.tools.params.FormatProcessor.generateAndAdd(FormatProcessor.java:155)
at com.elphel.vdt.core.tools.params.FormatProcessor.processTemplate(FormatProcessor.java:106)
at com.elphel.vdt.core.tools.params.FormatProcessor.process(FormatProcessor.java:73)
at com.elphel.vdt.core.tools.params.conditions.StringComparison.isTrue(StringComparison.java:77)
at com.elphel.vdt.core.tools.params.conditions.ConditionUtils.resolveConditionStrings(ConditionUtils.java:37)
at com.elphel.vdt.core.tools.params.CommandLinesBlock.getLines(CommandLinesBlock.java:208)
at com.elphel.vdt.core.tools.contexts.Context.buildParams(Context.java:304)
at com.elphel.vdt.core.tools.params.Tool.buildParams(Tool.java:1301)
at com.elphel.vdt.core.tools.params.Tool.buildParams(Tool.java:1284)
at com.elphel.vdt.core.launching.VDTLaunchUtil.getArguments(VDTLaunchUtil.java:163)
at com.elphel.vdt.core.launching.VDTLaunchConfigurationDelegate.doLaunch(VDTLaunchConfigurationDelegate.java:101)
at com.elphel.vdt.core.launching.VDTLaunchConfigurationDelegate.launch(VDTLaunchConfigurationDelegate.java:149)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:858)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:707)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1018)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1222)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
*/
......@@ -27,6 +27,8 @@ import com.elphel.vdt.core.tools.config.ConfigException;
import com.elphel.vdt.core.tools.params.conditions.*;
import com.elphel.vdt.core.tools.params.types.ParamTypeString;
import com.elphel.vdt.core.tools.params.types.ParamTypeString.KIND;
import com.elphel.vdt.veditor.VerilogPlugin;
import com.elphel.vdt.veditor.preference.PreferenceStrings;
public class CommandLinesBlock extends UpdateableStringsContainer
implements Cloneable
......@@ -245,7 +247,8 @@ public class CommandLinesBlock extends UpdateableStringsContainer
}
public void update(Updateable from) throws ConfigException {
update(from,null);
System.out.println("CommandLinesBlock#update(from,null)");
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_OTHER))
System.out.println("CommandLinesBlock#update(from,null)");
}
}
......@@ -344,25 +344,30 @@ public class Parameter implements Cloneable, Updateable {
String errmsg = "Parameter '" + id +
"' of context '" + context.getName() +
"' - error processing default value: ";
// if (id.startsWith("read_xdc")){
// System.out.println(errmsg);
// }
List<String> processedDefaultValue = null;
if (topProcessor==null) topProcessor=new FormatProcessor(null,null);
FormatProcessor processor = new FormatProcessor(new Recognizer[] {
//new RepeaterRecognizer(),
new SimpleGeneratorRecognizer(menuMode),
new ContextParamListRecognizer(context, topProcessor) // Andrey: returning list as the source parameter
// new ContextParamRecognizer(context)
}, topProcessor);
//new RepeaterRecognizer(),
new SimpleGeneratorRecognizer(menuMode),
new ContextParamListRecognizer(context, topProcessor), // Andrey: returning list as the source parameter
// new ContextParamRecognizer(context)
new DefaultListGeneratorRecognizer(menuMode)
}, topProcessor);
try {
processedDefaultValue = processor.process(resolvedDefaultValue);
for(Iterator<String> i = processedDefaultValue.iterator(); i.hasNext();)
type.checkValue(i.next());
processedDefaultValue = processor.process(resolvedDefaultValue);
for(Iterator<String> i = processedDefaultValue.iterator(); i.hasNext();)
type.checkValue(i.next());
} catch(ToolException e) {
MessageUI.error(errmsg + e.getMessage(), e);
MessageUI.error(errmsg + e.getMessage(), e);
} catch(ConfigException e) {
MessageUI.error(errmsg + e.getMessage(), e);
MessageUI.error(errmsg + e.getMessage(), e);
}
canonicalizeValue(processedDefaultValue);
......
/*******************************************************************************
* Copyright (c) 2006 Elphel, Inc and Excelsior, LLC.
* This file is a part of Eclipse/VDT plug-in.
* Eclipse/VDT plug-in is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* Eclipse/VDT plug-in is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with Eclipse VDT plug-in; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*******************************************************************************/
package com.elphel.vdt.core.tools.params.recognizers;
import com.elphel.vdt.core.Utils;
import com.elphel.vdt.core.tools.generators.*;
import com.elphel.vdt.core.tools.params.FormatProcessor;
import com.elphel.vdt.core.tools.params.Tool;
public class DefaultListGeneratorRecognizer implements Recognizer {
private static final String CONTROL_SEQ = "%";
private static final int CONTROL_SEQ_LEN = CONTROL_SEQ.length();
private static AbstractGenerator[] generators = new AbstractGenerator[] {
new SourceListGenerator("","",null),
new FilteredSourceListGenerator("","",null),
new FileListGenerator("","",null)
};
public DefaultListGeneratorRecognizer(){
super();
}
public DefaultListGeneratorRecognizer(boolean menuMode){
super();
for (int i=0;i<generators.length;i++){
generators[i].setMenuMode(menuMode);
}
}
public DefaultListGeneratorRecognizer(boolean menuMode, Tool tool){
super();
for (int i=0;i<generators.length;i++){
generators[i].setMenuMode(menuMode);
generators[i].setTool(tool);
}
}
public DefaultListGeneratorRecognizer(Tool tool){
super();
for (int i=0;i<generators.length;i++){
generators[i].setTool(tool);
}
}
public RecognizerResult recognize(String template, int startPos, FormatProcessor topProcessor) {
RecognizerResult result = new RecognizerResult();
// first see if there is the control sequence
if(template.startsWith(CONTROL_SEQ, startPos)) {
startPos += CONTROL_SEQ_LEN;
// read the identifier from startPos
int newPos = Utils.findBoundary(template, startPos);
String genName = template.substring(startPos, newPos);
result.set(findGenerator(genName), newPos, topProcessor);
}
return result;
}
private AbstractGenerator findGenerator(String genName) {
for(int i = 0; i < generators.length; i++)
if(genName.equals(generators[i].getName()))
return generators[i];
return null;
}
}
......@@ -40,9 +40,9 @@ public class SimpleGeneratorRecognizer implements Recognizer {
new UserNameGenerator(),
new StateDirGenerator(),
new StateFileGenerator(),
new StateBaseGenerator(),
new SourceListGenerator("","",""),
new FilteredSourceListGenerator("","","")
new StateBaseGenerator()
// new SourceListGenerator("","",""),
// new FilteredSourceListGenerator("","","")
};
public SimpleGeneratorRecognizer(){
......
/*******************************************************************************
* Copyright (c) 2014 Elphel, Inc.
* This file is a part of Eclipse/VDT plug-in.
* Eclipse/VDT plug-in is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Eclipse/VDT plug-in is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
package com.elphel.vdt.ui.views;
import com.elphel.vdt.core.tools.params.ToolSequence;
public class ClearLogFiles extends ClearAction {
private ToolSequence toolSequence;
public ClearLogFiles(String message, ToolSequence toolSequence) {
super(message);
this. toolSequence= toolSequence;
}
public void clear() {
toolSequence.clearLogFiles();
}
} // class ContextsAction
/*******************************************************************************
* Copyright (c) 2014 Elphel, Inc.
* This file is a part of Eclipse/VDT plug-in.
* Eclipse/VDT plug-in is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Eclipse/VDT plug-in is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
package com.elphel.vdt.ui.views;
import com.elphel.vdt.core.tools.params.ToolSequence;
public class ClearStateFiles extends ClearAction {
private ToolSequence toolSequence;
public ClearStateFiles(String message, ToolSequence toolSequence) {
super(message);
this. toolSequence= toolSequence;
}
public void clear() {
toolSequence.clearStateFiles();
}
} // class ContextsAction
/*******************************************************************************
* Copyright (c) 2014 Elphel, Inc.
* This file is a part of Eclipse/VDT plug-in.
* Eclipse/VDT plug-in is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Eclipse/VDT plug-in is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
package com.elphel.vdt.ui.views;
import com.elphel.vdt.core.tools.params.ToolSequence;
public class ClearToolStates extends ClearAction {
private ToolSequence toolSequence;
public ClearToolStates(String message, ToolSequence toolSequence) {
super(message);
this. toolSequence= toolSequence;
}
public void clear() {
toolSequence.clearToolStates();
}
} // class ContextsAction
......@@ -156,6 +156,7 @@ public class DesignMenuModel {
int imageHeight = frameImage.getBounds().height;
int y = event.y + (itemHeight - imageHeight) / 2;
event.gc.drawImage(frameImage, x, y);
// System.out.println("showStateIcon(): "+imageKeyState);
if (isAnimation){
animBounds=frameImage.getBounds();
frameImage.dispose();
......@@ -317,6 +318,9 @@ public class DesignMenuModel {
} else if (tool.isAlmostDone()&& (tool.getState()==TOOL_STATE.UNKNOWN )){
iconName=VDTPluginImages.ICON_TOOLSTATE_ALMOST_WTF;
key= VDTPluginImages.KEY_TOOLSTATE_ALMOST_WTF;
} else if (tool.isAlmostDone()){ // restoring state, current state new (erased) or failure
iconName=VDTPluginImages.ICON_TOOLSTATE_ALMOST_GOOD;
key= VDTPluginImages.KEY_TOOLSTATE_ALMOST_GOOD;
} else {
switch (tool.getState()){
case NEW:
......
......@@ -32,7 +32,7 @@
format="CopyValue" default="-c" readonly="false" visible="true" />
<parameter id="TerminalMode" type="BoolYesNo" format="None"
default="false" label="Force termonal mode for remote program" />
default="false" label="Force terminal mode for remote program" />
<parameter id="SSHSwitches" label="Other ssh switches"
type="String" format="CopyValue" default="" readonly="false" visible="true" />
......
......@@ -178,7 +178,7 @@
mark="``"
sep=" "
prompt="@@FINISH@@"
success="write_bitstream completed successfully"
failure="ERROR"
log=""
stdout="parser_VivadoBitstream">
"cd ~/%VivadoProjectRoot\n"
......
......@@ -161,14 +161,14 @@
<!-- hidden (calculated) parameters -->
<!-- <parameter id="FilteredSourceList" type="Filelist"
format="FilteredSourceListSyntax" default="" readonly="true" visible="false" /> -->
<parameter id="FilteredSourceListPar" type="Filelist"
format="ParamListSyntax" default="%%FilteredSourceList" readonly="true" visible="false" />
<!-- Parameter read_xdc just copies parameter ConstraintsFiles, but they have different syntax (output representation) -->
<parameter id="read_xdc" type="Filelist" format="read_xdc_syntax"
default="%ConstraintsFiles" visible="false" />
<parameter id="read_xdc" type="Filelist"
format="read_xdc_syntax" default="%ConstraintsFiles" visible="false" />
<parameter id="FilteredSourceListPar" type="Filelist" label="FilteredSourceListPar"
format="ParamListSyntax" default="%%FilteredSourceList" readonly="false" visible="true" />
<!-- <parameter id="read_xdc" type="Filelist" format="read_xdc_syntax" label="" tooltip="read_xdc"
default="%ConstraintsFiles" visible="false" /> -->
......@@ -220,8 +220,7 @@
<input>
<group name="General">
<!--"blabla1"
"blabla2" -->
"FilteredSourceListPar"
"ConstraintsFiles"
"SkipSnapshotSynth"
"SnapshotSynth" <!-- same as in project -->
......
......@@ -11,7 +11,7 @@
disable="DisableVivadoTiming"
>
<depends-list>
<depends state="SnapshotOptPhys"/>
<depends state="SnapshotRoute"/>
</depends-list>
<action-menu>
......
......@@ -11,7 +11,7 @@
disable="DisableVivadoTimingSummary"
>
<depends-list>
<depends state="SnapshotSynth"/>
<depends state="SnapshotRoute"/>
</depends-list>
<action-menu>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment