Fixed Debugger - getting children of top level variables

This commit is contained in:
Jindra Petřík
2023-12-30 20:08:41 +01:00
parent 9df764e9ea
commit a6f2784e28
3 changed files with 18 additions and 24 deletions

View File

@@ -2,6 +2,8 @@
All notable changes to this project will be documented in this file.
## [Unreleased]
### Fixed
- Debugger - getting children of top level variables
## [20.1.0] - 2023-12-30
### Added

View File

@@ -164,8 +164,8 @@ public class DebugPanel extends JPanel {
public DebugPanel() {
super(new BorderLayout());
debugRegistersTable = new MyTreeTable(new ABCPanel.VariablesTableModel(debugRegistersTable, new ArrayList<>(), new ArrayList<>()), false);
debugLocalsTable = new MyTreeTable(new ABCPanel.VariablesTableModel(debugLocalsTable, new ArrayList<>(), new ArrayList<>()), false);
debugRegistersTable = new MyTreeTable(new ABCPanel.VariablesTableModel(debugRegistersTable, new ArrayList<>()), false);
debugLocalsTable = new MyTreeTable(new ABCPanel.VariablesTableModel(debugLocalsTable, new ArrayList<>()), false);
MouseAdapter watchHandler = new MouseAdapter() {
@@ -372,7 +372,7 @@ public class DebugPanel extends JPanel {
debugLocalsTable.addMouseListener(watchHandler);
//debugScopeTable.addMouseListener(watchHandler);
debugScopeTable = new MyTreeTable(new ABCPanel.VariablesTableModel(debugScopeTable, new ArrayList<>(), new ArrayList<>()), false);
debugScopeTable = new MyTreeTable(new ABCPanel.VariablesTableModel(debugScopeTable, new ArrayList<>()), false);
constantPoolTable = new JTable();
traceLogTextarea = new JTextArea();
@@ -516,11 +516,7 @@ public class DebugPanel extends JPanel {
if (!as3) {
root = Main.getDebugHandler().getVariable(0, "_root", false, false).parent;
}
List<Long> regVarIds = new ArrayList<>();
for (int i = 0; i < f.registers.size(); i++) {
regVarIds.add(0L);
}
safeSetTreeModel(debugRegistersTable, new ABCPanel.VariablesTableModel(debugRegistersTable, f.registers, regVarIds));
safeSetTreeModel(debugRegistersTable, new ABCPanel.VariablesTableModel(debugRegistersTable, f.registers));
List<Variable> locals = new ArrayList<>();
if (root != null) {
locals.add(root);
@@ -528,13 +524,9 @@ public class DebugPanel extends JPanel {
locals.addAll(f.arguments);
locals.addAll(f.variables);
List<Long> localIds = new ArrayList<>();
localIds.addAll(f.argumentFrameIds);
localIds.addAll(f.frameIds);
localsTable = new ABCPanel.VariablesTableModel(debugLocalsTable, locals, localIds);
localsTable = new ABCPanel.VariablesTableModel(debugLocalsTable, locals);
safeSetTreeModel(debugLocalsTable, localsTable);
safeSetTreeModel(debugScopeTable, new ABCPanel.VariablesTableModel(debugScopeTable, f.scopeChain, f.scopeChainFrameIds));
safeSetTreeModel(debugScopeTable, new ABCPanel.VariablesTableModel(debugScopeTable, f.scopeChain));
/*TableModelListener refreshListener = new TableModelListener() {
@Override
@@ -571,9 +563,9 @@ public class DebugPanel extends JPanel {
debugLocalsTable.getTreeTableModel().addTreeModelListener(refreshListener);
debugScopeTable.getTreeTableModel().addTreeModelListener(refreshListener);
} else {
debugRegistersTable.setTreeModel(new ABCPanel.VariablesTableModel(debugRegistersTable, new ArrayList<>(), new ArrayList<>()));
debugLocalsTable.setTreeModel(new ABCPanel.VariablesTableModel(debugLocalsTable, new ArrayList<>(), new ArrayList<>()));
debugScopeTable.setTreeModel(new ABCPanel.VariablesTableModel(debugScopeTable, new ArrayList<>(), new ArrayList<>()));
debugRegistersTable.setTreeModel(new ABCPanel.VariablesTableModel(debugRegistersTable, new ArrayList<>()));
debugLocalsTable.setTreeModel(new ABCPanel.VariablesTableModel(debugLocalsTable, new ArrayList<>()));
debugScopeTable.setTreeModel(new ABCPanel.VariablesTableModel(debugScopeTable, new ArrayList<>()));
}
InConstantPool cpool = Main.getDebugHandler().getConstantPool();
if (cpool != null) {

View File

@@ -360,15 +360,15 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
}
InGetVariable igv;
//Long objectId = varToObjectId(var);
Long objectId = varToObjectId(var);
boolean useGetter = (var.flags & VariableFlags.IS_CONST) == 0;
/*if (objectId != 0) {
if (parentObjectId == 0 && objectId != 0L) {
igv = Main.getDebugHandler().getVariable(objectId, "", true, useGetter);
} else {*/
igv = Main.getDebugHandler().getVariable(parentObjectId, var.name, true, useGetter);
//}
} else {
igv = Main.getDebugHandler().getVariable(parentObjectId, var.name, true, useGetter);
}
//current var is getter function - set it to value really got
if ((var.flags & VariableFlags.HAS_GETTER) > 0) {
@@ -467,13 +467,13 @@ public class ABCPanel extends JPanel implements ItemListener, SearchListener<Scr
private final MyTreeTable ttable;
public VariablesTableModel(MyTreeTable ttable, List<Variable> vars, List<Long> parentIds) {
public VariablesTableModel(MyTreeTable ttable, List<Variable> vars) {
this.ttable = ttable;
List<VariableNode> childs = new ArrayList<>();
for (int i = 0; i < vars.size(); i++) {
childs.add(new VariableNode(new ArrayList<>(), 1, vars.get(i), 0L/*parentIds.get(i)*/, null));
childs.add(new VariableNode(new ArrayList<>(), 1, vars.get(i), 0L, null));
}
root = new VariableNode(new ArrayList<>(), 0, null, 0L, null, childs);
}