Usenet comp.unix.tru64 (2000-2013)
 help / color / mirror / Atom feed
* Getting the PC in a signal handler
@ 2000-10-23  4:00 Stephan Erbs Korsholm
  0 siblings, 0 replies; only message in thread
From: Stephan Erbs Korsholm @ 2000-10-23  4:00 UTC (permalink / raw)


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



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-10-23  4:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-10-23  4:00 Getting the PC in a signal handler Stephan Erbs Korsholm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox