#include<stdio.h> #include<unistd.h> #include<procfs.h> #include<sys/regset.h> int main() { FILE *fp; pstatus_t san; int c; pid_t pid; lwpstatus_t san2; int nlwp; pid=getpid(); char str[40]; sprintf(str, "/proc/%d/status", pid); fp=fopen(str,"r"); fread(&san, sizeof(san), 1, fp); san2=san.pr_lwp; printf("eip=%d\n",san2.pr_reg[EIP]); printf("nlwp=%d\n",san.pr_nlwp); printf("eax=%d\n",san2.pr_reg[EAX]); return 0; }
/* OUTPUT: eip=-17832443 nlwp=1 eax=3 */ I tried this code. But the values the EIP register returned were not what we expect, right? Why is EIP returning a garbage value. The same is the case with other registers as well. Only EAX is returning a value which may be thought to be correct. Even in the case of EAX, how can we check if the value is right? -- This message posted from opensolaris.org _______________________________________________ opensolaris-discuss mailing list opensolaris-discuss@opensolaris.org