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

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

Issue 2632643004: Remove WTFReportAssertionFailure and WTFReportBacktrace. (Closed)
Patch Set: Address review comments Created 3 years, 10 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 | « base/debug/stack_trace_unittest.cc ('k') | third_party/WebKit/Source/wtf/Assertions.h » ('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 #include <stddef.h> 9 #include <stddef.h>
10 10
11 #include <algorithm>
11 #include <iostream> 12 #include <iostream>
12 #include <memory> 13 #include <memory>
13 14
14 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
15 #include "base/logging.h" 16 #include "base/logging.h"
16 #include "base/macros.h" 17 #include "base/macros.h"
17 #include "base/memory/singleton.h" 18 #include "base/memory/singleton.h"
18 #include "base/synchronization/lock.h" 19 #include "base/synchronization/lock.h"
19 20
20 namespace base { 21 namespace base {
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 203
203 // Disable optimizations for the StackTrace::StackTrace function. It is 204 // Disable optimizations for the StackTrace::StackTrace function. It is
204 // important to disable at least frame pointer optimization ("y"), since 205 // important to disable at least frame pointer optimization ("y"), since
205 // that breaks CaptureStackBackTrace() and prevents StackTrace from working 206 // that breaks CaptureStackBackTrace() and prevents StackTrace from working
206 // in Release builds (it may still be janky if other frames are using FPO, 207 // in Release builds (it may still be janky if other frames are using FPO,
207 // but at least it will make it further). 208 // but at least it will make it further).
208 #if defined(COMPILER_MSVC) 209 #if defined(COMPILER_MSVC)
209 #pragma optimize("", off) 210 #pragma optimize("", off)
210 #endif 211 #endif
211 212
212 StackTrace::StackTrace() { 213 StackTrace::StackTrace(size_t count) {
214 count = std::min(arraysize(trace_), count);
215
213 // When walking our own stack, use CaptureStackBackTrace(). 216 // When walking our own stack, use CaptureStackBackTrace().
214 count_ = CaptureStackBackTrace(0, arraysize(trace_), trace_, NULL); 217 count_ = CaptureStackBackTrace(0, count, trace_, NULL);
215 } 218 }
216 219
217 #if defined(COMPILER_MSVC) 220 #if defined(COMPILER_MSVC)
218 #pragma optimize("", on) 221 #pragma optimize("", on)
219 #endif 222 #endif
220 223
221 StackTrace::StackTrace(EXCEPTION_POINTERS* exception_pointers) { 224 StackTrace::StackTrace(EXCEPTION_POINTERS* exception_pointers) {
222 InitTrace(exception_pointers->ContextRecord); 225 InitTrace(exception_pointers->ContextRecord);
223 } 226 }
224 227
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 (*os) << "\t" << trace_[i] << "\n"; 287 (*os) << "\t" << trace_[i] << "\n";
285 } 288 }
286 } else { 289 } else {
287 (*os) << "Backtrace:\n"; 290 (*os) << "Backtrace:\n";
288 context->OutputTraceToStream(trace_, count_, os); 291 context->OutputTraceToStream(trace_, count_, os);
289 } 292 }
290 } 293 }
291 294
292 } // namespace debug 295 } // namespace debug
293 } // namespace base 296 } // namespace base
OLDNEW
« no previous file with comments | « base/debug/stack_trace_unittest.cc ('k') | third_party/WebKit/Source/wtf/Assertions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698