summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.context/usymbols.c
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2008-12-10 20:39:45 +0100
committerMark Wielaard <mjw@redhat.com>2008-12-10 20:39:45 +0100
commitd2f4d7286629da6e9f1b844beefb141a4d3ef2c3 (patch)
treeffcff9ea678de1196ad1d95a3ee6880eaf39e3df /testsuite/systemtap.context/usymbols.c
parente8318a92c7b07579b89da5ff6fef782ce5d2b58c (diff)
downloadsystemtap-steved-d2f4d7286629da6e9f1b844beefb141a4d3ef2c3.tar.gz
systemtap-steved-d2f4d7286629da6e9f1b844beefb141a4d3ef2c3.tar.xz
systemtap-steved-d2f4d7286629da6e9f1b844beefb141a4d3ef2c3.zip
PR6866: First pass at translating addresses to symbol names through vma.
Diffstat (limited to 'testsuite/systemtap.context/usymbols.c')
-rw-r--r--testsuite/systemtap.context/usymbols.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/testsuite/systemtap.context/usymbols.c b/testsuite/systemtap.context/usymbols.c
new file mode 100644
index 00000000..f8ee05b5
--- /dev/null
+++ b/testsuite/systemtap.context/usymbols.c
@@ -0,0 +1,41 @@
+/* usymbol test case
+ * Copyright (C) 2008, Red Hat Inc.
+ *
+ * This file is part of systemtap, and is free software. You can
+ * redistribute it and/or modify it under the terms of the GNU General
+ * Public License (GPL); either version 2, or (at your option) any
+ * later version.
+ *
+ * Uses signal to tranfer user space addresses into the kernel where a
+ * probe on sigaction will extract them and produce the symbols. To
+ * poke into the executable we get the sa_handler, to poke into glibc
+ * we get the sa_restorer fields in the stap script.
+ *
+ * XXX - Seems sa_restorer isn't set on all architectures. should use
+ * our own shared library and set signal handler from there. Also
+ * need to handle @plt symbols (setting a handler in the main
+ * executable that is in a shared library will have the @plt address,
+ * not the address inside the shared library).
+ */
+
+#include <signal.h>
+typedef void (*sighandler_t)(int);
+
+void
+handler (int signum)
+{
+ /* dummy handler, just used for the address... */
+}
+
+sighandler_t
+libc_handler (void *func)
+{
+ return (sighandler_t) func;
+}
+
+int
+main (int argc, char *argv[], char *envp[])
+{
+ // Use SIGFPE since we never expect that to be triggered.
+ signal(SIGFPE, handler);
+}