[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-hackers
Subject:    User Space DTrace and dumping function arguments for user space
From:       Shrikanth Kamath <shrikanth07 () gmail ! com>
Date:       2013-08-16 22:10:13
Message-ID: CAEOAkMVrJ7bfCaDLDOFzN=VQ6KGyUXc6pSNjGooB9TN0zpmJiQ () mail ! gmail ! com
[Download RAW message or body]

Can we dump function arguments for user space functions just like for functions
in kernel space? Can FBT provider dump arguments for user space functions if we
do dtrace -l -f <function name> -v?

I was DTrace'ing "top" utility, (the "top" utility has both
the CTF and the Dwarf debug sections built in the object file)

I am trying to inspect get_system_info function called by "top", I
confirm it is present to be probed

    root% dtrace -l | grep get_system_info
    55154  pid8488      top        get_system_info entry

But I cannot dump the arguments to the function...
root% dtrace -l -f get_system_info -v
   ID   PROVIDER            MODULE                          FUNCTION NAME
55154    pid8488               top                   get_system_info entry

        Probe Description Attributes
                Identifier Names: Private
                Data Semantics:   Private
                Dependency Class: Unknown

        Argument Attributes
                Identifier Names: Private
                Data Semantics:   Private
                Dependency Class: Unknown

        Argument Types
                None

Testing with a simple script,
    pid8488::get_system_info:entry
    {
        this->info = (struct system_info *)copyin(args[0],
sizeof(struct system_info));
        ...
    }

...if I use the args[0] notation it says the following,
 dtrace: failed to compile script top_d.d: line 17: index 0 is out of
range for pid8488::get_system_info:entry args[ ]

Instead if I replace with arg0, it compiles but the values are not
neccesarily sane.
Example the ncpus member of struct system_info shows a garbage value.

The complete script is
pid8488::get_system_info:entry
{
    this->info = (struct system_info *)copyin(arg0, sizeof(struct system_info));
    printf("last pid [%d] \n", this->info->last_pid);
}
pid8488::get_process_info:entry
{
    this->info = (struct system_info *)copyin(arg0, sizeof(struct system_info));
    printf("ncpus [%d] \n", this->info->ncpus);
}

Running this
55154         get_system_info:entry last pid [8513]
55155         get_process_info:entry ncpus [134558720]

Supposed to be showing number of cpus? Anything wrong with the scripting?
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic