dabde7d9 | 21-Jul-2025 |
Mark Johnston <markj@FreeBSD.org> |
libdtrace: Permit taking the address of an identifier without type info
Symbols defined using assembler directives lack type info, but in this case one ought to be able to cast a pointer to the symb
libdtrace: Permit taking the address of an identifier without type info
Symbols defined using assembler directives lack type info, but in this case one ought to be able to cast a pointer to the symbol and dereference the pointer to get a value. Without this change, D disallows this trick since it requires all identifiers to have a type.
Relax the rules slightly and allow an identifier to have type "void" if we know we're just taking its address.
As a result, the following dtrace invocation works:
dtrace -n 'tick-1s {printf("%d", *(int *)&`ticks);}'
In particular, since commit b2b974f7ef4c ("clock: Simplify subr_ticks and rename"), "ticks" does not have any type info associated with it, so its value couldn't be printed. This trick provides a workaround and is probably generally useful.
Add a regression test which exercises this functionality.
PR: 287752 Reviewed by: avg MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D51417
show more ...
|
9a30c8d3 | 10-Mar-2025 |
Mark Johnston <markj@FreeBSD.org> |
libdtrace: Fix an off-by-one in CPU ID handling
The illumos-specific _SC_CPUID_MAX is the largest CPU ID in the system. This was mapped to _SC_NPROCESSORS_CONF, which is the total number of CPUs re
libdtrace: Fix an off-by-one in CPU ID handling
The illumos-specific _SC_CPUID_MAX is the largest CPU ID in the system. This was mapped to _SC_NPROCESSORS_CONF, which is the total number of CPUs recognized by the kernel. If CPU IDs are contiguous, as is the case on amd64 and arm64, this value is one greater than the maximum ID. As a result, when consuming per-CPU dtrace buffers, libdtrace tries to fetch from a non-existent CPU. This is mostly harmless in practice, but still wrong.
As we don't have a sysconf value for the maximum CPU ID, add a wrapper which fetches it using the kern.smp.maxid sysctl.
MFC after: 2 weeks Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D49243
show more ...
|
7bbcbd43 | 10-Jul-2024 |
Mark Johnston <markj@FreeBSD.org> |
libdtrace: Compute the relocation offset for all non-ET_REL objects
The use of an ifdef here most likely carries over from when the dtrace port only worked on x86 platforms.
MFC after: 2 weeks Spon
libdtrace: Compute the relocation offset for all non-ET_REL objects
The use of an ifdef here most likely carries over from when the dtrace port only worked on x86 platforms.
MFC after: 2 weeks Sponsored by: Innovate UK
show more ...
|
1112883e | 28-Jul-2023 |
Eric van Gyzen <vangyzen@FreeBSD.org> |
dtrace: remove dead code for PR_REQUESTED
libproc's PR_REQUESTED is not implemented on FreeBSD. Remove dead code in dtrace that would handle it.
Reviewed by: markj MFC after: 1 week Sponsored by:
dtrace: remove dead code for PR_REQUESTED
libproc's PR_REQUESTED is not implemented on FreeBSD. Remove dead code in dtrace that would handle it.
Reviewed by: markj MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D41225
show more ...
|
bcbce2a2 | 25-Jul-2023 |
Eric van Gyzen <vangyzen@FreeBSD.org> |
dtrace: do not overload libproc flags
dtrace stored its PR_RLC and PR_KLC flags in the proc_handle's flags, where they collided with PATTACH_FORCE and PATTACH_RDONLY, respectively. Thus, Psetflags(P
dtrace: do not overload libproc flags
dtrace stored its PR_RLC and PR_KLC flags in the proc_handle's flags, where they collided with PATTACH_FORCE and PATTACH_RDONLY, respectively. Thus, Psetflags(PR_KLC) effectively also set the PATTACH_RDONLY flag.
Since the flags are private to dtrace (at least on FreeBSD), store them in dtrace's own dt_proc structure instead.
On FreeBSD, either PR_RLC or PR_KLC was always set, so remove code that would handle the case where neither was set.
Reviewed by: markj MFC after: 1 week Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D41121
show more ...
|
f711d5c3 | 10-Jan-2023 |
Mitchell Horne <mhorne@FreeBSD.org> |
libdtrace: add riscv support
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 w
libdtrace: add riscv support
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.
Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D38301
show more ...
|