[DTrace-devel] [PATCH 29/38] Allow relocation of the ERROR PRID

Eugene Loh eugene.loh at oracle.com
Fri Jul 19 23:49:55 UTC 2024


Yeah.  This patch was superseded by a v2 (Jun 27), which acknowledges 
your point.  It's "simpler" to say "3".  It is arguably more robust to 
set the value during relocation.  I figured I'd do it the "more robust" 
way and am happy to be talked into the simpler patch.

I'll wait for your comments on the v2 patch.  If there you say the extra 
effort is not worth it, I'll post a v3 with the simpler version.

On 7/19/24 17:41, Kris Van Hees wrote:
> Why is this patch needed?  As far as I can see, BEGIN, END, and ERROR are
> always created as the first 3 probes (in that order), so they will have probe
> IDs 1, 2, and 3.
>
> On Thu, Jun 27, 2024 at 01:38:55AM -0400, eugene.loh--- via DTrace-devel wrote:
>> From: Eugene Loh <eugene.loh at oracle.com>
>>
>> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
>> ---
>>   libdtrace/dt_bpf.h   | 1 +
>>   libdtrace/dt_cc.c    | 3 +++
>>   libdtrace/dt_dlibs.c | 1 +
>>   3 files changed, 5 insertions(+)
>>
>> diff --git a/libdtrace/dt_bpf.h b/libdtrace/dt_bpf.h
>> index 5b2df264..58cf29cc 100644
>> --- a/libdtrace/dt_bpf.h
>> +++ b/libdtrace/dt_bpf.h
>> @@ -56,6 +56,7 @@ extern "C" {
>>   #define DT_CONST_ZERO_OFF		22
>>   #define DT_CONST_STACK_OFF		23
>>   #define DT_CONST_STACK_SKIP		24
>> +#define DT_CONST_ERROR_PRID		25
>>   
>>   #define DT_BPF_LOG_SIZE_DEFAULT	(UINT32_MAX >> 8)
>>   #define DT_BPF_LOG_SIZE_SMALL	4096
>> diff --git a/libdtrace/dt_cc.c b/libdtrace/dt_cc.c
>> index d1ee3843..3d9a9c79 100644
>> --- a/libdtrace/dt_cc.c
>> +++ b/libdtrace/dt_cc.c
>> @@ -1076,6 +1076,9 @@ dt_link_construct(dtrace_hdl_t *dtp, const dt_probe_t *prp, dtrace_difo_t *dp,
>>   				nrp->dofr_data = sizeof(uint64_t)
>>   				    * dtp->dt_options[DTRACEOPT_MAXFRAMES];
>>   				continue;
>> +			case DT_CONST_ERROR_PRID:
>> +				nrp->dofr_data = dtp->dt_error->desc->id;
>> +				continue;
>>   			case DT_CONST_BOOTTM:
>>   				if (boottime == 0 && get_boottime())
>>   					return -1;
>> diff --git a/libdtrace/dt_dlibs.c b/libdtrace/dt_dlibs.c
>> index bc883e11..1fb561ad 100644
>> --- a/libdtrace/dt_dlibs.c
>> +++ b/libdtrace/dt_dlibs.c
>> @@ -80,6 +80,7 @@ static const dt_ident_t		dt_bpf_symbols[] = {
>>   	DT_BPF_SYMBOL_ID(STBSZ, DT_IDENT_SCALAR, DT_CONST_STBSZ),
>>   	DT_BPF_SYMBOL_ID(STRSZ, DT_IDENT_SCALAR, DT_CONST_STRSZ),
>>   	DT_BPF_SYMBOL_ID(STKSIZ, DT_IDENT_SCALAR, DT_CONST_STKSIZ),
>> +	DT_BPF_SYMBOL_ID(ERROR_PRID, DT_IDENT_SCALAR, DT_CONST_ERROR_PRID),
>>   	DT_BPF_SYMBOL_ID(BOOTTM, DT_IDENT_SCALAR, DT_CONST_BOOTTM),
>>   	DT_BPF_SYMBOL_ID(NSPEC, DT_IDENT_SCALAR, DT_CONST_NSPEC),
>>   	DT_BPF_SYMBOL_ID(NCPUS, DT_IDENT_SCALAR, DT_CONST_NCPUS),
>> -- 
>> 2.18.4
>>
>>
>> _______________________________________________
>> DTrace-devel mailing list
>> DTrace-devel at oss.oracle.com
>> https://oss.oracle.com/mailman/listinfo/dtrace-devel



More information about the DTrace-devel mailing list