Ported the Firefox Profiler to FreeBSD in order to investigate why WebRender has some jank when scrolling some walls of text on my 4K/HiDPI setup.
The profiler code initially looked somewhat scary: some Google Breakpad code is used, a custom stack unwinder called LUL is used on Linux (which also partially derived from Breakpad code)…
Initially, I got it working with “pre-symbolication” (an option to build the goblin ELF parser into Firefox for this purpose) only, ifdef’ing any Breakpad code out.
- the only part of Breakpad used is extracting build IDs from shared objects (and in fact the “base profiler”, a copy (for now) of the Gecko profiler used for profiling during the early startup phase, just copied all the relevant code);
devel/breakpadwas there in FreeBSD Ports (but expires in like three days!), and its patches showed that it’s really trivial to get all it working.
In the end, the patch turned out to be mostly just
The only meaningful parts are:
thr_kill2 instead of
supporting the different
mcontext structs, and
(for the pre-symbolication code path) ignoring symbol names returned by
dladdr because they’re hilariously bad.
Post your response
If you write a response on your website, mark it up with h-entry and let me know the URL: