Commit c3b3f877 authored by Andrey Filippov's avatar Andrey Filippov
Browse files

Debugging tool sequencing

parent cf2d0868
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -46,6 +46,7 @@ import com.elphel.vdt.Txt;
import com.elphel.vdt.VDT;
import com.elphel.vdt.VDT;
//import com.elphel.vdt.VDTPlugin;
//import com.elphel.vdt.VDTPlugin;
import com.elphel.vdt.veditor.VerilogPlugin;
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.options.OptionsCore;
import com.elphel.vdt.core.tools.contexts.Context;
import com.elphel.vdt.core.tools.contexts.Context;
import com.elphel.vdt.core.tools.contexts.PackageContext;
import com.elphel.vdt.core.tools.contexts.PackageContext;
@@ -360,7 +361,7 @@ public class LaunchCore {
        DebugPlugin.getDefault().getLaunchManager().addLaunch(launch);                                       
        DebugPlugin.getDefault().getLaunchManager().addLaunch(launch);                                       
//        VDTRunner runner = VDTLaunchUtil.getRunner();
//        VDTRunner runner = VDTLaunchUtil.getRunner();
        VDTProgramRunner runner = configuration.getProgramRunner();
        VDTProgramRunner runner = configuration.getProgramRunner();
		int numItem=configuration.getBuildStep();
		int numItem=configuration.getPrevBuildStep();
		//getProgramRunner
		//getProgramRunner
		
		
// Probably wrong thing to launch - what if it starts with console?
// Probably wrong thing to launch - what if it starts with console?
@@ -385,6 +386,7 @@ public class LaunchCore {
     */
     */
    protected static boolean saveAllEditors(boolean confirm) {
    protected static boolean saveAllEditors(boolean confirm) {
        if (VerilogPlugin.getActiveWorkbenchWindow() == null) {
        if (VerilogPlugin.getActiveWorkbenchWindow() == null) {
			if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING))
				System.out.println("VerilogPlugin.getActiveWorkbenchWindow() == null");
				System.out.println("VerilogPlugin.getActiveWorkbenchWindow() == null");
            return true; // false;
            return true; // false;
        }
        }
+4 −1
Original line number Original line Diff line number Diff line
@@ -174,7 +174,9 @@ public class RunningBuilds {
	}
	}
	
	
	public VDTRunnerConfiguration resumeConfiguration(String consoleName){
	public VDTRunnerConfiguration resumeConfiguration(String consoleName){
		if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING)) {
			System.out.println("VDTRunnerConfiguration#resumeConfiguration("+consoleName+")");
			System.out.println("VDTRunnerConfiguration#resumeConfiguration("+consoleName+")");
		}
		VDTRunnerConfiguration conf=unfinishedBuilds.get(consoleName);
		VDTRunnerConfiguration conf=unfinishedBuilds.get(consoleName);
//		unfinishedBuilds.remove(consoleName); // 
//		unfinishedBuilds.remove(consoleName); // 
		return conf;
		return conf;
@@ -293,6 +295,7 @@ public class RunningBuilds {
			if (toolName.equals(runConfig.getToolName())){
			if (toolName.equals(runConfig.getToolName())){
				Tool tool=ToolsCore.getTool(runConfig.getToolName());
				Tool tool=ToolsCore.getTool(runConfig.getToolName());
//				tool.setRunning(false);
//				tool.setRunning(false);
	    		System.out.println("RunningBuilds#isAlreadyOpen("+toolName+"), state="+tool.getState()+" threadID="+Thread.currentThread().getId());
	    		tool.setMode(TOOL_MODE.STOP);
	    		tool.setMode(TOOL_MODE.STOP);
				tool.toolFinished();
				tool.toolFinished();
				if (tool.getState()==TOOL_STATE.KEPT_OPEN) {
				if (tool.getState()==TOOL_STATE.KEPT_OPEN) {
+2 −2
Original line number Original line Diff line number Diff line
@@ -58,7 +58,7 @@ public class VDTConsolePlayback{
			) throws CoreException{
			) throws CoreException{
        final boolean debugPrint=VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING);
        final boolean debugPrint=VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING);
    	VDTProgramRunner programRunner = runConfig.getProgramRunner();
    	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)
		// TODO: process - null- normal run, "" - playback latest log, or timestamp - play selected log file(s)
		String playBackStamp=runConfig.getPlayBackStamp();
		String playBackStamp=runConfig.getPlayBackStamp();
@@ -126,7 +126,7 @@ public class VDTConsolePlayback{
    			((buildParamsItem.getLogName()!=null)?(" ("+buildParamsItem.getLogName()+")"):"")+
    			((buildParamsItem.getLogName()!=null)?(" ("+buildParamsItem.getLogName()+")"):"")+
    			((playBackStamp.length()>0)?(" timestamp: "+playBackStamp):"");
    			((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, 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 processErr=null;
        IProcess processOut=null;
        IProcess processOut=null;
+8 −6
Original line number Original line Diff line number Diff line
@@ -87,7 +87,7 @@ public class VDTConsoleRunner{
        final boolean debugPrint=VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING);
        final boolean debugPrint=VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING);
    	VDTRunner runner = VDTLaunchUtil.getRunner();
    	VDTRunner runner = VDTLaunchUtil.getRunner();
    	VDTProgramRunner programRunner = runConfig.getProgramRunner();
    	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)
		// TODO: process - null- normal run, "" - playback latest log, or timestamp - play selected log file(s)
		String playBackStamp=runConfig.getPlayBackStamp();
		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, 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();
        IOConsoleOutputStream 	outStream= iCons.newOutputStream();
        IProcess process=((ProcessConsole)iCons).getProcess();
        IProcess process=((ProcessConsole)iCons).getProcess();
        consoleInStreamProxy= (IStreamsProxy2)process.getStreamsProxy();
        consoleInStreamProxy= (IStreamsProxy2)process.getStreamsProxy();
@@ -191,7 +191,7 @@ public class VDTConsoleRunner{
        boolean keepOpen=     buildParamsItem.keepOpen();
        boolean keepOpen=     buildParamsItem.keepOpen();
        if (keepOpen){
        if (keepOpen){
        	// TODO: Reuse keepOpen for other meaning?
        	// 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) {
        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);
    	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
    	// 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());
    	Tool tool=ToolsCore.getTool(runConfig.getToolName());
@@ -419,10 +420,11 @@ public class VDTConsoleRunner{
    	}
    	}
    	// Go on, continue with the sequence (maybe nothing is left
    	// 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 );
    	VDTLaunchUtil.getRunner().getRunningBuilds().saveUnfinished(runConfig.getOriginalConsoleName(), runConfig );
    	try {
    	try {
    		VDTLaunchUtil.getRunner().resumeLaunch(runConfig.getOriginalConsoleName()); // replace with console
    		VDTLaunchUtil.getRunner().resumeLaunch(runConfig.getOriginalConsoleName(),thisStep+1); // replace with console
		} catch (CoreException e) {
		} catch (CoreException e) {
			// TODO Auto-generated catch block
			// TODO Auto-generated catch block
			e.printStackTrace();
			e.printStackTrace();
+12 −4
Original line number Original line Diff line number Diff line
@@ -32,6 +32,8 @@ import org.eclipse.swt.widgets.Display;
import com.elphel.vdt.Txt;
import com.elphel.vdt.Txt;
import com.elphel.vdt.core.tools.contexts.BuildParamsItem;
import com.elphel.vdt.core.tools.contexts.BuildParamsItem;
import com.elphel.vdt.ui.MessageUI;
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);  
        monitor.worked(3);  


        // resolve arguments, save them
        // 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.setIsShell(VDTLaunchUtil.getIsShell(configuration));
    	runConfig.setPatternErrors(VDTLaunchUtil.getPatternErrors(configuration));
    	runConfig.setPatternErrors(VDTLaunchUtil.getPatternErrors(configuration));
    	runConfig.setToolName(VDTLaunchUtil.getToolName(configuration));
    	runConfig.setToolName(VDTLaunchUtil.getToolName(configuration));
@@ -107,7 +109,10 @@ public class VDTLaunchConfigurationDelegate implements ILaunchConfigurationDeleg
    	runConfig.setToolLogDir(VDTLaunchUtil.getToolLogDir(configuration));
    	runConfig.setToolLogDir(VDTLaunchUtil.getToolLogDir(configuration));
    	
    	
    	runConfig.setToolProjectPath(VDTLaunchUtil.getToolProjectPath(configuration));
    	runConfig.setToolProjectPath(VDTLaunchUtil.getToolProjectPath(configuration));
    	runConfig.setBuildStep(0);

    	//    	runConfig.setBuildStep(0);
    	runConfig.resetBuildStep();

    	List<String> controlFiles = VDTLaunchUtil.getControlFiles(configuration);
    	List<String> controlFiles = VDTLaunchUtil.getControlFiles(configuration);
    	runConfig.setControlFiles((String[])controlFiles.toArray(new String[controlFiles.size()]));
    	runConfig.setControlFiles((String[])controlFiles.toArray(new String[controlFiles.size()]));
//        String consoleName=VDTRunner.renderProcessLabel(runConfig.getToolName());
//        String consoleName=VDTRunner.renderProcessLabel(runConfig.getToolName());
@@ -125,7 +130,9 @@ public class VDTLaunchConfigurationDelegate implements ILaunchConfigurationDeleg
        	Display.getDefault().syncExec(new Runnable() {
        	Display.getDefault().syncExec(new Runnable() {
        		public void run() {
        		public void run() {
					try {
					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) {
					} catch (CoreException e) {
						System.out.println("Failed to resumeLaunch");
						System.out.println("Failed to resumeLaunch");
					} //, fiCons, this); // replace with console
					} //, fiCons, this); // replace with console
@@ -133,7 +140,8 @@ public class VDTLaunchConfigurationDelegate implements ILaunchConfigurationDeleg
        	});
        	});
        	
        	
        } else {
        } 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
        	runner.logPlaybackLaunch(consoleName); // tool logs playback with parsing
        }
        }
        return;
        return;
Loading