Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(918)

Side by Side Diff: base/debug/stack_trace_win.cc

Issue 1337223002: Fixes to possible GetLastError bugs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed some sandbox changes Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/password_manager/password_manager_util_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // add the directory of the executable to symbol search path. 70 // add the directory of the executable to symbol search path.
71 // All following errors are non-fatal. 71 // All following errors are non-fatal.
72 const size_t kSymbolsArraySize = 1024; 72 const size_t kSymbolsArraySize = 1024;
73 scoped_ptr<wchar_t[]> symbols_path(new wchar_t[kSymbolsArraySize]); 73 scoped_ptr<wchar_t[]> symbols_path(new wchar_t[kSymbolsArraySize]);
74 74
75 // Note: The below function takes buffer size as number of characters, 75 // Note: The below function takes buffer size as number of characters,
76 // not number of bytes! 76 // not number of bytes!
77 if (!SymGetSearchPathW(GetCurrentProcess(), 77 if (!SymGetSearchPathW(GetCurrentProcess(),
78 symbols_path.get(), 78 symbols_path.get(),
79 kSymbolsArraySize)) { 79 kSymbolsArraySize)) {
80 g_init_error = GetLastError();
80 DLOG(WARNING) << "SymGetSearchPath failed: " << g_init_error; 81 DLOG(WARNING) << "SymGetSearchPath failed: " << g_init_error;
81 g_init_error = GetLastError();
82 return false; 82 return false;
83 } 83 }
84 84
85 std::wstring new_path(std::wstring(symbols_path.get()) + 85 std::wstring new_path(std::wstring(symbols_path.get()) +
86 L";" + GetExePath().DirName().value()); 86 L";" + GetExePath().DirName().value());
87 if (!SymSetSearchPathW(GetCurrentProcess(), new_path.c_str())) { 87 if (!SymSetSearchPathW(GetCurrentProcess(), new_path.c_str())) {
88 g_init_error = GetLastError(); 88 g_init_error = GetLastError();
89 DLOG(WARNING) << "SymSetSearchPath failed." << g_init_error; 89 DLOG(WARNING) << "SymSetSearchPath failed." << g_init_error;
90 return false; 90 return false;
91 } 91 }
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 (*os) << "\t" << trace_[i] << "\n"; 276 (*os) << "\t" << trace_[i] << "\n";
277 } 277 }
278 } else { 278 } else {
279 (*os) << "Backtrace:\n"; 279 (*os) << "Backtrace:\n";
280 context->OutputTraceToStream(trace_, count_, os); 280 context->OutputTraceToStream(trace_, count_, os);
281 } 281 }
282 } 282 }
283 283
284 } // namespace debug 284 } // namespace debug
285 } // namespace base 285 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/password_manager/password_manager_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698