Chromium Code Reviews| Index: base/debug/stack_trace_win.cc |
| diff --git a/base/debug/stack_trace_win.cc b/base/debug/stack_trace_win.cc |
| index da75b0b61778e7685c90cad554a965c0010c136f..d8e7d580485a9ec6d2accf944bcb6b6365b6afb9 100644 |
| --- a/base/debug/stack_trace_win.cc |
| +++ b/base/debug/stack_trace_win.cc |
| @@ -12,7 +12,9 @@ |
| #include "base/basictypes.h" |
| #include "base/logging.h" |
| #include "base/memory/singleton.h" |
| +#include "base/path_service.h" |
| #include "base/process_util.h" |
| +#include "base/string_util.h" |
| #include "base/synchronization/lock.h" |
| namespace base { |
| @@ -129,9 +131,7 @@ class SymbolContext { |
| SymSetOptions(SYMOPT_DEFERRED_LOADS | |
| SYMOPT_UNDNAME | |
| SYMOPT_LOAD_LINES); |
| - if (SymInitialize(GetCurrentProcess(), NULL, TRUE)) { |
| - init_error_ = ERROR_SUCCESS; |
| - } else { |
| + if (!SymInitialize(GetCurrentProcess(), NULL, TRUE)) { |
| init_error_ = GetLastError(); |
| // TODO(awong): Handle error: SymInitialize can fail with |
| // ERROR_INVALID_PARAMETER. |
| @@ -139,6 +139,34 @@ class SymbolContext { |
| // process (prevents future tests from running or kills the browser |
| // process). |
| DLOG(ERROR) << "SymInitialize failed: " << init_error_; |
| + return; |
| + } |
| + |
| + init_error_ = ERROR_SUCCESS; |
| + |
| + // When transferring the binaries e.g. between bots, path put |
| + // into the executable will get off. To still retrieve symbols correctly, |
| + // add the directory of the executable to symbol search path. |
| + // All following errors are non-fatal. |
| + wchar_t symbols_path[1024]; |
| + if (!SymGetSearchPathW(GetCurrentProcess(), |
| + symbols_path, |
| + sizeof(symbols_path))) { |
|
cpu_(ooo_6.6-7.5)
2013/03/07 20:31:50
last parameter looks incorrect, I don't think it i
|
| + DLOG(WARNING) << "SymGetSearchPath failed: "; |
| + return; |
| + } |
| + |
| + FilePath module_path; |
| + if (!PathService::Get(FILE_EXE, &module_path)) { |
| + DLOG(WARNING) << "PathService::Get(FILE_EXE) failed."; |
| + return; |
| + } |
| + |
| + std::wstring new_path(std::wstring(symbols_path) + |
| + L";" + module_path.DirName().value()); |
| + if (!SymSetSearchPathW(GetCurrentProcess(), new_path.c_str())) { |
| + DLOG(WARNING) << "SymSetSearchPath failed."; |
| + return; |
| } |
| } |