Program: 149945
Project: 149945
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.sysWrite("String_Node_Str");
  while (VM_Magic.getCallerFramePointer(fp).NE(STACKFRAME_SENTINEL_FP)) {
    if (!MM_Interface.addressInVM(ip)) {
      VM.sysWrite("String_Node_Str");
      ip=VM_Magic.getReturnAddress(fp);
      fp=VM_Magic.getCallerFramePointer(fp);
      continue;
    }
    int compiledMethodId=VM_Magic.getCompiledMethodID(fp);
    if (compiledMethodId == INVISIBLE_METHOD_ID) {
      VM.sysWrite("String_Node_Str");
    }
 else {
      VM_CompiledMethod compiledMethod=VM_CompiledMethods.getCompiledMethod(compiledMethodId);
      if (compiledMethod == null) {
        VM.sysWrite("String_Node_Str",compiledMethodId,"String_Node_Str");
      }
 else       if (compiledMethod.getCompilerType() == VM_CompiledMethod.TRAP) {
        VM.sysWrite("String_Node_Str");
      }
 else {
        VM_Method method=compiledMethod.getMethod();
        Offset instructionOffset=compiledMethod.getInstructionOffset(ip);
        int lineNumber=compiledMethod.findLineNumberForInstruction(instructionOffset);
        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);
              if (iei > 0)               bci=VM_OptEncodedCallSiteTree.getByteCodeOffset(iei,inlineEncoding);
            }
          }
 else {
            showMethod(method,lineNumber);
          }
          ip=VM_Magic.getReturnAddress(fp);
          fp=VM_Magic.getCallerFramePointer(fp);
          continue;
        }
        showMethod(method,lineNumber);
      }
    }
    ip=VM_Magic.getReturnAddress(fp);
    fp=VM_Magic.getCallerFramePointer(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.sysWrite("String_Node_Str");
  while (VM_Magic.getCallerFramePointer(fp).NE(STACKFRAME_SENTINEL_FP)) {
    if (!MM_Interface.addressInVM(ip)) {
      showMethod("String_Node_Str",fp);
      ip=VM_Magic.getReturnAddress(fp);
      fp=VM_Magic.getCallerFramePointer(fp);
      continue;
    }
    int compiledMethodId=VM_Magic.getCompiledMethodID(fp);
    if (compiledMethodId == 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);
        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);
            }
          }
 else {
            showMethod(method,lineNumber,fp);
          }
          ip=VM_Magic.getReturnAddress(fp);
          fp=VM_Magic.getCallerFramePointer(fp);
          continue;
        }
        showMethod(method,lineNumber,fp);
      }
    }
    ip=VM_Magic.getReturnAddress(fp);
    fp=VM_Magic.getCallerFramePointer(fp);
  }
  --inDumpStack;
}