Hi all,
I am using DTrace to debug a signal related 32-bit program on Solaris 10(64-bit). The source code of program is: #include <stdio.h> #include <signal.h> struct sigaction act; void handler(int a, siginfo_t *b, void *c) { } int main(void) { act.sa_flags = 1; act.sa_sigaction = handler; sigemptyset(&act.sa_mask); sigaction(SIGINT, &act, NULL); printf("The address is 0x%x, sizeof(struct sigaction) is %d\n", &act, sizeof(struct sigaction)); return 0; } The DTrace script is : #!/usr/sbin/dtrace -Cs -32 #include <signal.h> sigaction:entry /pid == $target/ { this->sig = (struct sigaction *)copyin(arg1, sizeof(struct sigaction)); printf("pid is %d: arg0 is %d, arg1 is 0x%x, sa_flags is %d, sa_sigaction is 0x%x\n", pid, arg0, arg1, (int)(this->sig->sa_flags), (int)(this->sig->sa_sigaction)); printf("0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", *((char*)this->sig), *(((char*)this->sig) + 1), *(((char*)this->sig) + 2), *(((char*)this->sig) + 3), *(((char*)this->sig) + 4), *(((char*)this->sig) + 5), *(((char*)this->sig) + 6), *(((char*)this->sig) + 7)); printf("0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", *(((char*)this->sig) + 8), *(((char*)this->sig) + 9), *(((char*)this->sig) + 10), *(((char*)this->sig) + 11), *(((char*)this->sig) + 12), *(((char*)this->sig) + 13), *(((char*)this->sig) + 14), *(((char*)this->sig) + 15)); printf("0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", *(((char*)this->sig) + 16), *(((char*)this->sig) + 17), *(((char*)this->sig) + 18), *(((char*)this->sig) + 19), *(((char*)this->sig) + 20), *(((char*)this->sig) + 21), *(((char*)this->sig) + 22), *(((char*)this->sig) + 23)); printf("0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", *(((char*)this->sig) + 24), *(((char*)this->sig) + 25), *(((char*)this->sig) + 26), *(((char*)this->sig) + 27), *(((char*)this->sig) + 28), *(((char*)this->sig) + 29), *(((char*)this->sig) + 30), *(((char*)this->sig) + 31)); ustack(); } The execute the command: "./trace.d -c ./a", and the output is: bash-3.2# ./trace.d -c ./a dtrace: script './trace.d' matched 6 probes The address is 0x8060ea0, sizeof(struct sigaction) is 32 dtrace: pid 23721 has exited CPU ID FUNCTION:NAME 2 58241 sigaction:entry pid is 23721: arg0 is 2, arg1 is 0x8047760, sa_flags is 1, sa_sigaction is 0xffbffeff 0x1 0x0 0x0 0x0 0x4 0xe9 0xed 0xfe 0xff 0xfe 0xbf 0xff 0xff 0xff 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 libc.so.1`__sigaction+0x15 a`main+0x51 a`_start+0x80 The C program output the address of act is 0x8060ea0, but DTrace outputs the address of act is 0x8047760. Furthermore, the data in 0x8047760 isn't same as C program has set. Could anyone give any help or clues on this issue? Thanks very much in advance! Bets Regards Nan Xiao ------------------------------------------- dtrace-discuss Archives: https://www.listbox.com/member/archive/184261/=now RSS Feed: https://www.listbox.com/member/archive/rss/184261/25769126-e243886f Modify Your Subscription: https://www.listbox.com/member/?member_id=25769126&id_secret=25769126-8d47a7b2 Powered by Listbox: http://www.listbox.com