From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19675 invoked by alias); 24 Oct 2014 21:11:29 -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 19666 invoked by uid 89); 24 Oct 2014 21:11:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: mail-la0-f49.google.com Received: from mail-la0-f49.google.com (HELO mail-la0-f49.google.com) (209.85.215.49) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 24 Oct 2014 21:11:27 +0000 Received: by mail-la0-f49.google.com with SMTP id gf13so1992164lab.8 for ; Fri, 24 Oct 2014 14:11:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=pRVp2YgdIE4oEEESS2jgxNjHIlK6f37VYt9okcdx1dg=; b=OYz+If3qovEC/zl/g9VGFbMJrz85VbrbSiZeJKUyublCk5xn928tJHEkJCZslD/DaC txh73LlcTXffsWXhXDdYx4+LAiQMQd1PEY1DwZozD6Q6IFtcW1QV72ZqmVnuw0ob+teR qh5C7M9c//7mgRoYxh5I0UnGHsiLhbR2eVKzC1AR2Ma8tsaYV8R9YILEBFGdPCvAZWnX 3fYOzQQJksUJbsz/8k15cUKoB4Dbh589TXinmONhLw/lTmVoX1H3Td3lUmnZFzWbniyw e6lyF5ZbaqCE6LbsMIWPkrgwOOxHPArwr5aRh24dASrnPKUd1zmrNQcdBb/A4VnfPmxB zIVA== X-Gm-Message-State: ALoCoQm23onIC/pBWuQlz1o5WL/WTHPNhGW3unvT2+h5wfFbz3Lal0UxqfluKpqdT02ygvshmaFl MIME-Version: 1.0 X-Received: by 10.112.134.39 with SMTP id ph7mr6938147lbb.45.1414185083025; Fri, 24 Oct 2014 14:11:23 -0700 (PDT) Received: by 10.112.59.129 with HTTP; Fri, 24 Oct 2014 14:11:22 -0700 (PDT) In-Reply-To: <544AB1E5.8030509@redhat.com> References: <1413986485-4673-1-git-send-email-martin.galvan@tallertechnologies.com> <544822D6.8020606@redhat.com> <544828BB.9040900@redhat.com> <544A68B1.9000909@redhat.com> <544AB1E5.8030509@redhat.com> Date: Fri, 24 Oct 2014 21:11:00 -0000 Message-ID: Subject: Re: [PATCH] Python API: Add gdb.is_in_prologue and gdb.is_in_epilogue. From: Martin Galvan To: Pedro Alves Cc: gdb-patches@sourceware.org, Doug Evans , Eli Zaretskii , Ulrich Weigand , Daniel Gutson Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-SW-Source: 2014-10/txt/msg00678.txt.bz2 On Fri, Oct 24, 2014 at 5:09 PM, Pedro Alves wrote: >> Well, I followed the code while testing a rather simple function and >> noticed that handle_step_into_function is very similar (in terms of >> the approach) to in_prologue plus some address corrections and setting >> a breakpoint to proceed to. The API function needs only the address >> calculation part. >> >> What if: >> 1) I split handle_step_into_function in the address calc part and >> the brakpoint insertion part, >> moving the address calc to a new function (publicly available from infru= n.h). >> 2) I expose such function to the Python API. >> >> Would that be accepted? Would you want to see a patch? >> >> Please keep in mind that what I actually need is not really messing >> with the prologue, but to know where the local variables are >> accessible. If I could simply use DWARF info to accomplish that then I >> wouldn't even touch the prologue at all. > > Hmm, how is this different from simply doing "break function" ? > GDB sets function breakpoints after the prologue already. A "step" > into a function should stop at the exact same address as if the user > did "b function; c" to run to said function. > > So, when you detect that you stepped into a function, you could > just set the breakpoint by function name? In order for that to work, I'd have to run the program up to that point. I really need to be able to determine if at a given PC the local variables will be accessible without actually running the program. Ideally I'd use only DWARF info to know that. I looked up the approach GDB takes when setting a breakpoint at a function name. From what I saw it appears to be similar as the "optimistic" path from in_prologue (that is, using symtab and line info). I guess that makes sense since setting a breakpoint by function name by definition requires us to have debugging info. --=20 Mart=C3=ADn Galv=C3=A1n Software Engineer Taller Technologies Argentina San Lorenzo 47, 3rd Floor, Office 5 C=C3=B3rdoba, Argentina Phone: 54 351 4217888 / +54 351 4218211