m***@public.gmane.org
17 years ago
I have a C program,
$cat sample.cpp
#include <stdio.h>
#include <memory.h>
#include <stdlib.h>
struct xxx
{
int yyy;
int zzz;
const char *name;
};
void sub1 (struct xxx *p)
{
printf ("CProgram: %d %d %s\n", p->yyy, p->zzz, p->name);
}
main()
{
char * key = (char *)malloc(5);
key[0] = 'A';
key[1] = 'B';
key[2] = 'C';
key[3] = 'D';
key[4] = '\0';
struct xxx *t1 = new struct xxx;
t1->yyy = 20;
t1->zzz = 30;
t1->name = key;
sub1 (t1);
}
and a DTrace script :
$cat sample.d
struct xxx
{
int yyy;
int zzz;
const char *name;
};
pid$target:a.out:*sub1*:entry
{
sp = (struct xxx *) copyin (arg0, sizeof (struct xxx));
printf ("DTrace: %d %d \n", sp->yyy, sp->zzz);
printf ("DTrace: name=%s\n", stringof(sp->name));
exit (0);
}
$CC sample.cpp
$dtrace: script 'sample.d' matched 1 probe
CProgram: 20 30 ABCD
dtrace: pid 2624 has exited
dtrace: error on enabled probe ID 1 (ID 47665: pid2624:a.out:__1cEsub16FpnDxxx__v_:entry): invalid address (0x2872800000000) in action #4
What is this error ? I get this error when I compile the program in 64 bit as well.
$CC -xarch=v9 sample.cpp
$dtrace -s sample.d -c ./a.out
dtrace: script 'sample.d' matched 1 probe
CProgram: 20 30 ABCD
dtrace: pid 2629 has exited
dtrace: error on enabled probe ID 1 (ID 47665: pid2629:a.out:__1cEsub16FpnDxxx__v_:entry): invalid address (0x10010a000) in action #4
$cat sample.cpp
#include <stdio.h>
#include <memory.h>
#include <stdlib.h>
struct xxx
{
int yyy;
int zzz;
const char *name;
};
void sub1 (struct xxx *p)
{
printf ("CProgram: %d %d %s\n", p->yyy, p->zzz, p->name);
}
main()
{
char * key = (char *)malloc(5);
key[0] = 'A';
key[1] = 'B';
key[2] = 'C';
key[3] = 'D';
key[4] = '\0';
struct xxx *t1 = new struct xxx;
t1->yyy = 20;
t1->zzz = 30;
t1->name = key;
sub1 (t1);
}
and a DTrace script :
$cat sample.d
struct xxx
{
int yyy;
int zzz;
const char *name;
};
pid$target:a.out:*sub1*:entry
{
sp = (struct xxx *) copyin (arg0, sizeof (struct xxx));
printf ("DTrace: %d %d \n", sp->yyy, sp->zzz);
printf ("DTrace: name=%s\n", stringof(sp->name));
exit (0);
}
$CC sample.cpp
$dtrace: script 'sample.d' matched 1 probe
CProgram: 20 30 ABCD
dtrace: pid 2624 has exited
dtrace: error on enabled probe ID 1 (ID 47665: pid2624:a.out:__1cEsub16FpnDxxx__v_:entry): invalid address (0x2872800000000) in action #4
What is this error ? I get this error when I compile the program in 64 bit as well.
$CC -xarch=v9 sample.cpp
$dtrace -s sample.d -c ./a.out
dtrace: script 'sample.d' matched 1 probe
CProgram: 20 30 ABCD
dtrace: pid 2629 has exited
dtrace: error on enabled probe ID 1 (ID 47665: pid2629:a.out:__1cEsub16FpnDxxx__v_:entry): invalid address (0x10010a000) in action #4