From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3438 invoked by alias); 22 Oct 2014 17:47:19 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 3426 invoked by uid 89); 22 Oct 2014 17:47:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: mtaout20.012.net.il Received: from mtaout20.012.net.il (HELO mtaout20.012.net.il) (80.179.55.166) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 22 Oct 2014 17:47:14 +0000 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0NDU00F00X6MT000@a-mtaout20.012.net.il> for gdb-patches@sourceware.org; Wed, 22 Oct 2014 20:47:12 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NDU00FOVXEN8N90@a-mtaout20.012.net.il>; Wed, 22 Oct 2014 20:47:12 +0300 (IDT) Date: Wed, 22 Oct 2014 17:47:00 -0000 From: Eli Zaretskii Subject: Re: [PATCH] Python API: Add gdb.is_in_prologue and gdb.is_in_epilogue. In-reply-to: To: Martin Galvan Cc: gdb-patches@sourceware.org Reply-to: Eli Zaretskii Message-id: <83fveg809v.fsf@gnu.org> References: <1413986485-4673-1-git-send-email-martin.galvan@tallertechnologies.com> <83tx2w87j0.fsf@gnu.org> X-IsSubscribed: yes X-SW-Source: 2014-10/txt/msg00584.txt.bz2 > Date: Wed, 22 Oct 2014 14:33:15 -0300 > From: Martin Galvan > Cc: gdb-patches@sourceware.org > > On Wed, Oct 22, 2014 at 12:10 PM, Eli Zaretskii wrote: > >> From: Martin Galvan > >> Cc: Martin Galvan > >> +In general you shouldn't worry about passing a @var{functionStart} > >> +argument unless your binary doesn't have debugging info, in which case > >> +ommiting @var{functionStart} may result in @code{True} being returned > >> +when the @var{pc} is not actually inside a prologue. > > > > Isn't it better to require this argument in that case? Zero is not > > very useful starting address, in most cases. > > I looked at this again and I think it should stay as an optional > argument. GDB's in_prologue will only check for the functionStart > argument when it has no other way to determine whether the given PC > belongs to a prologue; otherwise it'll just ignore it. Because of > this, is_in_prologue will return True if we pass it a pc that belongs > to a prologue together with any valid address regardless of it being a > function start, let alone the function PC belongs to. Making it a > required argument to me sounds like we're asking is_in_prologue > whether PC is in the prologue of the function starting at > functionStart, instead of simply telling whether PC belongs to any > prologue (which was my original intent). I think we are miscommunicating. What I had in mind is raise an exception or display an error message when GDB has no other means to determine where the function's start is (e.g., no debug info), and no functionStart argument was passed. That is what I meant by "require". IOW, it's up to the user to decide when to provide it, but GDB will refuse to use some arbitrary number, such as zero, if it cannot determine the starting address. (Btw, using mixed-case argument names in thge manual is a bad idea, because in the Info format @var causes its argument to be up-cased.)