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

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

Issue 6825038: Create a content::ResourceContext. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix dependencies. Created 9 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 exception_pointers->ContextRecord, 167 exception_pointers->ContextRecord,
168 NULL, 168 NULL,
169 &SymFunctionTableAccess64, 169 &SymFunctionTableAccess64,
170 &SymGetModuleBase64, 170 &SymGetModuleBase64,
171 NULL) && 171 NULL) &&
172 count_ < arraysize(trace_)) { 172 count_ < arraysize(trace_)) {
173 trace_[count_++] = reinterpret_cast<void*>(stack_frame.AddrPC.Offset); 173 trace_[count_++] = reinterpret_cast<void*>(stack_frame.AddrPC.Offset);
174 } 174 }
175 } 175 }
176 176
177 void StackTrace::PrintBacktrace() { 177 void StackTrace::PrintBacktrace() const {
178 OutputToStream(&std::cerr); 178 OutputToStream(&std::cerr);
179 } 179 }
180 180
181 void StackTrace::OutputToStream(std::ostream* os) { 181 void StackTrace::OutputToStream(std::ostream* os) const {
182 SymbolContext* context = SymbolContext::GetInstance(); 182 SymbolContext* context = SymbolContext::GetInstance();
183 DWORD error = context->init_error(); 183 DWORD error = context->init_error();
184 if (error != ERROR_SUCCESS) { 184 if (error != ERROR_SUCCESS) {
185 (*os) << "Error initializing symbols (" << error 185 (*os) << "Error initializing symbols (" << error
186 << "). Dumping unresolved backtrace:\n"; 186 << "). Dumping unresolved backtrace:\n";
187 for (int i = 0; (i < count_) && os->good(); ++i) { 187 for (int i = 0; (i < count_) && os->good(); ++i) {
188 (*os) << "\t" << trace_[i] << "\n"; 188 (*os) << "\t" << trace_[i] << "\n";
189 } 189 }
190 } else { 190 } else {
191 (*os) << "Backtrace:\n"; 191 (*os) << "Backtrace:\n";
192 context->OutputTraceToStream(trace_, count_, os); 192 context->OutputTraceToStream(trace_, count_, os);
193 } 193 }
194 } 194 }
195 195
196 } // namespace debug 196 } // namespace debug
197 } // namespace base 197 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698