OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <dlfcn.h> | 5 #include <dlfcn.h> |
6 #include <errno.h> | 6 #include <errno.h> |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <stdbool.h> | 8 #include <stdbool.h> |
| 9 #include <stddef.h> |
| 10 #include <stdint.h> |
9 #include <stdlib.h> | 11 #include <stdlib.h> |
10 #include <string.h> | 12 #include <string.h> |
11 #include <sys/mman.h> | 13 #include <sys/mman.h> |
12 #include <unistd.h> | 14 #include <unistd.h> |
13 #include <unwind.h> | 15 #include <unwind.h> |
14 | 16 |
15 #include "tools/android/heap_profiler/heap_profiler.h" | 17 #include "tools/android/heap_profiler/heap_profiler.h" |
16 | 18 |
17 #define HEAP_PROFILER_EXPORT __attribute__((visibility("default"))) | 19 #define HEAP_PROFILER_EXPORT __attribute__((visibility("default"))) |
18 | 20 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 state->frames[state->frame_count++] = ip; | 202 state->frames[state->frame_count++] = ip; |
201 return (state->frame_count >= state->max_depth) ? | 203 return (state->frame_count >= state->max_depth) ? |
202 _URC_END_OF_STACK : _URC_NO_REASON; | 204 _URC_END_OF_STACK : _URC_NO_REASON; |
203 } | 205 } |
204 | 206 |
205 static uint32_t get_backtrace(uintptr_t* frames, uint32_t max_depth) { | 207 static uint32_t get_backtrace(uintptr_t* frames, uint32_t max_depth) { |
206 stack_crawl_state_t state = {.frames = frames, .max_depth = max_depth}; | 208 stack_crawl_state_t state = {.frames = frames, .max_depth = max_depth}; |
207 _Unwind_Backtrace(unwind_fn, &state); | 209 _Unwind_Backtrace(unwind_fn, &state); |
208 return state.frame_count; | 210 return state.frame_count; |
209 } | 211 } |
OLD | NEW |