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