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>
diff --git a/tests/testfile_const_type.c b/tests/testfile_const_type.c
new file mode 100644
index 0000000..259007d
--- /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);
+}