[LCP] in SIGSEGV, how to tell whether the offending access is a read-access or write access?

David Nugent davidn at datalinktech.com.au
Fri Mar 27 08:13:04 EST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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.

Regards,
David

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAknL7+AACgkQgyBtWyGDJqWihgCeI77qwwY/wKW+rB6k5cTHiXKN
d98An3nKa7o35i12+XZ+3wzxdXe5w4hQ
=qGZh
-----END PGP SIGNATURE-----



More information about the linuxCprogramming mailing list