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

Bug fixes

parent 83666e1b
...@@ -252,7 +252,31 @@ public class LaunchCore { ...@@ -252,7 +252,31 @@ public class LaunchCore {
return; return;
} }
// System.out.println("DebugUITools.launch() tool="+tool.getName()+" project="+project.getName()+" resource="+resource.toString()+" logBuildStamp="+logBuildStamp); // System.out.println("DebugUITools.launch() tool="+tool.getName()+" project="+project.getName()+" resource="+resource.toString()+" logBuildStamp="+logBuildStamp);
DebugUITools.launch(launchConfig, ILaunchManager.RUN_MODE); 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) { } catch (CoreException e) {
IStatus status = e.getStatus(); IStatus status = e.getStatus();
if (status.getSeverity() != IStatus.CANCEL) if (status.getSeverity() != IStatus.CANCEL)
......
...@@ -293,6 +293,8 @@ public class RunningBuilds { ...@@ -293,6 +293,8 @@ public class RunningBuilds {
Tool tool=ToolsCore.getTool(runConfig.getToolName()); Tool tool=ToolsCore.getTool(runConfig.getToolName());
if (tool.getState()==TOOL_STATE.KEPT_OPEN) { if (tool.getState()==TOOL_STATE.KEPT_OPEN) {
tool.setState(TOOL_STATE.NEW); tool.setState(TOOL_STATE.NEW);
tool. setOpenTool(null);
removeConfiguration(consoleName);
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING)) System.out.print("Killed open console"); if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING)) System.out.print("Killed open console");
return true; return true;
} }
...@@ -316,17 +318,26 @@ public class RunningBuilds { ...@@ -316,17 +318,26 @@ public class RunningBuilds {
System.out.println("Unfinished build: "+key); System.out.println("Unfinished build: "+key);
} }
} }
tool.setMode(TOOL_MODE.STOP); // got here with no actual console, but unfinishedBuilds had "Vivado ..." in state "New"
tool.toolFinished(); if (actualConsoleExists(consoleName)) {
if (tool.getState()==TOOL_STATE.KEPT_OPEN) { tool.setMode(TOOL_MODE.STOP);
MessageUI.error("Termninal that starts by this tool ("+toolName+") is already open in console \""+consoleName+"\". You may close it manually."); tool.toolFinished();
if (tool.getState()==TOOL_STATE.KEPT_OPEN) {
MessageUI.error("Termninal that starts by this tool ("+toolName+") is already open in console \""+consoleName+"\". You may close it manually.");
tool.toolFinished();
return true;
}
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(); tool.toolFinished();
return true; 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);
} }
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;
} }
} }
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING)) { if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_LAUNCHING)) {
...@@ -339,4 +350,25 @@ public class RunningBuilds { ...@@ -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 } // class RunningBuilds
...@@ -56,6 +56,11 @@ class OptionsUtils { ...@@ -56,6 +56,11 @@ class OptionsUtils {
while(i.hasNext()) { while(i.hasNext()) {
String str = (String)i.next(); String str = (String)i.next();
value += str + SEPARATOR; value += str + SEPARATOR;
}
if (value.contains("ConstraintsFiles")){
System.out.println("convertListToString() contains ConstraintsFiles");
System.out.println("convertListToString() contains ConstraintsFiles");
} }
return value; return value;
} }
...@@ -69,7 +74,12 @@ class OptionsUtils { ...@@ -69,7 +74,12 @@ class OptionsUtils {
List<String> list; List<String> list;
if ((value == null) || (value.length() == 0 )) { if ((value == null) || (value.length() == 0 )) {
list = new ArrayList<String>(); list = new ArrayList<String>();
} else { } else {
if (value.contains("ConstraintsFiles")){
System.out.println("convertStringToList() contains ConstraintsFiles");
System.out.println("convertStringToList() contains ConstraintsFiles");
}
String items[] = value.split(SEPARATOR); String items[] = value.split(SEPARATOR);
list = new ArrayList<String>(items.length); list = new ArrayList<String>(items.length);
for (String item : items) { for (String item : items) {
......
...@@ -111,6 +111,7 @@ public class ToolSequence { ...@@ -111,6 +111,7 @@ public class ToolSequence {
tool.setStateJustThis(TOOL_STATE.NEW); tool.setStateJustThis(TOOL_STATE.NEW);
tool.clearDependStamps(); tool.clearDependStamps();
} }
tool.setOpenTool(null); // reset tool state (only needed for console tools)
} }
setToolsDirtyFlag(true); // update may be needed ? setToolsDirtyFlag(true); // update may be needed ?
toolFinished(null); toolFinished(null);
...@@ -369,8 +370,26 @@ public class ToolSequence { ...@@ -369,8 +370,26 @@ public class ToolSequence {
return false; // tools are not linked return false; // tools are not linked
} }
} }
public void launchNextTool(final Tool tool) throws CoreException {
public void launchNextTool(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());
}
}
});
} else {
do_launchNextTool(tool);
}
}
public void do_launchNextTool(Tool tool) throws CoreException {
// if (!okToRun()) return; // if (!okToRun()) return;
// setStateProvides(); // just testing // setStateProvides(); // just testing
tool.setDesignFlowView(designFlowView); // maybe will not be needed with ToolSequencing class tool.setDesignFlowView(designFlowView); // maybe will not be needed with ToolSequencing class
...@@ -384,7 +403,8 @@ public class ToolSequence { ...@@ -384,7 +403,8 @@ public class ToolSequence {
tool.setMode(twa.getMode()) ; //TOOL_MODE.RUN); tool.setMode(twa.getMode()) ; //TOOL_MODE.RUN);
tool.setChoice(twa.getChoice()); tool.setChoice(twa.getChoice());
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_THREAD_CONFICT)) 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, LaunchCore.launch( tool,
SelectedResourceManager.getDefault().getSelectedProject(), SelectedResourceManager.getDefault().getSelectedProject(),
twa.getFullPath(), twa.getFullPath(),
...@@ -400,10 +420,30 @@ public class ToolSequence { ...@@ -400,10 +420,30 @@ public class ToolSequence {
// apply designFlowView to the tool itself // apply designFlowView to the tool itself
if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_THREAD_CONFICT)) if (VerilogPlugin.getPreferenceBoolean(PreferenceStrings.DEBUG_THREAD_CONFICT))
System.out.println(">>>>>>>> launching 2: "+tool.getName()+" threadID="+Thread.currentThread().getId()); 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, LaunchCore.launch( tool,
SelectedResourceManager.getDefault().getSelectedProject(), SelectedResourceManager.getDefault().getSelectedProject(),
SelectedResourceManager.getDefault().getChosenTarget(), SelectedResourceManager.getDefault().getChosenTarget(),
null); // run, not playback 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() } // launchTool()
...@@ -525,6 +565,7 @@ public class ToolSequence { ...@@ -525,6 +565,7 @@ public class ToolSequence {
for (Tool consoleTool:consoleTools){ // or maybe do it after other dependencies? for (Tool consoleTool:consoleTools){ // or maybe do it after other dependencies?
if (consoleTool.getState()!=TOOL_STATE.KEPT_OPEN) { if (consoleTool.getState()!=TOOL_STATE.KEPT_OPEN) {
DEBUG_PRINT("Need to launch tool"+consoleTool.getName()+" to satisfy dependencies of tool "+tool.getName()); 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 return consoleTool; // start the console session
} }
} }
......
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