Commit Graph

2747 Commits

Author SHA1 Message Date
d28080b9ad libsysprof-analyze: add SysprofDocumentJitmap
This adds a specific frame type for the Jitmap frames in the capture files.
You can iterate them without having to bswap as well, which is why this
does not use the SysprofCaptureJitmapIter (which does require bswap'd
frames).
2023-05-22 12:18:57 -07:00
c7f025d4d3 libsysprof-analyze: allow filtering by pid 2023-05-22 10:59:38 -07:00
d057f69924 libsysprof-analyze: cleanup nicks a bit 2023-05-21 12:13:16 -07:00
052321db7e libsysprof-analyze: add PolicyKit to subsystems 2023-05-20 17:08:20 -07:00
3df434d950 libsysprof-analyze: resolve symbols in ELF in non-symbol areas
If we get an address that doesn't fall within a symbol, we still want to
generate a valid string/address range for it here so that we can get
nick annotations correct. If we hit the fallback path, we won't get that.
2023-05-20 10:37:53 -07:00
9d8096baa6 libsysprof-analyze: pass-through when there are no matches 2023-05-19 17:30:03 -07:00
f1d0d71ee5 libsysprof-analyze: ensure mounts are sorted by length
This matches what we did previously so that we find the closest mount
match first.
2023-05-19 17:07:29 -07:00
39e6be47fb libsysprof-analyze: add plumbing to track overlays
This just gets the plumbing into place, we'll still need to use it to do
the path translations.
2023-05-19 17:03:35 -07:00
3ff5312c2e libsysprof-analyze: index overlay frames
We will want these to process mount namespaces.
2023-05-19 16:57:47 -07:00
12e497891f libsysprof-analyze: add SysprofDocumentOverlay
This maps to the SysprofCaptureOverlay data frames. We need them currently
to be able to locate files from various podman/toolbox rootless containers.
2023-05-19 16:51:15 -07:00
61d5187b09 libsysprof-analyze: fallback in case of debuglink error
If for some reason the debuglink has an issue, we can fallback to looking
at the specific ELF containing the address we wanted to look at.
2023-05-19 16:33:21 -07:00
d7f6e4b922 libsysprof-analyze: add some common tags
It's nice to have various labels on subsystems used on the desktop, so add
some common ones here that are part of the platform.
2023-05-19 16:19:29 -07:00
167255be45 libsysprof-analyze: implement basics of ELF symbolizer
There are still lots of kinks to iron out of this, but it gets some of the
basic plumbing in place for symbolizing. Particularly, we're not at all
yet addressing the overlays in the capture which will be needed to do some
handling of Flatpak/Podman processes.

