libunwind-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Libunwind-devel] Docs suggestion - things that invalidate a saved conte


From: Craig Ringer
Subject: [Libunwind-devel] Docs suggestion - things that invalidate a saved context
Date: Wed, 20 Jun 2018 20:18:44 +0800

Hi folks

This probably falls into the category of "how can you not have figured that out" and "too obvious to document" for many here, but a quick docs suggestion:

In unw_getcontext, it'd be helpful to explain the bounds of validity for a saved context. In particular, a saved context ceases to be valid after returning from the function that captured the context or after a longjmp() / siglongjmp(). It may still work, but the stack pointer has moved back and it's not safe to access the stack anymore. New function calls, alloca(), etc, may clobber the residual state left on the stack.

I just spent a really embarrassing amount of time figuring out that this is why my PostgreSQL self-backtrace handler worked fine in non-returning direct error callbacks, but produced garbled nonsense when invoked after a longjmp() / setjmp().

--
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

reply via email to

[Prev in Thread] Current Thread [Next in Thread]