Operating System - HP-UX
1820755 Members
3658 Online
109627 Solutions
New Discussion юеВ

How do I find fault location

 
SOLVED
Go to solution
Tony Abo
Occasional Advisor

How do I find fault location

I am trying to do some enhanced error reporting when exceptions occur in my applications running on PA-RISC 11.00 and 11.11. I need the address of the instruction that caused the SEGV, BUS, etc. error.

In my sigaction handler, I get a pointer to a siginfo_t which has the address being referenced, but not the location of the referencing instruction. I also have the pointer to the saved context, which I'm sure has the desired information, or at least a roadmap to where the information is hidden, but I can't seem to find it.

Thanks for any help on this.
3 REPLIES 3
Dennis Handly
Acclaimed Contributor
Solution

Re: How do I find fault location

You could just call U_STACK_TRACE to get the complete stack trace:
extern "C" void U_STACK_TRACE(void);

This is in libcl on PA and libunwind on IPF.

The address of the instruction is the PC of course.

The fields in question may look something like this:
if ((pinfo.hw_regs.ss_flags & (SS_WIDEREGS | SS_NARROWISINVALID)) ==
(SS_WIDEREGS | SS_NARROWISINVALID)) {
pco = pinfo.hw_regs.ss_wide.ss_32.ss_pcoq_head_lo;
}
else {
pco = pinfo.hw_regs.ss_narrow.ss_pcoq_head;
}
Tony Abo
Occasional Advisor

Re: How do I find fault location

Ok, this works:
GetSSReg( &((ucontext_t *) pContext)->uc_mcontext, ss_pcoq_head);

Thanks for the tips
Tony Abo
Occasional Advisor

Re: How do I find fault location

GetSSReg( &((ucontext_t *) pContext)->uc_mcontext, ss_pcoq_head);