blob: b0b0a97c42b8c6a7d28b4be56575403e8a4352af (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
# Nonsensical program used to generate example DWARF package files with type
# units, location lists, range lists, and macros.
# = foobar.h =
struct Foo
{
int a, b;
int foo ();
};
struct Bar
{
long a, b;
long bar ();
};
#define FROB(x) ((x) ^ 0x2a2a2a2a)
#define FRY(x) ((x) * 0x100000001b3)
inline long
fibonacci (unsigned int n)
{
if (n == 0)
return 0;
else
{
long a = 0;
long b = 1;
for (unsigned int i = 2; i < n; i++)
{
long tmp = a + b;
a = b;
b = tmp;
}
return b;
}
}
# = foo.cc =
#include "foobar.h"
#define ZERO() (1 - 1)
int
x_x (int x)
{
for (int i = x; i > ZERO(); i--)
x *= x;
return x;
}
int
Foo::foo ()
{
int x = a;
if (a > b)
x -= b;
return FROB (x_x (x));
}
# = bar.cc =
#include "foobar.h"
#define ONE 1
long
Bar::bar ()
{
if (a == b)
return ONE;
else
return a > b ? b : a;
}
# = main.cc =
#include "foobar.h"
#define MAIN_ARGS int argc, char **argv
int
main(MAIN_ARGS)
{
struct Foo myfoo { argc, FROB (argc) };
struct Bar mybar { fibonacci (argc), FRY (argc) };
return myfoo.foo() + mybar.bar();
}
# Built with GCC at commit 80048aa13a6b ("debug/111409 - don't generate COMDAT
# macro sections for split DWARF").
$ g++ -gdwarf-5 -gsplit-dwarf -fdebug-types-section -g3 -O2 foo.cc bar.cc main.cc -o testfile-dwp-5
# GNU dwp as of binutils 2.41 only supports DWARF 4.
$ llvm-dwp -e testfile-dwp-5 -o testfile-dwp-5.dwp
$ g++ -gdwarf-4 -gsplit-dwarf -fdebug-types-section -g3 -O2 foo.cc bar.cc main.cc -o testfile-dwp-4
$ dwp -e testfile-dwp-4
$ g++ -gdwarf-4 -gstrict-dwarf -gsplit-dwarf -fdebug-types-section -g3 -O2 foo.cc bar.cc main.cc -o testfile-dwp-4-strict
$ dwp -e testfile-dwp-4-strict
|