Page MenuHomeFreeBSD

libdtrace: add riscv support
ClosedPublic

Authored by mhorne on Jan 31 2023, 7:27 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sep 28 2024, 12:10 AM
Unknown Object (File)
Sep 27 2024, 8:47 PM
Unknown Object (File)
Sep 27 2024, 4:08 AM
Unknown Object (File)
Sep 24 2024, 12:57 PM
Unknown Object (File)
Sep 22 2024, 10:23 PM
Unknown Object (File)
Sep 22 2024, 12:28 PM
Unknown Object (File)
Sep 18 2024, 9:13 AM
Unknown Object (File)
Sep 17 2024, 1:35 PM
Subscribers

Details

Summary

Largely untested, as we can't really do anything with user probes
without an implementation of fasttrap. However, this is enough to
generate an embedded dtrace program with dtrace -G and link the
generated ELF file.

Diff Detail

Repository
rG FreeBSD src repository
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 49363
Build 46253: arc lint + arc unit

Event Timeline

cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
1004–1007

The implementation is copied from arm64. I really have no idea if this is true about is-enabled probes, as this file really doesn't give much of a clue as to what that means.

1355

This comment is the best indication of what is going on, and what dt_modtext() is for.

markj added inline comments.
cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
1004–1007

So with USDT you define one or more providers, each with a set of probes:

provider foo {
    probe bar(int arg1, char *arg);
    probe baz();
};

dtrace -h takes that and spits out a C header which defines FOO_BAR() and FOO_BAZ() macros, "calls" to which turn into USDT probes. For each probe you also get an _ENABLED macro, e.g., FOO_BAR_ENABLED(). This lets you test whether the corresponding probe is currently enabled. I'm not sure when that's useful, maybe one uses the _ENABLED check to decide whether to take a slow path which contains probes and loads extra data to pass to those probes.

Both probes and is-enabled checks expand to function calls. I haven't looked exactly at how these are handled on amd64, but without some ability to test you might just leave an XXX comment to revisit the matter. There are some USDT regression tests which exercise this functionality.

This revision is now accepted and ready to land.Feb 1 2023, 4:01 PM
This revision was automatically updated to reflect the committed changes.