From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18719 invoked by alias); 8 May 2012 02:35:20 -0000 Received: (qmail 18458 invoked by uid 22791); 8 May 2012 02:35:19 -0000 X-SWARE-Spam-Status: No, hits=-5.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-qa0-f48.google.com (HELO mail-qa0-f48.google.com) (209.85.216.48) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 May 2012 02:35:05 +0000 Received: by qady23 with SMTP id y23so188239qad.14 for ; Mon, 07 May 2012 19:35:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding:x-system-of-record :x-gm-message-state; bh=Kbvr5UhgbTBS2be80LmYGYPWl12VANEKzBKe8nIQcp4=; b=kf3zlCZa9uPRqqGFbX/n880Hjq2l0yMggJULcOe8sLD4kj4soUkxuwedcmCo3C+iHe JrwxiHVH0dDVZRhqg2hpHUUMv4xhvCshDmVPMxrNAuwYnobqEqh+dgEiLw7kMGB/n+0E 2MxG3brANxEIVbFRjWNS7GrIwZDP3J77Ikhpq1EZoupfmyJEqdZeQrljn1nqoa6pdByf YNjDnn8Ha9ehuGQpq5kQJWOAKX5vuOZ0SS/VWFy2yfMy1sy5MKxE1g1p5tbxrLHgjuFJ qsubOCBU+DpQUcZf1R9HzKS64si8sEijw2UcIU+VinphhbajWCTo5ohPfo//5UevAJnL MBmg== Received: by 10.224.180.212 with SMTP id bv20mr22385591qab.4.1336444504457; Mon, 07 May 2012 19:35:04 -0700 (PDT) MIME-Version: 1.0 Received: by 10.224.180.212 with SMTP id bv20mr22385576qab.4.1336444504267; Mon, 07 May 2012 19:35:04 -0700 (PDT) Received: by 10.224.215.132 with HTTP; Mon, 7 May 2012 19:35:04 -0700 (PDT) In-Reply-To: <8362c73huz.fsf@gnu.org> References: <8362c73huz.fsf@gnu.org> Date: Tue, 08 May 2012 02:35:00 -0000 Message-ID: Subject: Re: [RFC] - Exposing find_pc_line through Python API From: Siva Chandra To: Eli Zaretskii Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-System-Of-Record: true X-Gm-Message-State: ALoCoQn4S9yBlkqKF1KdtxCQAY6Y9lCHYFOlnmgd4uPI7ow+bAt22LJpW6lozaihDccPovVvhGYNPPyvd2r7w+nChIzDPuFecqMA+R/uZIiikl/1y1FU0aMs/Ilbp35pXjY+53HUdUqyBgJ+YW3hEa7nLLoNRBkUwQ== X-IsSubscribed: yes 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 X-SW-Source: 2012-05/txt/msg00206.txt.bz2 Siva> +The difference between @var{actual} being @code{True} or @code{False} Siva> +can be illustrated with an example. =A0Let a call to a function @cod= e{func} Siva> +be on line 20 in a C source file as Siva> + Siva> +@smallexample Siva> +18 =A0... Siva> +19 Siva> +20 =A0func (); Siva> +21 Siva> +22 =A0return 0; Siva> +23 Siva> +24 =A0... Siva> +@end smallexample Siva> + Siva> +After executing @value{GDBN} commands @code{step} followed by @code{= up} Siva> +at line 20, the actual value of the @code{PC} register should corres= pond Siva> +to the next code line at line 22. =A0However, since the function Siva> +@code{func} has not yet been executed, the user feels that the execu= tion Siva> +is still at line 20 (the call site) in the caller. Eli> If I were that user, I would "feel" that the execution is at the first Eli> line (or maybe in the prologue) of 'func', since PC is (in my mind) Eli> unaffected by commands that walk the call stack. =A0And if you are Eli> talking about the value of PC saved in the frame of the caller of Eli> 'func', then saying that line 22 is the "actual" location is again Eli> confusing, because execution did not yet reach that point. Not just the PC saved in the frame of the caller of 'func', even $pc will have the same value. If after a 'step' and 'up' you do 'print /d $pc', it will print the same value as (gdb) python print gdb.selected_frame().pc() Eli> So I have hard time understanding why we need the distinction. =A0And Eli> since you say that the current Symtab_and_line.line gives the second Eli> alternatives, I'm confused even more. I do not understand myself why the second alternative was selected to reflect in Symtab_and_line.line. Eli> It's possible that I'm the only confused person here, but in that Eli> case, at least the example should be fixed to show and explain the Eli> distinction more clearly and unequivocally, and also in which Eli> situations the "actual" value is useful. I am working on something for which I need to know the last function call on a particular source line. The heuristic I am trying to use is that, when we 'step' in and out (via 'up') of the last function call, the PC should correspond to the next source line and not the call site of the last function call. Thanks, Siva Chandra