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

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

Issue 185423006: Eliminate build warnings in base/ for Android x64 (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: rebase Created 6 years, 9 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 | « base/debug/proc_maps_linux.cc ('k') | base/os_compat_android.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 #ifdef __LP64__
15 #define FMT_ADDR "0x%016lx"
16 #else
17 #define FMT_ADDR "0x%08x"
18 #endif
19
14 namespace { 20 namespace {
15 21
16 struct StackCrawlState { 22 struct StackCrawlState {
17 StackCrawlState(uintptr_t* frames, size_t max_depth) 23 StackCrawlState(uintptr_t* frames, size_t max_depth)
18 : frames(frames), 24 : frames(frames),
19 frame_count(0), 25 frame_count(0),
20 max_depth(max_depth), 26 max_depth(max_depth),
21 have_skipped_self(false) {} 27 have_skipped_self(false) {}
22 28
23 uintptr_t* frames; 29 uintptr_t* frames;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 103
98 std::vector<MappedMemoryRegion>::iterator iter = regions.begin(); 104 std::vector<MappedMemoryRegion>::iterator iter = regions.begin();
99 while (iter != regions.end()) { 105 while (iter != regions.end()) {
100 if (address >= iter->start && address < iter->end && 106 if (address >= iter->start && address < iter->end &&
101 !iter->path.empty()) { 107 !iter->path.empty()) {
102 break; 108 break;
103 } 109 }
104 ++iter; 110 ++iter;
105 } 111 }
106 112
107 *os << base::StringPrintf("#%02d 0x%08x ", i, address); 113 *os << base::StringPrintf("#%02zd " FMT_ADDR " ", i, address);
108 114
109 if (iter != regions.end()) { 115 if (iter != regions.end()) {
110 uintptr_t rel_pc = address - iter->start + iter->offset; 116 uintptr_t rel_pc = address - iter->start + iter->offset;
111 const char* path = iter->path.c_str(); 117 const char* path = iter->path.c_str();
112 *os << base::StringPrintf("%s+0x%08x", path, rel_pc); 118 *os << base::StringPrintf("%s+" FMT_ADDR, path, rel_pc);
113 } else { 119 } else {
114 *os << "<unknown>"; 120 *os << "<unknown>";
115 } 121 }
116 122
117 *os << "\n"; 123 *os << "\n";
118 } 124 }
119 } 125 }
120 126
121 } // namespace debug 127 } // namespace debug
122 } // namespace base 128 } // namespace base
OLDNEW
« no previous file with comments | « base/debug/proc_maps_linux.cc ('k') | base/os_compat_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698