Commit 84a71610 authored by Markus's avatar Markus
Browse files

Allows you to re-enter debugging window... and some other shit

parent 8a46b1cb
...@@ -9,6 +9,7 @@ public aspect FixCompiler { ...@@ -9,6 +9,7 @@ public aspect FixCompiler {
pointcut exHandler(Throwable t) : call(void main.PseuCoCo.handleExceptions(..)) && args(t); pointcut exHandler(Throwable t) : call(void main.PseuCoCo.handleExceptions(..)) && args(t);
void around(Throwable t) : exHandler(t){ void around(Throwable t) : exHandler(t){
//t.printStackTrace(gui.Output.err);
if (t instanceof ThreadDeath) return; if (t instanceof ThreadDeath) return;
proceed(t); proceed(t);
} }
......
...@@ -125,7 +125,7 @@ public class Pseuco { ...@@ -125,7 +125,7 @@ public class Pseuco {
* Reseting code * Reseting code
*/ */
private static void init() { private static void init() {
MainCodeGen.inputNode = null; MainCodeGen.inputNode = null;
MainCodeGen.output = true; MainCodeGen.output = true;
MainCodeGen.generatedCode = null; MainCodeGen.generatedCode = null;
MainCodeGen.isJavaCodeGeneration = true; MainCodeGen.isJavaCodeGeneration = true;
......
...@@ -148,7 +148,7 @@ public class GUI extends JFrame { ...@@ -148,7 +148,7 @@ public class GUI extends JFrame {
public void run() { public void run() {
menuStop.setEnabled(false); menuStop.setEnabled(false);
menuRun.setEnabled(true); menuRun.setEnabled(true);
menuDebug.setEnabled(true); //menuDebug.setEnabled(true);
popUpRun.setEnabled(true); popUpRun.setEnabled(true);
} }
}); });
...@@ -158,7 +158,7 @@ public class GUI extends JFrame { ...@@ -158,7 +158,7 @@ public class GUI extends JFrame {
output.setText(""); output.setText("");
menuStop.setEnabled(true); menuStop.setEnabled(true);
menuRun.setEnabled(false); menuRun.setEnabled(false);
menuDebug.setEnabled(false); //menuDebug.setEnabled(false);
popUpRun.setEnabled(false); popUpRun.setEnabled(false);
} }
}); });
...@@ -330,6 +330,10 @@ public class GUI extends JFrame { ...@@ -330,6 +330,10 @@ public class GUI extends JFrame {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (Pseuco.debugging && !menuRun.isEnabled()){
Pseuco.debugger.makeFrame();
return;
}
if (!checkCurrentProject()) return; if (!checkCurrentProject()) return;
savePseuCo(Start.workspace+System.getProperty("file.separator")+currentProject+".pseuco"); savePseuCo(Start.workspace+System.getProperty("file.separator")+currentProject+".pseuco");
Pseuco.debug(Start.workspace+System.getProperty("file.separator")+currentProject+".pseuco"); Pseuco.debug(Start.workspace+System.getProperty("file.separator")+currentProject+".pseuco");
......
...@@ -17,9 +17,15 @@ public aspect bughunter01 { ...@@ -17,9 +17,15 @@ public aspect bughunter01 {
//Additional error displaying - this shows you internal compiler errors //Additional error displaying - this shows you internal compiler errors
//catches: public static void handleExceptions(Throwable e) //catches: public static void handleExceptions(Throwable e)
/*pointcut err(Throwable t) : call(void main.PseuCoCo.handleExceptions(Throwable, ..)) && args(t, ..); /*
pointcut err(Throwable t) : call(void main.PseuCoCo.handleExceptions(..)) && args(t, ..);
before(Throwable t) : err(t){ before(Throwable t) : err(t){
System.err.println("DETECTED AN EXCEPTION: "); System.err.println("DETECTED AN EXCEPTION: ");
t.printStackTrace(); t.printStackTrace();
}*/ } // */
/*
before() : call(* tree.PseuCoParser.main(..)) && within(main.PseuCoCo){
codeGen.MainCodeGen.shortOutputs = false;
} // */
} }
...@@ -118,6 +118,17 @@ public class DebuggerHandler { ...@@ -118,6 +118,17 @@ public class DebuggerHandler {
return frame; return frame;
} }
private Runnable makeframe = new Runnable() {
@Override
public void run() {
frame = new DebuggerFrame(debuggerhandler);
frame.setWatchingEnabled(!threads.isEmpty());
for (Entry<Thread, ManagedThreadPane> e: threads.entrySet()){
frame.addManagedThreadPane(e.getValue());
}
}
};
/** /**
* Creates the debugger frame, if it doesn't exist. * Creates the debugger frame, if it doesn't exist.
* Might be call from EDT or not. * Might be call from EDT or not.
...@@ -125,22 +136,15 @@ public class DebuggerHandler { ...@@ -125,22 +136,15 @@ public class DebuggerHandler {
public synchronized void makeFrame(){ public synchronized void makeFrame(){
if (frame != null) return; if (frame != null) return;
if (SwingUtilities.isEventDispatchThread()){ if (SwingUtilities.isEventDispatchThread()){
frame = new DebuggerFrame(debuggerhandler); makeframe.run();
frame.setWatchingEnabled(!threads.isEmpty()); }else{
return; try {
} SwingUtilities.invokeAndWait(makeframe);
try { } catch (InvocationTargetException e) {
SwingUtilities.invokeAndWait(new Runnable() { e.printStackTrace(Output.err);
@Override } catch (InterruptedException e) {
public void run() { e.printStackTrace(Output.err);
frame = new DebuggerFrame(debuggerhandler); }
frame.setWatchingEnabled(!threads.isEmpty());
}
});
} catch (InvocationTargetException e) {
e.printStackTrace(Output.err);
} catch (InterruptedException e) {
e.printStackTrace(Output.err);
} }
} }
......
...@@ -25,6 +25,7 @@ public class DebuggerRefresherThread extends Thread { ...@@ -25,6 +25,7 @@ public class DebuggerRefresherThread extends Thread {
} catch (InvocationTargetException e) { } catch (InvocationTargetException e) {
e.printStackTrace(Output.err); e.printStackTrace(Output.err);
} catch (InterruptedException e) { } catch (InterruptedException e) {
interrupt();
} catch (NullPointerException e) {} } catch (NullPointerException e) {}
} }
} }
......
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