Hi Robert,
Thanks very much for your answer!
Per my understanding, it should be:
(1) "arg0 ... arg9" will always exist, while args[] only exist if there is
ctf data.
(2) When args[] exist, I can use "dtrace -lvn" command to get the argument
types.
Are these understandings right? Thanks very much in advance!
Best Regards
Nan Xiao
------------------ ???????? ------------------
??????: "Robert Mustacchi";<[email protected]>;
????????: 2014??10??31??(??????) ????11:30
??????: "Nan Xiao"<[email protected]>;
"dtrace-discuss"<[email protected]>;
????: Re: [dtrace-discuss] How to decide use "arg0...arg9" or "args[]"?
On 10/30/2014 07:47 PM, Nan Xiao via dtrace-discuss wrote:
> Hi all,
>
>
> There are two argument types in DTrace: "arg0...arg9" vs "args[]".
> According to Brendan's book, the definitions of two argument types are like
> this:
>
> Variable Name Type Description
> arg0...arg9 uint64_t Probe arguments; content is
> provider-specific
> args[] * Typed probe arguments; content is
> provider-specific
>
> My question is how to decide use "arg0...arg9" or "args[]"? Per my
> understanding, I can use "dtrace -lvn probe" to check.
>
> For example:
> bash-3.2# dtrace -lvn syscall::read:entry
> ID PROVIDER MODULE FUNCTION NAME
> 58077 syscall read
> entry
>
>
> ......
>
>
> Argument Types
> None
>
>
> Since "Argument Types are None", I should use "arg0...arg9".
>
>
>
> bash-3.2# dtrace -lvn proc:::signal-handle
> ID PROVIDER MODULE FUNCTION NAME
> 1163 proc genunix psig
> signal-handle
>
>
> ......
>
>
> Argument Types
> args[0]: int
> args[1]: siginfo_t *
> args[2]: int (*)()
>
>
> Since "Argument Types are not None", I should use "args[]".
>
>
>
> Is this method right? Thanks very much in advance!
Which you'll want to use depends on the situation. The types of arg0 and
args[0] will be different and the latter may not always exist. arg0 and
friends are generally always defined as an int64_t (if you consider pid,
syscall, and fbt for a moment). If we have ctf data, then the type of
args[%d] will be the type of that data. Consider the case where you use
the print() action. print(arg0) will always print an int64_t, where as
print(args[0]) will print the data based on the type information that we
have.
Does that help clarify things?
Robert
-------------------------------------------
dtrace-discuss
Archives: https://www.listbox.com/member/archive/184261/=now
RSS Feed: https://www.listbox.com/member/archive/rss/184261/25769126-e243886f
Modify Your Subscription:
https://www.listbox.com/member/?member_id=25769126&id_secret=25769126-8d47a7b2
Powered by Listbox: http://www.listbox.com