The error message is a little misleading. The limitation is not scratch space but the size of the strings(strsize) in DTrace. This is 256 bytes by default. If your strjoin is bigger than 256 bytes then you would get this error. See http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/uts/common/dtrace/dtrace.c#3863
The way to fix it is to set strsize #pragma D option strsize=1024 // make sure your string can fit in! -Angelo On May 11, 2010, at 8:01 AM, Mark Phalan wrote: > I'm getting an "out of scratch space in action" error and I don't know > why. The amount of data being copied around is very small: > > > # dtrace -n 'simple$target:::start {printf("%s\n", > args[0]->data_string);}' -c "./simple" > dtrace: description 'simple$target:::start ' matched 1 probe > dtrace: pid 1601 has exited > dtrace: error on enabled probe ID 1 (ID 66120: > simple1601:simple:main:start): out of scratch space in action #1 at DIF > offset 148 > > > # cat simple.d > typedef struct _my_data { > uint32_t length; /* length of data buffer */ > uint32_t data; /* Pointer to data */ > } my_data; > > typedef struct data { > string data_string; > } data_t; > > translator data_t < my_data *P > { > data_string = strjoin("@", > stringof(copyin((uintptr_t)(*((uint32_t *) > copyin((uintptr_t)&P->data, sizeof (uint32_t)))), *((uint32_t *) > copyin((uintptr_t)&P->length, sizeof (uint32_t)))))); > }; > > > # cat simple.c > typedef struct _my_data { > unsigned int length; > char *data; > } my_data; > > #include "s.h" > > int main() { > my_data data; > > data.length = strlen("TEST"); > data.data = malloc(data.length); > memcpy(data.data, "TEST", data.length); > > SIMPLE_START(&data); > } > > > If I remove the "strjoin" in the translator it works fine. > > -M > > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss@opensolaris.org _______________________________________________ dtrace-discuss mailing list dtrace-discuss@opensolaris.org