use of jadx.api.plugins.input.data.IDebugInfo in project jadx by skylot.
the class Smali method formatMthParamInfo.
private boolean formatMthParamInfo(IMethodData mth, SmaliWriter smali, ICodeReader codeReader, LineInfo line) {
List<String> types = mth.getMethodRef().getArgTypes();
if (types.isEmpty()) {
return false;
}
int paramCount = 0;
int paramStart = 0;
int regNum = line.smaliMthNode.getParamRegStart();
if (!hasStaticFlag(mth.getAccessFlags())) {
line.addRegName(regNum, "p0");
line.smaliMthNode.setParamReg(regNum, "p0");
regNum += 1;
paramStart = 1;
}
IDebugInfo dbgInfo = codeReader.getDebugInfo();
if (dbgInfo != null) {
for (ILocalVar var : dbgInfo.getLocalVars()) {
if (var.getStartOffset() == -1) {
int i = writeParamInfo(smali, line, regNum, paramStart, var.getName(), var.getType());
regNum += i;
paramStart += i;
paramCount++;
}
}
}
for (; paramCount < types.size(); paramCount++) {
int i = writeParamInfo(smali, line, regNum, paramStart, "", types.get(paramCount));
regNum += i;
paramStart += i;
}
return true;
}
use of jadx.api.plugins.input.data.IDebugInfo in project jadx by skylot.
the class JavaCodeReader method getDebugInfo.
@Override
@Nullable
public IDebugInfo getDebugInfo() {
int maxStack = readMaxStack();
reader.skip(2);
reader.skip(reader.readU4());
reader.skip(reader.readU2() * 8);
JavaAttrStorage attrs = clsData.getAttributesReader().load(reader);
LineNumberTableAttr linesAttr = attrs.get(JavaAttrType.LINE_NUMBER_TABLE);
LocalVarsAttr varsAttr = attrs.get(JavaAttrType.LOCAL_VAR_TABLE);
if (linesAttr == null && varsAttr == null) {
return null;
}
Map<Integer, Integer> linesMap = linesAttr != null ? linesAttr.getLineMap() : Collections.emptyMap();
List<ILocalVar> vars;
if (varsAttr == null) {
vars = Collections.emptyList();
} else {
List<JavaLocalVar> javaVars = varsAttr.getVars();
LocalVarTypesAttr typedVars = attrs.get(JavaAttrType.LOCAL_VAR_TYPE_TABLE);
if (typedVars != null && !typedVars.getVars().isEmpty()) {
// merge signature from typedVars into javaVars
Map<JavaLocalVar, JavaLocalVar> varsMap = new HashMap<>(javaVars.size());
javaVars.forEach(v -> varsMap.put(v, v));
for (JavaLocalVar typedVar : typedVars.getVars()) {
JavaLocalVar jv = varsMap.get(typedVar);
if (jv != null) {
jv.setSignature(typedVar.getSignature());
}
}
}
javaVars.forEach(v -> v.shiftRegNum(maxStack));
vars = Collections.unmodifiableList(javaVars);
}
return new DebugInfo(linesMap, vars);
}
Aggregations