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

Side by Side Diff: trunk/src/base/debug/stack_trace_android.cc

Issue 27092002: Revert 227219 "Revert 226920 "Roll Clang 188423:191856."" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 2 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
« no previous file with comments | « no previous file | trunk/src/base/security_unittest.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 <android/log.h> 7 #include <android/log.h>
8 #include <unwind.h> 8 #include <unwind.h>
9 9
10 #include "base/debug/proc_maps_linux.h" 10 #include "base/debug/proc_maps_linux.h"
11 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 #include "base/threading/thread_restrictions.h" 12 #include "base/threading/thread_restrictions.h"
13 13
14 namespace { 14 namespace {
15 15
16 struct StackCrawlState { 16 struct StackCrawlState {
17 StackCrawlState(uintptr_t* frames, size_t max_depth) 17 StackCrawlState(uintptr_t* frames, size_t max_depth)
18 : frames(frames), 18 : frames(frames),
19 frame_count(0), 19 frame_count(0),
20 max_depth(max_depth), 20 max_depth(max_depth),
21 have_skipped_self(false) {} 21 have_skipped_self(false) {}
22 22
23 uintptr_t* frames; 23 uintptr_t* frames;
24 size_t frame_count; 24 size_t frame_count;
25 size_t max_depth; 25 size_t max_depth;
26 bool have_skipped_self; 26 bool have_skipped_self;
27 }; 27 };
28 28
29 // Clang's unwind.h doesn't provide _Unwind_GetIP on ARM, refer to
30 // http://llvm.org/bugs/show_bug.cgi?id=16564 for details.
31 #if defined(__clang__)
32 uintptr_t _Unwind_GetIP(_Unwind_Context* context) {
33 uintptr_t ip = 0;
34 _Unwind_VRS_Get(context, _UVRSC_CORE, 15, _UVRSD_UINT32, &ip);
35 return ip & ~static_cast<uintptr_t>(0x1); // Remove thumb mode bit.
36 }
37 #endif
38
39 _Unwind_Reason_Code TraceStackFrame(_Unwind_Context* context, void* arg) { 29 _Unwind_Reason_Code TraceStackFrame(_Unwind_Context* context, void* arg) {
40 StackCrawlState* state = static_cast<StackCrawlState*>(arg); 30 StackCrawlState* state = static_cast<StackCrawlState*>(arg);
41 uintptr_t ip = _Unwind_GetIP(context); 31 uintptr_t ip = _Unwind_GetIP(context);
42 32
43 // The first stack frame is this function itself. Skip it. 33 // The first stack frame is this function itself. Skip it.
44 if (ip != 0 && !state->have_skipped_self) { 34 if (ip != 0 && !state->have_skipped_self) {
45 state->have_skipped_self = true; 35 state->have_skipped_self = true;
46 return _URC_NO_REASON; 36 return _URC_NO_REASON;
47 } 37 }
48 38
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } else { 113 } else {
124 *os << "<unknown>"; 114 *os << "<unknown>";
125 } 115 }
126 116
127 *os << "\n"; 117 *os << "\n";
128 } 118 }
129 } 119 }
130 120
131 } // namespace debug 121 } // namespace debug
132 } // namespace base 122 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | trunk/src/base/security_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698