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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -0
- data/README.md +11 -0
- data/Rakefile +9 -2
- data/doc/development.md +11 -0
- data/examples/mandelbrot.rb +69 -0
- data/examples/mandelbrot_ractor.rb +77 -0
- data/ext/pf2/build.rs +7 -0
- data/ext/pf2/src/ruby_c_api_helper.c +6 -0
- data/ext/pf2/src/serialization/profile.rs +1 -0
- data/ext/pf2/src/serialization/serializer.rs +4 -0
- data/ext/pf2/src/signal_scheduler.rs +1 -1
- data/ext/pf2/src/util.rs +2 -1
- data/ext/pf2c/backtrace_state.c +10 -0
- data/ext/pf2c/backtrace_state.h +10 -0
- data/ext/pf2c/configuration.c +90 -0
- data/ext/pf2c/configuration.h +23 -0
- data/ext/pf2c/extconf.rb +21 -0
- data/ext/pf2c/pf2.c +17 -0
- data/ext/pf2c/pf2.h +8 -0
- data/ext/pf2c/ringbuffer.c +74 -0
- data/ext/pf2c/ringbuffer.h +24 -0
- data/ext/pf2c/sample.c +70 -0
- data/ext/pf2c/sample.h +22 -0
- data/ext/pf2c/serializer.c +377 -0
- data/ext/pf2c/serializer.h +58 -0
- data/ext/pf2c/session.c +344 -0
- data/ext/pf2c/session.h +51 -0
- data/lib/pf2/cli.rb +33 -2
- data/lib/pf2/reporter/annotate.rb +101 -0
- data/lib/pf2/reporter/firefox_profiler.rb +1 -1
- data/lib/pf2/reporter/firefox_profiler_ser2.rb +308 -0
- data/lib/pf2/reporter.rb +2 -0
- data/lib/pf2/version.rb +1 -1
- data/vendor/libbacktrace/.gitignore +5 -0
- data/vendor/libbacktrace/Isaac.Newton-Opticks.txt +9286 -0
- data/vendor/libbacktrace/LICENSE +29 -0
- data/vendor/libbacktrace/Makefile.am +708 -0
- data/vendor/libbacktrace/Makefile.in +2820 -0
- data/vendor/libbacktrace/README.md +46 -0
- data/vendor/libbacktrace/aclocal.m4 +864 -0
- data/vendor/libbacktrace/alloc.c +167 -0
- data/vendor/libbacktrace/allocfail.c +136 -0
- data/vendor/libbacktrace/allocfail.sh +104 -0
- data/vendor/libbacktrace/atomic.c +113 -0
- data/vendor/libbacktrace/backtrace-supported.h.in +66 -0
- data/vendor/libbacktrace/backtrace.c +129 -0
- data/vendor/libbacktrace/backtrace.h +189 -0
- data/vendor/libbacktrace/btest.c +517 -0
- data/vendor/libbacktrace/compile +348 -0
- data/vendor/libbacktrace/config/enable.m4 +38 -0
- data/vendor/libbacktrace/config/lead-dot.m4 +31 -0
- data/vendor/libbacktrace/config/libtool.m4 +7545 -0
- data/vendor/libbacktrace/config/ltoptions.m4 +369 -0
- data/vendor/libbacktrace/config/ltsugar.m4 +123 -0
- data/vendor/libbacktrace/config/ltversion.m4 +23 -0
- data/vendor/libbacktrace/config/lt~obsolete.m4 +98 -0
- data/vendor/libbacktrace/config/multi.m4 +68 -0
- data/vendor/libbacktrace/config/override.m4 +117 -0
- data/vendor/libbacktrace/config/unwind_ipinfo.m4 +37 -0
- data/vendor/libbacktrace/config/warnings.m4 +227 -0
- data/vendor/libbacktrace/config.guess +1700 -0
- data/vendor/libbacktrace/config.h.in +185 -0
- data/vendor/libbacktrace/config.sub +1885 -0
- data/vendor/libbacktrace/configure +15952 -0
- data/vendor/libbacktrace/configure.ac +642 -0
- data/vendor/libbacktrace/dwarf.c +4593 -0
- data/vendor/libbacktrace/edtest.c +120 -0
- data/vendor/libbacktrace/edtest2.c +43 -0
- data/vendor/libbacktrace/elf.c +7471 -0
- data/vendor/libbacktrace/fileline.c +407 -0
- data/vendor/libbacktrace/filenames.h +52 -0
- data/vendor/libbacktrace/filetype.awk +13 -0
- data/vendor/libbacktrace/install-debuginfo-for-buildid.sh.in +65 -0
- data/vendor/libbacktrace/install-sh +501 -0
- data/vendor/libbacktrace/instrumented_alloc.c +114 -0
- data/vendor/libbacktrace/internal.h +428 -0
- data/vendor/libbacktrace/ltmain.sh +8636 -0
- data/vendor/libbacktrace/macho.c +1361 -0
- data/vendor/libbacktrace/missing +215 -0
- data/vendor/libbacktrace/mmap.c +331 -0
- data/vendor/libbacktrace/mmapio.c +110 -0
- data/vendor/libbacktrace/move-if-change +83 -0
- data/vendor/libbacktrace/mtest.c +410 -0
- data/vendor/libbacktrace/nounwind.c +66 -0
- data/vendor/libbacktrace/pecoff.c +1123 -0
- data/vendor/libbacktrace/posix.c +104 -0
- data/vendor/libbacktrace/print.c +117 -0
- data/vendor/libbacktrace/read.c +110 -0
- data/vendor/libbacktrace/simple.c +108 -0
- data/vendor/libbacktrace/sort.c +108 -0
- data/vendor/libbacktrace/state.c +72 -0
- data/vendor/libbacktrace/stest.c +137 -0
- data/vendor/libbacktrace/test-driver +148 -0
- data/vendor/libbacktrace/test_format.c +55 -0
- data/vendor/libbacktrace/testlib.c +234 -0
- data/vendor/libbacktrace/testlib.h +110 -0
- data/vendor/libbacktrace/ttest.c +161 -0
- data/vendor/libbacktrace/unittest.c +92 -0
- data/vendor/libbacktrace/unknown.c +65 -0
- data/vendor/libbacktrace/xcoff.c +1617 -0
- data/vendor/libbacktrace/xztest.c +508 -0
- data/vendor/libbacktrace/zstdtest.c +523 -0
- data/vendor/libbacktrace/ztest.c +541 -0
- metadata +122 -3
@@ -0,0 +1,120 @@
|
|
1
|
+
/* edtest.c -- Test for libbacktrace storage allocation stress handling
|
2
|
+
Copyright (C) 2017-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
|
+
#include "config.h"
|
33
|
+
|
34
|
+
#include <assert.h>
|
35
|
+
#include <stdio.h>
|
36
|
+
#include <stdlib.h>
|
37
|
+
#include <string.h>
|
38
|
+
#include <sys/types.h>
|
39
|
+
|
40
|
+
#include "backtrace.h"
|
41
|
+
#include "backtrace-supported.h"
|
42
|
+
#include "internal.h"
|
43
|
+
|
44
|
+
#include "testlib.h"
|
45
|
+
|
46
|
+
static int test1 (void) __attribute__ ((noinline, noclone, optnone, unused));
|
47
|
+
extern int f2 (int);
|
48
|
+
extern int f3 (int, int);
|
49
|
+
|
50
|
+
static int
|
51
|
+
test1 (void)
|
52
|
+
{
|
53
|
+
/* Returning a value here and elsewhere avoids a tailcall which
|
54
|
+
would mess up the backtrace. */
|
55
|
+
return f2 (__LINE__) + 1;
|
56
|
+
}
|
57
|
+
|
58
|
+
int
|
59
|
+
f3 (int f1line, int f2line)
|
60
|
+
{
|
61
|
+
struct info all[20];
|
62
|
+
struct bdata data;
|
63
|
+
int f3line;
|
64
|
+
int i;
|
65
|
+
|
66
|
+
data.all = &all[0];
|
67
|
+
data.index = 0;
|
68
|
+
data.max = 20;
|
69
|
+
data.failed = 0;
|
70
|
+
|
71
|
+
f3line = __LINE__ + 1;
|
72
|
+
i = backtrace_full (state, 0, callback_one, error_callback_one, &data);
|
73
|
+
|
74
|
+
if (i != 0)
|
75
|
+
{
|
76
|
+
fprintf (stderr, "test1: unexpected return value %d\n", i);
|
77
|
+
data.failed = 1;
|
78
|
+
}
|
79
|
+
|
80
|
+
if (data.index < 3)
|
81
|
+
{
|
82
|
+
fprintf (stderr,
|
83
|
+
"test1: not enough frames; got %zu, expected at least 3\n",
|
84
|
+
data.index);
|
85
|
+
data.failed = 1;
|
86
|
+
}
|
87
|
+
|
88
|
+
check ("test1", 0, all, f3line, "f3", "edtest.c", &data.failed);
|
89
|
+
check ("test1", 1, all, f2line, "f2", "edtest2_build.c", &data.failed);
|
90
|
+
check ("test1", 2, all, f1line, "test1", "edtest.c", &data.failed);
|
91
|
+
|
92
|
+
printf ("%s: backtrace_full alloc stress\n", data.failed ? "FAIL" : "PASS");
|
93
|
+
|
94
|
+
if (data.failed)
|
95
|
+
++failures;
|
96
|
+
|
97
|
+
return failures;
|
98
|
+
}
|
99
|
+
|
100
|
+
int
|
101
|
+
main (int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
|
102
|
+
{
|
103
|
+
state = backtrace_create_state (argv[0], BACKTRACE_SUPPORTS_THREADS,
|
104
|
+
error_callback_create, NULL);
|
105
|
+
|
106
|
+
// Grab the storage allocation lock prior to doing anything interesting.
|
107
|
+
// The intent here is to insure that the backtrace_alloc code is forced
|
108
|
+
// to always call mmap() for new memory as opposed to reusing previously
|
109
|
+
// allocated memory from the free list. Doing things this way helps
|
110
|
+
// simulate what you might see in a multithreaded program in which there
|
111
|
+
// are racing calls to the allocator.
|
112
|
+
struct backtrace_state *state_internal =
|
113
|
+
(struct backtrace_state *) state;
|
114
|
+
state_internal->lock_alloc = 1;
|
115
|
+
|
116
|
+
// Kick off the test
|
117
|
+
test1();
|
118
|
+
|
119
|
+
exit (failures > 0 ? EXIT_FAILURE : EXIT_SUCCESS);
|
120
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
/* edtest2.c -- Test for libbacktrace storage allocation stress handling (p2)
|
2
|
+
Copyright (C) 2017-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
|
+
/* This file intentionally written without any #include's
|
33
|
+
*/
|
34
|
+
|
35
|
+
extern int f3(int, int);
|
36
|
+
extern int f2(int);
|
37
|
+
|
38
|
+
int f2(int x)
|
39
|
+
{
|
40
|
+
/* Returning a value here and elsewhere avoids a tailcall which
|
41
|
+
would mess up the backtrace. */
|
42
|
+
return f3(x, __LINE__) + 3;
|
43
|
+
}
|