summaryrefslogtreecommitdiffstats
path: root/src/debug/dwarf/testdata
diff options
context:
space:
mode:
Diffstat (limited to 'src/debug/dwarf/testdata')
-rw-r--r--src/debug/dwarf/testdata/bitfields.c17
-rw-r--r--src/debug/dwarf/testdata/bitfields.elf4bin0 -> 2464 bytes
-rw-r--r--src/debug/dwarf/testdata/cppunsuptypes.cc34
-rw-r--r--src/debug/dwarf/testdata/cppunsuptypes.elfbin0 -> 3920 bytes
-rw-r--r--src/debug/dwarf/testdata/cycle.c7
-rw-r--r--src/debug/dwarf/testdata/cycle.elfbin0 -> 2624 bytes
-rw-r--r--src/debug/dwarf/testdata/debug_rnglistsbin0 -> 23 bytes
-rw-r--r--src/debug/dwarf/testdata/line-clang-dwarf5.elfbin0 -> 18384 bytes
-rw-r--r--src/debug/dwarf/testdata/line-clang.elfbin0 -> 10271 bytes
-rw-r--r--src/debug/dwarf/testdata/line-gcc-dwarf5.elfbin0 -> 18040 bytes
-rw-r--r--src/debug/dwarf/testdata/line-gcc-win.binbin0 -> 133202 bytes
-rw-r--r--src/debug/dwarf/testdata/line-gcc.elfbin0 -> 10113 bytes
-rw-r--r--src/debug/dwarf/testdata/line1.c9
-rw-r--r--src/debug/dwarf/testdata/line1.h7
-rw-r--r--src/debug/dwarf/testdata/line2.c6
-rw-r--r--src/debug/dwarf/testdata/ranges.c25
-rwxr-xr-xsrc/debug/dwarf/testdata/ranges.elfbin0 -> 10348 bytes
-rw-r--r--src/debug/dwarf/testdata/rnglistx.c19
-rwxr-xr-xsrc/debug/dwarf/testdata/rnglistx.elfbin0 -> 11024 bytes
-rw-r--r--src/debug/dwarf/testdata/split.c5
-rw-r--r--src/debug/dwarf/testdata/split.elfbin0 -> 9509 bytes
-rw-r--r--src/debug/dwarf/testdata/typedef.c86
-rwxr-xr-xsrc/debug/dwarf/testdata/typedef.elfbin0 -> 12448 bytes
-rw-r--r--src/debug/dwarf/testdata/typedef.elf4bin0 -> 9496 bytes
-rw-r--r--src/debug/dwarf/testdata/typedef.elf5bin0 -> 6016 bytes
-rw-r--r--src/debug/dwarf/testdata/typedef.machobin0 -> 5024 bytes
-rw-r--r--src/debug/dwarf/testdata/typedef.macho4bin0 -> 6220 bytes
27 files changed, 215 insertions, 0 deletions
diff --git a/src/debug/dwarf/testdata/bitfields.c b/src/debug/dwarf/testdata/bitfields.c
new file mode 100644
index 0000000..0583333
--- /dev/null
+++ b/src/debug/dwarf/testdata/bitfields.c
@@ -0,0 +1,17 @@
+// Copyright 2022 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+/*
+Linux ELF:
+gcc -gdwarf-4 -m64 -c bitfields.c -o bitfields.elf4
+*/
+
+typedef struct another_struct {
+ unsigned short quix;
+ int xyz[0];
+ unsigned x:1;
+ long long array[40];
+} t_another_struct;
+t_another_struct q2;
+
diff --git a/src/debug/dwarf/testdata/bitfields.elf4 b/src/debug/dwarf/testdata/bitfields.elf4
new file mode 100644
index 0000000..2e06e68
--- /dev/null
+++ b/src/debug/dwarf/testdata/bitfields.elf4
Binary files differ
diff --git a/src/debug/dwarf/testdata/cppunsuptypes.cc b/src/debug/dwarf/testdata/cppunsuptypes.cc
new file mode 100644
index 0000000..e9281c7
--- /dev/null
+++ b/src/debug/dwarf/testdata/cppunsuptypes.cc
@@ -0,0 +1,34 @@
+// Copyright 2019 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// cppunsuptypes.elf built with g++ 7.3
+// g++ -g -c -o cppunsuptypes.elf cppunsuptypes.cc
+
+int i = 3;
+double d = 3;
+
+// anonymous reference type
+int &culprit = i;
+
+// named reference type
+typedef double &dref;
+dref dr = d;
+
+// incorporated into another type
+typedef struct {
+ dref q;
+ int &r;
+} hasrefs;
+
+hasrefs hr = { d, i };
+
+// This code is intended to trigger a DWARF "pointer to member" type DIE
+struct CS { int dm; };
+
+int foo()
+{
+ int CS::* pdm = &CS::dm;
+ CS cs = {42};
+ return cs.*pdm;
+}
diff --git a/src/debug/dwarf/testdata/cppunsuptypes.elf b/src/debug/dwarf/testdata/cppunsuptypes.elf
new file mode 100644
index 0000000..e955512
--- /dev/null
+++ b/src/debug/dwarf/testdata/cppunsuptypes.elf
Binary files differ
diff --git a/src/debug/dwarf/testdata/cycle.c b/src/debug/dwarf/testdata/cycle.c
new file mode 100644
index 0000000..a0b53df
--- /dev/null
+++ b/src/debug/dwarf/testdata/cycle.c
@@ -0,0 +1,7 @@
+typedef struct aaa *AAA;
+typedef AAA BBB;
+struct aaa { BBB val; };
+
+AAA x(void) {
+ return (AAA)0;
+}
diff --git a/src/debug/dwarf/testdata/cycle.elf b/src/debug/dwarf/testdata/cycle.elf
new file mode 100644
index 0000000..e0b66ca
--- /dev/null
+++ b/src/debug/dwarf/testdata/cycle.elf
Binary files differ
diff --git a/src/debug/dwarf/testdata/debug_rnglists b/src/debug/dwarf/testdata/debug_rnglists
new file mode 100644
index 0000000..985ec6c
--- /dev/null
+++ b/src/debug/dwarf/testdata/debug_rnglists
Binary files differ
diff --git a/src/debug/dwarf/testdata/line-clang-dwarf5.elf b/src/debug/dwarf/testdata/line-clang-dwarf5.elf
new file mode 100644
index 0000000..7b80c9c
--- /dev/null
+++ b/src/debug/dwarf/testdata/line-clang-dwarf5.elf
Binary files differ
diff --git a/src/debug/dwarf/testdata/line-clang.elf b/src/debug/dwarf/testdata/line-clang.elf
new file mode 100644
index 0000000..b63cc78
--- /dev/null
+++ b/src/debug/dwarf/testdata/line-clang.elf
Binary files differ
diff --git a/src/debug/dwarf/testdata/line-gcc-dwarf5.elf b/src/debug/dwarf/testdata/line-gcc-dwarf5.elf
new file mode 100644
index 0000000..34ce17c
--- /dev/null
+++ b/src/debug/dwarf/testdata/line-gcc-dwarf5.elf
Binary files differ
diff --git a/src/debug/dwarf/testdata/line-gcc-win.bin b/src/debug/dwarf/testdata/line-gcc-win.bin
new file mode 100644
index 0000000..583ad44
--- /dev/null
+++ b/src/debug/dwarf/testdata/line-gcc-win.bin
Binary files differ
diff --git a/src/debug/dwarf/testdata/line-gcc.elf b/src/debug/dwarf/testdata/line-gcc.elf
new file mode 100644
index 0000000..50500a8
--- /dev/null
+++ b/src/debug/dwarf/testdata/line-gcc.elf
Binary files differ
diff --git a/src/debug/dwarf/testdata/line1.c b/src/debug/dwarf/testdata/line1.c
new file mode 100644
index 0000000..f358647
--- /dev/null
+++ b/src/debug/dwarf/testdata/line1.c
@@ -0,0 +1,9 @@
+#include "line1.h"
+
+void f2();
+
+int main()
+{
+ f1();
+ f2();
+}
diff --git a/src/debug/dwarf/testdata/line1.h b/src/debug/dwarf/testdata/line1.h
new file mode 100644
index 0000000..974d4c8
--- /dev/null
+++ b/src/debug/dwarf/testdata/line1.h
@@ -0,0 +1,7 @@
+static void f1()
+{
+ char buf[10];
+ int i;
+ for(i = 0; i < 10; i++)
+ buf[i] = 1;
+}
diff --git a/src/debug/dwarf/testdata/line2.c b/src/debug/dwarf/testdata/line2.c
new file mode 100644
index 0000000..38d8998
--- /dev/null
+++ b/src/debug/dwarf/testdata/line2.c
@@ -0,0 +1,6 @@
+#include <stdio.h>
+
+void f2()
+{
+ printf("hello\n");
+}
diff --git a/src/debug/dwarf/testdata/ranges.c b/src/debug/dwarf/testdata/ranges.c
new file mode 100644
index 0000000..2f208e5
--- /dev/null
+++ b/src/debug/dwarf/testdata/ranges.c
@@ -0,0 +1,25 @@
+// gcc -g -O2 -freorder-blocks-and-partition
+
+const char *arr[10000];
+const char *hot = "hot";
+const char *cold = "cold";
+
+__attribute__((noinline))
+void fn(int path) {
+ int i;
+
+ if (path) {
+ for (i = 0; i < sizeof arr / sizeof arr[0]; i++) {
+ arr[i] = hot;
+ }
+ } else {
+ for (i = 0; i < sizeof arr / sizeof arr[0]; i++) {
+ arr[i] = cold;
+ }
+ }
+}
+
+int main(int argc, char *argv[]) {
+ fn(argc);
+ return 0;
+}
diff --git a/src/debug/dwarf/testdata/ranges.elf b/src/debug/dwarf/testdata/ranges.elf
new file mode 100755
index 0000000..7f54138
--- /dev/null
+++ b/src/debug/dwarf/testdata/ranges.elf
Binary files differ
diff --git a/src/debug/dwarf/testdata/rnglistx.c b/src/debug/dwarf/testdata/rnglistx.c
new file mode 100644
index 0000000..8770435
--- /dev/null
+++ b/src/debug/dwarf/testdata/rnglistx.c
@@ -0,0 +1,19 @@
+// clang -gdwarf-5 -O2 -nostdlib
+
+__attribute__((noinline, cold))
+static int sum(int i) {
+ int j, s;
+
+ s = 0;
+ for (j = 0; j < i; j++) {
+ s += j * i;
+ }
+ return s;
+}
+
+int main(int argc, char** argv) {
+ if (argc == 0) {
+ return 0;
+ }
+ return sum(argc);
+}
diff --git a/src/debug/dwarf/testdata/rnglistx.elf b/src/debug/dwarf/testdata/rnglistx.elf
new file mode 100755
index 0000000..c2d7f55
--- /dev/null
+++ b/src/debug/dwarf/testdata/rnglistx.elf
Binary files differ
diff --git a/src/debug/dwarf/testdata/split.c b/src/debug/dwarf/testdata/split.c
new file mode 100644
index 0000000..0ef3427
--- /dev/null
+++ b/src/debug/dwarf/testdata/split.c
@@ -0,0 +1,5 @@
+// gcc -gsplit-dwarf split.c -o split.elf
+
+int main()
+{
+}
diff --git a/src/debug/dwarf/testdata/split.elf b/src/debug/dwarf/testdata/split.elf
new file mode 100644
index 0000000..99ee2c2
--- /dev/null
+++ b/src/debug/dwarf/testdata/split.elf
Binary files differ
diff --git a/src/debug/dwarf/testdata/typedef.c b/src/debug/dwarf/testdata/typedef.c
new file mode 100644
index 0000000..3e7e008
--- /dev/null
+++ b/src/debug/dwarf/testdata/typedef.c
@@ -0,0 +1,86 @@
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+/*
+Linux ELF:
+gcc -gdwarf-2 -m64 -c typedef.c && gcc -gdwarf-2 -m64 -o typedef.elf typedef.o
+
+OS X Mach-O:
+gcc -gdwarf-2 -m64 -c typedef.c -o typedef.macho
+gcc -gdwarf-4 -m64 -c typedef.c -o typedef.macho4
+*/
+#include <complex.h>
+
+typedef volatile int* t_ptr_volatile_int;
+typedef const char *t_ptr_const_char;
+typedef long t_long;
+typedef unsigned short t_ushort;
+typedef int t_func_int_of_float_double(float, double);
+typedef int (*t_ptr_func_int_of_float_double)(float, double);
+typedef int (*t_ptr_func_int_of_float_complex)(float complex);
+typedef int (*t_ptr_func_int_of_double_complex)(double complex);
+typedef int (*t_ptr_func_int_of_long_double_complex)(long double complex);
+typedef int *t_func_ptr_int_of_char_schar_uchar(char, signed char, unsigned char);
+typedef void t_func_void_of_char(char);
+typedef void t_func_void_of_void(void);
+typedef void t_func_void_of_ptr_char_dots(char*, ...);
+typedef struct my_struct {
+ volatile int vi;
+ char x : 1;
+ int y : 4;
+ int z[0];
+ long long array[40];
+ int zz[0];
+} t_my_struct;
+typedef struct my_struct1 {
+ int zz [1];
+} t_my_struct1;
+typedef union my_union {
+ volatile int vi;
+ char x : 1;
+ int y : 4;
+ long long array[40];
+} t_my_union;
+typedef enum my_enum {
+ e1 = 1,
+ e2 = 2,
+ e3 = -5,
+ e4 = 1000000000000000LL,
+} t_my_enum;
+
+typedef struct list t_my_list;
+struct list {
+ short val;
+ t_my_list *next;
+};
+
+typedef struct tree {
+ struct tree *left, *right;
+ unsigned long long val;
+} t_my_tree;
+
+t_ptr_volatile_int *a2;
+t_ptr_const_char **a3a;
+t_long *a4;
+t_ushort *a5;
+t_func_int_of_float_double *a6;
+t_ptr_func_int_of_float_double *a7;
+t_func_ptr_int_of_char_schar_uchar *a8;
+t_func_void_of_char *a9;
+t_func_void_of_void *a10;
+t_func_void_of_ptr_char_dots *a11;
+t_my_struct *a12;
+t_my_struct1 *a12a;
+t_my_union *a12b;
+t_my_enum *a13;
+t_my_list *a14;
+t_my_tree *a15;
+t_ptr_func_int_of_float_complex *a16;
+t_ptr_func_int_of_double_complex *a17;
+t_ptr_func_int_of_long_double_complex *a18;
+
+int main()
+{
+ return 0;
+}
diff --git a/src/debug/dwarf/testdata/typedef.elf b/src/debug/dwarf/testdata/typedef.elf
new file mode 100755
index 0000000..b2062d2
--- /dev/null
+++ b/src/debug/dwarf/testdata/typedef.elf
Binary files differ
diff --git a/src/debug/dwarf/testdata/typedef.elf4 b/src/debug/dwarf/testdata/typedef.elf4
new file mode 100644
index 0000000..3d5a5a1
--- /dev/null
+++ b/src/debug/dwarf/testdata/typedef.elf4
Binary files differ
diff --git a/src/debug/dwarf/testdata/typedef.elf5 b/src/debug/dwarf/testdata/typedef.elf5
new file mode 100644
index 0000000..aec48f6
--- /dev/null
+++ b/src/debug/dwarf/testdata/typedef.elf5
Binary files differ
diff --git a/src/debug/dwarf/testdata/typedef.macho b/src/debug/dwarf/testdata/typedef.macho
new file mode 100644
index 0000000..f75afcc
--- /dev/null
+++ b/src/debug/dwarf/testdata/typedef.macho
Binary files differ
diff --git a/src/debug/dwarf/testdata/typedef.macho4 b/src/debug/dwarf/testdata/typedef.macho4
new file mode 100644
index 0000000..093ff37
--- /dev/null
+++ b/src/debug/dwarf/testdata/typedef.macho4
Binary files differ