Mark Phalan
2010-05-11 12:01:09 UTC
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
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