[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Process traceing



   From: lars brinkhoff <lars@nocrew.org>
   Date: 18 Feb 2000 08:50:30 +0100

   Mark Kettenis <kettenis@wins.uva.nl> writes:
   >    From: Mariusz Woloszyn <emsi@it.pl>
   >    How can I determine the context of cr2 special register when the proces
   >    caught SIGSEGV? The sigcontext structure defined in hurd in
   >    /include/bits/sigcontext.h file does not contain the cr2 register.
   > The Hurd uses the same signal handler conventions as BSD, which means
   > that you can declare you signal handler as:
   >    void handler (int sig, int code, struct sigcontext *scp)
   > For SIGSEGV, `code' is the faulting address.

   Also, how do you find out if it was a read or a write (or even exec)
   access?

I don't know if there is an easy way.  The `sc_error' member of the
sigcontext is set to the error code that is generated by the Mach
kernel in association with the fault.

The KERN_WRITE_PROTECTION_FAILURE error code looks promising.  The
comment in <mach/kern_return.h> suggests that you can set
VM_PROT_NOTIFY for the pages you're interested in such that this error
code will be returned when you write to those pages.  But I'm not sure
this really works.

Mark


Reply to: