Commit 94396bb0 authored by Andrey Filippov's avatar Andrey Filippov
Browse files

Bug fixes

parent 83666e1b
Loading
Loading
Loading
Loading
+25 −1
Original line number Diff line number Diff line
@@ -253,6 +253,30 @@ public class LaunchCore {
            }
//        	System.out.println("DebugUITools.launch() tool="+tool.getName()+" project="+project.getName()+" resource="+resource.toString()+" logBuildStamp="+logBuildStamp);
            DebugUITools.launch(launchConfig, ILaunchManager.RUN_MODE);
/*
java.lang.NullPointerException
	at org.eclipse.debug.internal.ui.DebugUIPlugin.launchInBackground(DebugUIPlugin.java:1257)
	at org.eclipse.debug.ui.DebugUITools.launch(DebugUITools.java:757)
	at com.elphel.vdt.core.launching.LaunchCore.launch(LaunchCore.java:255)
	at com.elphel.vdt.core.tools.params.ToolSequence.launchNextTool(ToolSequence.java:403)
	at com.elphel.vdt.core.tools.params.ToolSequence.continueRunningTools(ToolSequence.java:356)
	at com.elphel.vdt.core.tools.params.ToolSequence.doToolFinished(ToolSequence.java:306)
	at com.elphel.vdt.core.tools.params.ToolSequence.toolFinished(ToolSequence.java:236)
	at com.elphel.vdt.core.tools.params.Tool.toolFinished(Tool.java:455)
	at com.elphel.vdt.core.launching.VDTRunner.doResumeLaunch(VDTRunner.java:315)
	at com.elphel.vdt.core.launching.VDTRunner.resumeLaunch(VDTRunner.java:123)
	at com.elphel.vdt.core.launching.VDTConsoleRunner.finishConsolescript(VDTConsoleRunner.java:439)
	at com.elphel.vdt.core.launching.VDTConsoleRunner$2.streamAppended(VDTConsoleRunner.java:268)
	at org.eclipse.debug.internal.core.OutputStreamMonitor$ContentNotifier.run(OutputStreamMonitor.java:258)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.debug.internal.core.OutputStreamMonitor$ContentNotifier.notifyAppend(OutputStreamMonitor.java:268)
	at org.eclipse.debug.internal.core.OutputStreamMonitor.fireStreamAppended(OutputStreamMonitor.java:117)
	at org.eclipse.debug.internal.core.OutputStreamMonitor.read(OutputStreamMonitor.java:157)
	at org.eclipse.debug.internal.core.OutputStreamMonitor.access$1(OutputStreamMonitor.java:135)
	at org.eclipse.debug.internal.core.OutputStreamMonitor$1.run(OutputStreamMonitor.java:208)
	at java.lang.Thread.run(Thread.java:724)
            
 */
        } catch (CoreException e) {
            IStatus status = e.getStatus();
            if (status.getSeverity() != IStatus.CANCEL)
+40 −8
Original line number Diff line number Diff line
@@ -293,6 +293,8 @@ public class RunningBuilds {
				Tool tool=ToolsCore.getTool(runConfig.getToolName());
				if (tool.getState()==TOOL_STATE.KEPT_OPEN) {
					tool.setState(TOOL_STATE.NEW);
					tool. setOpenTool(null);
					removeConfiguration(consoleName);
					if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING)) System.out.print("Killed open console");
					return true;
				}
@@ -316,6 +318,8 @@ public class RunningBuilds {
						System.out.println("Unfinished build: "+key);
					}
				}
				// got here with no actual console, but unfinishedBuilds had "Vivado ..." in state "New"
				if (actualConsoleExists(consoleName)) {
					tool.setMode(TOOL_MODE.STOP);
					tool.toolFinished();
					if (tool.getState()==TOOL_STATE.KEPT_OPEN) {
@@ -323,10 +327,17 @@ public class RunningBuilds {
						tool.toolFinished();
						return true;
					}
	    		MessageUI.error("Something is wrong in RunningBuilds#isAlreadyOpen as the console for the specified tool "+tool.getName()+" is already open");
					MessageUI.error("Something is wrong in: RunningBuilds#isAlreadyOpen as the console for the specified tool "+tool.getName()+" is already open");
					tool.setState(TOOL_STATE.FAILURE);
					tool.toolFinished();
					return true;
				} else {
					String msg="BUG: there is unfinishedBuild for cosole="+consoleName+ "( tool="+toolName+
							"), but no actual is console open.";
					System.out.println(msg);
					MessageUI.error(msg);
					removeConfiguration(consoleName);
				}
			}
		}
		if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING)) {
@@ -339,4 +350,25 @@ public class RunningBuilds {
	}

	
	/**
	 * Checks if there is actual console starting with this name (plus " (" actually exists
	 * Used to recover if for some reasons unfinishedBuild for this console was not removed (a BUG)
	 * @param consolePrefix console name without timestamp data
	 * @return true if such console actually exusts
	 */
	public boolean actualConsoleExists(String consolePrefix){
		IConsoleManager man = ConsolePlugin.getDefault().getConsoleManager(); // debugging
		IConsole[] consoles=(IConsole[]) man.getConsoles();
		String consoleStartsWith=consolePrefix+" ("; // space and start of date
		for (int i=0;i<consoles.length;i++){
			if (consoles[i].getName().startsWith(consoleStartsWith)){
				return true;
			}
		}
		return false;
		
	}
	

	
} // class RunningBuilds
+11 −1
Original line number Diff line number Diff line
@@ -57,6 +57,11 @@ class OptionsUtils {
            String str = (String)i.next();
            value += str + SEPARATOR;
        }
        if (value.contains("ConstraintsFiles")){
        	System.out.println("convertListToString() contains ConstraintsFiles");
        	System.out.println("convertListToString() contains ConstraintsFiles");
        	
        }
        return value;
    }
    
