[LCP] in SIGSEGV, how to tell whether the offending access is a read-access or write access?
davidn at datalinktech.com.au
Fri Mar 27 08:13:04 EST 2009
-----BEGIN PGP SIGNED MESSAGE-----
On 26/03/2009, at 2:32 PM, Mark Farnell wrote:
> I am writing a SIGSEGV handler, in struct, siginfo_t I can tell the
> offending address, However can I also find out whether it was a read-
> or a write- attempt? If so, how?
SIGSEGV just indicates an illegal access, which could be either. but I
don't believe that there is a machine independent way of discovering
which. It would require looking at and interpreting the machine level
instruction at the faulting address. This may be a little tricky in
some cases (indirect fetches etc) and may require more data such as
register contents and so on.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)
-----END PGP SIGNATURE-----
More information about the linuxCprogramming