| OLD | NEW | 
|---|
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without | 
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are | 
| 4 // met: | 4 // met: | 
| 5 // | 5 // | 
| 6 //     * Redistributions of source code must retain the above copyright | 6 //     * Redistributions of source code must retain the above copyright | 
| 7 //       notice, this list of conditions and the following disclaimer. | 7 //       notice, this list of conditions and the following disclaimer. | 
| 8 //     * Redistributions in binary form must reproduce the above | 8 //     * Redistributions in binary form must reproduce the above | 
| 9 //       copyright notice, this list of conditions and the following | 9 //       copyright notice, this list of conditions and the following | 
| 10 //       disclaimer in the documentation and/or other materials provided | 10 //       disclaimer in the documentation and/or other materials provided | 
| (...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1244 | 1244 | 
| 1245     // Store the address. | 1245     // Store the address. | 
| 1246     ASSERT((stack_frame.AddrPC.Offset >> 32) == 0);  // 32-bit address. | 1246     ASSERT((stack_frame.AddrPC.Offset >> 32) == 0);  // 32-bit address. | 
| 1247     frames[frames_count].address = | 1247     frames[frames_count].address = | 
| 1248         reinterpret_cast<void*>(stack_frame.AddrPC.Offset); | 1248         reinterpret_cast<void*>(stack_frame.AddrPC.Offset); | 
| 1249 | 1249 | 
| 1250     // Try to locate a symbol for this frame. | 1250     // Try to locate a symbol for this frame. | 
| 1251     DWORD64 symbol_displacement; | 1251     DWORD64 symbol_displacement; | 
| 1252     SmartPointer<IMAGEHLP_SYMBOL64> symbol( | 1252     SmartPointer<IMAGEHLP_SYMBOL64> symbol( | 
| 1253         NewArray<IMAGEHLP_SYMBOL64>(kStackWalkMaxNameLen)); | 1253         NewArray<IMAGEHLP_SYMBOL64>(kStackWalkMaxNameLen)); | 
| 1254     if (!symbol) return kStackWalkError;  // Out of memory. | 1254     if (symbol.is_empty()) return kStackWalkError;  // Out of memory. | 
| 1255     memset(*symbol, 0, sizeof(IMAGEHLP_SYMBOL64) + kStackWalkMaxNameLen); | 1255     memset(*symbol, 0, sizeof(IMAGEHLP_SYMBOL64) + kStackWalkMaxNameLen); | 
| 1256     symbol->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL64); | 1256     (*symbol)->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL64); | 
| 1257     symbol->MaxNameLength = kStackWalkMaxNameLen; | 1257     (*symbol)->MaxNameLength = kStackWalkMaxNameLen; | 
| 1258     ok = _SymGetSymFromAddr64(process_handle,             // hProcess | 1258     ok = _SymGetSymFromAddr64(process_handle,             // hProcess | 
| 1259                               stack_frame.AddrPC.Offset,  // Address | 1259                               stack_frame.AddrPC.Offset,  // Address | 
| 1260                               &symbol_displacement,       // Displacement | 1260                               &symbol_displacement,       // Displacement | 
| 1261                               *symbol);                   // Symbol | 1261                               *symbol);                   // Symbol | 
| 1262     if (ok) { | 1262     if (ok) { | 
| 1263       // Try to locate more source information for the symbol. | 1263       // Try to locate more source information for the symbol. | 
| 1264       IMAGEHLP_LINE64 Line; | 1264       IMAGEHLP_LINE64 Line; | 
| 1265       memset(&Line, 0, sizeof(Line)); | 1265       memset(&Line, 0, sizeof(Line)); | 
| 1266       Line.SizeOfStruct = sizeof(Line); | 1266       Line.SizeOfStruct = sizeof(Line); | 
| 1267       DWORD line_displacement; | 1267       DWORD line_displacement; | 
| 1268       ok = _SymGetLineFromAddr64( | 1268       ok = _SymGetLineFromAddr64( | 
| 1269           process_handle,             // hProcess | 1269           process_handle,             // hProcess | 
| 1270           stack_frame.AddrPC.Offset,  // dwAddr | 1270           stack_frame.AddrPC.Offset,  // dwAddr | 
| 1271           &line_displacement,         // pdwDisplacement | 1271           &line_displacement,         // pdwDisplacement | 
| 1272           &Line);                     // Line | 1272           &Line);                     // Line | 
| 1273       // Format a text representation of the frame based on the information | 1273       // Format a text representation of the frame based on the information | 
| 1274       // available. | 1274       // available. | 
| 1275       if (ok) { | 1275       if (ok) { | 
| 1276         SNPrintF(MutableCStrVector(frames[frames_count].text, | 1276         SNPrintF(MutableCStrVector(frames[frames_count].text, | 
| 1277                                    kStackWalkMaxTextLen), | 1277                                    kStackWalkMaxTextLen), | 
| 1278                  "%s %s:%d:%d", | 1278                  "%s %s:%d:%d", | 
| 1279                  symbol->Name, Line.FileName, Line.LineNumber, | 1279                  (*symbol)->Name, Line.FileName, Line.LineNumber, | 
| 1280                  line_displacement); | 1280                  line_displacement); | 
| 1281       } else { | 1281       } else { | 
| 1282         SNPrintF(MutableCStrVector(frames[frames_count].text, | 1282         SNPrintF(MutableCStrVector(frames[frames_count].text, | 
| 1283                                    kStackWalkMaxTextLen), | 1283                                    kStackWalkMaxTextLen), | 
| 1284                  "%s", | 1284                  "%s", | 
| 1285                  symbol->Name); | 1285                  (*symbol)->Name); | 
| 1286       } | 1286       } | 
| 1287       // Make sure line termination is in place. | 1287       // Make sure line termination is in place. | 
| 1288       frames[frames_count].text[kStackWalkMaxTextLen - 1] = '\0'; | 1288       frames[frames_count].text[kStackWalkMaxTextLen - 1] = '\0'; | 
| 1289     } else { | 1289     } else { | 
| 1290       // No text representation of this frame | 1290       // No text representation of this frame | 
| 1291       frames[frames_count].text[0] = '\0'; | 1291       frames[frames_count].text[0] = '\0'; | 
| 1292 | 1292 | 
| 1293       // Continue if we are just missing a module (for non C/C++ frames a | 1293       // Continue if we are just missing a module (for non C/C++ frames a | 
| 1294       // module will never be found). | 1294       // module will never be found). | 
| 1295       int err = GetLastError(); | 1295       int err = GetLastError(); | 
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1896 | 1896 | 
| 1897   // Release the thread handles | 1897   // Release the thread handles | 
| 1898   CloseHandle(data_->sampler_thread_); | 1898   CloseHandle(data_->sampler_thread_); | 
| 1899   CloseHandle(data_->profiled_thread_); | 1899   CloseHandle(data_->profiled_thread_); | 
| 1900 } | 1900 } | 
| 1901 | 1901 | 
| 1902 | 1902 | 
| 1903 #endif  // ENABLE_LOGGING_AND_PROFILING | 1903 #endif  // ENABLE_LOGGING_AND_PROFILING | 
| 1904 | 1904 | 
| 1905 } }  // namespace v8::internal | 1905 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|