summaryrefslogtreecommitdiff
path: root/util/backtrace-symbols.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2008-05-26 19:56:09 -0400
committerBehdad Esfahbod <behdad@behdad.org>2008-05-27 04:45:37 -0400
commit30a16df29ba434d298d0c8d9dbb70c1b0a398f35 (patch)
treeead95e45dac5ddf8ee5a6c99beec3198abe6dd7d /util/backtrace-symbols.c
parentce56e0cd0c0afc887bc0c4d46d51b934923f2d2c (diff)
[util/backtrace-symbols] Implement backtrace_symbols_fd()
Diffstat (limited to 'util/backtrace-symbols.c')
-rw-r--r--util/backtrace-symbols.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/util/backtrace-symbols.c b/util/backtrace-symbols.c
index e6ac2563..1365b837 100644
--- a/util/backtrace-symbols.c
+++ b/util/backtrace-symbols.c
@@ -359,3 +359,21 @@ char **backtrace_symbols(void *const *buffer, int size)
return final;
}
+
+void
+backtrace_symbols_fd(void *const *buffer, int size, int fd)
+{
+ int j;
+ char **strings;
+
+ strings = backtrace_symbols(buffer, size);
+ if (strings == NULL) {
+ perror("backtrace_symbols");
+ exit(EXIT_FAILURE);
+ }
+
+ for (j = 0; j < size; j++)
+ printf("%s\n", strings[j]);
+
+ free(strings);
+}