pf2 0.2.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +31 -2
  3. data/Cargo.lock +186 -17
  4. data/Cargo.toml +1 -1
  5. data/README.md +18 -6
  6. data/Rakefile +8 -0
  7. data/crates/backtrace-sys2/.gitignore +1 -0
  8. data/crates/backtrace-sys2/Cargo.toml +9 -0
  9. data/crates/backtrace-sys2/build.rs +48 -0
  10. data/crates/backtrace-sys2/src/lib.rs +5 -0
  11. data/crates/backtrace-sys2/src/libbacktrace/.gitignore +15 -0
  12. data/crates/backtrace-sys2/src/libbacktrace/Isaac.Newton-Opticks.txt +9286 -0
  13. data/crates/backtrace-sys2/src/libbacktrace/LICENSE +29 -0
  14. data/crates/backtrace-sys2/src/libbacktrace/Makefile.am +623 -0
  15. data/crates/backtrace-sys2/src/libbacktrace/Makefile.in +2666 -0
  16. data/crates/backtrace-sys2/src/libbacktrace/README.md +36 -0
  17. data/crates/backtrace-sys2/src/libbacktrace/aclocal.m4 +864 -0
  18. data/crates/backtrace-sys2/src/libbacktrace/alloc.c +167 -0
  19. data/crates/backtrace-sys2/src/libbacktrace/allocfail.c +136 -0
  20. data/crates/backtrace-sys2/src/libbacktrace/allocfail.sh +104 -0
  21. data/crates/backtrace-sys2/src/libbacktrace/atomic.c +113 -0
  22. data/crates/backtrace-sys2/src/libbacktrace/backtrace-supported.h.in +66 -0
  23. data/crates/backtrace-sys2/src/libbacktrace/backtrace.c +129 -0
  24. data/crates/backtrace-sys2/src/libbacktrace/backtrace.h +189 -0
  25. data/crates/backtrace-sys2/src/libbacktrace/btest.c +501 -0
  26. data/crates/backtrace-sys2/src/libbacktrace/compile +348 -0
  27. data/crates/backtrace-sys2/src/libbacktrace/config/enable.m4 +38 -0
  28. data/crates/backtrace-sys2/src/libbacktrace/config/lead-dot.m4 +31 -0
  29. data/crates/backtrace-sys2/src/libbacktrace/config/libtool.m4 +7436 -0
  30. data/crates/backtrace-sys2/src/libbacktrace/config/ltoptions.m4 +369 -0
  31. data/crates/backtrace-sys2/src/libbacktrace/config/ltsugar.m4 +123 -0
  32. data/crates/backtrace-sys2/src/libbacktrace/config/ltversion.m4 +23 -0
  33. data/crates/backtrace-sys2/src/libbacktrace/config/lt~obsolete.m4 +98 -0
  34. data/crates/backtrace-sys2/src/libbacktrace/config/multi.m4 +68 -0
  35. data/crates/backtrace-sys2/src/libbacktrace/config/override.m4 +117 -0
  36. data/crates/backtrace-sys2/src/libbacktrace/config/unwind_ipinfo.m4 +37 -0
  37. data/crates/backtrace-sys2/src/libbacktrace/config/warnings.m4 +227 -0
  38. data/crates/backtrace-sys2/src/libbacktrace/config.guess +1700 -0
  39. data/crates/backtrace-sys2/src/libbacktrace/config.h.in +182 -0
  40. data/crates/backtrace-sys2/src/libbacktrace/config.sub +1885 -0
  41. data/crates/backtrace-sys2/src/libbacktrace/configure +15740 -0
  42. data/crates/backtrace-sys2/src/libbacktrace/configure.ac +613 -0
  43. data/crates/backtrace-sys2/src/libbacktrace/dwarf.c +4402 -0
  44. data/crates/backtrace-sys2/src/libbacktrace/edtest.c +120 -0
  45. data/crates/backtrace-sys2/src/libbacktrace/edtest2.c +43 -0
  46. data/crates/backtrace-sys2/src/libbacktrace/elf.c +7443 -0
  47. data/crates/backtrace-sys2/src/libbacktrace/fileline.c +407 -0
  48. data/crates/backtrace-sys2/src/libbacktrace/filenames.h +52 -0
  49. data/crates/backtrace-sys2/src/libbacktrace/filetype.awk +13 -0
  50. data/crates/backtrace-sys2/src/libbacktrace/install-debuginfo-for-buildid.sh.in +65 -0
  51. data/crates/backtrace-sys2/src/libbacktrace/install-sh +501 -0
  52. data/crates/backtrace-sys2/src/libbacktrace/instrumented_alloc.c +114 -0
  53. data/crates/backtrace-sys2/src/libbacktrace/internal.h +389 -0
  54. data/crates/backtrace-sys2/src/libbacktrace/libtool.m4 +7436 -0
  55. data/crates/backtrace-sys2/src/libbacktrace/ltmain.sh +8636 -0
  56. data/crates/backtrace-sys2/src/libbacktrace/ltoptions.m4 +369 -0
  57. data/crates/backtrace-sys2/src/libbacktrace/ltsugar.m4 +123 -0
  58. data/crates/backtrace-sys2/src/libbacktrace/ltversion.m4 +23 -0
  59. data/crates/backtrace-sys2/src/libbacktrace/lt~obsolete.m4 +98 -0
  60. data/crates/backtrace-sys2/src/libbacktrace/macho.c +1355 -0
  61. data/crates/backtrace-sys2/src/libbacktrace/missing +215 -0
  62. data/crates/backtrace-sys2/src/libbacktrace/mmap.c +331 -0
  63. data/crates/backtrace-sys2/src/libbacktrace/mmapio.c +110 -0
  64. data/crates/backtrace-sys2/src/libbacktrace/move-if-change +83 -0
  65. data/crates/backtrace-sys2/src/libbacktrace/mtest.c +410 -0
  66. data/crates/backtrace-sys2/src/libbacktrace/nounwind.c +66 -0
  67. data/crates/backtrace-sys2/src/libbacktrace/pecoff.c +957 -0
  68. data/crates/backtrace-sys2/src/libbacktrace/posix.c +104 -0
  69. data/crates/backtrace-sys2/src/libbacktrace/print.c +92 -0
  70. data/crates/backtrace-sys2/src/libbacktrace/read.c +110 -0
  71. data/crates/backtrace-sys2/src/libbacktrace/simple.c +108 -0
  72. data/crates/backtrace-sys2/src/libbacktrace/sort.c +108 -0
  73. data/crates/backtrace-sys2/src/libbacktrace/state.c +72 -0
  74. data/crates/backtrace-sys2/src/libbacktrace/stest.c +137 -0
  75. data/crates/backtrace-sys2/src/libbacktrace/test-driver +148 -0
  76. data/crates/backtrace-sys2/src/libbacktrace/test_format.c +55 -0
  77. data/crates/backtrace-sys2/src/libbacktrace/testlib.c +234 -0
  78. data/crates/backtrace-sys2/src/libbacktrace/testlib.h +110 -0
  79. data/crates/backtrace-sys2/src/libbacktrace/ttest.c +161 -0
  80. data/crates/backtrace-sys2/src/libbacktrace/unittest.c +92 -0
  81. data/crates/backtrace-sys2/src/libbacktrace/unknown.c +65 -0
  82. data/crates/backtrace-sys2/src/libbacktrace/xcoff.c +1606 -0
  83. data/crates/backtrace-sys2/src/libbacktrace/xztest.c +508 -0
  84. data/crates/backtrace-sys2/src/libbacktrace/zstdtest.c +523 -0
  85. data/crates/backtrace-sys2/src/libbacktrace/ztest.c +541 -0
  86. data/ext/pf2/Cargo.toml +1 -0
  87. data/ext/pf2/src/backtrace.rs +127 -0
  88. data/ext/pf2/src/lib.rs +3 -0
  89. data/ext/pf2/src/profile.rs +16 -1
  90. data/ext/pf2/src/profile_serializer.rs +95 -21
  91. data/ext/pf2/src/ringbuffer.rs +7 -0
  92. data/ext/pf2/src/ruby_init.rs +18 -6
  93. data/ext/pf2/src/ruby_internal_apis.rs +47 -0
  94. data/ext/pf2/src/sample.rs +22 -1
  95. data/ext/pf2/src/signal_scheduler/configuration.rs +7 -0
  96. data/ext/pf2/src/signal_scheduler/timer_installer.rs +79 -126
  97. data/ext/pf2/src/signal_scheduler.rs +95 -26
  98. data/ext/pf2/src/timer_thread_scheduler.rs +88 -12
  99. data/ext/pf2/src/util.rs +2 -2
  100. data/lib/pf2/reporter.rb +12 -5
  101. data/lib/pf2/version.rb +1 -1
  102. data/lib/pf2.rb +3 -6
  103. metadata +97 -6
