From b9fb5e04814145864bec95ffd8b519e591f4e02c Mon Sep 17 00:00:00 2001 From: Martin Mohr Date: Fri, 9 Dec 2016 16:26:43 +0100 Subject: [PATCH 1/2] display which classes each handler catches when outputting IR --- com.ibm.wala.core/src/com/ibm/wala/ssa/IR.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/com.ibm.wala.core/src/com/ibm/wala/ssa/IR.java b/com.ibm.wala.core/src/com/ibm/wala/ssa/IR.java index da9bbd008..1039e8fdc 100644 --- a/com.ibm.wala.core/src/com/ibm/wala/ssa/IR.java +++ b/com.ibm.wala.core/src/com/ibm/wala/ssa/IR.java @@ -154,7 +154,17 @@ public abstract class IR { int end = bb.getLastInstructionIndex(); result.append("BB").append(bb.getNumber()); if (bb instanceof ExceptionHandlerBasicBlock) { - result.append(""); + + result.append(" ("); + Iterator catchIter = ((ExceptionHandlerBasicBlock) bb).getCaughtExceptionTypes(); + while (catchIter.hasNext()) { + TypeReference next = catchIter.next(); + result.append(next); + if (catchIter.hasNext()) { + result.append(","); + } + } + result.append(")"); } result.append("\n"); for (Iterator it = bb.iteratePhis(); it.hasNext();) { From 9c854a4be6b62c37b60a7148770214824344b168 Mon Sep 17 00:00:00 2001 From: Brian Alliet Date: Tue, 7 Mar 2017 12:00:02 -0500 Subject: [PATCH 2/2] Add int size() and int get(int index) methods to IntStack. Accrue (http://people.seas.harvard.edu/~chong/accrue.html) uses IntStack internally for various things and found these convenient. --- .../com/ibm/wala/util/collections/IntStack.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/com.ibm.wala.util/src/com/ibm/wala/util/collections/IntStack.java b/com.ibm.wala.util/src/com/ibm/wala/util/collections/IntStack.java index 80dc25f5d..176eebac3 100644 --- a/com.ibm.wala.util/src/com/ibm/wala/util/collections/IntStack.java +++ b/com.ibm.wala.util/src/com/ibm/wala/util/collections/IntStack.java @@ -59,4 +59,21 @@ public class IntStack { return top == -1; } + /** + * @return the number of elements in the stack. + */ + public int size() { + return top + 1; + } + + /** + * @return the ith int from the bottom of the stack + */ + public int get(int i) { + if (i < 0 || i > top) { + throw new IndexOutOfBoundsException(); + } + return state[i]; + } + }