diff --git a/include/Makefile.am b/include/Makefile.am
index 90681df..18e94b7 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -4,6 +4,7 @@ nobase_include_HEADERS = trbase.h \
tr/interface.h \
tr/memory.h \
tr/logger.h \
+ tr/print_trace.h \
tr/sized_data.h \
tr/tree_macros.h \
tr/interface/class.h \
diff --git a/include/tr/print_trace.h b/include/tr/print_trace.h
new file mode 100644
index 0000000..7c9c48b
--- /dev/null
+++ b/include/tr/print_trace.h
@@ -0,0 +1,23 @@
+/**
+ * \file
+ *
+ * \author The GNU Software Foundation.
+ *
+ * \copyright
+ * Copyright © 2014 The GNU Softare Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+void print_trace (void);
diff --git a/include/trbase.h b/include/trbase.h
index 42d41d0..09e900d 100644
--- a/include/trbase.h
+++ b/include/trbase.h
@@ -5,6 +5,7 @@
#include "tr/memory.h"
#include "tr/class.h"
#include "tr/logger.h"
+#include "tr/print_trace.h"
#include "tr/sized_data.h"
#include "tr/interface.h"
#include "tr/interface/class.h"
diff --git a/src/Makefile.am b/src/Makefile.am
index 5b06a78..e7a9081 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -6,6 +6,7 @@ AM_CFLAGS += -I../include/
TR_CLASS = memory.c \
interface.c \
logger.c \
+ print_trace.c \
stderr.c \
syslog.c \
sized_data.c \
diff --git a/src/print_trace.c b/src/print_trace.c
new file mode 100644
index 0000000..48466fc
--- /dev/null
+++ b/src/print_trace.c
@@ -0,0 +1,47 @@
+/**
+ * \file
+ *
+ * \author The GNU Software Foundation.
+ *
+ * \copyright
+ * Copyright © 2014 The GNU Softare Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include
+#include
+#include
+
+/* 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);
+}
+
+// vim: set ts=4 sw=4: