5 backtrace_symbols(void *const *buffer, int size)
7 - int i, clen, alen, offset;
17 - (char **)cp = &(rval[size]);
18 for (i = 0; i < size; i++) {
19 if (dladdr(buffer[i], &info) != 0) {
20 if (info.dli_sname == NULL)
23 strlen(info.dli_sname) + /* "function" */
25 - D10(offset) + /* "offset */
28 strlen(info.dli_fname) + /* "filename" */
30 rval = realloc_safe(rval, clen + alen);
33 - snprintf(cp, alen, "%p <%s+%d> at %s",
34 + snprintf((char *) rval + clen, alen, "%p <%s+%d> at %s",
35 buffer[i], info.dli_sname, offset, info.dli_fname);
39 rval = realloc_safe(rval, clen + alen);
42 - snprintf(cp, alen, "%p", buffer[i]);
43 + snprintf((char *) rval + clen, alen, "%p", buffer[i]);
47 + rval[i] = (char *) clen;
51 + for (i = 0; i < size; i++)
52 + rval[i] += (long) rval;
59 snprintf(buf, len, "%p\n", buffer[i]);
61 - write(fd, buf, len - 1);
62 + write(fd, buf, strlen(buf));