|
|
@ -29,7 +29,7 @@ public class BytecodeSourceMapper { |
|
|
|
private final Map<String, Map<String, Map<Integer, Integer>>> mapping = new LinkedHashMap<String, Map<String, Map<Integer, Integer>>>(); |
|
|
|
private final Map<String, Map<String, Map<Integer, Integer>>> mapping = new LinkedHashMap<String, Map<String, Map<Integer, Integer>>>(); |
|
|
|
|
|
|
|
|
|
|
|
// original line to decompiled line
|
|
|
|
// original line to decompiled line
|
|
|
|
private final Map<Integer, Integer> linesMapping = new LinkedHashMap<Integer, Integer>(); |
|
|
|
private final Map<Integer, Integer> linesMapping = new HashMap<Integer, Integer>(); |
|
|
|
|
|
|
|
|
|
|
|
public void addMapping(String className, String methodName, int bytecodeOffset, int sourceLine) { |
|
|
|
public void addMapping(String className, String methodName, int bytecodeOffset, int sourceLine) { |
|
|
|
Map<String, Map<Integer, Integer>> class_mapping = mapping.get(className); |
|
|
|
Map<String, Map<Integer, Integer>> class_mapping = mapping.get(className); |
|
|
@ -56,6 +56,10 @@ public class BytecodeSourceMapper { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void dumpMapping(TextBuffer buffer, boolean offsetsToHex) { |
|
|
|
public void dumpMapping(TextBuffer buffer, boolean offsetsToHex) { |
|
|
|
|
|
|
|
if (mapping.isEmpty() && linesMapping.isEmpty()) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String lineSeparator = DecompilerContext.getNewLineSeparator(); |
|
|
|
String lineSeparator = DecompilerContext.getNewLineSeparator(); |
|
|
|
|
|
|
|
|
|
|
|
for (Entry<String, Map<String, Map<Integer, Integer>>> class_entry : mapping.entrySet()) { |
|
|
|
for (Entry<String, Map<String, Map<Integer, Integer>>> class_entry : mapping.entrySet()) { |
|
|
@ -91,9 +95,9 @@ public class BytecodeSourceMapper { |
|
|
|
|
|
|
|
|
|
|
|
// lines mapping
|
|
|
|
// lines mapping
|
|
|
|
buffer.append("Lines mapping:").appendLineSeparator(); |
|
|
|
buffer.append("Lines mapping:").appendLineSeparator(); |
|
|
|
int[] mapping = getOriginalLinesMapping(); |
|
|
|
Map<Integer, Integer> sorted = new TreeMap<Integer, Integer>(linesMapping); |
|
|
|
for (int i = 0; i < mapping.length; i += 2) { |
|
|
|
for (Entry<Integer, Integer> entry : sorted.entrySet()) { |
|
|
|
buffer.append(mapping[i]).append(" <-> ").append(mapping[i + 1]).appendLineSeparator(); |
|
|
|
buffer.append(entry.getKey()).append(" <-> ").append(entry.getValue()).appendLineSeparator(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|