use of jadx.gui.device.debugger.SmaliDebugger.SmaliDebuggerException in project jadx by skylot.
the class DebugController method setDelayBreakpoint.
private void setDelayBreakpoint(FileBreakpoint bp) {
boolean hasSet = bpStore.hasSetDelaied(bp.cls);
bpStore.add(bp, null);
if (!hasSet) {
updateQueue.execute(() -> {
try {
debugger.regClassPrepareEventForBreakpoint(bp.cls, id -> {
List<FileBreakpoint> list = bpStore.get(bp.cls);
for (FileBreakpoint fbp : list) {
setBreakpoint(id, fbp);
}
});
} catch (SmaliDebuggerException e) {
logErr(e);
failBreakpoint(bp, "");
}
});
}
}
use of jadx.gui.device.debugger.SmaliDebugger.SmaliDebuggerException in project jadx by skylot.
the class DebugController method decodeObject.
private boolean decodeObject(RuntimeValueTreeNode valNode) {
RuntimeValue rValue = valNode.getRuntimeValue();
boolean ok = true;
if (debugger.readID(rValue) == 0) {
if (valNode.isAbsoluteType()) {
valNode.updateValue("null");
return ok;
} else if (!art.readNullObject()) {
valNode.updateType(art.typeForNull());
valNode.updateValue("0");
return ok;
}
}
String sig;
try {
sig = debugger.readObjectSignatureSync(rValue);
valNode.updateType(String.format("%s@%d", DbgUtils.classSigToRawFullName(sig), debugger.readID(rValue)));
} catch (SmaliDebuggerException e) {
ok = debugger.errIsInvalidObject(e.getErrCode()) && valNode instanceof RegTreeNode;
if (ok) {
try {
RegTreeNode reg = (RegTreeNode) valNode;
RuntimeRegister rr = debugger.getRegisterSync(cur.frame.getThreadID(), cur.frame.getFrame().getID(), reg.getRuntimeRegNum(), RuntimeType.INT);
reg.updateReg(rr);
rValue = rr;
valNode.updateType(RuntimeType.INT.getDesc());
valNode.updateValue(Long.toString((int) debugger.readAll(rValue)));
} catch (SmaliDebuggerException except) {
logErr(except, String.format("Update %s failed, %s", valNode.getName(), except.getMessage()));
valNode.updateValue(except.getMessage());
ok = false;
}
} else {
logErr(e);
}
}
return ok;
}
use of jadx.gui.device.debugger.SmaliDebugger.SmaliDebuggerException in project jadx by skylot.
the class DebugController method refreshCurFrame.
private void refreshCurFrame(long threadID, long codeOffset) {
try {
Frame frame = debugger.getCurrentFrame(threadID);
cur.frame.setFrame(frame);
cur.frame.updateCodeOffset(codeOffset);
} catch (SmaliDebuggerException e) {
logErr(e);
}
}
use of jadx.gui.device.debugger.SmaliDebugger.SmaliDebuggerException in project jadx by skylot.
the class DebugController method stopAtOnCreate.
private void stopAtOnCreate() {
JClass mainActivity = DbgUtils.searchMainActivity(debuggerPanel.getMainWindow());
if (mainActivity == null) {
debuggerPanel.log("Failed to set breakpoint at onCreate, you have to do it yourself.");
return;
}
lazyQueue.execute(() -> openMainActivityTab(mainActivity));
String clsSig = DbgUtils.getRawFullName(mainActivity);
try {
long id = debugger.getClassID(clsSig, true);
if (id != -1) {
// this app is running, we can't stop at onCreate anymore.
return;
}
debuggerPanel.log(String.format("Breakpoint will set at %s.%s", clsSig, ONCREATE_SIGNATURE));
debugger.regMethodEntryEventSync(clsSig, ONCREATE_SIGNATURE::equals);
} catch (SmaliDebuggerException e) {
logErr(e, String.format("Failed set breakpoint at %s.%s", clsSig, ONCREATE_SIGNATURE));
}
}
use of jadx.gui.device.debugger.SmaliDebugger.SmaliDebuggerException in project jadx by skylot.
the class DebugController method updateAllFields.
private void updateAllFields(FrameNode frame) {
List<FieldNode> fldNodes = Collections.emptyList();
String clsSig = frame.getClsSig();
if (clsSig != null) {
ClassNode clsNode = DbgUtils.getClassNodeBySig(clsSig, debuggerPanel.getMainWindow());
if (clsNode != null) {
fldNodes = clsNode.getFields();
}
}
try {
long thisID = debugger.getThisID(frame.getThreadID(), frame.getFrame().getID());
List<RuntimeField> flds = debugger.getAllFieldsSync(frame.getClsID());
List<FieldTreeNode> nodes = new ArrayList<>(flds.size());
for (RuntimeField fld : flds) {
FieldTreeNode fldNode = new FieldTreeNode(fld, thisID);
fldNodes.stream().filter(f -> f.getName().equals(fldNode.getName())).findFirst().ifPresent(smaliFld -> fldNode.setAlias(smaliFld.getAlias()));
nodes.add(fldNode);
}
debuggerPanel.updateThisFieldNodes(nodes);
frame.setFieldNodes(nodes);
if (thisID > 0 && nodes.size() > 0) {
lazyQueue.execute(() -> updateAllFieldValues(thisID, frame));
}
} catch (SmaliDebuggerException e) {
logErr(e);
}
}
Aggregations