diff --git a/src/org/ntlab/traceDebugger/DebuggingController.java b/src/org/ntlab/traceDebugger/DebuggingController.java index 755d204..0d7790b 100644 --- a/src/org/ntlab/traceDebugger/DebuggingController.java +++ b/src/org/ntlab/traceDebugger/DebuggingController.java @@ -285,7 +285,7 @@ refresh(null, debuggingTp, false); return true; } - + public boolean stepOverAction() { if (!isRunning) return false; if (debuggingTp == null) return false; @@ -298,28 +298,13 @@ int currentLineNo = debuggingTp.getStatement().getLineNo(); boolean isReturned = false; - // �X�e�b�v�I�[�o�[��p���ē��B�_�����‚��Ă��� - TracePoint startTp = debuggingTp.duplicate(); while (!(isReturned = !(debuggingTp.stepOver()))) { if (currentLineNo != debuggingTp.getStatement().getLineNo()) break; previousTp = debuggingTp.duplicate(); } - TracePoint goalTp = debuggingTp.duplicate(); - if (!isReturned) { - // �X�e�b�v�t����p���č��x�͌Ăяo����ɂ�����Ȃ���\�ߌ��‚��Ă��������B�_�܂Ői�܂��� (�ϐ������X�V�̂��ߓr���̃A�b�v�f�[�g��S�ďE��) - debuggingTp = startTp; - do { - Statement statement = debuggingTp.getStatement(); - if (statement.equals(goalTp.getStatement())) break; - if (statement instanceof FieldUpdate || statement instanceof ArrayUpdate) { - Variables.getInstance().addDifferentialUpdatePoint(debuggingTp); - } - } while (debuggingTp.stepFull()); - } else { - debuggingTp = goalTp; + if (isReturned) { while (!debuggingTp.stepOver()); // �Ăяo�����ł̎��̃X�e�[�g�����g�܂Ői�߂� } - if (debugExecutionIsTerminated(debuggingTp)) return false; refresh(previousTp, debuggingTp, isReturned, true); return true; @@ -345,7 +330,7 @@ refresh(previousTp, debuggingTp, true); return true; } - + public boolean stepNextAction() { if (!isRunning) return false; if (debuggingTp == null) return false; @@ -355,27 +340,13 @@ } TracePoint previousTp = debuggingTp; debuggingTp = debuggingTp.duplicate(); - TracePoint startTp = debuggingTp.duplicate(); boolean isReturned = !(debuggingTp.stepNext()); - TracePoint goalTp = debuggingTp.duplicate(); - if (!isReturned) { - // �X�e�b�v�t����p���č��x�͌Ăяo����ɂ�����Ȃ���\�ߌ��‚��Ă��������B�_�܂Ői�܂��� (�ϐ������X�V�̂��ߓr���̃A�b�v�f�[�g��S�ďE��) - debuggingTp = startTp; - do { - Statement statement = debuggingTp.getStatement(); - if (statement.equals(goalTp.getStatement())) break; - if (statement instanceof FieldUpdate || statement instanceof ArrayUpdate) { - Variables.getInstance().addDifferentialUpdatePoint(debuggingTp); - } - } while (debuggingTp.stepFull()); - } else { - debuggingTp = startTp; + if (isReturned) { while (!debuggingTp.stepOver()); // �Ăяo�����ł̎��̃X�e�[�g�����g�܂Ői�߂� } - if (debugExecutionIsTerminated(debuggingTp)) return false; refresh(previousTp, debuggingTp, isReturned, true); - return true; + return true; } public boolean resumeAction() { diff --git a/src/org/ntlab/traceDebugger/Variables.java b/src/org/ntlab/traceDebugger/Variables.java index b0e5bbb..b22e95d 100644 --- a/src/org/ntlab/traceDebugger/Variables.java +++ b/src/org/ntlab/traceDebugger/Variables.java @@ -1,8 +1,6 @@ package org.ntlab.traceDebugger; import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; @@ -20,12 +18,12 @@ import org.ntlab.traceAnalysisPlatform.tracer.trace.Statement; import org.ntlab.traceAnalysisPlatform.tracer.trace.TracePoint; import org.ntlab.traceDebugger.Variable.VariableType; +import org.ntlab.traceDebugger.analyzerProvider.VariableUpdatePointFinder; public class Variables { private static final Variables theInstance = new Variables(); private List roots = new ArrayList<>(); private List rootTreeNodes = new ArrayList<>(); - private Map> containerIdToDifferentialUpdateTracePoints = new HashMap<>(); // �ϐ������X�V�ӏ����L�� public static final String VARIABLE_TYPE_KEY = "variableType"; public static Variables getInstance() { @@ -134,25 +132,6 @@ addAdditionalAttributes(child, idSet, additionalAttributes); } } - - public void addDifferentialUpdatePoint(TracePoint tp) { - Statement statement = tp.getStatement(); - String containerId = null; - if (statement instanceof FieldUpdate) { - FieldUpdate fu = (FieldUpdate)statement; - containerId = fu.getContainerObjId(); - } else if (statement instanceof ArrayUpdate) { - ArrayUpdate au = (ArrayUpdate)statement; - containerId = au.getArrayObjectId(); - } - if (containerId == null) return; - List tracePoints = containerIdToDifferentialUpdateTracePoints.get(containerId); - if (tracePoints == null) { - tracePoints = new ArrayList(); - containerIdToDifferentialUpdateTracePoints.put(containerId, tracePoints); - } - tracePoints.add(tp.duplicate()); - } public void updateForDifferential(TracePoint from, TracePoint to, boolean isReturned) { updateForDifferential(to); @@ -162,37 +141,36 @@ private void updateForDifferential(TracePoint before) { for (Variable variable : roots) { - updateForDifferential(variable, new HashSet(), before); + updateForDifferental(variable, before); } - containerIdToDifferentialUpdateTracePoints.clear(); } - - private void updateForDifferential(Variable variable, Set hasCheckedObjectIdSet, TracePoint before) { + + private void updateForDifferental(Variable variable, TracePoint before) { variable.setBeforeTracePoint(before); - Set containerIdList = containerIdToDifferentialUpdateTracePoints.keySet(); - String containerId = variable.getContainerId(); - if (containerIdList.contains(containerId)) { - for (TracePoint tp : containerIdToDifferentialUpdateTracePoints.get(containerId)) { - Statement statement = tp.getStatement(); + String objectId = variable.getContainerId(); + String variableName = variable.getFullyQualifiedVariableName(); + if (variableName.contains("[")) { + // note: �z��̏ꍇ�̓C���f�b�N�X�݂̂����o�� + String arrayIndexName = variable.getVariableName(); + variableName = arrayIndexName.substring(arrayIndexName.indexOf("[") + 1, arrayIndexName.lastIndexOf("]")); + } + + TracePoint lastUpdatePoint = variable.getLastUpdatePoint(); + TracePoint updateTracePoint = VariableUpdatePointFinder.getInstance().getPoint(objectId, variableName, before); + if (updateTracePoint != null) { + Statement statement = updateTracePoint.getStatement(); + if (lastUpdatePoint == null || !(statement.equals(lastUpdatePoint.getStatement()))) { if (statement instanceof FieldUpdate) { FieldUpdate fu = (FieldUpdate)statement; - if (variable.getFullyQualifiedVariableName().equals(fu.getFieldName())) { - updateForDifferentialField(variable, fu.getValueClassName(), fu.getValueObjId(), tp); - } + updateForDifferentialField(variable, fu.getValueClassName(), fu.getValueObjId(), updateTracePoint); } else if (statement instanceof ArrayUpdate) { ArrayUpdate au = (ArrayUpdate)statement; - String fullyQualifiedVariableName = variable.getFullyQualifiedVariableName(); - if (fullyQualifiedVariableName.contains("[" + au.getIndex() + "]")) { - updateForDifferentialField(variable, au.getValueClassName(), au.getValueObjectId(), tp); - } + updateForDifferentialField(variable, au.getValueClassName(), au.getValueObjectId(), updateTracePoint); } } } - HashSet hasCheckedObjectIdSetOnNext = new HashSet<>(hasCheckedObjectIdSet); - hasCheckedObjectIdSetOnNext.add(variable.getContainerId()); for (Variable child : variable.getChildren()) { - if (hasCheckedObjectIdSetOnNext.contains(child.getContainerId())) continue; - updateForDifferential(child, hasCheckedObjectIdSetOnNext, before); + updateForDifferental(child, before); } } @@ -358,7 +336,6 @@ public void resetData() { roots.clear(); rootTreeNodes.clear(); - containerIdToDifferentialUpdateTracePoints.clear(); } private void resetSpecialValues() {