From: pcm <pcm...@us...> - 2005-06-09 16:29:31
|
Update of /cvsroot/javapathfinder/javapathfinder/src/gov/nasa/jpf/jvm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31198/src/gov/nasa/jpf/jvm Modified Files: TrailInfo.java JVM.java UncaughtException.java Log Message: the path was not updated on UncaughtException exit, causing the last Transition not to appear in the error report. We probably should print out something even if the sourcepath is not set, so Step.printStepOn() still needs some work Index: TrailInfo.java =================================================================== RCS file: /cvsroot/javapathfinder/javapathfinder/src/gov/nasa/jpf/jvm/TrailInfo.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- TrailInfo.java 26 Apr 2005 19:44:08 -0000 1.1.1.1 +++ TrailInfo.java 9 Jun 2005 16:29:23 -0000 1.2 @@ -120,7 +120,8 @@ void addStep (Step step) { if (first == null) { - first = last = step; + first = step; + last = step; } else { last.next = step; last = step; @@ -138,7 +139,6 @@ pw.print(" Random #"); pw.print(random); } - pw.println(); if (showSteps) { Index: JVM.java =================================================================== RCS file: /cvsroot/javapathfinder/javapathfinder/src/gov/nasa/jpf/jvm/JVM.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- JVM.java 9 Jun 2005 06:46:44 -0000 1.5 +++ JVM.java 9 Jun 2005 16:29:23 -0000 1.6 @@ -898,6 +898,25 @@ return forward(); } + /** + * store the current SystemState's TrainInfo in our path, after updating it + * with whatever annotations the JVM wants to add. + * This is supposed to be called after each transition we want to keep + */ + void updatePath () { + Transition t = ss.trail(); + + // <2do> we should probably store the output directly in the TrailInfo, + // but this might not be our only annotation in the future + + // did we have output during the last transition? If yes, add it + if ((out != null) && (out.length() > 0)) { + t.setOutput( out.toString()); + out.setLength(0); + } + + path.add(t); + } /** * try to advance the state @@ -945,12 +964,7 @@ // by the subsequent operations (before we return from forward) pushSystemState(); - Transition t = ss.trail(); - if ((out != null) && (out.length() > 0)) { - t.setOutput( out.toString()); - out.setLength(0); - } - path.add(t); + updatePath(); // get ready for the next round (resets Scheduler) ss.prepareNext(this); @@ -967,7 +981,8 @@ // } catch (JPFException e) { // throw e; } catch (UncaughtException e) { - // something blew up, so we definitely executed something + updatePath(); // or we loose the last transition + // something blew up, so we definitely executed something (hence return true) return true; } catch (RuntimeException e) { throw new JPFException(e); Index: UncaughtException.java =================================================================== RCS file: /cvsroot/javapathfinder/javapathfinder/src/gov/nasa/jpf/jvm/UncaughtException.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- UncaughtException.java 26 Apr 2005 19:44:08 -0000 1.1.1.1 +++ UncaughtException.java 9 Jun 2005 16:29:23 -0000 1.2 @@ -78,5 +78,6 @@ pw.print(" : "); thread.printStackTrace(pw, xObjRef); + pw.flush(); } } |