@@ -70,6 +75,11 @@ class OptionsUtils {
        if ((value == null) || (value.length() == 0 )) {
            list = new ArrayList<String>();
        } else {
            if (value.contains("ConstraintsFiles")){
            	System.out.println("convertStringToList() contains ConstraintsFiles");
            	System.out.println("convertStringToList() contains ConstraintsFiles");
            }
        	
            String items[] = value.split(SEPARATOR);
            list = new ArrayList<String>(items.length);
            for (String item : items) {
+44 −3
Original line number Diff line number Diff line
@@ -111,6 +111,7 @@ public class ToolSequence {
				tool.setStateJustThis(TOOL_STATE.NEW);
				tool.clearDependStamps();
			}
			tool.setOpenTool(null); // reset tool state (only needed for console tools) 
		}
		setToolsDirtyFlag(true); // update may be needed ?
		toolFinished(null);
@@ -369,8 +370,26 @@ public class ToolSequence {
			return false; // tools are not linked
		}
	}
	public void launchNextTool(final Tool tool) throws CoreException {
		if (Thread.currentThread().getId()>1){
			if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_THREAD_CONFICT))
				System.out.println(">>>>>>>> launching 2A: "+tool.getName()+" threadID="+Thread.currentThread().getId()+
						" ("+Thread.currentThread().getName()+")");
			Display.getDefault().asyncExec(new Runnable() { 
				public void run() {
		    		try {
		    			do_launchNextTool(tool);		    			
					} catch (CoreException e1) {
                        MessageUI.error( "Error launchNextTool("+tool.getName()+" e="+ e1.getMessage());
					}
				}
			});
			
	public void launchNextTool(Tool tool) throws CoreException {
		} else {
			do_launchNextTool(tool);
		}
	}
	public void do_launchNextTool(Tool tool) throws CoreException {
//		if (!okToRun()) return;
//		setStateProvides(); // just testing
		tool.setDesignFlowView(designFlowView); // maybe will not be needed with ToolSequencing class
@@ -384,7 +403,8 @@ public class ToolSequence {
				tool.setMode(twa.getMode()) ; //TOOL_MODE.RUN);
				tool.setChoice(twa.getChoice());
				if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_THREAD_CONFICT))
					System.out.println(">>>>>>>> launching: "+tool.getName()+" threadID="+Thread.currentThread().getId());
					System.out.println(">>>>>>>> launching: "+tool.getName()+" threadID="+Thread.currentThread().getId()+
							" ("+Thread.currentThread().getName()+")");
				LaunchCore.launch( tool,
						SelectedResourceManager.getDefault().getSelectedProject(),
						twa.getFullPath(),
@@ -400,10 +420,30 @@ public class ToolSequence {
		// apply designFlowView to the tool itself
		if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_THREAD_CONFICT))
			System.out.println(">>>>>>>> launching 2: "+tool.getName()+" threadID="+Thread.currentThread().getId());
		if (Thread.currentThread().getId()>1){
			System.out.println("High thread number");
		}
		// here were problems with the thread id >1, waiting at breakpoint fixed
		LaunchCore.launch( tool,
				SelectedResourceManager.getDefault().getSelectedProject(),
				SelectedResourceManager.getDefault().getChosenTarget(),
				null); // run, not playback 
/*
 * Reused old VDTRunner()
RunningBuilds#isAlreadyOpen(VivadoOpt), no match threadID=42
Unfinished build: Vivado (Apr 1, 2014 11:23:25 AM MDT) tool Vivado
Internal Error
java.lang.NullPointerException
	at org.eclipse.debug.internal.ui.DebugUIPlugin.launchInBackground(DebugUIPlugin.java:1257)
	at org.eclipse.debug.ui.DebugUITools.launch(DebugUITools.java:757)
	at com.elphel.vdt.core.launching.LaunchCore.launch(LaunchCore.java:255)
	at com.elphel.vdt.core.tools.params.ToolSequence.launchNextTool(ToolSequence.java:403)
	at com.elphel.vdt.core.tools.params.ToolSequence.continueRunningTools(ToolSequence.java:356)
	at com.elphel.vdt.core.tools.params.ToolSequence.doToolFinished(ToolSequence.java:306)
	at com.elphel.vdt.core.tools.params.ToolSequence.toolFinished(ToolSequence.java:236)
	at com.elphel.vdt.core.tools.params.Tool.toolFinished(Tool.java:455)

 */
	} // launchTool()

	
@@ -525,6 +565,7 @@ public class ToolSequence {
		for (Tool consoleTool:consoleTools){ // or maybe do it after other dependencies?
			if (consoleTool.getState()!=TOOL_STATE.KEPT_OPEN) {
				DEBUG_PRINT("Need to launch tool"+consoleTool.getName()+" to satisfy dependencies of tool "+tool.getName());
				consoleTool.setOpenTool(null); // reset tool state 
				return consoleTool; // start the console session
			}
		}