pf2 0.7.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +19 -0
  3. data/README.md +11 -0
  4. data/Rakefile +9 -2
  5. data/doc/development.md +11 -0
  6. data/examples/mandelbrot.rb +69 -0
  7. data/examples/mandelbrot_ractor.rb +77 -0
  8. data/ext/pf2/build.rs +7 -0
  9. data/ext/pf2/src/ruby_c_api_helper.c +6 -0
  10. data/ext/pf2/src/serialization/profile.rs +1 -0
  11. data/ext/pf2/src/serialization/serializer.rs +4 -0
  12. data/ext/pf2/src/signal_scheduler.rs +1 -1
  13. data/ext/pf2/src/util.rs +2 -1
  14. data/ext/pf2c/backtrace_state.c +10 -0
  15. data/ext/pf2c/backtrace_state.h +10 -0
  16. data/ext/pf2c/configuration.c +90 -0
  17. data/ext/pf2c/configuration.h +23 -0
  18. data/ext/pf2c/extconf.rb +21 -0
  19. data/ext/pf2c/pf2.c +17 -0
  20. data/ext/pf2c/pf2.h +8 -0
  21. data/ext/pf2c/ringbuffer.c +74 -0
  22. data/ext/pf2c/ringbuffer.h +24 -0
  23. data/ext/pf2c/sample.c +70 -0
  24. data/ext/pf2c/sample.h +22 -0
  25. data/ext/pf2c/serializer.c +377 -0
  26. data/ext/pf2c/serializer.h +58 -0
  27. data/ext/pf2c/session.c +344 -0
  28. data/ext/pf2c/session.h +51 -0
  29. data/lib/pf2/cli.rb +33 -2
  30. data/lib/pf2/reporter/annotate.rb +101 -0
  31. data/lib/pf2/reporter/firefox_profiler.rb +1 -1
  32. data/lib/pf2/reporter/firefox_profiler_ser2.rb +308 -0
  33. data/lib/pf2/reporter.rb +2 -0
  34. data/lib/pf2/version.rb +1 -1
  35. data/vendor/libbacktrace/.gitignore +5 -0
  36. data/vendor/libbacktrace/Isaac.Newton-Opticks.txt +9286 -0
  37. data/vendor/libbacktrace/LICENSE +29 -0
  38. data/vendor/libbacktrace/Makefile.am +708 -0
  39. data/vendor/libbacktrace/Makefile.in +2820 -0
  40. data/vendor/libbacktrace/README.md +46 -0
  41. data/vendor/libbacktrace/aclocal.m4 +864 -0
  42. data/vendor/libbacktrace/alloc.c +167 -0
  43. data/vendor/libbacktrace/allocfail.c +136 -0
  44. data/vendor/libbacktrace/allocfail.sh +104 -0
  45. data/vendor/libbacktrace/atomic.c +113 -0
  46. data/vendor/libbacktrace/backtrace-supported.h.in +66 -0
  47. data/vendor/libbacktrace/backtrace.c +129 -0
  48. data/vendor/libbacktrace/backtrace.h +189 -0
  49. data/vendor/libbacktrace/btest.c +517 -0
  50. data/vendor/libbacktrace/compile +348 -0
  51. data/vendor/libbacktrace/config/enable.m4 +38 -0
  52. data/vendor/libbacktrace/config/lead-dot.m4 +31 -0
  53. data/vendor/libbacktrace/config/libtool.m4 +7545 -0
  54. data/vendor/libbacktrace/config/ltoptions.m4 +369 -0
  55. data/vendor/libbacktrace/config/ltsugar.m4 +123 -0
  56. data/vendor/libbacktrace/config/ltversion.m4 +23 -0
  57. data/vendor/libbacktrace/config/lt~obsolete.m4 +98 -0
  58. data/vendor/libbacktrace/config/multi.m4 +68 -0
  59. data/vendor/libbacktrace/config/override.m4 +117 -0
  60. data/vendor/libbacktrace/config/unwind_ipinfo.m4 +37 -0
  61. data/vendor/libbacktrace/config/warnings.m4 +227 -0
  62. data/vendor/libbacktrace/config.guess +1700 -0
  63. data/vendor/libbacktrace/config.h.in +185 -0
  64. data/vendor/libbacktrace/config.sub +1885 -0
  65. data/vendor/libbacktrace/configure +15952 -0
  66. data/vendor/libbacktrace/configure.ac +642 -0
  67. data/vendor/libbacktrace/dwarf.c +4593 -0
  68. data/vendor/libbacktrace/edtest.c +120 -0
  69. data/vendor/libbacktrace/edtest2.c +43 -0
  70. data/vendor/libbacktrace/elf.c +7471 -0
  71. data/vendor/libbacktrace/fileline.c +407 -0
  72. data/vendor/libbacktrace/filenames.h +52 -0
  73. data/vendor/libbacktrace/filetype.awk +13 -0
  74. data/vendor/libbacktrace/install-debuginfo-for-buildid.sh.in +65 -0
  75. data/vendor/libbacktrace/install-sh +501 -0
  76. data/vendor/libbacktrace/instrumented_alloc.c +114 -0
  77. data/vendor/libbacktrace/internal.h +428 -0
  78. data/vendor/libbacktrace/ltmain.sh +8636 -0
  79. data/vendor/libbacktrace/macho.c +1361 -0
  80. data/vendor/libbacktrace/missing +215 -0
  81. data/vendor/libbacktrace/mmap.c +331 -0
  82. data/vendor/libbacktrace/mmapio.c +110 -0
  83. data/vendor/libbacktrace/move-if-change +83 -0
  84. data/vendor/libbacktrace/mtest.c +410 -0
  85. data/vendor/libbacktrace/nounwind.c +66 -0
  86. data/vendor/libbacktrace/pecoff.c +1123 -0
  87. data/vendor/libbacktrace/posix.c +104 -0
  88. data/vendor/libbacktrace/print.c +117 -0
  89. data/vendor/libbacktrace/read.c +110 -0
  90. data/vendor/libbacktrace/simple.c +108 -0
  91. data/vendor/libbacktrace/sort.c +108 -0
  92. data/vendor/libbacktrace/state.c +72 -0
  93. data/vendor/libbacktrace/stest.c +137 -0
  94. data/vendor/libbacktrace/test-driver +148 -0
  95. data/vendor/libbacktrace/test_format.c +55 -0
  96. data/vendor/libbacktrace/testlib.c +234 -0
  97. data/vendor/libbacktrace/testlib.h +110 -0
  98. data/vendor/libbacktrace/ttest.c +161 -0
  99. data/vendor/libbacktrace/unittest.c +92 -0
  100. data/vendor/libbacktrace/unknown.c +65 -0
  101. data/vendor/libbacktrace/xcoff.c +1617 -0
  102. data/vendor/libbacktrace/xztest.c +508 -0
  103. data/vendor/libbacktrace/zstdtest.c +523 -0
  104. data/vendor/libbacktrace/ztest.c +541 -0
  105. metadata +122 -3
