Skip to content

Commit 8a7d540

Browse files
committed
Add system property to include exception basic blocks
1 parent d4a87b1 commit 8a7d540

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ There are command line options that can be used:
7070
| `-a` | Report the ancestry of the entrypoint | `-a` |
7171
| `-o` | The name of the output file | `-o example` |
7272

73+
### System Properties
74+
| Property | Usage | Example |
75+
| --- | --- | --- |
76+
| jcg.includeExceptionBasicBlocks | Set to "true" to included exception basic blocks, otherwise these will be excluded by default | -Djcg.includeExceptionBasicBlocks=true |
77+
78+
7379
## Known Restrictions
7480

7581
* The static call graph generator does not account for methods invoked via reflection.

src/main/java/gr/gousiosg/javacg/stat/MethodVisitor.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,12 @@ private List<LinkedList<InstructionHandle>> computeBasicBlocks(InstructionList i
149149
public Set<Pair<String, String>> start() {
150150
if (mg.isAbstract() || mg.isNative()) return Collections.emptySet();
151151

152+
boolean includeExceptionBasicBlocks = Boolean.getBoolean("jcg.includeExceptionBasicBlocks");
153+
152154
List<LinkedList<InstructionHandle>> bbs = this.computeBasicBlocks(mg.getInstructionList());
153155

154156
for (LinkedList<InstructionHandle> bb : bbs) {
155-
if (bb.getLast().getInstruction() instanceof ATHROW) {
157+
if (!includeExceptionBasicBlocks && bb.getLast().getInstruction() instanceof ATHROW) {
156158
// skip BBs that throw exceptions
157159
continue;
158160
}

0 commit comments

Comments
 (0)