| 81 | } |
| 82 | |
| 83 | int stackutil_get_stack(int id, char **type, int *nframes, void *frames[MAX_STACK_FRAMES], int64_t *hits) |
| 84 | { |
| 85 | *type = NULL; |
| 86 | #ifndef __GLIBC__ |
| 87 | return -1; |
| 88 | #endif |
| 89 | Pthread_mutex_lock(&stacklk); |
| 90 | if (id < 0 || id >= stackid) { |
| 91 | Pthread_mutex_unlock(&stacklk); |
| 92 | return -1; |
| 93 | } |
| 94 | *nframes = stacks[id]->nframes; |
| 95 | for (int i = 0; i < stacks[id]->nframes; i++) { |
| 96 | frames[i] = stacks[id]->frames[i]; |
| 97 | } |
| 98 | *hits = stacks[id]->hits; |
| 99 | *type = strdup(stacks[id]->type); |
| 100 | Pthread_mutex_unlock(&stacklk); |
| 101 | return 0; |
| 102 | } |
| 103 | |
| 104 | char *stackutil_get_stack_str(int id, char **type, int *nframes, int64_t *hits) |
| 105 | { |
no test coverage detected