summaryrefslogtreecommitdiff
path: root/multimedia/avidemux2/files/execinfo.cpp
diff options
context:
space:
mode:
authorTimur I. Bakeyev <timur@FreeBSD.org>2008-07-15 02:53:29 +0000
committerTimur I. Bakeyev <timur@FreeBSD.org>2008-07-15 02:53:29 +0000
commitaa9f6ea2c00471586a087fc0fb31f8f21ec7686d (patch)
treedda5c01b3a8eeff09d2841effe86dd4581b470f2 /multimedia/avidemux2/files/execinfo.cpp
parent- Fix error in procname path (diff)
Upgrade avidemux2 to the 2.4.2 version and switch to CMake
PR: ports/125508 Submitted by: timur@FreeBSD.org Approved by: amistry@am-productions.biz (maintainer)
Diffstat (limited to 'multimedia/avidemux2/files/execinfo.cpp')
-rw-r--r--multimedia/avidemux2/files/execinfo.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/multimedia/avidemux2/files/execinfo.cpp b/multimedia/avidemux2/files/execinfo.cpp
new file mode 100644
index 000000000000..00304cfdc026
--- /dev/null
+++ b/multimedia/avidemux2/files/execinfo.cpp
@@ -0,0 +1,37 @@
+#include <execinfo.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+/* Obtain a backtrace and print it to stdout. */
+void
+print_trace (void)
+{
+ void *array[10];
+ size_t size;
+ char **strings;
+ size_t i;
+
+ size = backtrace (array, 10);
+ strings = backtrace_symbols (array, size);
+
+ printf ("Obtained %zd stack frames.\n", size);
+
+ for (i = 0; i < size; i++)
+ printf ("%s\n", strings[i]);
+
+ free (strings);
+}
+
+/* A dummy function to make the backtrace more interesting. */
+void
+dummy_function (void)
+{
+ print_trace ();
+}
+
+int
+main (void)
+{
+ dummy_function ();
+ return 0;
+}