Madhusudhan Reddy
2007-Jan-19 12:38 UTC
[dtrace-discuss] invalid address (0x0) in action #2 at DIF offset 52
Hi, Iam facing this strange problem when i execute the following dtrace script on on particular thread(tid ==1) where as it works perfectly with another thread(tid == 4).Can someone help me with this problem? pid$1::SGetMsg:return /tid == 1 && self->trace == 1/ { printf("SGetMsg Ptr=0x%p\n", arg3); printf("Sget Reurn val %x Thread id %d 3 \n",*(int*)copyin(arg3,4),tid); } The argument which iam trying to print is pointer to a pointer. This message posted from opensolaris.org
Gonzalo Siero
2007-Jan-19 13:01 UTC
[dtrace-discuss] invalid address (0x0) in action #2 at DIF offset 52
Madhusudhan, you are using arg3 in "return" probe. If the function has a return value, it is stored in argument one. If a function does not have a return value, argument one is not defined; what''s arg3?? if it''s fourth input argument of SGetMsg:entry you must save it in a thread local var to print it afterwards. In return probe you can''t be sure it contains that info. Cheers, Gonzalo. Madhusudhan Reddy wrote:> Hi, > Iam facing this strange problem when i execute the following dtrace script on on particular thread(tid ==1) where as it works perfectly with another thread(tid == 4).Can someone help me with this problem? > pid$1::SGetMsg:return > /tid == 1 && self->trace == 1/ > { > printf("SGetMsg Ptr=0x%p\n", arg3); > printf("Sget Reurn val %x Thread id %d 3 \n",*(int*)copyin(arg3,4),tid); > } > > The argument which iam trying to print is pointer to a pointer. > > > This message posted from opensolaris.org > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org
Madhusudhan Reddy
2007-Jan-20 13:42 UTC
[dtrace-discuss] Re: invalid address (0x0) in action #2 at DIF offset 52
Gonzalo, If iam not wrong, input arguments of the function are arg0,arg1, arg2..... and return arguments are arg1, arg2, arg3..... 3rd Input argument of SGetMsg(which is pointer to a pointer) is of my interest so iam trying to print this value using arg3 when the function returns. Anything wrong ? Below is the prototype of the function for your reference PUBLIC S16 SGetMsg ( REG1 Region region, REG2 Pool pool, Buffer **mBufPtr ) Thanks, Madhusudhan Reddy This message posted from opensolaris.org
Jeremy Harris
2007-Jan-20 14:00 UTC
[dtrace-discuss] Re: invalid address (0x0) in action #2 at DIF offset 52
Madhusudhan Reddy wrote:> Gonzalo, > If iam not wrong, input arguments of the function are arg0,arg1, arg2..... and return arguments are arg1, arg2, arg3.....A "C" function has only one (or zero) return arguments; supplied in a "return" statement.> > 3rd Input argument of SGetMsg(which is pointer to a pointer) is of my interest so iam trying to print this value using arg3 when the function returns. Anything wrong ?A "C" function can''t change it''s caller''s view of an input argument either. What you might be asking for (I''m not clear, from your question) is the value pointed to by the third input argument, at the time of return from the function. If so, you should do something like capturing that 3rd input argument on entry to the function (in one D clause) and indirecting through the captured pointer on exit from the function (in a separate D clause). - Jeremy
Chip Bennett
2007-Jan-20 14:11 UTC
[dtrace-discuss] Re: invalid address (0x0) in action #2 at DIF offset 52
Hi, You need to grab the value of arg3 on the entry probe to the function (pid$1::SGetMsg:entry), save it in a thread-local variable, and then reference the thread-local variable in the return probe instead of the built-in variable arg3. arg3 only contains a copy of your function argument for the duration of the entry probe clause. Chip Madhusudhan Reddy wrote:> Gonzalo, > If iam not wrong, input arguments of the function are arg0,arg1, arg2..... and return arguments are arg1, arg2, arg3..... > > 3rd Input argument of SGetMsg(which is pointer to a pointer) is of my interest so iam trying to print this value using arg3 when the function returns. Anything wrong ? > > Below is the prototype of the function for your reference > > PUBLIC S16 SGetMsg > ( > REG1 Region region, > REG2 Pool pool, > Buffer **mBufPtr > ) > > Thanks, > Madhusudhan Reddy > > > This message posted from opensolaris.org > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org >