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 | 9 |
10 #include <iostream> | 10 #include <iostream> |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 // ERROR_INVALID_PARAMETER. | 145 // ERROR_INVALID_PARAMETER. |
146 // When it fails, we should not call debugbreak since it kills the current | 146 // When it fails, we should not call debugbreak since it kills the current |
147 // process (prevents future tests from running or kills the browser | 147 // process (prevents future tests from running or kills the browser |
148 // process). | 148 // process). |
149 DLOG(ERROR) << "SymInitialize failed: " << init_error_; | 149 DLOG(ERROR) << "SymInitialize failed: " << init_error_; |
150 return; | 150 return; |
151 } | 151 } |
152 | 152 |
153 init_error_ = ERROR_SUCCESS; | 153 init_error_ = ERROR_SUCCESS; |
154 | 154 |
155 // Work around a mysterious hang on Windows XP. | |
156 if (base::win::GetVersion() < base::win::VERSION_VISTA) | |
157 return; | |
158 | |
159 // When transferring the binaries e.g. between bots, path put | 155 // When transferring the binaries e.g. between bots, path put |
160 // into the executable will get off. To still retrieve symbols correctly, | 156 // into the executable will get off. To still retrieve symbols correctly, |
161 // add the directory of the executable to symbol search path. | 157 // add the directory of the executable to symbol search path. |
162 // All following errors are non-fatal. | 158 // All following errors are non-fatal. |
163 const size_t kSymbolsArraySize = 1024; | 159 const size_t kSymbolsArraySize = 1024; |
164 scoped_ptr<wchar_t[]> symbols_path(new wchar_t[kSymbolsArraySize]); | 160 scoped_ptr<wchar_t[]> symbols_path(new wchar_t[kSymbolsArraySize]); |
165 | 161 |
166 // Note: The below function takes buffer size as number of characters, | 162 // Note: The below function takes buffer size as number of characters, |
167 // not number of bytes! | 163 // not number of bytes! |
168 if (!SymGetSearchPathW(GetCurrentProcess(), | 164 if (!SymGetSearchPathW(GetCurrentProcess(), |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 (*os) << "\t" << trace_[i] << "\n"; | 274 (*os) << "\t" << trace_[i] << "\n"; |
279 } | 275 } |
280 } else { | 276 } else { |
281 (*os) << "Backtrace:\n"; | 277 (*os) << "Backtrace:\n"; |
282 context->OutputTraceToStream(trace_, count_, os); | 278 context->OutputTraceToStream(trace_, count_, os); |
283 } | 279 } |
284 } | 280 } |
285 | 281 |
286 } // namespace debug | 282 } // namespace debug |
287 } // namespace base | 283 } // namespace base |
OLD | NEW |