Angelo Rajadurai
2008-Jan-04 18:40 UTC
[dtrace-discuss] How do I print wide char string arguments!
Hopefully this is a straight forward issue and I''m missing
something obvious.
I''m trying to print a wchar_t [] argument from a simple example
program like
#include <stdio.h>
#include <wchar.h>
#include <unistd.h>
void
prout(wchar_t *wstr)
{
}
int
main()
{
wchar_t name[]=L"Angelo Rajadurai";
int i;
for(i=0; i<1000 ; i++)
{
prout(name);
sleep(1);
}
}
With a D script like
#!/usr/sbin/dtrace -s
pid$target::prout:entry{
printf("Argument of %s is %s\n",probefunc,copyinstr(arg0));
}
but it just prints the first char of the string "A"
I''m aware of the %ls and %ws format options in printf() but for
the life of me I''m unable to typecast copyin() into a whcar_t[]
So help! I think I need a copyinwstr() or wstringof() equiv!
Thanks
Angelo
