This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, RFC] Enable libsanitizer on powerpc{,64}
On 11/20/2012 12:16 PM, Peter Bergner wrote:
> +uptr Unwind_GetBP(struct _Unwind_Context *ctx) {
> + return _Unwind_GetCFA(ctx);
> +}
> +
> +struct Unwind_Trace_Info {
> + StackTrace *stack;
> + uptr bp;
> +};
> +
> _Unwind_Reason_Code Unwind_Trace(struct _Unwind_Context *ctx,
> void *param) {
> - StackTrace *b = (StackTrace*)param;
> - CHECK(b->size < b->max_size);
> + Unwind_Trace_Info *p = (Unwind_Trace_Info *)param;
> + StackTrace *b = p->stack;
> uptr pc = Unwind_GetIP(ctx);
> + if (Unwind_GetBP(ctx) == p->bp) {
BP will only equal the CFA on some targets. It really depends on how the target sets up the stack frame. It will also depend on the target actually using frame pointers.
On the other hand, CFA = SP on the next frame up. And that's rather more reliable based on how we work with dwarf2 and define the CFA. Only very unusual functions have CFA != the incoming SP -- asm versions of longjmp for example.
r~
- References:
- [PATCH, RFC] Enable libsanitizer on powerpc{,64}
- Re: [PATCH, RFC] Enable libsanitizer on powerpc{,64}
- From: Konstantin Serebryany
- Re: [PATCH, RFC] Enable libsanitizer on powerpc{,64}
- Re: [PATCH, RFC] Enable libsanitizer on powerpc{,64}
- From: Konstantin Serebryany
- Re: [PATCH, RFC] Enable libsanitizer on powerpc{,64}
- Re: [PATCH, RFC] Enable libsanitizer on powerpc{,64}
- From: Konstantin Serebryany
- Re: [PATCH, RFC] Enable libsanitizer on powerpc{,64}
- Re: [PATCH, RFC] Enable libsanitizer on powerpc{,64}
- From: Konstantin Serebryany
- Re: [PATCH, RFC] Enable libsanitizer on powerpc{,64}