@@ -0,0 +1,29 @@
1
+ # Copyright (C) 2012-2016 Free Software Foundation, Inc.
2
+
3
+ # Redistribution and use in source and binary forms, with or without
4
+ # modification, are permitted provided that the following conditions are
5
+ # met:
6
+
7
+ # (1) Redistributions of source code must retain the above copyright
8
+ # notice, this list of conditions and the following disclaimer.
9
+
10
+ # (2) Redistributions in binary form must reproduce the above copyright
11
+ # notice, this list of conditions and the following disclaimer in
12
+ # the documentation and/or other materials provided with the
13
+ # distribution.
14
+
15
+ # (3) The name of the author may not be used to
16
+ # endorse or promote products derived from this software without
17
+ # specific prior written permission.
18
+
19
+ # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20
+ # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ # DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
23
+ # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24
+ # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26
+ # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27
+ # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
28
+ # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
+ # POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,623 @@
1
+ # Makefile.am -- Backtrace Makefile.
2
+ # Copyright (C) 2012-2021 Free Software Foundation, Inc.
3
+
4
+ # Redistribution and use in source and binary forms, with or without
5
+ # modification, are permitted provided that the following conditions are
6
+ # met:
7
+
8
+ # (1) Redistributions of source code must retain the above copyright
9
+ # notice, this list of conditions and the following disclaimer.
10
+
11
+ # (2) Redistributions in binary form must reproduce the above copyright
12
+ # notice, this list of conditions and the following disclaimer in
13
+ # the documentation and/or other materials provided with the
14
+ # distribution.
15
+
16
+ # (3) The name of the author may not be used to
17
+ # endorse or promote products derived from this software without
18
+ # specific prior written permission.
19
+
20
+ # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21
+ # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22
+ # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ # DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
24
+ # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25
+ # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27
+ # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28
+ # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
29
+ # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
+ # POSSIBILITY OF SUCH DAMAGE.
31
+
32
+ ACLOCAL_AMFLAGS = -I config
33
+
34
+ AM_CPPFLAGS =
35
+
36
+ AM_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) $(PIC_FLAG)
37
+
38
+ include_HEADERS = backtrace.h backtrace-supported.h
39
+
40
+ lib_LTLIBRARIES = libbacktrace.la
41
+
42
+ libbacktrace_la_SOURCES = \
43
+ backtrace.h \
44
+ atomic.c \
45
+ dwarf.c \
46
+ fileline.c \
47
+ internal.h \
48
+ posix.c \
49
+ print.c \
50
+ sort.c \
51
+ state.c
52
+
53
+ BACKTRACE_FILES = \
54
+ backtrace.c \
55
+ simple.c \
56
+ nounwind.c
57
+
58
+ FORMAT_FILES = \
59
+ elf.c \
60
+ macho.c \
61
+ pecoff.c \
62
+ unknown.c \
63
+ xcoff.c
64
+
65
+ VIEW_FILES = \
66
+ read.c \
67
+ mmapio.c
68
+
69
+ ALLOC_FILES = \
70
+ alloc.c \
71
+ mmap.c
72
+
73
+ EXTRA_libbacktrace_la_SOURCES = \
74
+ $(BACKTRACE_FILES) \
75
+ $(FORMAT_FILES) \
76
+ $(VIEW_FILES) \
77
+ $(ALLOC_FILES)
78
+
79
+ libbacktrace_la_LIBADD = \
80
+ $(BACKTRACE_FILE) \
81
+ $(FORMAT_FILE) \
82
+ $(VIEW_FILE) \
83
+ $(ALLOC_FILE)
84
+
85
+ libbacktrace_la_DEPENDENCIES = $(libbacktrace_la_LIBADD)
86
+
87
+ # Testsuite.
88
+
89
+ # Add a test to this variable if you want it to be built as a program,
90
+ # with SOURCES, etc.
91
+ check_PROGRAMS =
92
+
93
+ # Add a test to this variable if you want it to be run.
94
+ TESTS =
95
+
96
+ # Add a test to this variable if you want it to be built as a Makefile
97
+ # target and run.
98
+ MAKETESTS =
99
+
100
+ # Add a test to this variable if you want it to be built as a program,
101
+ # with SOURCES, etc., and run.
102
+ BUILDTESTS =
103
+
104
+ # Add a file to this variable if you want it to be built for testing.
105
+ check_DATA =
106
+
107
+ # Flags to use when compiling test programs.
108
+ libbacktrace_TEST_CFLAGS = $(EXTRA_FLAGS) $(WARN_FLAGS) -g
109
+
110
+ if USE_DSYMUTIL
111
+
112
+ %.dSYM: %
113
+ $(DSYMUTIL) $<
114
+
115
+ endif USE_DSYMUTIL
116
+
117
+ if NATIVE
118
+ check_LTLIBRARIES = libbacktrace_alloc.la
119
+
120
+ libbacktrace_alloc_la_SOURCES = $(libbacktrace_la_SOURCES)
121
+ libbacktrace_alloc_la_LIBADD = $(BACKTRACE_FILE) $(FORMAT_FILE) read.lo alloc.lo
122
+
123
+ libbacktrace_alloc_la_DEPENDENCIES = $(libbacktrace_alloc_la_LIBADD)
124
+
125
+ check_LTLIBRARIES += libbacktrace_noformat.la
126
+
127
+ libbacktrace_noformat_la_SOURCES = $(libbacktrace_la_SOURCES)
128
+ libbacktrace_noformat_la_LIBADD = $(BACKTRACE_FILE) $(VIEW_FILE) $(ALLOC_FILE)
129
+
130
+ libbacktrace_noformat_la_DEPENDENCIES = $(libbacktrace_noformat_la_LIBADD)
131
+
132
+ if HAVE_ELF
133
+ if HAVE_OBJCOPY_DEBUGLINK
134
+
135
+ TEST_BUILD_ID_DIR=$(abs_builddir)/usr/lib/debug/.build-id/
136
+
137
+ check_LTLIBRARIES += libbacktrace_elf_for_test.la
138
+
139
+ libbacktrace_elf_for_test_la_SOURCES = $(libbacktrace_la_SOURCES)
140
+ libbacktrace_elf_for_test_la_LIBADD = $(BACKTRACE_FILE) elf_for_test.lo \
141
+ $(VIEW_FILE) $(ALLOC_FILE)
142
+
143
+ elf_for_test.c: elf.c
144
+ SEARCH='^#define SYSTEM_BUILD_ID_DIR.*$$'; \
145
+ REPLACE="#define SYSTEM_BUILD_ID_DIR \"$(TEST_BUILD_ID_DIR)\""; \
146
+ $(SED) "s%$$SEARCH%$$REPLACE%" \
147
+ $< \
148
+ > $@.tmp
149
+ mv $@.tmp $@
150
+
151
+ endif HAVE_OBJCOPY_DEBUGLINK
152
+ endif HAVE_ELF
153
+
154
+ elf_%.c: elf.c
155
+ SEARCH='#error "Unknown BACKTRACE_ELF_SIZE"'; \
156
+ REPLACE='#undef BACKTRACE_ELF_SIZE\
157
+ #define BACKTRACE_ELF_SIZE'; \
158
+ $(SED) "s/^$$SEARCH\$$/$$REPLACE $*/" \
159
+ $< \
160
+ > $@.tmp
161
+ mv $@.tmp $@
162
+
163
+ xcoff_%.c: xcoff.c
164
+ SEARCH='#error "Unknown BACKTRACE_XCOFF_SIZE"'; \
165
+ REPLACE='#undef BACKTRACE_XCOFF_SIZE\
166
+ #define BACKTRACE_XCOFF_SIZE'; \
167
+ $(SED) "s/^$$SEARCH\$$/$$REPLACE $*/" \
168
+ $< \
169
+ > $@.tmp
170
+ mv $@.tmp $@
171
+
172
+ test_elf_32_SOURCES = test_format.c testlib.c
173
+ test_elf_32_CFLAGS = $(libbacktrace_TEST_CFLAGS)
174
+ test_elf_32_LDADD = libbacktrace_noformat.la elf_32.lo
175
+
176
+ BUILDTESTS += test_elf_32
177
+
178
+ test_elf_64_SOURCES = test_format.c testlib.c
179
+ test_elf_64_CFLAGS = $(libbacktrace_TEST_CFLAGS)
180
+ test_elf_64_LDADD = libbacktrace_noformat.la elf_64.lo
181
+
182
+ BUILDTESTS += test_elf_64
183
+
184
+ test_macho_SOURCES = test_format.c testlib.c
185
+ test_macho_CFLAGS = $(libbacktrace_TEST_CFLAGS)
186
+ test_macho_LDADD = libbacktrace_noformat.la macho.lo
187
+
188
+ BUILDTESTS += test_macho
189
+
190
+ test_xcoff_32_SOURCES = test_format.c testlib.c
191
+ test_xcoff_32_CFLAGS = $(libbacktrace_TEST_CFLAGS)
192
+ test_xcoff_32_LDADD = libbacktrace_noformat.la xcoff_32.lo
193
+
194
+ BUILDTESTS += test_xcoff_32
195
+
196
+ test_xcoff_64_SOURCES = test_format.c testlib.c
197
+ test_xcoff_64_CFLAGS = $(libbacktrace_TEST_CFLAGS)
198
+ test_xcoff_64_LDADD = libbacktrace_noformat.la xcoff_64.lo
199
+
200
+ BUILDTESTS += test_xcoff_64
201
+
202
+ test_pecoff_SOURCES = test_format.c testlib.c
203
+ test_pecoff_CFLAGS = $(libbacktrace_TEST_CFLAGS)
204
+ test_pecoff_LDADD = libbacktrace_noformat.la pecoff.lo
205
+
206
+ BUILDTESTS += test_pecoff
207
+
208
+ test_unknown_SOURCES = test_format.c testlib.c
209
+ test_unknown_CFLAGS = $(libbacktrace_TEST_CFLAGS)
210
+ test_unknown_LDADD = libbacktrace_noformat.la unknown.lo
211
+
212
+ BUILDTESTS += test_unknown
213
+
214
+ unittest_SOURCES = unittest.c testlib.c
215
+ unittest_CFLAGS = $(libbacktrace_TEST_CFLAGS)
216
+ unittest_LDADD = libbacktrace.la
217
+
218
+ BUILDTESTS += unittest
219
+
220
+ unittest_alloc_SOURCES = $(unittest_SOURCES)
221
+ unittest_alloc_CFLAGS = $(libbacktrace_TEST_CFLAGS)
222
+ unittest_alloc_LDADD = libbacktrace_alloc.la
223
+
224
+ BUILDTESTS += unittest_alloc
225
+
226
+ check_LTLIBRARIES += libbacktrace_instrumented_alloc.la
227
+
228
+ libbacktrace_instrumented_alloc_la_SOURCES = $(libbacktrace_la_SOURCES)
229
+ libbacktrace_instrumented_alloc_la_LIBADD = $(BACKTRACE_FILE) $(FORMAT_FILE) \
230
+ read.lo instrumented_alloc.lo
231
+
232
+ libbacktrace_instrumented_alloc_la_DEPENDENCIES = \
233
+ $(libbacktrace_instrumented_alloc_la_LIBADD)
234
+
235
+ instrumented_alloc.lo: alloc.c
236
+
237
+ allocfail_SOURCES = allocfail.c testlib.c
238
+ allocfail_CFLAGS = $(libbacktrace_TEST_CFLAGS)
239
+ allocfail_LDADD = libbacktrace_instrumented_alloc.la
240
+
241
+ check_PROGRAMS += allocfail
242
+
243
+ allocfail.sh: allocfail
244
+
245
+ TESTS += allocfail.sh
246
+
247
+ if USE_DSYMUTIL
248
+ check_DATA += allocfail.dSYM
249
+ endif USE_DSYMUTIL
250
+
251
+ if HAVE_ELF
252
+ if HAVE_BUILDID
253
+ if HAVE_OBJCOPY_DEBUGLINK
254
+
255
+ b2test_SOURCES = $(btest_SOURCES)
256
+ b2test_CFLAGS = $(libbacktrace_TEST_CFLAGS)
257
+ b2test_LDFLAGS = -Wl,--build-id
258
+ b2test_LDADD = libbacktrace_elf_for_test.la
259
+
260
+ check_PROGRAMS += b2test
261
+ MAKETESTS += b2test_buildid
262
+
263
+ if HAVE_DWZ
264
+
265
+ b3test_SOURCES = $(btest_SOURCES)
266
+ b3test_CFLAGS = $(libbacktrace_TEST_CFLAGS)
267
+ b3test_LDFLAGS = -Wl,--build-id
268
+ b3test_LDADD = libbacktrace_elf_for_test.la
269
+
270
+ check_PROGRAMS += b3test
271
+ MAKETESTS += b3test_dwz_buildid
272
+
273
+ endif HAVE_DWZ
274
+
275
+ endif HAVE_OBJCOPY_DEBUGLINK
276
+ endif HAVE_BUILDID
277
+ endif HAVE_ELF
278
+
279
+ btest_SOURCES = btest.c testlib.c
280
+ btest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -O
281
+ btest_LDADD = libbacktrace.la
282
+
283
+ BUILDTESTS += btest
284
+
285
+ if USE_DSYMUTIL
286
+ check_DATA += btest.dSYM
287
+ endif USE_DSYMUTIL
288
+
289
+ if HAVE_ELF
290
+
291
+ btest_lto_SOURCES = btest.c testlib.c
292
+ btest_lto_CFLAGS = $(libbacktrace_TEST_CFLAGS) -O -flto
293
+ btest_lto_LDADD = libbacktrace.la
294
+
295
+ BUILDTESTS += btest_lto
296
+
297
+ endif HAVE_ELF
298
+
299
+ btest_alloc_SOURCES = $(btest_SOURCES)
300
+ btest_alloc_CFLAGS = $(libbacktrace_TEST_CFLAGS)
301
+ btest_alloc_LDADD = libbacktrace_alloc.la
302
+
303
+ BUILDTESTS += btest_alloc
304
+
305
+ if USE_DSYMUTIL
306
+ check_DATA += btest_alloc.dSYM
307
+ endif USE_DSYMUTIL
308
+
309
+ if HAVE_DWZ
310
+
311
+ %_dwz: %
312
+ rm -f $@ $@_common.debug
313
+ cp $< $@_1
314
+ cp $< $@_2
315
+ if $(DWZ) -m $@_common.debug $@_1 $@_2; then \
316
+ rm -f $@_2; \
317
+ mv $@_1 $@; \
318
+ else \
319
+ echo "Ignoring dwz errors, assuming that test passes"; \
320
+ cp $< $@; \
321
+ fi
322
+
323
+ MAKETESTS += btest_dwz
324
+
325
+ if HAVE_OBJCOPY_DEBUGLINK
326
+
327
+ MAKETESTS += btest_dwz_gnudebuglink
328
+
329
+ endif HAVE_OBJCOPY_DEBUGLINK
330
+
331
+ endif HAVE_DWZ
332
+
333
+ stest_SOURCES = stest.c
334
+ stest_CFLAGS = $(libbacktrace_TEST_CFLAGS)
335
+ stest_LDADD = libbacktrace.la
336
+
337
+ BUILDTESTS += stest
338
+
339
+ if USE_DSYMUTIL
340
+ check_DATA += stest.dSYM
341
+ endif USE_DSYMUTIL
342
+
343
+ stest_alloc_SOURCES = $(stest_SOURCES)
344
+ stest_alloc_CFLAGS = $(libbacktrace_TEST_CFLAGS)
345
+ stest_alloc_LDADD = libbacktrace_alloc.la
346
+
347
+ BUILDTESTS += stest_alloc
348
+
349
+ if USE_DSYMUTIL
350
+ check_DATA += stest_alloc.dSYM
351
+ endif USE_DSYMUTIL
352
+
353
+ if HAVE_ELF
354
+
355
+ ztest_SOURCES = ztest.c testlib.c
356
+ ztest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -DSRCDIR=\"$(srcdir)\"
357
+ ztest_LDADD = libbacktrace.la
358
+ ztest_alloc_LDADD = libbacktrace_alloc.la
359
+
360
+ if HAVE_ZLIB
361
+ ztest_LDADD += -lz
362
+ ztest_alloc_LDADD += -lz
363
+ endif
364
+ ztest_LDADD += $(CLOCK_GETTIME_LINK)
365
+ ztest_alloc_LDADD += $(CLOCK_GETTIME_LINK)
366
+
367
+ BUILDTESTS += ztest
368
+
369
+ ztest_alloc_SOURCES = $(ztest_SOURCES)
370
+ ztest_alloc_CFLAGS = $(ztest_CFLAGS)
371
+
372
+ BUILDTESTS += ztest_alloc
373
+
374
+ zstdtest_SOURCES = zstdtest.c testlib.c
375
+ zstdtest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -DSRCDIR=\"$(srcdir)\"
376
+ zstdtest_LDADD = libbacktrace.la
377
+ zstdtest_alloc_LDADD = libbacktrace_alloc.la
378
+
379
+ if HAVE_ZSTD
380
+ zstdtest_LDADD += -lzstd
381
+ zstdtest_alloc_LDADD += -lzstd
382
+ endif
383
+ zstdtest_LDADD += $(CLOCK_GETTIME_LINK)
384
+ zstdtest_alloc_LDADD += $(CLOCK_GETTIME_LINK)
385
+
386
+ BUILDTESTS += zstdtest
387
+
388
+ zstdtest_alloc_SOURCES = $(zstdtest_SOURCES)
389
+ zstdtest_alloc_CFLAGS = $(zstdtest_CFLAGS)
390
+
391
+ BUILDTESTS += zstdtest_alloc
392
+
393
+ endif HAVE_ELF
394
+
395
+ edtest_SOURCES = edtest.c edtest2_build.c testlib.c
396
+ edtest_CFLAGS = $(libbacktrace_TEST_CFLAGS)
397
+ edtest_LDADD = libbacktrace.la
398
+
399
+ BUILDTESTS += edtest
400
+
401
+ if USE_DSYMUTIL
402
+ check_DATA += edtest.dSYM
403
+ endif USE_DSYMUTIL
404
+
405
+ edtest_alloc_SOURCES = $(edtest_SOURCES)
406
+ edtest_alloc_CFLAGS = $(libbacktrace_TEST_CFLAGS)
407
+ edtest_alloc_LDADD = libbacktrace_alloc.la
408
+
409
+ if USE_DSYMUTIL
410
+ check_DATA += edtest_alloc.dSYM
411
+ endif USE_DSYMUTIL
412
+
413
+ BUILDTESTS += edtest_alloc
414
+
415
+ edtest2_build.c: gen_edtest2_build; @true
416
+ gen_edtest2_build: $(srcdir)/edtest2.c
417
+ cat $(srcdir)/edtest2.c > tmp-edtest2_build.c
418
+ $(SHELL) $(srcdir)/move-if-change tmp-edtest2_build.c edtest2_build.c
419
+ echo timestamp > $@
420
+
421
+ if HAVE_PTHREAD
422
+
423
+ BUILDTESTS += ttest
424
+
425
+ ttest_SOURCES = ttest.c testlib.c
426
+ ttest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -pthread
427
+ ttest_LDADD = libbacktrace.la
428
+
429
+ if USE_DSYMUTIL
430
+ check_DATA += ttest.dSYM
431
+ endif USE_DSYMUTIL
432
+
433
+ BUILDTESTS += ttest_alloc
434
+
435
+ ttest_alloc_SOURCES = $(ttest_SOURCES)
436
+ ttest_alloc_CFLAGS = $(ttest_CFLAGS)
437
+ ttest_alloc_LDADD = libbacktrace_alloc.la
438
+
439
+ if USE_DSYMUTIL
440
+ check_DATA += ttest_alloc.dSYM
441
+ endif USE_DSYMUTIL
442
+
443
+ endif HAVE_PTHREAD
444
+
445
+ if HAVE_OBJCOPY_DEBUGLINK
446
+
447
+ MAKETESTS += btest_gnudebuglink
448
+
449
+ %_gnudebuglink: %
450
+ $(OBJCOPY) --only-keep-debug $< $@.debug
451
+ $(OBJCOPY) --strip-debug --add-gnu-debuglink=$@.debug $< $@
452
+
453
+ endif HAVE_OBJCOPY_DEBUGLINK
454
+
455
+ %_buildid: %
456
+ ./install-debuginfo-for-buildid.sh \
457
+ "$(TEST_BUILD_ID_DIR)" \
458
+ $<
459
+ $(OBJCOPY) --strip-debug $< $@
460
+
461
+ if HAVE_COMPRESSED_DEBUG
462
+
463
+ ctestg_SOURCES = btest.c testlib.c
464
+ ctestg_CFLAGS = $(libbacktrace_TEST_CFLAGS)
465
+ ctestg_LDFLAGS = -Wl,--compress-debug-sections=zlib-gnu
466
+ ctestg_LDADD = libbacktrace.la
467
+
468
+ ctesta_SOURCES = btest.c testlib.c
469
+ ctesta_CFLAGS = $(libbacktrace_TEST_CFLAGS)
470
+ ctesta_LDFLAGS = -Wl,--compress-debug-sections=zlib-gabi
471
+ ctesta_LDADD = libbacktrace.la
472
+
473
+ BUILDTESTS += ctestg ctesta
474
+
475
+ if HAVE_COMPRESSED_DEBUG_ZSTD
476
+
477
+ ctestzstd_SOURCES = btest.c testlib.c
478
+ ctestzstd_CFLAGS = $(libbacktrace_TEST_CFLAGS)
479
+ ctestzstd_LDFLAGS = -Wl,--compress-debug-sections=zstd
480
+ ctestzstd_LDADD = libbacktrace.la
481
+
482
+ BUILDTESTS += ctestzstd
483
+
484
+ endif
485
+
486
+ ctestg_alloc_SOURCES = $(ctestg_SOURCES)
487
+ ctestg_alloc_CFLAGS = $(ctestg_CFLAGS)
488
+ ctestg_alloc_LDFLAGS = $(ctestg_LDFLAGS)
489
+ ctestg_alloc_LDADD = libbacktrace_alloc.la
490
+
491
+ ctesta_alloc_SOURCES = $(ctesta_SOURCES)
492
+ ctesta_alloc_CFLAGS = $(ctesta_CFLAGS)
493
+ ctesta_alloc_LDFLAGS = $(ctesta_LDFLAGS)
494
+ ctesta_alloc_LDADD = libbacktrace_alloc.la
495
+
496
+ BUILDTESTS += ctestg_alloc ctesta_alloc
497
+
498
+ endif
499
+
500
+ if HAVE_DWARF5
501
+
502
+ dwarf5_SOURCES = btest.c testlib.c
503
+ dwarf5_CFLAGS = $(libbacktrace_TEST_CFLAGS) -gdwarf-5
504
+ dwarf5_LDADD = libbacktrace.la
505
+
506
+ BUILDTESTS += dwarf5
507
+
508
+ if USE_DSYMUTIL
509
+ check_DATA += dwarf5.dSYM
510
+ endif USE_DSYMUTIL
511
+
512
+ dwarf5_alloc_SOURCES = $(dwarf5_SOURCES)
513
+ dwarf5_alloc_CFLAGS = $(dwarf5_CFLAGS)
514
+ dwarf5_alloc_LDADD = libbacktrace_alloc.la
515
+
516
+ BUILDTESTS += dwarf5_alloc
517
+
518
+ if USE_DSYMUTIL
519
+ check_DATA += dwarf5_alloc.dSYM
520
+ endif USE_DSYMUTIL
521
+
522
+ endif
523
+
524
+ mtest_SOURCES = mtest.c testlib.c
525
+ mtest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -O
526
+ mtest_LDADD = libbacktrace.la
527
+
528
+ BUILDTESTS += mtest
529
+
530
+ if USE_DSYMUTIL
531
+ check_DATA += mtest.dSYM
532
+ endif USE_DSYMUTIL
533
+
534
+ if HAVE_MINIDEBUG
535
+
536
+ MAKETESTS += mtest_minidebug
537
+
538
+ %_minidebug: %
539
+ $(NM) -D $< -P --defined-only | $(AWK) '{ print $$1 }' | sort > $<.dsyms
540
+ $(NM) $< -P --defined-only | $(AWK) '{ if ($$2 == "T" || $$2 == "t" || $$2 == "D") print $$1 }' | sort > $<.fsyms
541
+ $(COMM) -13 $<.dsyms $<.fsyms > $<.keepsyms
542
+ $(OBJCOPY) --only-keep-debug $< $<.dbg
543
+ $(OBJCOPY) -S --remove-section .gdb_index --remove-section .comment --keep-symbols=$<.keepsyms $<.dbg $<.mdbg
544
+ $(OBJCOPY) --strip-all --remove-section ..comment $< $<.strip
545
+ rm -f $<.mdbg.xz
546
+ $(XZ) $<.mdbg
547
+ $(OBJCOPY) --add-section .gnu_debugdata=$<.mdbg.xz $<.strip
548
+ mv $<.strip $@
549
+
550
+ endif HAVE_MINIDEBUG
551
+
552
+ endif NATIVE
553
+
554
+ if HAVE_ELF
555
+
556
+ xztest_SOURCES = xztest.c testlib.c
557
+ xztest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -DSRCDIR=\"$(srcdir)\"
558
+ xztest_LDADD = libbacktrace.la
559
+
560
+ xztest_alloc_SOURCES = $(xztest_SOURCES)
561
+ xztest_alloc_CFLAGS = $(xztest_CFLAGS)
562
+ xztest_alloc_LDADD = libbacktrace_alloc.la
563
+
564
+ if HAVE_LIBLZMA
565
+ xztest_LDADD += -llzma
566
+ xztest_alloc_LDADD += -llzma
567
+ endif
568
+
569
+ xztest_LDADD += $(CLOCK_GETTIME_LINK)
570
+ xztest_alloc_LDADD += $(CLOCK_GETTIME_LINK)
571
+
572
+ BUILDTESTS += xztest xztest_alloc
573
+
574
+ endif HAVE_ELF
575
+
576
+ check_PROGRAMS += $(BUILDTESTS)
577
+
578
+ TESTS += $(MAKETESTS) $(BUILDTESTS)
579
+
580
+ CLEANFILES = \
581
+ $(MAKETESTS) $(BUILDTESTS) *.debug elf_for_test.c edtest2_build.c \
582
+ gen_edtest2_build \
583
+ *.dsyms *.fsyms *.keepsyms *.dbg *.mdbg *.mdbg.xz *.strip
584
+
585
+ clean-local:
586
+ -rm -rf usr
587
+
588
+ # We can't use automake's automatic dependency tracking, because it
589
+ # breaks when using bootstrap-lean. Automatic dependency tracking
590
+ # with GCC bootstrap will cause some of the objects to depend on
591
+ # header files in prev-gcc/include, e.g., stddef.h and stdarg.h. When
592
+ # using bootstrap-lean, prev-gcc is removed after each stage. When
593
+ # running "make install", those header files will be gone, causing the
594
+ # library to be rebuilt at install time. That may not succeed.
595
+
596
+ # These manual dependencies do not include dependencies on unwind.h,
597
+ # even though that is part of GCC, because where to find it depends on
598
+ # whether we are being built as a host library or a target library.
599
+
600
+ alloc.lo: config.h backtrace.h internal.h
601
+ backtrace.lo: config.h backtrace.h internal.h
602
+ btest.lo: filenames.h backtrace.h backtrace-supported.h
603
+ dwarf.lo: config.h filenames.h backtrace.h internal.h
604
+ elf.lo: config.h backtrace.h internal.h
605
+ fileline.lo: config.h backtrace.h internal.h
606
+ macho.lo: config.h backtrace.h internal.h
607
+ mmap.lo: config.h backtrace.h internal.h
608
+ mmapio.lo: config.h backtrace.h internal.h
609
+ mtest.lo: backtrace.h backtrace-supported.h
610
+ nounwind.lo: config.h internal.h
611
+ pecoff.lo: config.h backtrace.h internal.h
612
+ posix.lo: config.h backtrace.h internal.h
613
+ print.lo: config.h backtrace.h internal.h
614
+ read.lo: config.h backtrace.h internal.h
615
+ simple.lo: config.h backtrace.h internal.h
616
+ sort.lo: config.h backtrace.h internal.h
617
+ stest.lo: config.h backtrace.h internal.h
618
+ state.lo: config.h backtrace.h backtrace-supported.h internal.h
619
+ unknown.lo: config.h backtrace.h internal.h
620
+ xcoff.lo: config.h backtrace.h internal.h
621
+ xztest.lo: config.h backtrace.h backtrace-supported.h internal.h testlib.h
622
+ ztest.lo: config.h backtrace.h backtrace-supported.h internal.h testlib.h
623
+