Anatoli,

I think your C executable is 32 bit.  I recompiled it into a 64 bit
binary, and it worked correctly.

However, a long long in a 32 bit binary should be 64 bits, so I also
tried the -32 option with dtrace, and that didn't seem to make any
difference.

If you look at the assembly code for each compilation (32 bit and 64
bit), there is a distinct difference in the way the return value is
processed.  (I used gcc.)

32-bit snipit...

        sethi   %hi(4294966272), %i4
        or      %i4, 1023, %i4
        sethi   %hi(4294966272), %i5
        or      %i5, 1023, %i5
        mov     %i4, %i0
        mov     %i5, %i1
        ret
        restore

64-bit snipit...

        mov     -1, %g1
        mov     %g1, %i0
        return  %i7+8

>From the value you are getting (actually a 32 bit -1), I suspect that
DTrace is only grabbing %i0 and putting it arg0, which is sufficient for
a 64 bit app, but for a 32 bit app returning a long long, the return
value comes back in %i0 _and_ %i1.

I don't know why DTrace is not picking up %i1.  I was hoping the -32
option would have triggered that.  Anybody else got any thoughts?

Chip


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:dtrace-discuss-
> [EMAIL PROTECTED] On Behalf Of Anatoli
> Sent: Tuesday, October 14, 2008 12:10 PM
> To: [email protected]
> Subject: [dtrace-discuss] printing (long long) arg1 on :::return
> 
> Hi, All
> I have run onto inability to trace (long long) return values - please
> see details below.
> Is there a way to get it correctly ?
> Thanks in advance
> 
> inline unsigned long long ret_ll(void){
>     return (unsigned long long)(-1);
> }
> 
> int main( int argc, char* argv[] ){
>     while( 1 ){
>         ret_ll();
>         sleep(1);
>     }
> }
> 
> Here is what I am getting:
> 
> # isainfo -b
> 64
> # dtrace -n "pid`pgrep ret_ll`::ret_ll:return{trace(arg1)}"
> dtrace: description 'pid5633::ret_ll:return' matched 1 probe
> CPU     ID                    FUNCTION:NAME
>   0  47874                    ret_ll:return        4294967295   <-- it
> is definately not a (long long)
> 
> PS: have tried as well:
> # dtrace -n "pid`pgrep ret_ll`::ret_ll:return{printf(\"%lld\", (long
> long)arg1)}"
> dtrace: description 'pid13837::ret_ll:return' matched 1 probe
> CPU     ID                    FUNCTION:NAME
>   1  47874                    ret_ll:return 4294967295          <--
> more like just (int)
> --
> This message posted from opensolaris.org
> _______________________________________________
> dtrace-discuss mailing list
> [email protected]


_______________________________________________
dtrace-discuss mailing list
[email protected]

Reply via email to