Davide Ancri <falsemail@nospam.xx> wrote:
David Gibbs wrote:
David Gibbs <> dagibbs@qnx.com> > wrote:
There isn’t something giving all the registers, but the siginfo_t passed
to the handler (defined in <sys/siginfo.h> does give some extra information
for those signals – in particular it gives fltno, ip, and address that
caused the fault. I’m not sure what the address will be.
I have been corrected – apparently the third “void *” entry may/will be
a ucontext_t in this case that gives a full register set. <ucontext.h>.
Thanks a lot, David!
sys/siginfo.h> and <ucontext.h> are not so easy to understand at the
first view,
Yeah, cause they’re unions to cover various different cases.
<sys/siginfo.h> is messy cause it is information for various different
types of signals – but the comments looked ok.
<ucontext.h> is messy cause the register sets are different for all
the different processors we support.
but if I’m not missing something, I can start experimenting
with code similar to this:
#include <signal.h
#include <sys/siginfo.h
#include <ucontext.h
void MySegv ( int signo, siginfo_t* s, ucontext_t* u )
{
…
}
int main ( int c, char** v )
{
signal( SIGSEGV, (void*)MySegv );
(int)0xDEADC0DE = -1;
return 0;
}
Am I right?
Assuming DEADCODE isn’t a valid address, yeah, I think that will work.
(I don’t think the C compiler will call that an invalid lvalue.)
-David
David Gibbs
QNX Training Services
dagibbs@qnx.com