diff --git a/src/org/ntlab/traceDebugger/analyzerProvider/Alias.java b/src/org/ntlab/traceDebugger/analyzerProvider/Alias.java index 15b487c..0ff8e1a 100644 --- a/src/org/ntlab/traceDebugger/analyzerProvider/Alias.java +++ b/src/org/ntlab/traceDebugger/analyzerProvider/Alias.java @@ -2,13 +2,17 @@ import org.ntlab.traceAnalysisPlatform.tracer.trace.ArrayAccess; import org.ntlab.traceAnalysisPlatform.tracer.trace.ArrayCreate; -import org.ntlab.traceAnalysisPlatform.tracer.trace.BlockEnter; import org.ntlab.traceAnalysisPlatform.tracer.trace.FieldAccess; import org.ntlab.traceAnalysisPlatform.tracer.trace.MethodExecution; import org.ntlab.traceAnalysisPlatform.tracer.trace.MethodInvocation; import org.ntlab.traceAnalysisPlatform.tracer.trace.Statement; import org.ntlab.traceAnalysisPlatform.tracer.trace.TracePoint; - + +/** + * �I�u�W�F�N�g�̎Q�Ə��(�G�C���A�X)��\���N���X + * @author Isitani + * + */ public class Alias { private String objectId; private TracePoint occurrencePoint; // ���Y�I�u�W�F�N�g�̎Q�Ƃ��s���Ă�����s�ӏ��ɑΉ�����TracePoint @@ -28,7 +32,7 @@ ARRAY_ELEMENT, ARRAY, ARRAY_CREATE, - + // ���\�b�h����̏o�� ACTUAL_ARGUMENT, RECEIVER, @@ -63,12 +67,19 @@ } public String getMethodSignature() { - return occurrencePoint.getMethodExecution().getCallerSideSignature(); + String signature = occurrencePoint.getMethodExecution().getCallerSideSignature(); + if (signature != null) return signature; + return occurrencePoint.getMethodExecution().getSignature(); +// return occurrencePoint.getMethodExecution().getCallerSideSignature(); } public int getLineNo() { - Statement statement = occurrencePoint.getStatement(); - return statement.getLineNo(); + try { + Statement statement = occurrencePoint.getStatement(); + return statement.getLineNo(); + } catch (Exception e) { + return -1; + } } public void setIndex(int index) { diff --git a/src/org/ntlab/traceDebugger/analyzerProvider/DeltaExtractor.java b/src/org/ntlab/traceDebugger/analyzerProvider/DeltaExtractor.java index 79fed07..2d4a1e6 100644 --- a/src/org/ntlab/traceDebugger/analyzerProvider/DeltaExtractor.java +++ b/src/org/ntlab/traceDebugger/analyzerProvider/DeltaExtractor.java @@ -11,7 +11,7 @@ import org.ntlab.traceAnalysisPlatform.tracer.trace.Statement; import org.ntlab.traceAnalysisPlatform.tracer.trace.Trace; import org.ntlab.traceAnalysisPlatform.tracer.trace.TracePoint; - + /** * �f���^���o�A���S���Y��(�z��ւ̃A�N�Z�X�𐄑�����]���̃o�[�W����) * extract(...)���\�b�h�Q�Œ��o����B @@ -48,7 +48,7 @@ public DeltaExtractor(String traceFile) { trace = new Trace(traceFile); } - + public DeltaExtractor(Trace trace) { this.trace = trace; } @@ -80,7 +80,7 @@ // Reference[] lastRef) throws TraceFileException { // return trace.getLastCallTree(refs, colls, arrys, endLine, lastRef); // } - + /** * �f���^���o�A���S���Y���̌Ăяo�����T�������icalleeSearch�Ƒ��ݍċA�ɂȂ��Ă���j * @param trace�@��͑Ώۃg���[�X @@ -93,7 +93,7 @@ protected MethodExecution callerSearch(Trace trace, TracePoint tracePoint, ArrayList objList, MethodExecution childMethodExecution) { return callerSearch(trace, tracePoint, objList, childMethodExecution, defaultAliasCollector); } - + /** * �f���^���o�A���S���Y���̌Ăяo�����T�������icalleeSearch�Ƒ��ݍċA�ɂȂ��Ă���j * @param trace�@��͑Ώۃg���[�X @@ -155,7 +155,7 @@ removeList.add(thisObjectId); // ��ň�U�AthisObject ����菜�� } } - + // �߂�l�ɒT���Ώۂ��܂܂�Ă����calleeSearch���ċA�Ăяo�� while (tracePoint.stepBackOver()) { Statement statement = tracePoint.getStatement(); @@ -293,7 +293,7 @@ if (methodExecution.isCollectionType()) { objList.add(thisObjectId); } - + // �����̎擾 ArrayList argments = methodExecution.getArguments(); @@ -500,7 +500,7 @@ finalCount = 0; return methodExecution; } - + /** * �f���^���o�A���S���Y���̌Ăяo����T������(�ċA�Ăяo���ɂȂ��Ă���) * @param trace ��͑Ώۃg���[�X @@ -855,7 +855,7 @@ return null; } } - + private ExtractedStructure extractSub(TracePoint creationTracePoint, Reference targetRef, IAliasCollector aliasCollector) { eStructure = new ExtractedStructure(); ArrayList objList = new ArrayList(); @@ -880,7 +880,7 @@ public ExtractedStructure extract(TracePoint tracePoint, ObjectReference argObj) { return extract(tracePoint, argObj, defaultAliasCollector); } - + public ExtractedStructure extract(TracePoint tracePoint, ObjectReference argObj, IAliasCollector aliasCollector) { MethodExecution methodExecution = tracePoint.getMethodExecution(); eStructure = new ExtractedStructure(); @@ -985,7 +985,7 @@ public MethodExecution getCurrentMethodExecution(Thread thread) { return trace.getCurrentMethodExecution(thread); } - + /** * methodSignature �ɑO����v���郁�\�b�h�������ƒ��\�b�h�̍Ō�̎��s * @param methodSignature ���\�b�h��(�O����v�Ō�������) @@ -994,7 +994,7 @@ public MethodExecution getLastMethodExecution(String methodSignature) { return trace.getLastMethodExecution(methodSignature); } - + /** * methodSignature �ɑO����v���郁�\�b�h�������ƒ��\�b�h�� before �ȑO�̍Ō�̎��s * @param methodSignature ���\�b�h��(�O����v�Ō�������) @@ -1004,7 +1004,7 @@ public MethodExecution getLastMethodExecution(String methodSignature, TracePoint before) { return trace.getLastMethodExecution(methodSignature, before); } - + public ArrayList getMethodExecutions(String methodSignature) { return trace.getMethodExecutions(methodSignature); } diff --git a/src/org/ntlab/traceDebugger/analyzerProvider/DeltaExtractorJSON.java b/src/org/ntlab/traceDebugger/analyzerProvider/DeltaExtractorJSON.java index 53020a1..b61e63f 100644 --- a/src/org/ntlab/traceDebugger/analyzerProvider/DeltaExtractorJSON.java +++ b/src/org/ntlab/traceDebugger/analyzerProvider/DeltaExtractorJSON.java @@ -16,8 +16,7 @@ import org.ntlab.traceAnalysisPlatform.tracer.trace.Trace; import org.ntlab.traceAnalysisPlatform.tracer.trace.TraceJSON; import org.ntlab.traceAnalysisPlatform.tracer.trace.TracePoint; - - + /** * �f���^���o�A���S���Y��(�z��ւ̃A�N�Z�X�����m�ł���Javassist��JSON�g���[�X�ɑΉ����A�A���S���Y����P����) * @@ -28,7 +27,7 @@ public DeltaExtractorJSON(String traceFile) { super(new TraceJSON(traceFile)); } - + public DeltaExtractorJSON(TraceJSON trace) { super(trace); } @@ -104,7 +103,7 @@ removeList.add(thisObjectId); // ��ň�U�AthisObject ����菜�� } } - + // �߂�l�ɒT���Ώۂ��܂܂�Ă����calleeSearch���ċA�Ăяo�� while (tracePoint.stepBackOver()) { Statement statement = tracePoint.getStatement(); @@ -233,7 +232,7 @@ if (methodExecution.isCollectionType()) { objList.add(thisObjectId); } - + // �����̎擾 ArrayList arguments = methodExecution.getArguments(); @@ -367,7 +366,7 @@ finalCount = 0; return methodExecution; } - + /** * �f���^���o�A���S���Y���̌Ăяo����T������(�ċA�Ăяo���ɂȂ��Ă���) * @param trace ��͑Ώۃg���[�X @@ -389,7 +388,7 @@ ((DeltaAugmentationInfo)methodExecution.getAugmentation()).setSetterSide(false); // ��{�I��getter�Ăяo���̂͂������A���� ArrayList arguments = methodExecution.getArguments(); ObjectReference trackingObj = null; - + aliasCollector.addAlias(new Alias(Alias.AliasType.RETURN_VALUE, 0, objectId, tracePoint.duplicate())); //static���o�R�����null�������Ă��鎞������ if (objectId != null) { @@ -489,6 +488,9 @@ dstObject = thisObj; trackingObj = dstObject; } + aliasCollector.addAlias(new Alias(Alias.AliasType.ARRAY_CREATE, 0, ac.getArrayObjectId(), tracePoint.duplicate())); + aliasCollector.changeTrackingObject(ac.getArrayObjectId(), thisObjectId); + aliasCollector.addAlias(new Alias(Alias.AliasType.THIS, 0, thisObjectId, tracePoint.duplicate())); if (Trace.isNull(thisObjectId)) objectId = null; // static�ϐ��̏ꍇ else objectId = thisObjectId; objList.set(index, objectId); @@ -502,8 +504,12 @@ ((DeltaAugmentationInfo)childMethodExecution.getAugmentation()).setTraceObjectId(Integer.parseInt(objectId)); TracePoint childTracePoint = tracePoint.duplicate(); childTracePoint.stepBackNoReturn(); - aliasCollector.addAlias(new Alias(Alias.AliasType.METHOD_INVOCATION, 0, ret.getId(), tracePoint.duplicate())); - calleeSearch(trace, childTracePoint, objList, childMethodExecution.isStatic(), index, aliasCollector); // �Ăяo���������ɒT�� + if (!childMethodExecution.isConstructor()) { + aliasCollector.addAlias(new Alias(Alias.AliasType.METHOD_INVOCATION, 0, ret.getId(), tracePoint.duplicate())); + calleeSearch(trace, childTracePoint, objList, childMethodExecution.isStatic(), index, aliasCollector); // �Ăяo���������ɒT�� + } else { + aliasCollector.addAlias(new Alias(Alias.AliasType.CONSTRACTOR_INVOCATION, 0, ret.getId(), tracePoint.duplicate())); + } if (childMethodExecution.isConstructor()) { // �R���X�g���N�^�Ăяo���������ꍇ if (objectId.equals(srcObject.getId())) { @@ -512,12 +518,16 @@ eStructure.addSrcSide(r); srcObject = thisObj; trackingObj = srcObject; + aliasCollector.changeTrackingObject(objectId, thisObjectId); + aliasCollector.addAlias(new Alias(Alias.AliasType.THIS, 0, thisObjectId, tracePoint.duplicate())); } else if (objectId.equals(dstObject.getId())) { r = new Reference(thisObj, dstObject); r.setCreation(true); eStructure.addDstSide(r); dstObject = thisObj; trackingObj = dstObject; + aliasCollector.changeTrackingObject(objectId, thisObjectId); + aliasCollector.addAlias(new Alias(Alias.AliasType.THIS, 0, thisObjectId, tracePoint.duplicate())); } if (Trace.isNull(thisObjectId)) objectId = null; // static�ϐ��̏ꍇ else objectId = thisObjectId; @@ -567,11 +577,15 @@ r.setCollection(true); eStructure.addSrcSide(r); srcObject = thisObj; + aliasCollector.changeTrackingObject(objectId, thisObjectId); + aliasCollector.addAlias(new Alias(Alias.AliasType.THIS, 0, thisObjectId, tracePoint.duplicate())); } else if(objectId.equals(dstObject.getId())) { r = new Reference(thisObj, dstObject); r.setCollection(true); eStructure.addDstSide(r); dstObject =thisObj; + aliasCollector.changeTrackingObject(objectId, thisObjectId); + aliasCollector.addAlias(new Alias(Alias.AliasType.THIS, 0, thisObjectId, tracePoint.duplicate())); } } objList.set(index, methodExecution.getThisObjId()); diff --git a/src/org/ntlab/traceDebugger/analyzerProvider/DeltaRelatedAliasCollector.java b/src/org/ntlab/traceDebugger/analyzerProvider/DeltaRelatedAliasCollector.java index ebb8c1f..f904085 100644 --- a/src/org/ntlab/traceDebugger/analyzerProvider/DeltaRelatedAliasCollector.java +++ b/src/org/ntlab/traceDebugger/analyzerProvider/DeltaRelatedAliasCollector.java @@ -20,6 +20,7 @@ @Override public void addAlias(Alias alias) { relatedAliases.add(alias); + if (alias == null) return; String objId = alias.getObjectId(); String srcOrDst = ""; if (srcSideIdList.contains(objId) && !(dstSideIdList.contains(objId))) {