Program: 149911
Project: 149911
Buggy source:
/** 
 * Dump state of a (stopped) thread's stack.
 * @param ip instruction pointer for first frame to dump
 * @param fp frame pointer for first frame to dump
 */
public static void dumpStack(Address ip,Address fp){
  ++inDumpStack;
  if (inDumpStack > 1 && inDumpStack <= VM.maxSystemTroubleRecursionDepth + VM.maxSystemTroubleRecursionDepthBeforeWeStopVMSysWrite) {
    VM.sysWrite("String_Node_Str");
    VM.sysWrite(inDumpStack);
    VM.sysWriteln("String_Node_Str");
  }
  if (inDumpStack > VM.maxSystemTroubleRecursionDepth) {
    VM.dieAbruptlyRecursiveSystemTrouble();
    if (VM.VerifyAssertions)     VM._assert(VM.NOT_REACHED);
  }
  VM.sysWriteln();
  if (fp.LT(Selected.Plan.ploSpace.getStart()) || fp.GT(Selected.Plan.ploSpace.getStart().plus(Selected.Plan.ploSpace.getExtent()))) {
    VM.sysWrite("String_Node_Str",fp);
    VM.sysWriteln("String_Node_Str");
  }
 else {
    try {
      VM.sysWriteln("String_Node_Str");
      while (VM_Magic.getCallerFramePointer(fp).NE(ArchitectureSpecific.VM_StackframeLayoutConstants.STACKFRAME_SENTINEL_FP)) {
        if (!MM_Interface.addressInVM(ip)) {
          showMethod("String_Node_Str",fp);
          ip=VM_Magic.getReturnAddress(fp);
          fp=VM_Magic.getCallerFramePointer(fp);
        }
 else {
          int compiledMethodId=VM_Magic.getCompiledMethodID(fp);
          if (compiledMethodId == ArchitectureSpecific.VM_StackframeLayoutConstants.INVISIBLE_METHOD_ID) {
            showMethod("String_Node_Str",fp);
          }
 else {
            VM_CompiledMethod compiledMethod=VM_CompiledMethods.getCompiledMethod(compiledMethodId);
            if (compiledMethod == null) {
              showMethod(compiledMethodId,fp);
            }
 else             if (compiledMethod.getCompilerType() == VM_CompiledMethod.TRAP) {
              showMethod("String_Node_Str",fp);
            }
 else {
              VM_Method method=compiledMethod.getMethod();
              Offset instructionOffset=compiledMethod.getInstructionOffset(ip);
              int lineNumber=compiledMethod.findLineNumberForInstruction(instructionOffset);
              boolean frameShown=false;
              if (VM.BuildForOptCompiler && compiledMethod.getCompilerType() == VM_CompiledMethod.OPT) {
                VM_OptCompiledMethod optInfo=(VM_OptCompiledMethod)compiledMethod;
                VM_OptMachineCodeMap map=optInfo.getMCMap();
                int iei=map.getInlineEncodingForMCOffset(instructionOffset);
                if (iei >= 0) {
                  int[] inlineEncoding=map.inlineEncoding;
                  int bci=map.getBytecodeIndexForMCOffset(instructionOffset);
                  for (; iei >= 0; iei=VM_OptEncodedCallSiteTree.getParent(iei,inlineEncoding)) {
                    int mid=VM_OptEncodedCallSiteTree.getMethodID(iei,inlineEncoding);
                    method=VM_MemberReference.getMemberRef(mid).asMethodReference().getResolvedMember();
                    lineNumber=((VM_NormalMethod)method).getLineNumberForBCIndex(bci);
                    showMethod(method,lineNumber,fp);
                    if (iei > 0) {
                      bci=VM_OptEncodedCallSiteTree.getByteCodeOffset(iei,inlineEncoding);
                    }
                  }
                  frameShown=true;
                }
              }
              if (!frameShown) {
                showMethod(method,lineNumber,fp);
              }
            }
          }
          ip=VM_Magic.getReturnAddress(fp);
          fp=VM_Magic.getCallerFramePointer(fp);
        }
        if (fp.LT(Selected.Plan.ploSpace.getStart()) || fp.GT(Selected.Plan.ploSpace.getStart().plus(Selected.Plan.ploSpace.getExtent()))) {
          VM.sysWrite("String_Node_Str",fp);
          VM.sysWriteln("String_Node_Str");
          break;
        }
      }
    }
 catch (    Throwable t) {
      VM.sysWriteln("String_Node_Str",fp);
    }
  }
  --inDumpStack;
}

