summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.base/const_value.c
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2009-10-05 09:14:49 +0200
committerMark Wielaard <mjw@redhat.com>2009-10-05 09:14:49 +0200
commit3e9565715db9be1dd1719a33aa7d341c930aadda (patch)
tree66d7af3df0f564f894b26b4e047f309284c987f8 /testsuite/systemtap.base/const_value.c
parent03ba05b65a2c555d3057006ef490d958bbf07df5 (diff)
downloadsystemtap-steved-3e9565715db9be1dd1719a33aa7d341c930aadda.tar.gz
systemtap-steved-3e9565715db9be1dd1719a33aa7d341c930aadda.tar.xz
systemtap-steved-3e9565715db9be1dd1719a33aa7d341c930aadda.zip
Add tescase for DW_AT_const_value location descriptions.
* testsuite/systemtap.base/const_value.c: New test. * testsuite/systemtap.base/const_value.exp: Likewise. * testsuite/systemtap.base/const_value.stp: Likewise.
Diffstat (limited to 'testsuite/systemtap.base/const_value.c')
-rw-r--r--testsuite/systemtap.base/const_value.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/testsuite/systemtap.base/const_value.c b/testsuite/systemtap.base/const_value.c
new file mode 100644
index 00000000..4ff82161
--- /dev/null
+++ b/testsuite/systemtap.base/const_value.c
@@ -0,0 +1,31 @@
+#include "sdt.h"
+
+struct foo
+{
+ const int i;
+ const long j;
+};
+
+typedef struct foo fooer;
+
+static int
+bar (const int i, const long j)
+{
+ return i * j;
+}
+
+// Because of PR10726 we don't want to get this function inlined.
+// We do need -O2 to get the const_value encodings in dwarf.
+static __attribute__((__noinline__)) int
+func (int (*f) ())
+{
+ const fooer baz = { .i = 2, .j = 21 };
+ STAP_PROBE (test, constvalues);
+ return f(baz.i, baz.j);
+}
+
+int
+main (int argc, char *argv[], char *envp[])
+{
+ return func (&bar) - 42;
+}