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

Function comdb2_cheapstack_char_array

util/walkback.c:865–889  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

863}
864
865int comdb2_cheapstack_char_array(char *str, int maxln)
866{
867 void *stack[MAXFRAMES];
868 unsigned int nframes;
869 char *p;
870 int i, ccount, first = 1;
871
872 if (maxln <= 0 || stack_pc_getlist(NULL, stack, MAXFRAMES, &nframes)) {
873 return -1;
874 }
875 p = str;
876 for (i = 0; i < nframes && i < MAXFRAMES && maxln > 0; i++) {
877 if (stack[i]) {
878 if (first) {
879 ccount = snprintf(p, maxln, "%p", stack[i]);
880 first = 0;
881 } else {
882 ccount = snprintf(p, maxln, " %p", stack[i]);
883 }
884 p += ccount;
885 maxln -= ccount;
886 }
887 }
888 return 0;
889}
890
891#include <stdlib.h>
892#include <stdarg.h>

Callers 2

cdb2_openFunction · 0.85
recover_deadlock_flagsFunction · 0.85

Calls 1

stack_pc_getlistFunction · 0.85

Tested by

no test coverage detected