Fixed version (ground truth):
/** 
 * Dump state of a (stopped) thread's stack.
 * @param ip instruction pointer for first frame to dump
 * @param fp frame pointer for first frame to dump
 */
public static void dumpStack(Address ip,Address fp){
  ++inDumpStack;
  if (inDumpStack > 1 && inDumpStack <= VM.maxSystemTroubleRecursionDepth + VM.maxSystemTroubleRecursionDepthBeforeWeStopVMSysWrite) {
    VM.sysWrite("String_Node_Str");
    VM.sysWrite(inDumpStack);
    VM.sysWriteln("String_Node_Str");
  }
  if (inDumpStack > VM.maxSystemTroubleRecursionDepth) {
    VM.dieAbruptlyRecursiveSystemTrouble();
    if (VM.VerifyAssertions)     VM._assert(VM.NOT_REACHED);
  }
  VM.sysWriteln();
  if (!isAddressValidFramePointer(fp)) {
    VM.sysWrite("String_Node_Str",fp);
    VM.sysWriteln("String_Node_Str");
  }
 else {
    try {
      VM.sysWriteln("String_Node_Str");
      while (VM_Magic.getCallerFramePointer(fp).NE(ArchitectureSpecific.VM_StackframeLayoutConstants.STACKFRAME_SENTINEL_FP)) {
        if (!MM_Interface.addressInVM(ip)) {
          showMethod("String_Node_Str",fp);
          ip=VM_Magic.getReturnAddress(fp);
          fp=VM_Magic.getCallerFramePointer(fp);
        }
 else {
          int compiledMethodId=VM_Magic.getCompiledMethodID(fp);
          if (compiledMethodId == ArchitectureSpecific.VM_StackframeLayoutConstants.INVISIBLE_METHOD_ID) {
            showMethod("String_Node_Str",fp);
          }
 else {
            VM_CompiledMethod compiledMethod=VM_CompiledMethods.getCompiledMethod(compiledMethodId);
            if (compiledMethod == null) {
              showMethod(compiledMethodId,fp);
            }
 else             if (compiledMethod.getCompilerType() == VM_CompiledMethod.TRAP) {
              showMethod("String_Node_Str",fp);
            }
 else {
              VM_Method method=compiledMethod.getMethod();
              Offset instructionOffset=compiledMethod.getInstructionOffset(ip);
              int lineNumber=compiledMethod.findLineNumberForInstruction(instructionOffset);
              boolean frameShown=false;
              if (VM.BuildForOptCompiler && compiledMethod.getCompilerType() == VM_CompiledMethod.OPT) {
                VM_OptCompiledMethod optInfo=(VM_OptCompiledMethod)compiledMethod;
                VM_OptMachineCodeMap map=optInfo.getMCMap();
                int iei=map.getInlineEncodingForMCOffset(instructionOffset);
                if (iei >= 0) {
                  int[] inlineEncoding=map.inlineEncoding;
                  int bci=map.getBytecodeIndexForMCOffset(instructionOffset);
                  for (; iei >= 0; iei=VM_OptEncodedCallSiteTree.getParent(iei,inlineEncoding)) {
                    int mid=VM_OptEncodedCallSiteTree.getMethodID(iei,inlineEncoding);
                    method=VM_MemberReference.getMemberRef(mid).asMethodReference().getResolvedMember();
                    lineNumber=((VM_NormalMethod)method).getLineNumberForBCIndex(bci);
                    showMethod(method,lineNumber,fp);
                    if (iei > 0) {
                      bci=VM_OptEncodedCallSiteTree.getByteCodeOffset(iei,inlineEncoding);
                    }
                  }
                  frameShown=true;
                }
              }
              if (!frameShown) {
                showMethod(method,lineNumber,fp);
              }
            }
          }
          ip=VM_Magic.getReturnAddress(fp);
          fp=VM_Magic.getCallerFramePointer(fp);
        }
        if (!isAddressValidFramePointer(fp)) {
          VM.sysWrite("String_Node_Str",fp);
          VM.sysWriteln("String_Node_Str");
          break;
        }
      }
    }
 catch (    Throwable t) {
      VM.sysWriteln("String_Node_Str",fp);
    }
  }
  --inDumpStack;
}