MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / stackutil_get_stack

Function stackutil_get_stack

util/stackutil.c:83–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83int 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
104char *stackutil_get_stack_str(int id, char **type, int *nframes, int64_t *hits)
105{

Callers 1

stackutil_get_stack_strFunction · 0.85

Calls 1

strdupFunction · 0.50

Tested by

no test coverage detected