On Wed, Oct 10, 2012 at 03:37:53PM -0700, Arun Sharma wrote:
> On Wed, Oct 10, 2012 at 9:21 AM, Harald Servat <[email protected]> wrote:
> > Hello list,
> >
> >   I was wondering whether in the recent development of libunwind if the
> > library gives the possibility to know which is the effective address
> > that is being accessed in a sighandler (not the Program Counter itself,
> > but the memory referenced, if the PC pointed to a Load/Store op). Or if
> > this functionality is out of the scope of libunwind and must be done
> > through other libraries/tools (and if any, do you have any clue?).
> 
> I'd say this is out of the scope of libunwind. A couple of suggestions:
> 
> * SA_SIGINFO can provide the faulting address for some signals
> * PEBS/IBS on x86 CPUs have this capability (as a profiling tool).
> Relevant patches have been posted multiple times on linux-kernel, but
> haven't made it to mainline yet.
> * If nothing else works, you could try to use a x86 instruction
> decoder and compute the effective address by interpreting the
> instruction.

If CPU did reported the faulted address, then you can get it for sure
on FreeBSD/x86 or x86_64. The kernel passes a fully populated ucontext_t
to the handler, which contains the snaphot of the register file at the
fault time, as well as mc_err field, which is the CPU error as pushed
on stack by microcode.

I expect a similar mechanism available for other Unixes.

Attachment: pgp522OfoSNte.pgp
Description: PGP signature

_______________________________________________
Libunwind-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/libunwind-devel

Reply via email to