From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 54590 invoked by alias); 21 Oct 2016 12:58:45 -0000 Mailing-List: contact gnu-gabi-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: gnu-gabi-owner@sourceware.org Received: (qmail 54571 invoked by uid 89); 21 Oct 2016 12:58:43 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.99.2 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=customary, H*Ad:U*gnu-gabi, arrived, site X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: mx2.suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Date: Fri, 01 Jan 2016 00:00:00 -0000 From: Michael Matz To: Florian Weimer cc: "H.J. Lu" , gnu-gabi@sourceware.org Subject: Re: [PATCH] Make _Unwind_GetIPInfo part of the ABI In-Reply-To: Message-ID: References: User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-SW-Source: 2016-q4/txt/msg00013.txt.bz2 Hi, On Fri, 21 Oct 2016, Florian Weimer wrote: > Without _Unwind_GetIPInfo, it is not possible to unwind correctly > through signal handlers. glibc needs this, otherwise cancellation does > not work. > > The attached patch documents this function and makes it part of the ABI. > I tried to explain as best as I could why this function is needed, > without talking about exception handler regions. > > The 32-bit ABI will need a similar change. > > The second patch is for the Makefile, so that it doesn't ask for input > on an error. Thanks, integrated in my copy, though I changed the text slightly to the below. The parameter is customary called "ip_before_insn" (though that is wrong as well, and should be named "ip_at_insn" or the like). Ciao, Michael. Index: libraries.tex =================================================================== --- libraries.tex (revision 251) +++ libraries.tex (working copy) @@ -42,6 +42,7 @@ The unwind library interface consists of \codeindex{\_Unwind\_GetGR},\\ \codeindex{\_Unwind\_SetGR},\\ \codeindex{\_Unwind\_GetIP},\\ +\codeindex{\_Unwind\_GetIPInfo},\\ \codeindex{\_Unwind\_SetIP},\\ \codeindex{\_Unwind\_GetRegionStart},\\ \codeindex{\_Unwind\_GetLanguageSpecificData},\\ @@ -524,6 +525,41 @@ identified by the unwind context. This v procedure fragment for a function call that is known to not return (such as \code{\_Unwind\_Resume}). +Applications which unwind through asynchronous signals and other +non-call locations should use \code{\_Unwind\_GetIPInfo} below, and +the additional flag that function provides. + +\subsubsection{\code{\_Unwind\_GetIPInfo}} + +\code{ +\begin{tabular}{l} + uint64 \_Unwind\_GetIPInfo\\ + \ \ (struct \_Unwind\_Context *context, int *ip\_before\_insn);\\ +\end{tabular} +} + +This function returns the same value as \code{\_Unwind\_GetIP}. In +addition, the argument \code{ip\_before\_insn} must not be not null, and +\code{*ip\_before\_insn} is updated with a flag which indicates whether +the returned pointer is at or after the first not yet fully executed +instruction. + +If \code{*ip\_before\_insn} is false, the application calling +\code{\_Unwind\_GetIPInfo} should assume that the instruction pointer +provided points after a call instruction which has not yet returned. +In general, this means that the application should use the preceding +call instruction as the instruction pointer location of the unwind +context. Typically, this can be approximated by subtracting one from +the returned instruction pointer. + +If \code{*ip\_before\_insn} is true, then the instruction pointer does not +refer to an active call site. Usually, this means that the +instruction pointer refers to the point at which an asynchronous +signal arrived. In this case, the application should use the +instruction pointer returned from \code{\_Unwind\_GetIPInfo} as the +instruction pointer location of the unwind context, without +adjustment. + \subsubsection{\code{\_Unwind\_SetIP}} \code{ \begin{tabular}{l}