[dtrace-discuss] find the address of a variable with its name

Jon Haslam Jonathan.Haslam at Sun.COM
Fri Jun 1 06:56:59 PDT 2007


Hi Fabien,

> I have another problem with Dtrace: I want to get the address of a global variable used by a process if I just know the name.
> It's possible with dbx with a print &name_of_the_variable but with Dtrace? trace(`name_of_the_variable) doesn't work...
>   

Unfortunately, there isn't the user-land equivalent of the kernel scoping
operator (`) and you currently need to go through a bit of a dance to do 
this.
Basically, for a global variable, you need to find the address of the 
variable
in question using your favourite debugger (i.e. mdb(1)) and then use the
copyin subroutine to get at the data in question.

A previous discussion of this with a bit more detail can be found at:

http://www.opensolaris.org/jive/message.jspa?messageID=80703


Jon.


More information about the dtrace-discuss mailing list