summaryrefslogtreecommitdiff
path: root/tests/testfile_const_type.c
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2013-08-31 00:52:12 +0200
committerMark Wielaard <mjw@redhat.com>2013-09-06 12:17:14 +0200
commit6e6e54e12a30b70929d9465fae3dc601684a8794 (patch)
treedce12a231222431d3de5b6d87488a6fe6d9b56ff /tests/testfile_const_type.c
parentb2535b6a6be7717cdd41834d76e5cb48cb446b83 (diff)
downloadelfutils-6e6e54e12a30b70929d9465fae3dc601684a8794.tar.gz
tests: Add new varlocs test for dwarf_getlocation* functions.
This tests the new dwarf_getlocations, dwarf_getlocation_attr and dwarf_getlocation_die functions. But it is also an example of how to handle location expressions and which libdw functions can be used to access all information required to interpret each DW_OP. It might make sense to extend this test/example into a program that verifies various properties of DWARF expressions. Signed-off-by: Mark Wielaard <mjw@redhat.com>
Diffstat (limited to 'tests/testfile_const_type.c')
-rw-r--r--tests/testfile_const_type.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/testfile_const_type.c b/tests/testfile_const_type.c
new file mode 100644
index 00000000..259007d0
--- /dev/null
+++ b/tests/testfile_const_type.c
@@ -0,0 +1,14 @@
+// gcc -m32 -g -O2 -o const_type const_type.c
+
+__attribute__((noinline, noclone)) int
+f1 (long long d)
+{
+ long long w = d / 0x1234567800000LL;
+ return w;
+}
+
+int
+main ()
+{
+ return f1 (4LL) - f1 (4LL);
+}