Search in sources :

Example 1 with RuntimeField

use of jadx.gui.device.debugger.SmaliDebugger.RuntimeField 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);
    }
}
Also used : ClassNode(jadx.core.dex.nodes.ClassNode) FieldNode(jadx.core.dex.nodes.FieldNode) SmaliDebuggerException(jadx.gui.device.debugger.SmaliDebugger.SmaliDebuggerException) RuntimeField(jadx.gui.device.debugger.SmaliDebugger.RuntimeField) ArrayList(java.util.ArrayList)

Example 2 with RuntimeField

use of jadx.gui.device.debugger.SmaliDebugger.RuntimeField in project jadx by skylot.

the class DebugController method updateAllFieldValues.

private void updateAllFieldValues(long thisID, FrameNode frame) {
    List<FieldTreeNode> nodes = frame.getFieldNodes();
    if (nodes.size() > 0) {
        List<FieldTreeNode> flds = new ArrayList<>(nodes.size());
        List<RuntimeField> rts = new ArrayList<>(nodes.size());
        nodes.forEach(n -> {
            RuntimeField f = n.getRuntimeField();
            if (f.isBelongToThis()) {
                flds.add(n);
                rts.add(f);
            }
        });
        try {
            debugger.getAllFieldValuesSync(thisID, rts);
            flds.forEach(n -> decodeRuntimeValue(n));
            debuggerPanel.refreshThisFieldTree();
        } catch (SmaliDebuggerException e) {
            logErr(e);
        }
    }
}
Also used : SmaliDebuggerException(jadx.gui.device.debugger.SmaliDebugger.SmaliDebuggerException) RuntimeField(jadx.gui.device.debugger.SmaliDebugger.RuntimeField) ArrayList(java.util.ArrayList)

Aggregations

RuntimeField (jadx.gui.device.debugger.SmaliDebugger.RuntimeField)2 SmaliDebuggerException (jadx.gui.device.debugger.SmaliDebugger.SmaliDebuggerException)2 ArrayList (java.util.ArrayList)2 ClassNode (jadx.core.dex.nodes.ClassNode)1 FieldNode (jadx.core.dex.nodes.FieldNode)1