[Duckwater-discuss] First code review for changing the debugging of libsldap [bugid 6655471]

Tomas Heran Tomas.Heran at Sun.COM
Thu Mar 27 06:07:59 PDT 2008


Marco,

Marco van Wieringen wrote:

> 
> The last bit is also where my fun started. I probably am just
> overlooking something but I cannot get the copyinstr to work
> for some members of the structures I defined up until now.
> Maybe someone with lots of dtrace knowledge can help me out
> there. Its probably something very stupid but mind you that up
> till 2 months ago I did nothing with dtrace.
> 

[snip]

> dtrace: error on enabled probe ID 16 (ID 51637:
> libsldap8044:libsldap.so.1:addConnection:AddConnection): invalid address
> (0x8094ae0) in action #19 at DIF offset 20

I believe the problem lies in the Connection structure translator (in
file libsldap.d), specifically in the way you are copying the
serverAddr:

>  178 /*
>  179  * Translator from ns_internal.h struct Connection to dtrace defined struct libsldap_connection
>  180  */
>  181 #pragma D binding "1.5" translator
>  182 translator struct libsldap_connection <struct connection *P> {
>  183         connectionId = *(int *)copyin((uintptr_t)&P->connectionId, sizeof (ConnectionID));
>  184         usedBit = *(boolean_t *)copyin((uintptr_t)&P->usedBit, sizeof(boolean_t));
>  185         notAvail = *(boolean_t *)copyin((uintptr_t)&P->notAvail, sizeof(boolean_t));
>  186         shared = *(int *)copyin((uintptr_t)&P->shared, sizeof (int));
>  187         pid = *(pid_t *)copyin((uintptr_t)&P->pid, sizeof(pid_t));
>  188         serverAddr = copyinstr((uintptr_t)P->serverAddr);
>  189 };

Based on /usr/lib/dtrace/iscsi.d and my own experiments, I believe line
188 should go like this:

     serverAddr = (curthread->t_procp->p_model == 0x00100000) ?
     	copyinstr((uintptr_t)*(uint32_t *)copyin((uintptr_t)
		&P->serverAddr, sizeof (uint32_t))) :
     	copyinstr((uintptr_t)*(uint64_t *)copyin((uintptr_t)
		&P->serverAddr, sizeof (uint64_t)));

Please let me know whether it worked for you.

Tomas



More information about the duckwater-discuss mailing list