public GraphViewer(Graph<Object> graph) throws WalaException { super(null); this.graph = graph; if (graph == null) { throw new WalaException("null graph for SWT viewer"); } }
public static <T> File writeDotFile(Graph<T> g, NodeDecorator<T> labels, String title, String dotfile) throws WalaException { if (g == null) { throw new IllegalArgumentException("g is null"); } StringBuilder dotStringBuffer = dotOutput(g, labels, title); // retrieve the filename parameter to this component, a String if (dotfile == null) { throw new WalaException("internal error: null filename parameter"); } try { File f = new File(dotfile); try (final FileWriter fw = new FileWriter(f)) { fw.write(dotStringBuffer.toString()); } return f; } catch (Exception e) { throw new WalaException("Error writing dot file " + dotfile, e); } }
public static <T> File writeDotFile(Graph<T> g, NodeDecorator<T> labels, String title, String dotfile) throws WalaException { if (g == null) { throw new IllegalArgumentException("g is null"); } StringBuilder dotStringBuffer = dotOutput(g, labels, title); // retrieve the filename parameter to this component, a String if (dotfile == null) { throw new WalaException("internal error: null filename parameter"); } try { File f = new File(dotfile); try (Writer fw = Files.newBufferedWriter(f.toPath(), StandardCharsets.UTF_8)) { fw.write(dotStringBuffer.toString()); } return f; } catch (Exception e) { throw new WalaException("Error writing dot file " + dotfile, e); } }
public static <T> File writeDotFile(Graph<T> g, NodeDecorator<T> labels, String title, String dotfile) throws WalaException { if (g == null) { throw new IllegalArgumentException("g is null"); } StringBuilder dotStringBuffer = dotOutput(g, labels, title); // retrieve the filename parameter to this component, a String if (dotfile == null) { throw new WalaException("internal error: null filename parameter"); } try { File f = new File(dotfile); try (Writer fw = Files.newBufferedWriter(f.toPath(), StandardCharsets.UTF_8)) { fw.write(dotStringBuffer.toString()); } return f; } catch (Exception e) { throw new WalaException("Error writing dot file " + dotfile, e); } }
public static <T> File writeDotFile(Graph<T> g, NodeDecorator<T> labels, String title, String dotfile) throws WalaException { if (g == null) { throw new IllegalArgumentException("g is null"); } StringBuilder dotStringBuffer = dotOutput(g, labels, title); // retrieve the filename parameter to this component, a String if (dotfile == null) { throw new WalaException("internal error: null filename parameter"); } try { File f = new File(dotfile); try (Writer fw = Files.newBufferedWriter(f.toPath(), StandardCharsets.UTF_8)) { fw.write(dotStringBuffer.toString()); } return f; } catch (Exception e) { throw new WalaException("Error writing dot file " + dotfile, e); } }
public void run() { String[] cmdarray = { getGvExe(), getPDFFile() }; try { Process p = Runtime.getRuntime().exec(cmdarray); setProcess(p); } catch (IOException e) { e.printStackTrace(); exception = new WalaException("gv invocation failed for\n" + Arrays.toString(cmdarray)); } }
@Override public boolean mayEscape(MethodReference allocMethod, int allocPC, MethodReference m) throws WalaException { if (allocMethod == null) { throw new IllegalArgumentException("null allocMethod"); } // nodes:= set of call graph nodes representing method m Set nodes = cg.getNodes(m); if (nodes.size() == 0) { throw new WalaException("could not find call graph node for method " + m); } // allocN := set of call graph nodes representing method allocMethod Set<CGNode> allocN = cg.getNodes(allocMethod); if (allocN.size() == 0) { throw new WalaException("could not find call graph node for allocation method " + allocMethod); } return mayEscape(allocN, allocPC, nodes); }
public void run() { String[] cmdarray = { getGvExe(), getPDFFile() }; try { Process p = Runtime.getRuntime().exec(cmdarray); setProcess(p); } catch (IOException e) { e.printStackTrace(); exception = new WalaException("gv invocation failed for\n" + Arrays.toString(cmdarray)); } }
public void run() { String[] cmdarray = { getGvExe(), getPDFFile() }; try { Process p = Runtime.getRuntime().exec(cmdarray); setProcess(p); } catch (IOException e) { e.printStackTrace(); exception = new WalaException("gv invocation failed for\n" + Arrays.toString(cmdarray)); } }
public static Properties loadProperties() throws WalaException { try { Properties result = loadPropertiesFromFile(WalaProperties.class.getClassLoader(), PROPERTY_FILENAME); String outputDir = result.getProperty(OUTPUT_DIR, DefaultPropertiesValues.DEFAULT_OUTPUT_DIR); result.setProperty(OUTPUT_DIR, convertToAbsolute(outputDir)); String walaReport = result.getProperty(WALA_REPORT, DefaultPropertiesValues.DEFAULT_WALA_REPORT_FILENAME); result.setProperty(WALA_REPORT, convertToAbsolute(walaReport)); return result; } catch (Exception e) { // e.printStackTrace(); throw new WalaException("Unable to set up wala properties ", e); } }
@Override public boolean mayEscape(MethodReference allocMethod, int allocPC, MethodReference m) throws WalaException { if (allocMethod == null) { throw new IllegalArgumentException("null allocMethod"); } // nodes:= set of call graph nodes representing method m Set nodes = cg.getNodes(m); if (nodes.size() == 0) { throw new WalaException("could not find call graph node for method " + m); } // allocN := set of call graph nodes representing method allocMethod Set<CGNode> allocN = cg.getNodes(allocMethod); if (allocN.size() == 0) { throw new WalaException("could not find call graph node for allocation method " + allocMethod); } return mayEscape(allocN, allocPC, nodes); }
public static Properties loadProperties() throws WalaException { try { Properties result = loadPropertiesFromFile(WalaProperties.class.getClassLoader(), PROPERTY_FILENAME); String outputDir = result.getProperty(OUTPUT_DIR, DefaultPropertiesValues.DEFAULT_OUTPUT_DIR); result.setProperty(OUTPUT_DIR, convertToAbsolute(outputDir)); String walaReport = result.getProperty(WALA_REPORT, DefaultPropertiesValues.DEFAULT_WALA_REPORT_FILENAME); result.setProperty(WALA_REPORT, convertToAbsolute(walaReport)); return result; } catch (Exception e) { // e.printStackTrace(); throw new WalaException("Unable to set up wala properties ", e); } }
public static void checkForFrontEndErrors(IClassHierarchy cha) throws WalaException { StringBuilder message = null; for(IClassLoader loader : cha.getLoaders()) { if (loader instanceof CAstAbstractLoader) { Iterator<ModuleEntry> errors = ((CAstAbstractLoader)loader).getModulesWithParseErrors(); if (errors.hasNext()) { if (message == null) { message = new StringBuilder("front end errors:\n"); } while (errors.hasNext()) { ModuleEntry errorModule = errors.next(); for(Warning w : (((CAstAbstractLoader)loader).getMessages(errorModule))) { message.append("error in ").append(errorModule.getName()).append(":\n"); message.append(w.toString()).append('\n'); } } } // clear out the errors to free some memory ((CAstAbstractLoader)loader).clearMessages(); } } if (message != null) { message.append("end of front end errors\n"); throw new WalaException(String.valueOf(message)); } }
/** * @param n a call graph node * @param allocPC a bytecode index corresponding to an allocation * @return the NewSiteReference for the allocation */ static NewSiteReference findAlloc(CGNode n, int allocPC) throws WalaException { if (n == null) { throw new IllegalArgumentException("null n"); } for (NewSiteReference site : Iterator2Iterable.make(n.iterateNewSites())) { if (site.getProgramCounter() == allocPC) { return site; } } throw new WalaException("Failed to find an allocation at pc " + allocPC + " in node " + n); }
public static void checkForFrontEndErrors(IClassHierarchy cha) throws WalaException { StringBuilder message = null; for(IClassLoader loader : cha.getLoaders()) { if (loader instanceof CAstAbstractLoader) { Iterator<ModuleEntry> errors = ((CAstAbstractLoader)loader).getModulesWithParseErrors(); if (errors.hasNext()) { if (message == null) { message = new StringBuilder("front end errors:\n"); } while (errors.hasNext()) { ModuleEntry errorModule = errors.next(); for(Warning w : (((CAstAbstractLoader)loader).getMessages(errorModule))) { message.append("error in ").append(errorModule.getName()).append(":\n"); message.append(w.toString()).append('\n'); } } } // clear out the errors to free some memory ((CAstAbstractLoader)loader).clearMessages(); } } if (message != null) { message.append("end of front end errors\n"); throw new WalaException(String.valueOf(message)); } }
/** * @param n a call graph node * @param allocPC a bytecode index corresponding to an allocation * @return the NewSiteReference for the allocation */ static NewSiteReference findAlloc(CGNode n, int allocPC) throws WalaException { if (n == null) { throw new IllegalArgumentException("null n"); } for (NewSiteReference site : Iterator2Iterable.make(n.iterateNewSites())) { if (site.getProgramCounter() == allocPC) { return site; } } throw new WalaException("Failed to find an allocation at pc " + allocPC + " in node " + n); }
/** * Launch a process to view a PDF file */ public static Process launchPDFView(String pdfFile, String gvExe) throws WalaException { // set up a viewer for the ps file. if (gvExe == null) { throw new IllegalArgumentException("null gvExe"); } if (pdfFile == null) { throw new IllegalArgumentException("null psFile"); } final PDFViewLauncher gv = new PDFViewLauncher(); gv.setGvExe(gvExe); gv.setPDFFile(pdfFile); gv.run(); if (gv.getProcess() == null) { throw new WalaException(" problem spawning process "); } return gv.getProcess(); }
/** * Launch a process to view a PDF file */ public static Process launchPDFView(String pdfFile, String gvExe) throws WalaException { // set up a viewer for the ps file. if (gvExe == null) { throw new IllegalArgumentException("null gvExe"); } if (pdfFile == null) { throw new IllegalArgumentException("null psFile"); } final PDFViewLauncher gv = new PDFViewLauncher(); gv.setGvExe(gvExe); gv.setPDFFile(pdfFile); gv.run(); if (gv.getProcess() == null) { throw new WalaException(" problem spawning process "); } return gv.getProcess(); }
InstanceKey ik = hg.getHeapModel().getInstanceKeyForAllocation(n, site); if (ik == null) { throw new WalaException("could not get instance key at site " + site + " in " + n);
InstanceKey ik = hg.getHeapModel().getInstanceKeyForAllocation(n, site); if (ik == null) { throw new WalaException("could not get instance key at site " + site + " in " + n);