@@ -0,0 +1,708 @@
1
+ # Makefile.am -- Backtrace Makefile.
2
+ # Copyright (C) 2012-2024 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
+ # Flags to use when linking test programs.
111
+ # This avoids generating a shell script when configured with --enable-shared.
112
+ libbacktrace_testing_ldflags = -no-install
113
+
114
+ if USE_DSYMUTIL
115
+
116
+ %.dSYM: %
117
+ $(DSYMUTIL) $<
118
+
119
+ endif USE_DSYMUTIL
120
+
121
+ if NATIVE
122
+ check_LTLIBRARIES = libbacktrace_alloc.la
123
+
124
+ libbacktrace_alloc_la_SOURCES = $(libbacktrace_la_SOURCES)
125
+ libbacktrace_alloc_la_LIBADD = $(BACKTRACE_FILE) $(FORMAT_FILE) read.lo alloc.lo
126
+
127
+ libbacktrace_alloc_la_DEPENDENCIES = $(libbacktrace_alloc_la_LIBADD)
128
+
129
+ check_LTLIBRARIES += libbacktrace_noformat.la
130
+
131
+ libbacktrace_noformat_la_SOURCES = $(libbacktrace_la_SOURCES)
132
+ libbacktrace_noformat_la_LIBADD = $(BACKTRACE_FILE) $(VIEW_FILE) $(ALLOC_FILE)
133
+
134
+ libbacktrace_noformat_la_DEPENDENCIES = $(libbacktrace_noformat_la_LIBADD)
135
+
136
+ if HAVE_ELF
137
+ if HAVE_OBJCOPY_DEBUGLINK
138
+
139
+ TEST_BUILD_ID_DIR=$(abs_builddir)/usr/lib/debug/.build-id/
140
+
141
+ check_LTLIBRARIES += libbacktrace_elf_for_test.la
142
+
143
+ libbacktrace_elf_for_test_la_SOURCES = $(libbacktrace_la_SOURCES)
144
+ libbacktrace_elf_for_test_la_LIBADD = $(BACKTRACE_FILE) elf_for_test.lo \
145
+ $(VIEW_FILE) $(ALLOC_FILE)
146
+
147
+ elf_for_test.c: elf.c
148
+ SEARCH='^#define SYSTEM_BUILD_ID_DIR.*$$'; \
149
+ REPLACE="#define SYSTEM_BUILD_ID_DIR \"$(TEST_BUILD_ID_DIR)\""; \
150
+ $(SED) "s%$$SEARCH%$$REPLACE%" \
151
+ $< \
152
+ > $@.tmp
153
+ mv $@.tmp $@
154
+
155
+ endif HAVE_OBJCOPY_DEBUGLINK
156
+ endif HAVE_ELF
157
+
158
+ elf_%.c: elf.c
159
+ nlinit=`echo 'nl="'; echo '"'`; eval "$$nlinit"; \
160
+ SEARCH='#error "Unknown BACKTRACE_ELF_SIZE"'; \
161
+ REPLACE="#undef BACKTRACE_ELF_SIZE\\$${nl}#define BACKTRACE_ELF_SIZE"; \
162
+ $(SED) "s/^$$SEARCH\$$/$$REPLACE $*/" \
163
+ $< \
164
+ > $@.tmp
165
+ mv $@.tmp $@
166
+
167
+ xcoff_%.c: xcoff.c
168
+ nlinit=`echo 'nl="'; echo '"'`; eval "$$nlinit"; \
169
+ SEARCH='#error "Unknown BACKTRACE_XCOFF_SIZE"'; \
170
+ REPLACE="#undef BACKTRACE_XCOFF_SIZE\\$${nl}#define BACKTRACE_XCOFF_SIZE"; \
171
+ $(SED) "s/^$$SEARCH\$$/$$REPLACE $*/" \
172
+ $< \
173
+ > $@.tmp
174
+ mv $@.tmp $@
175
+
176
+ test_elf_32_SOURCES = test_format.c testlib.c
177
+ test_elf_32_CFLAGS = $(libbacktrace_TEST_CFLAGS)
178
+ test_elf_32_LDFLAGS = $(libbacktrace_testing_ldflags)
179
+ test_elf_32_LDADD = libbacktrace_noformat.la elf_32.lo
180
+
181
+ BUILDTESTS += test_elf_32
182
+
183
+ test_elf_64_SOURCES = test_format.c testlib.c
184
+ test_elf_64_CFLAGS = $(libbacktrace_TEST_CFLAGS)
185
+ test_elf_64_LDFLAGS = $(libbacktrace_testing_ldflags)
186
+ test_elf_64_LDADD = libbacktrace_noformat.la elf_64.lo
187
+
188
+ BUILDTESTS += test_elf_64
189
+
190
+ test_macho_SOURCES = test_format.c testlib.c
191
+ test_macho_CFLAGS = $(libbacktrace_TEST_CFLAGS)
192
+ test_macho_LDFLAGS = $(libbacktrace_testing_ldflags)
193
+ test_macho_LDADD = libbacktrace_noformat.la macho.lo
194
+
195
+ BUILDTESTS += test_macho
196
+
197
+ test_xcoff_32_SOURCES = test_format.c testlib.c
198
+ test_xcoff_32_CFLAGS = $(libbacktrace_TEST_CFLAGS)
199
+ test_xcoff_32_LDFLAGS = $(libbacktrace_testing_ldflags)
200
+ test_xcoff_32_LDADD = libbacktrace_noformat.la xcoff_32.lo
201
+
202
+ BUILDTESTS += test_xcoff_32
203
+
204
+ test_xcoff_64_SOURCES = test_format.c testlib.c
205
+ test_xcoff_64_CFLAGS = $(libbacktrace_TEST_CFLAGS)
206
+ test_xcoff_64_LDFLAGS = $(libbacktrace_testing_ldflags)
207
+ test_xcoff_64_LDADD = libbacktrace_noformat.la xcoff_64.lo
208
+
209
+ BUILDTESTS += test_xcoff_64
210
+
211
+ test_pecoff_SOURCES = test_format.c testlib.c
212
+ test_pecoff_CFLAGS = $(libbacktrace_TEST_CFLAGS)
213
+ test_pecoff_LDFLAGS = $(libbacktrace_testing_ldflags)
214
+ test_pecoff_LDADD = libbacktrace_noformat.la pecoff.lo
215
+
216
+ BUILDTESTS += test_pecoff
217
+
218
+ test_unknown_SOURCES = test_format.c testlib.c
219
+ test_unknown_CFLAGS = $(libbacktrace_TEST_CFLAGS)
220
+ test_unknown_LDFLAGS = $(libbacktrace_testing_ldflags)
221
+ test_unknown_LDADD = libbacktrace_noformat.la unknown.lo
222
+
223
+ BUILDTESTS += test_unknown
224
+
225
+ unittest_SOURCES = unittest.c testlib.c
226
+ unittest_CFLAGS = $(libbacktrace_TEST_CFLAGS)
227
+ unittest_LDFLAGS = $(libbacktrace_testing_ldflags)
228
+ unittest_LDADD = libbacktrace.la
229
+
230
+ BUILDTESTS += unittest
231
+
232
+ unittest_alloc_SOURCES = $(unittest_SOURCES)
233
+ unittest_alloc_CFLAGS = $(libbacktrace_TEST_CFLAGS)
234
+ unittest_alloc_LDFLAGS = $(libbacktrace_testing_ldflags)
235
+ unittest_alloc_LDADD = libbacktrace_alloc.la
236
+
237
+ BUILDTESTS += unittest_alloc
238
+
239
+ check_LTLIBRARIES += libbacktrace_instrumented_alloc.la
240
+
241
+ libbacktrace_instrumented_alloc_la_SOURCES = $(libbacktrace_la_SOURCES)
242
+ libbacktrace_instrumented_alloc_la_LIBADD = $(BACKTRACE_FILE) $(FORMAT_FILE) \
243
+ read.lo instrumented_alloc.lo
244
+
245
+ libbacktrace_instrumented_alloc_la_DEPENDENCIES = \
246
+ $(libbacktrace_instrumented_alloc_la_LIBADD)
247
+
248
+ instrumented_alloc.lo: alloc.c
249
+
250
+ allocfail_SOURCES = allocfail.c testlib.c
251
+ allocfail_CFLAGS = $(libbacktrace_TEST_CFLAGS)
252
+ allocfail_LDADD = libbacktrace_instrumented_alloc.la
253
+
254
+ check_PROGRAMS += allocfail
255
+
256
+ allocfail.sh: allocfail
257
+
258
+ TESTS += allocfail.sh
259
+
260
+ if USE_DSYMUTIL
261
+ check_DATA += allocfail.dSYM
262
+ endif USE_DSYMUTIL
263
+
264
+ if HAVE_ELF
265
+ if HAVE_BUILDID
266
+ if HAVE_OBJCOPY_DEBUGLINK
267
+
268
+ b2test_SOURCES = $(btest_SOURCES)
269
+ b2test_CFLAGS = $(libbacktrace_TEST_CFLAGS)
270
+ b2test_LDFLAGS = -Wl,--build-id $(libbacktrace_testing_ldflags)
271
+ b2test_LDADD = libbacktrace_elf_for_test.la
272
+
273
+ check_PROGRAMS += b2test
274
+ MAKETESTS += b2test_buildid b2test_buildidfull
275
+
276
+ if HAVE_DWZ
277
+
278
+ b3test_SOURCES = $(btest_SOURCES)
279
+ b3test_CFLAGS = $(libbacktrace_TEST_CFLAGS)
280
+ b3test_LDFLAGS = -Wl,--build-id $(libbacktrace_testing_ldflags)
281
+ b3test_LDADD = libbacktrace_elf_for_test.la
282
+
283
+ check_PROGRAMS += b3test
284
+ MAKETESTS += b3test_dwz_buildid b3test_dwz_buildidfull
285
+
286
+ endif HAVE_DWZ
287
+
288
+ endif HAVE_OBJCOPY_DEBUGLINK
289
+ endif HAVE_BUILDID
290
+ endif HAVE_ELF
291
+
292
+ btest_SOURCES = btest.c testlib.c
293
+ btest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -O
294
+ btest_LDFLAGS = $(libbacktrace_testing_ldflags)
295
+ btest_LDADD = libbacktrace.la
296
+
297
+ BUILDTESTS += btest
298
+
299
+ if USE_DSYMUTIL
300
+ check_DATA += btest.dSYM
301
+ endif USE_DSYMUTIL
302
+
303
+ if HAVE_ELF
304
+
305
+ btest_lto_SOURCES = btest.c testlib.c
306
+ btest_lto_CFLAGS = $(libbacktrace_TEST_CFLAGS) -O -flto
307
+ btest_lto_LDFLAGS = $(libbacktrace_testing_ldflags)
308
+ btest_lto_LDADD = libbacktrace.la
309
+
310
+ BUILDTESTS += btest_lto
311
+
312
+ endif HAVE_ELF
313
+
314
+ btest_alloc_SOURCES = $(btest_SOURCES)
315
+ btest_alloc_CFLAGS = $(libbacktrace_TEST_CFLAGS)
316
+ btest_alloc_LDFLAGS = $(libbacktrace_testing_ldflags)
317
+ btest_alloc_LDADD = libbacktrace_alloc.la
318
+
319
+ BUILDTESTS += btest_alloc
320
+
321
+ if USE_DSYMUTIL
322
+ check_DATA += btest_alloc.dSYM
323
+ endif USE_DSYMUTIL
324
+
325
+ if HAVE_DWZ
326
+
327
+ %_dwz: %
328
+ rm -f $@ $@_common.debug
329
+ cp $< $@_1
330
+ cp $< $@_2
331
+ if $(DWZ) -m $@_common.debug $@_1 $@_2; then \
332
+ rm -f $@_2; \
333
+ mv $@_1 $@; \
334
+ else \
335
+ echo "Ignoring dwz errors, assuming that test passes"; \
336
+ cp $< $@; \
337
+ fi
338
+
339
+ MAKETESTS += btest_dwz
340
+
341
+ if HAVE_OBJCOPY_DEBUGLINK
342
+
343
+ MAKETESTS += btest_dwz_gnudebuglink
344
+
345
+ endif HAVE_OBJCOPY_DEBUGLINK
346
+
347
+ endif HAVE_DWZ
348
+
349
+ stest_SOURCES = stest.c
350
+ stest_CFLAGS = $(libbacktrace_TEST_CFLAGS)
351
+ stest_LDFLAGS = $(libbacktrace_testing_ldflags)
352
+ stest_LDADD = libbacktrace.la
353
+
354
+ BUILDTESTS += stest
355
+
356
+ if USE_DSYMUTIL
357
+ check_DATA += stest.dSYM
358
+ endif USE_DSYMUTIL
359
+
360
+ stest_alloc_SOURCES = $(stest_SOURCES)
361
+ stest_alloc_CFLAGS = $(libbacktrace_TEST_CFLAGS)
362
+ stest_alloc_LDFLAGS = $(libbacktrace_testing_ldflags)
363
+ stest_alloc_LDADD = libbacktrace_alloc.la
364
+
365
+ BUILDTESTS += stest_alloc
366
+
367
+ if USE_DSYMUTIL
368
+ check_DATA += stest_alloc.dSYM
369
+ endif USE_DSYMUTIL
370
+
371
+ if HAVE_ELF
372
+
373
+ ztest_SOURCES = ztest.c testlib.c
374
+ ztest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -DSRCDIR=\"$(srcdir)\"
375
+ ztest_LDFLAGS = $(libbacktrace_testing_ldflags)
376
+ ztest_LDADD = libbacktrace.la
377
+ ztest_alloc_LDADD = libbacktrace_alloc.la
378
+
379
+ if HAVE_ZLIB
380
+ ztest_LDADD += -lz
381
+ ztest_alloc_LDADD += -lz
382
+ endif
383
+ ztest_LDADD += $(CLOCK_GETTIME_LINK)
384
+ ztest_alloc_LDADD += $(CLOCK_GETTIME_LINK)
385
+
386
+ BUILDTESTS += ztest
387
+
388
+ ztest_alloc_SOURCES = $(ztest_SOURCES)
389
+ ztest_alloc_CFLAGS = $(ztest_CFLAGS)
390
+ ztest_alloc_LDFLAGS = $(libbacktrace_testing_ldflags)
391
+
392
+ BUILDTESTS += ztest_alloc
393
+
394
+ zstdtest_SOURCES = zstdtest.c testlib.c
395
+ zstdtest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -DSRCDIR=\"$(srcdir)\"
396
+ zstdtest_LDFLAGS = $(libbacktrace_testing_ldflags)
397
+ zstdtest_LDADD = libbacktrace.la
398
+ zstdtest_alloc_LDADD = libbacktrace_alloc.la
399
+
400
+ if HAVE_ZSTD
401
+ zstdtest_LDADD += -lzstd
402
+ zstdtest_alloc_LDADD += -lzstd
403
+ endif
404
+ zstdtest_LDADD += $(CLOCK_GETTIME_LINK)
405
+ zstdtest_alloc_LDADD += $(CLOCK_GETTIME_LINK)
406
+
407
+ BUILDTESTS += zstdtest
408
+
409
+ zstdtest_alloc_SOURCES = $(zstdtest_SOURCES)
410
+ zstdtest_alloc_CFLAGS = $(zstdtest_CFLAGS)
411
+ zstdtest_alloc_LDFLAGS = $(libbacktrace_testing_ldflags)
412
+
413
+ BUILDTESTS += zstdtest_alloc
414
+
415
+ endif HAVE_ELF
416
+
417
+ edtest_SOURCES = edtest.c edtest2_build.c testlib.c
418
+ edtest_CFLAGS = $(libbacktrace_TEST_CFLAGS)
419
+ edtest_LDFLAGS = $(libbacktrace_testing_ldflags)
420
+ edtest_LDADD = libbacktrace.la
421
+
422
+ BUILDTESTS += edtest
423
+
424
+ if USE_DSYMUTIL
425
+ check_DATA += edtest.dSYM
426
+ endif USE_DSYMUTIL
427
+
428
+ edtest_alloc_SOURCES = $(edtest_SOURCES)
429
+ edtest_alloc_CFLAGS = $(libbacktrace_TEST_CFLAGS)
430
+ edtest_alloc_LDFLAGS = $(libbacktrace_testing_ldflags)
431
+ edtest_alloc_LDADD = libbacktrace_alloc.la
432
+
433
+ if USE_DSYMUTIL
434
+ check_DATA += edtest_alloc.dSYM
435
+ endif USE_DSYMUTIL
436
+
437
+ BUILDTESTS += edtest_alloc
438
+
439
+ edtest2_build.c: gen_edtest2_build; @true
440
+ gen_edtest2_build: $(srcdir)/edtest2.c
441
+ cat $(srcdir)/edtest2.c > tmp-edtest2_build.c
442
+ $(SHELL) $(srcdir)/move-if-change tmp-edtest2_build.c edtest2_build.c
443
+ echo timestamp > $@
444
+
445
+ if HAVE_PTHREAD
446
+
447
+ BUILDTESTS += ttest
448
+
449
+ ttest_SOURCES = ttest.c testlib.c
450
+ ttest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -pthread
451
+ ttest_LDFLAGS = $(libbacktrace_testing_ldflags)
452
+ ttest_LDADD = libbacktrace.la
453
+
454
+ if USE_DSYMUTIL
455
+ check_DATA += ttest.dSYM
456
+ endif USE_DSYMUTIL
457
+
458
+ BUILDTESTS += ttest_alloc
459
+
460
+ ttest_alloc_SOURCES = $(ttest_SOURCES)
461
+ ttest_alloc_CFLAGS = $(ttest_CFLAGS)
462
+ ttest_alloc_LDFLAGS = $(libbacktrace_testing_ldflags)
463
+ ttest_alloc_LDADD = libbacktrace_alloc.la
464
+
465
+ if USE_DSYMUTIL
466
+ check_DATA += ttest_alloc.dSYM
467
+ endif USE_DSYMUTIL
468
+
469
+ endif HAVE_PTHREAD
470
+
471
+ if HAVE_OBJCOPY_DEBUGLINK
472
+
473
+ MAKETESTS += btest_gnudebuglink btest_gnudebuglinkfull
474
+
475
+ %_gnudebuglink: %
476
+ $(OBJCOPY) --only-keep-debug $< $@.debug
477
+ $(OBJCOPY) --strip-debug --add-gnu-debuglink=$@.debug $< $@
478
+
479
+ %_gnudebuglinkfull: %
480
+ $(OBJCOPY) --only-keep-debug $< $@.debug
481
+ $(OBJCOPY) --strip-all --add-gnu-debuglink=$@.debug $< $@
482
+
483
+ endif HAVE_OBJCOPY_DEBUGLINK
484
+
485
+ %_buildid: %
486
+ ./install-debuginfo-for-buildid.sh \
487
+ "$(TEST_BUILD_ID_DIR)" \
488
+ $<
489
+ $(OBJCOPY) --strip-debug $< $@
490
+
491
+ %_buildidfull: %
492
+ ./install-debuginfo-for-buildid.sh \
493
+ "$(TEST_BUILD_ID_DIR)" \
494
+ $<
495
+ $(OBJCOPY) --strip-all $< $@
496
+
497
+ if HAVE_COMPRESSED_DEBUG_ZLIB_GNU
498
+
499
+ ctestg_SOURCES = btest.c testlib.c
500
+ ctestg_CFLAGS = $(libbacktrace_TEST_CFLAGS)
501
+ ctestg_LDFLAGS = -Wl,--compress-debug-sections=zlib-gnu $(libbacktrace_testing_ldflags)
502
+ ctestg_LDADD = libbacktrace.la
503
+
504
+ ctestg_alloc_SOURCES = $(ctestg_SOURCES)
505
+ ctestg_alloc_CFLAGS = $(ctestg_CFLAGS)
506
+ ctestg_alloc_LDFLAGS = $(ctestg_LDFLAGS) $(libbacktrace_testing_ldflags)
507
+ ctestg_alloc_LDADD = libbacktrace_alloc.la
508
+
509
+ BUILDTESTS += ctestg ctestg_alloc
510
+
511
+ endif
512
+
513
+ if HAVE_COMPRESSED_DEBUG_ZLIB_GABI
514
+
515
+ ctesta_SOURCES = btest.c testlib.c
516
+ ctesta_CFLAGS = $(libbacktrace_TEST_CFLAGS)
517
+ ctesta_LDFLAGS = -Wl,--compress-debug-sections=zlib-gabi $(libbacktrace_testing_ldflags)
518
+ ctesta_LDADD = libbacktrace.la
519
+
520
+ ctesta_alloc_SOURCES = $(ctesta_SOURCES)
521
+ ctesta_alloc_CFLAGS = $(ctesta_CFLAGS)
522
+ ctesta_alloc_LDFLAGS = $(ctesta_LDFLAGS) $(libbacktrace_testing_ldflags)
523
+ ctesta_alloc_LDADD = libbacktrace_alloc.la
524
+
525
+ BUILDTESTS += ctesta ctesta_alloc
526
+
527
+ endif
528
+
529
+ if HAVE_COMPRESSED_DEBUG_ZSTD
530
+
531
+ ctestzstd_SOURCES = btest.c testlib.c
532
+ ctestzstd_CFLAGS = $(libbacktrace_TEST_CFLAGS)
533
+ ctestzstd_LDFLAGS = -Wl,--compress-debug-sections=zstd $(libbacktrace_testing_ldflags)
534
+ ctestzstd_LDADD = libbacktrace.la
535
+
536
+ ctestzstd_alloc_SOURCES = $(ctestzstd_SOURCES)
537
+ ctestzstd_alloc_CFLAGS = $(ctestzstd_CFLAGS)
538
+ ctestzstd_alloc_LDFLAGS = $(ctestzstd_LDFLAGS) $(libbacktrace_testing_ldflags)
539
+ ctestzstd_alloc_LDADD = libbacktrace_alloc.la
540
+
541
+ BUILDTESTS += ctestzstd ctestzstd_alloc
542
+
543
+ endif
544
+
545
+ if HAVE_DWARF5
546
+
547
+ dwarf5_SOURCES = btest.c testlib.c
548
+ dwarf5_CFLAGS = $(libbacktrace_TEST_CFLAGS) -gdwarf-5
549
+ dwarf5_LDFLAGS = $(libbacktrace_testing_ldflags)
550
+ dwarf5_LDADD = libbacktrace.la
551
+
552
+ BUILDTESTS += dwarf5
553
+
554
+ if USE_DSYMUTIL
555
+ check_DATA += dwarf5.dSYM
556
+ endif USE_DSYMUTIL
557
+
558
+ dwarf5_alloc_SOURCES = $(dwarf5_SOURCES)
559
+ dwarf5_alloc_CFLAGS = $(dwarf5_CFLAGS)
560
+ dwarf5_alloc_LDFLAGS = $(libbacktrace_testing_ldflags)
561
+ dwarf5_alloc_LDADD = libbacktrace_alloc.la
562
+
563
+ BUILDTESTS += dwarf5_alloc
564
+
565
+ if USE_DSYMUTIL
566
+ check_DATA += dwarf5_alloc.dSYM
567
+ endif USE_DSYMUTIL
568
+
569
+ endif
570
+
571
+ mtest_SOURCES = mtest.c testlib.c
572
+ mtest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -O
573
+ mtest_LDFLAGS = $(libbacktrace_testing_ldflags)
574
+ mtest_LDADD = libbacktrace.la
575
+
576
+ BUILDTESTS += mtest
577
+
578
+ if USE_DSYMUTIL
579
+ check_DATA += mtest.dSYM
580
+ endif USE_DSYMUTIL
581
+
582
+ if HAVE_MINIDEBUG
583
+
584
+ MAKETESTS += mtest_minidebug
585
+
586
+ %_minidebug: %
587
+ $(NM) -D $< -P --defined-only | $(AWK) '{ print $$1 }' | sort > $<.dsyms
588
+ $(NM) $< -P --defined-only | $(AWK) '{ if ($$2 == "T" || $$2 == "t" || $$2 == "D") print $$1 }' | sort > $<.fsyms
589
+ $(COMM) -13 $<.dsyms $<.fsyms > $<.keepsyms
590
+ $(OBJCOPY) --only-keep-debug $< $<.dbg
591
+ $(OBJCOPY) -S --remove-section .gdb_index --remove-section .comment --keep-symbols=$<.keepsyms $<.dbg $<.mdbg
592
+ $(OBJCOPY) --strip-all --remove-section ..comment $< $<.strip
593
+ rm -f $<.mdbg.xz
594
+ $(XZ) $<.mdbg
595
+ $(OBJCOPY) --add-section .gnu_debugdata=$<.mdbg.xz $<.strip
596
+ mv $<.strip $@
597
+
598
+ if HAVE_ELF
599
+ if HAVE_BUILDID
600
+ if HAVE_OBJCOPY_DEBUGLINK
601
+
602
+ m2test_SOURCES = $(mtest_SOURCES)
603
+ m2test_CFLAGS = $(libbacktrace_TEST_CFLAGS) -O
604
+ m2test_LDFLAGS = -Wl,--build-id $(libbacktrace_testing_ldflags)
605
+ m2test_LDADD = libbacktrace_elf_for_test.la
606
+
607
+ check_PROGRAMS += m2test
608
+ MAKETESTS += m2test_minidebug2
609
+
610
+ # minidebug2 is like minidebug but also adds the gnu_debugdata section
611
+ # to the debug file, and uses a build ID file. There is no reason to do
612
+ # this but it was causing an infinite recursion.
613
+ %_minidebug2: %
614
+ $(NM) -D $< -P --defined-only | $(AWK) '{ print $$1 }' | sort > $<.dsyms2
615
+ $(NM) $< -P --defined-only | $(AWK) '{ if ($$2 == "T" || $$2 == "t" || $$2 == "D") print $$1 }' | sort > $<.fsyms2
616
+ $(COMM) -13 $<.dsyms2 $<.fsyms2 > $<.keepsyms2
617
+ $(OBJCOPY) --only-keep-debug $< $<.dbg2
618
+ $(OBJCOPY) -S --remove-section .gdb_index --remove-section .comment --keep-symbols=$<.keepsyms2 $<.dbg2 $<.mdbg2
619
+ $(OBJCOPY) --strip-all --remove-section ..comment $< $<.strip2
620
+ rm -f $<.mdbg2.xz
621
+ $(XZ) $<.mdbg2
622
+ $(OBJCOPY) --add-section .gnu_debugdata=$<.mdbg2.xz $<.dbg2
623
+ $(OBJCOPY) --add-section .gnu_debugdata=$<.mdbg2.xz $<.strip2
624
+ $(SHELL) ./install-debuginfo-for-buildid.sh $(TEST_BUILD_ID_DIR) $<.dbg2
625
+ mv $<.strip2 $@
626
+
627
+ endif HAVE_OBJCOPY_DEBUGLINK
628
+ endif HAVE_BUILDID
629
+ endif HAVE_ELF
630
+
631
+ endif HAVE_MINIDEBUG
632
+
633
+ endif NATIVE
634
+
635
+ if HAVE_ELF
636
+
637
+ xztest_SOURCES = xztest.c testlib.c
638
+ xztest_CFLAGS = $(libbacktrace_TEST_CFLAGS) -DSRCDIR=\"$(srcdir)\"
639
+ xztest_LDFLAGS = $(libbacktrace_testing_ldflags)
640
+ xztest_LDADD = libbacktrace.la
641
+
642
+ xztest_alloc_SOURCES = $(xztest_SOURCES)
643
+ xztest_alloc_CFLAGS = $(xztest_CFLAGS)
644
+ xztest_alloc_LDFLAGS = $(libbacktrace_testing_ldflags)
645
+ xztest_alloc_LDADD = libbacktrace_alloc.la
646
+
647
+ if HAVE_LIBLZMA
648
+ xztest_LDADD += -llzma
649
+ xztest_alloc_LDADD += -llzma
650
+ endif
651
+
652
+ xztest_LDADD += $(CLOCK_GETTIME_LINK)
653
+ xztest_alloc_LDADD += $(CLOCK_GETTIME_LINK)
654
+
655
+ BUILDTESTS += xztest xztest_alloc
656
+
657
+ endif HAVE_ELF
658
+
659
+ check_PROGRAMS += $(BUILDTESTS)
660
+
661
+ TESTS += $(MAKETESTS) $(BUILDTESTS)
662
+
663
+ CLEANFILES = \
664
+ $(MAKETESTS) $(BUILDTESTS) *.debug elf_for_test.c edtest2_build.c \
665
+ gen_edtest2_build \
666
+ *.dsyms *.fsyms *.keepsyms *.dbg *.mdbg *.mdbg.xz *.strip \
667
+ *.dsyms2 *.fsyms2 *.keepsyms2 *.dbg2 *.mdbg2 *.mdbg2.xz *.strip2
668
+
669
+ clean-local:
670
+ -rm -rf usr
671
+
672
+ # We can't use automake's automatic dependency tracking, because it
673
+ # breaks when using bootstrap-lean. Automatic dependency tracking
674
+ # with GCC bootstrap will cause some of the objects to depend on
675
+ # header files in prev-gcc/include, e.g., stddef.h and stdarg.h. When
676
+ # using bootstrap-lean, prev-gcc is removed after each stage. When
677
+ # running "make install", those header files will be gone, causing the
678
+ # library to be rebuilt at install time. That may not succeed.
679
+
680
+ # These manual dependencies do not include dependencies on unwind.h,
681
+ # even though that is part of GCC, because where to find it depends on
682
+ # whether we are being built as a host library or a target library.
683
+
684
+ alloc.lo: config.h backtrace.h internal.h
685
+ backtrace.lo: config.h backtrace.h internal.h
686
+ btest.lo: filenames.h backtrace.h backtrace-supported.h
687
+ dwarf.lo: config.h filenames.h backtrace.h internal.h
688
+ elf.lo: config.h backtrace.h internal.h
689
+ fileline.lo: config.h backtrace.h internal.h
690
+ macho.lo: config.h backtrace.h internal.h
691
+ mmap.lo: config.h backtrace.h internal.h
692
+ mmapio.lo: config.h backtrace.h internal.h
693
+ mtest.lo: backtrace.h backtrace-supported.h
694
+ nounwind.lo: config.h internal.h
695
+ pecoff.lo: config.h backtrace.h internal.h
696
+ posix.lo: config.h backtrace.h internal.h
697
+ print.lo: config.h backtrace.h internal.h
698
+ read.lo: config.h backtrace.h internal.h
699
+ simple.lo: config.h backtrace.h internal.h
700
+ sort.lo: config.h backtrace.h internal.h
701
+ stest.lo: config.h backtrace.h internal.h
702
+ state.lo: config.h backtrace.h backtrace-supported.h internal.h
703
+ unknown.lo: config.h backtrace.h internal.h
704
+ xcoff_32.lo: config.h backtrace.h internal.h
705
+ xcoff_64.lo: config.h backtrace.h internal.h
706
+ xztest.lo: config.h backtrace.h backtrace-supported.h internal.h testlib.h
707
+ ztest.lo: config.h backtrace.h backtrace-supported.h internal.h testlib.h
708
+