[DTrace-devel] [PATCH 02/16] Record object filename, inode, and base address for PID probes

Eugene Loh eugene.loh at oracle.com
Fri Mar 26 09:16:14 PDT 2021


Reviewed-by: Eugene Loh <eugene.loh at oracle.com>

But I do find one thing curious.  In the code below, there are seemingly 
spurious changes in variable order from one section of code to the 
next.  Consistency would be nice for someone reading through the code.  
E.g., if variables appear in one order in a header file, they could be 
initialized in that order in the code. Just a minor readability thing.

On 3/19/21 12:54 AM, Kris Van Hees wrote:
> diff --git a/include/dtrace/pid.h b/include/dtrace/pid.h
> @@ -27,9 +28,12 @@ typedef enum pid_probetype {
>   typedef struct pid_probespec {
>   	pid_t pps_pid;				/* task PID */
>   	pid_probetype_t pps_type;		/* probe type */
> -	char *pps_mod;				/* probe module */
> +	char *pps_mod;				/* probe module (object) */
>   	char pps_fun[DTRACE_FUNCNAMELEN];	/* probe function */
> +	ino_t pps_ino;				/* object inode */
> +	char *pps_fn;				/* object full filename */
>   	uint64_t pps_pc;			/* probe address */
> +	uint64_t pps_vaddr;			/* object base address */
>   	uint64_t pps_size;			/* function size (in bytes) */
>   	uint8_t pps_glen;			/* glob pattern length */
>   	char pps_gstr[1];			/* glob pattern string */
> diff --git a/libdtrace/dt_pid.c b/libdtrace/dt_pid.c
> @@ -33,7 +33,10 @@ typedef struct dt_pid_probe {
>   	const char *dpp_func;
>   	const char *dpp_name;
>   	const char *dpp_obj;
> +	char *dpp_fname;
> +	ino_t dpp_ino;
>   	uintptr_t dpp_pc;
> +	uintptr_t dpp_vaddr;
>   	size_t dpp_size;
>   	Lmid_t dpp_lmid;
>   	uint_t dpp_nmatches;
> @@ -151,6 +154,9 @@ dt_pid_per_sym(dt_pid_probe_t *pp, const GElf_Sym *symp, const char *func)
>   
>   	psp->pps_pid = pid;
>   	psp->pps_mod = dt_pid_objname(pp->dpp_lmid, pp->dpp_obj);
> +	psp->pps_ino = pp->dpp_ino;
> +	psp->pps_vaddr = pp->dpp_vaddr;
> +	psp->pps_fn = strdup(pp->dpp_fname);
>   	strcpy_safe(psp->pps_fun, sizeof(psp->pps_fun), func);
>   
>   	if (!isdash && gmatch("return", pp->dpp_name)) {
> @@ -279,6 +285,9 @@ dt_pid_per_mod(void *arg, const prmap_t *pmp, const char *obj)
>   
>   	dt_Plmid(pp->dpp_dtp, pid, pmp->pr_vaddr, &pp->dpp_lmid);
>   
> +	pp->dpp_ino = pmp->pr_inum;
> +	pp->dpp_vaddr = pmp->pr_vaddr;
> +
>   	/*
>   	 * Note: if an execve() happens in the victim after this point, the
>   	 * following lookups will (unavoidably) fail if the lmid in the previous



More information about the DTrace-devel mailing list