Lafontaine
2007-May-09 12:56 UTC
[dtrace-discuss] printf( " %d " , *(uint32_t *) copyin ( arg0, n)) ??
Hello, I don''t find a solution to my problem since we can''t use loops with Dtrace: I want to print n values (given size) from a specific address. If I ask printf( " %d " , *(uint32_t *) copyin ( addr, n )), it gives me only 4 bytes, if I ask printf( " %d " , *(unsigned char *) copyin ( addr, n )), it gives me only 1 byte.. How could I obtain the n bytes? Thank you for your answers it''s very important. Fabien. -- This message posted from opensolaris.org
Brian Utterback
2007-May-09 15:31 UTC
[dtrace-discuss] printf( " %d " , *(uint32_t *) copyin ( arg0, n)) ??
I am not sure what you are asking here. In the two printf statements, you are only asking for the number of bytes that it is printing. In the first place, you told printf that you were printing an unsigned 32 bit int, so it only printed 4 bytes. In the second case you told printf that you wanted to print a char, so it printed only one byte. I don''t see what the issue is. Are you saying that you want to print a series of values? Lafontaine wrote:> Hello, > I don''t find a solution to my problem since we can''t use loops with Dtrace: I want to print n values (given size) from a specific address. > If I ask printf( " %d " , *(uint32_t *) copyin ( addr, n )), it gives me only 4 bytes, > if I ask printf( " %d " , *(unsigned char *) copyin ( addr, n )), it gives me only 1 byte.. > How could I obtain the n bytes? > > Thank you for your answers it''s very important. > Fabien. > -- > This message posted from opensolaris.org > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org-- blu "When Congress started Daylight Savings Time earlier, did they even consider what affect an extra hour of daylight would have on global warming? Well, did they?" ---------------------------------------------------------------------- Brian Utterback - Solaris RPE, Sun Microsystems, Inc. Ph:877-259-7345, Em:brian.utterback-at-ess-you-enn-dot-kom
Adam Leventhal
2007-May-09 17:14 UTC
[dtrace-discuss] printf( " %d " , *(uint32_t *) copyin ( arg0, n)) ??
Hi Fabien, If you want to trace a block of memory, you can do so with the tracemem() action. If you have some array of variable length, you''ll have to do something a bit more clever to print it such as unrolling what would ideally be a loop or using a tick probe to print out entries periodically. Adam On Wed, May 09, 2007 at 05:56:49AM -0700, Lafontaine wrote:> Hello, > I don''t find a solution to my problem since we can''t use loops with Dtrace: I want to print n values (given size) from a specific address. > If I ask printf( " %d " , *(uint32_t *) copyin ( addr, n )), it gives me only 4 bytes, > if I ask printf( " %d " , *(unsigned char *) copyin ( addr, n )), it gives me only 1 byte.. > How could I obtain the n bytes? > > Thank you for your answers it''s very important. > Fabien. > -- > This message posted from opensolaris.org > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org-- Adam Leventhal, Solaris Kernel Development http://blogs.sun.com/ahl
Lafontaine
2007-May-10 07:49 UTC
[dtrace-discuss] Re: printf( " %d " , *(uint32_t *) copyin ( arg0, n)) ??
Hello Adam, ok it works with tracemem: tracemem( copyin ( addr , n) , n ); does it look good? another question: the result of tracemem give me (for n=10): 0 1 2 3 4 5 6 7 8 9 a b c d e f 0123456789abcdef 0: b7 60 00 00 00 07 00 00 00 15 .`........ Can I do something to just keep the values (b7 60 00 00 00 07 00 00 00 15) ? Thank you very much. Fabien. -- This message posted from opensolaris.org