Basic build-id/file-inode checks are done, but we just return NULL in those
cases (unlike previously in Sysprof where we would say "Inode Mismatch". In
those cases the fallback path is hit now which will just give a file path
plus instruction-pointer offset. We can show more details though in the
future now that we have more objects to represent things.
2023-05-19 15:53:41 -07:00
1833fabd62 libsysprof-analyze: include inode when creating ELF
We want to know the inode of the FD that was mmaped so that we can check
the requested inode when processing the address map from a particular
process.
2023-05-19 15:44:26 -07:00
f1f0261486 libsysprof-analyze: check if ELF matches inode/build-id
We still want to load it into the cache as it could get used by other
symbols/mmap regions, but don't return the ELF if it won't match an inode
or build-id check. Rely on other fallbacks to create fallback symbols
for those use cases.
2023-05-19 15:33:53 -07:00
c59bb4ca15 libsysprof-analyze: implement ELF debuglink loading 2023-05-19 14:53:06 -07:00
7885873ba3 libsysprof-analyze: implement various SysprofElf API
This wraps our ElfParser to give us an idiomatic API we can use with
GIO/GTK/etc.
2023-05-19 14:52:49 -07:00
d48f2763e0 libsysprof-analyze: cache negative lookups
If we fail to parse something as an ELF, then make sure we can skip it the
next time we see it.
2023-05-19 13:58:25 -07:00
269a8ea658 libsysprof-analyze: insert and lookup ELF from cache
We do need to at least translate the path to what we would want to see
from the host system before inserting/resolving, so that we don't risk
collisions in the cache.
2023-05-19 13:51:25 -07:00
cb74b88b1b libsysprof-analyze: try /var/run/host in flatpak/podman
In podman (at least with toolbox) it appears to give access to home via
/var/run/host/home/ so we don't need to translate home paths at all.

However, Flatpak does not give you home access via that path so we just
have to hope that we have access to $HOME from whatever application
mount namespace we're running from. That means to do symbolizing in a
Flatpak app you'd likely need --filesystem=host to be useful.
2023-05-19 13:33:41 -07:00
aa829f8665 libsysprof-analyze: load ElfParser for GMappedFile 2023-05-19 10:41:00 -07:00
8e101624bc libsysprof: add mmap variant for elfparser 2023-05-19 10:35:31 -07:00
322a6253ba libsysprof-analyze: add note about container breakouts 2023-05-19 10:25:13 -07:00
1a9e11baef libsysprof-analyze: start on namespace translation 2023-05-19 10:23:48 -07:00
90519fe830 libsysprof-analyze: rename :id to :fs-spec to match fstab
This is the description of the field in fstab(5) so we want to match that
so it's a bit more clear what we're keying off of when translating to a
mount device we can access on the host.
2023-05-19 10:17:03 -07:00
9e2ddae05c libsysprof-analyze: make string functions recognize NULL 2023-05-19 10:13:01 -07:00
e1da2d4f70 libsysprof-analyze: use GRefString for SysprofMountDevice
We will end up creating a lot of these, and it's nice to at least be able
to share the strings even if we can't always share the objects themselves.
2023-05-19 10:11:48 -07:00
aaa12307f2 libsysprof-analyze: fix name of property 2023-05-19 10:06:51 -07:00
63168656a5 libsysprof-analyze: add get_relative_path helper
This acts somewhat like g_file_get_relative_path() in that if it is not a
subdirectory of the parent, NULL is returned. Otherwise the relative path
is returned. We can just dive into the substring instead of copying which
is a bonus point.
2023-05-19 10:02:20 -07:00
7db4540f9a libsysprof-analyze: rename mount-path to mount-point
We want to be consistent with SysprofMount in naming.
2023-05-19 10:01:02 -07:00
d448519c29 libsysprof-analyze: prefix private API with _ 2023-05-18 16:23:12 -07:00
5c1802d77f libsysprof-analyze: add scaffolding for ELF loading 2023-05-18 15:44:36 -07:00
685f9e8bab libsysprof-analyze: add scaffolding for translate API 2023-05-18 15:44:20 -07:00
978bfc5680 libsysprof-analyze: add tool to test elf loader 2023-05-18 13:11:44 -07:00
ed19b3d2b6 libsysprof-analyze: add missing SysprofElfLoader ctor 2023-05-18 13:11:08 -07:00
da58a52bf3 libsysprof-analyze: give access to SysprofElf filename 2023-05-18 13:10:51 -07:00
487e88c8f0 libsysprof-analyze: add private getter for process info 2023-05-18 13:10:30 -07:00
19c5a21ac0 libsysprof-analyze: give shape to ELF loading APIs
We need to separate a number of concerns here, such as debug-dirs within
the process namespace vs global debug-dirs (external symbols on a developer
workstation vs IoT/Laptop/VM/alternate-device).

That means we need to be able to resolve paths via the mount namespace of
the process as it was seen in the capture file.

Additionally, we need to follow .gnu_debuglink section headers so that we
can associate the version with symbols with the ELF that is loaded from
the processes SysprofAddressLayout.
2023-05-18 12:00:25 -07:00
6ad94c59bf libsysprof-analyze: add strv helpers 2023-05-18 11:49:21 -07:00
6d86d55d61 libsysprof-analyze: give address in file/function
This at least gives more visibility into what location of the file is
being executed. That way you can separate different parts of the file
rather than one giant "this file" so long as we could unwind successfully.
2023-05-16 12:43:33 -07:00
09b8c1f737 libsysprof-analyze: leave some notes on elf symbolizing 2023-05-15 16:49:40 -07:00
287c7feca2 libsysprof-analyze: add test to analyze address layout 2023-05-15 15:26:27 -07:00
b786edd848 libsysprof-analyze: print mmap information 2023-05-15 15:20:52 -07:00
140bc1d384 libsysprof-analyze: add scaffolding for elf symbol resolver 2023-05-15 15:03:25 -07:00
d415f29a15 libsysprof-analyze: allow disabling bundled symbolizer 2023-05-15 14:52:59 -07:00
64a886eea8 libsysprof-analyze: handle NULL process info
This can happen for "process 0" for example, or anything that was
recorded for a pid which did not get a SysprofCaptureProcess frame.
2023-05-15 14:33:41 -07:00
22828daad1 libsysprof-anzlyze: deduplicate and sort kernel address ranges
Turns out we do need this, and we cannot trust kallsyms all that much even
from duplicated entries on immediate next lines.
2023-05-15 14:31:18 -07:00
65318afa51 libsysprof-analyze: use define for final address range 2023-05-15 14:30:29 -07:00
a90b9a2fc7 libsysprof-analyze: use separate cache for kernel symbols
Additionally this reduces some GHashTable lookup costs by doing it once
for the process-info per-traceable rather than one per instruction pointer
per traceable.
2023-05-15 14:30:06 -07:00
909228174e libsysprof-analyze: use mapped file from file chunk 2023-05-15 13:51:22 -07:00