From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,c6ea78e6b36010ed,start X-Google-Attributes: gidfa528,public From: Stephan Erbs Korsholm Subject: Getting the PC in a signal handler Date: 2000/10/23 Message-ID: #1/1 X-Deja-AN: 684733924 X-Complaints-To: usenet@daimi.au.dk X-Trace: gjallar.daimi.au.dk 972293138 5722128 130.225.8.27 (23 Oct 2000 09:25:38 GMT) Organization: --- NNTP-Posting-Date: Mon, 23 Oct 2000 09:25:38 +0000 (UTC) Newsgroups: comp.unix.tru64 Hi, About a year ago I posted a question regarding getting the PC at the time of signal reception. This did not work for me. I did not get an answer, but now I've solved the problem myself. For your information here it is, Platform, OSF1 V4.0 alpha Problem: You install a signal handler to catch some signal. In the handler you want to retrieve the value of the PC at the point of signal reception. The signature of the signal handler is, static void handler(int signo, siginfo_t* info, ucontext_t* context) According to the documentation you can get the PC from the (ucontext_t *) struct given to your signal handler (in context -> uc_mcontext.sc_pc). But this is not correct. The value of context -> uc_mcontext.sc_pc has no immediate relation to the PC. Solution: The value of the PC is instead, pc = ((u_int64)info -> _sifields._sipad[25] << 32) | (u_int32)info -> _sifields._sipad[24]; /Stephan