jdk/src/share/classes/com/sun/tools/hat/internal/parser/HprofReader.java
changeset 25522 10d789df41bb
parent 25186 63e1a2ec30f5
equal deleted inserted replaced
25521:80551dd1d902 25522:10d789df41bb
   225                     long classNameID = readID();
   225                     long classNameID = readID();
   226                     Long classIdI = classID;
   226                     Long classIdI = classID;
   227                     String nm = getNameFromID(classNameID).replace('/', '.');
   227                     String nm = getNameFromID(classNameID).replace('/', '.');
   228                     classNameFromObjectID.put(classIdI, nm);
   228                     classNameFromObjectID.put(classIdI, nm);
   229                     if (classNameFromSerialNo != null) {
   229                     if (classNameFromSerialNo != null) {
   230                         classNameFromSerialNo.put(new Integer(serialNo), nm);
   230                         classNameFromSerialNo.put(serialNo, nm);
   231                     }
   231                     }
   232                     break;
   232                     break;
   233                 }
   233                 }
   234 
   234 
   235                 case HPROF_HEAP_DUMP: {
   235                 case HPROF_HEAP_DUMP: {
   295                         long id = readID();
   295                         long id = readID();
   296                         String methodName = getNameFromID(readID());
   296                         String methodName = getNameFromID(readID());
   297                         String methodSig = getNameFromID(readID());
   297                         String methodSig = getNameFromID(readID());
   298                         String sourceFile = getNameFromID(readID());
   298                         String sourceFile = getNameFromID(readID());
   299                         int classSer = in.readInt();
   299                         int classSer = in.readInt();
   300                         String className = classNameFromSerialNo.get(new Integer(classSer));
   300                         String className = classNameFromSerialNo.get(classSer);
   301                         int lineNumber = in.readInt();
   301                         int lineNumber = in.readInt();
   302                         if (lineNumber < StackFrame.LINE_NUMBER_NATIVE) {
   302                         if (lineNumber < StackFrame.LINE_NUMBER_NATIVE) {
   303                             warn("Weird stack frame line number:  " + lineNumber);
   303                             warn("Weird stack frame line number:  " + lineNumber);
   304                             lineNumber = StackFrame.LINE_NUMBER_UNKNOWN;
   304                             lineNumber = StackFrame.LINE_NUMBER_UNKNOWN;
   305                         }
   305                         }
   322                             frames[i] = stackFrames.get(fid);
   322                             frames[i] = stackFrames.get(fid);
   323                             if (frames[i] == null) {
   323                             if (frames[i] == null) {
   324                                 throw new IOException("Stack frame " + toHex(fid) + " not found");
   324                                 throw new IOException("Stack frame " + toHex(fid) + " not found");
   325                             }
   325                             }
   326                         }
   326                         }
   327                         stackTraces.put(new Integer(serialNo),
   327                         stackTraces.put(serialNo,
   328                                         new StackTrace(frames));
   328                                         new StackTrace(frames));
   329                     }
   329                     }
   330                     break;
   330                     break;
   331                 }
   331                 }
   332                 case HPROF_UNLOAD_CLASS:
   332                 case HPROF_UNLOAD_CLASS:
   402                 case HPROF_GC_ROOT_THREAD_OBJ: {
   402                 case HPROF_GC_ROOT_THREAD_OBJ: {
   403                     long id = readID();
   403                     long id = readID();
   404                     int threadSeq = in.readInt();
   404                     int threadSeq = in.readInt();
   405                     int stackSeq = in.readInt();
   405                     int stackSeq = in.readInt();
   406                     bytesLeft -= identifierSize + 8;
   406                     bytesLeft -= identifierSize + 8;
   407                     threadObjects.put(new Integer(threadSeq),
   407                     threadObjects.put(threadSeq,
   408                                       new ThreadObject(id, stackSeq));
   408                                       new ThreadObject(id, stackSeq));
   409                     break;
   409                     break;
   410                 }
   410                 }
   411                 case HPROF_GC_ROOT_JNI_GLOBAL: {
   411                 case HPROF_GC_ROOT_JNI_GLOBAL: {
   412                     long id = readID();
   412                     long id = readID();
   608         }
   608         }
   609     }
   609     }
   610 
   610 
   611     private ThreadObject getThreadObjectFromSequence(int threadSeq)
   611     private ThreadObject getThreadObjectFromSequence(int threadSeq)
   612             throws IOException {
   612             throws IOException {
   613         ThreadObject to = threadObjects.get(new Integer(threadSeq));
   613         ThreadObject to = threadObjects.get(threadSeq);
   614         if (to == null) {
   614         if (to == null) {
   615             throw new IOException("Thread " + threadSeq +
   615             throw new IOException("Thread " + threadSeq +
   616                                   " not found for JNI local ref");
   616                                   " not found for JNI local ref");
   617         }
   617         }
   618         return to;
   618         return to;
   636 
   636 
   637     private StackTrace getStackTraceFromSerial(int ser) throws IOException {
   637     private StackTrace getStackTraceFromSerial(int ser) throws IOException {
   638         if (stackTraces == null) {
   638         if (stackTraces == null) {
   639             return null;
   639             return null;
   640         }
   640         }
   641         StackTrace result = stackTraces.get(new Integer(ser));
   641         StackTrace result = stackTraces.get(ser);
   642         if (result == null) {
   642         if (result == null) {
   643             warn("Stack trace not found for serial # " + ser);
   643             warn("Stack trace not found for serial # " + ser);
   644         }
   644         }
   645         return result;
   645         return result;
   646     }
   646     }