| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/debug/stack_trace.h" | 5 #include "base/debug/stack_trace.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <dbghelp.h> | 8 #include <dbghelp.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 | 10 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // process). | 64 // process). |
| 65 DLOG(ERROR) << "SymInitialize failed: " << g_init_error; | 65 DLOG(ERROR) << "SymInitialize failed: " << g_init_error; |
| 66 return false; | 66 return false; |
| 67 } | 67 } |
| 68 | 68 |
| 69 // When transferring the binaries e.g. between bots, path put | 69 // When transferring the binaries e.g. between bots, path put |
| 70 // into the executable will get off. To still retrieve symbols correctly, | 70 // into the executable will get off. To still retrieve symbols correctly, |
| 71 // add the directory of the executable to symbol search path. | 71 // add the directory of the executable to symbol search path. |
| 72 // All following errors are non-fatal. | 72 // All following errors are non-fatal. |
| 73 const size_t kSymbolsArraySize = 1024; | 73 const size_t kSymbolsArraySize = 1024; |
| 74 scoped_ptr<wchar_t[]> symbols_path(new wchar_t[kSymbolsArraySize]); | 74 std::unique_ptr<wchar_t[]> symbols_path(new wchar_t[kSymbolsArraySize]); |
| 75 | 75 |
| 76 // Note: The below function takes buffer size as number of characters, | 76 // Note: The below function takes buffer size as number of characters, |
| 77 // not number of bytes! | 77 // not number of bytes! |
| 78 if (!SymGetSearchPathW(GetCurrentProcess(), | 78 if (!SymGetSearchPathW(GetCurrentProcess(), |
| 79 symbols_path.get(), | 79 symbols_path.get(), |
| 80 kSymbolsArraySize)) { | 80 kSymbolsArraySize)) { |
| 81 g_init_error = GetLastError(); | 81 g_init_error = GetLastError(); |
| 82 DLOG(WARNING) << "SymGetSearchPath failed: " << g_init_error; | 82 DLOG(WARNING) << "SymGetSearchPath failed: " << g_init_error; |
| 83 return false; | 83 return false; |
| 84 } | 84 } |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 (*os) << "\t" << trace_[i] << "\n"; | 285 (*os) << "\t" << trace_[i] << "\n"; |
| 286 } | 286 } |
| 287 } else { | 287 } else { |
| 288 (*os) << "Backtrace:\n"; | 288 (*os) << "Backtrace:\n"; |
| 289 context->OutputTraceToStream(trace_, count_, os); | 289 context->OutputTraceToStream(trace_, count_, os); |
| 290 } | 290 } |
| 291 } | 291 } |
| 292 | 292 |
| 293 } // namespace debug | 293 } // namespace debug |
| 294 } // namespace base | 294 } // namespace base |
| OLD | NEW |