From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9388 invoked by alias); 7 Nov 2014 17:18:08 -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 9376 invoked by uid 89); 7 Nov 2014 17:18:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_SOFTFAIL autolearn=no version=3.3.2 X-HELO: mail-lb0-f171.google.com Received: from mail-lb0-f171.google.com (HELO mail-lb0-f171.google.com) (209.85.217.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 07 Nov 2014 17:18:06 +0000 Received: by mail-lb0-f171.google.com with SMTP id b6so3021582lbj.30 for ; Fri, 07 Nov 2014 09:18:03 -0800 (PST) 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=ZOwxzLTt+pvAYHQCvsjCW3+ZgeqgnuNz4z9/fCbSdh0=; b=aCO5g9U1hi8GeufHVKX85H/XUhivcfotC45XPmBq9jpccl8LbS0YnI1CWu9WwLtZFj bEXGFQSQr9xqby7+tCUfZcyJzP4ZpPNePokjdyHOjncrUuc0qWhYN9y2rv23X3FblTYC Qc/VXZlFQISHAnPOSU2T+VITbGYokQyZ0uMJIAUBrWE5lE6u3Riiy1FIHgkFmkCBpFZ8 AyWjtfTDaGV5RhGOhxaFyexrhllB+XeHQee5sugK0lkgUyLv7aU0kfQVM4XrVhkxhY7x 6sm6RPLQv4QN98QNUOEv9iHNgwwARk7rJ+VaWKEn7rNG1Xi3U9RR701fJ2hozGyCRTsd RzKA== X-Gm-Message-State: ALoCoQly6x1myo0b5MJvIuR6pq8ejL199f6O+30RHvDBZgDRm7nCEQsFiNsPXSwOH6vI2mb/tYER MIME-Version: 1.0 X-Received: by 10.112.146.37 with SMTP id sz5mr12380656lbb.27.1415380683269; Fri, 07 Nov 2014 09:18:03 -0800 (PST) Received: by 10.112.59.129 with HTTP; Fri, 7 Nov 2014 09:18:03 -0800 (PST) In-Reply-To: <545CFCCA.1070304@redhat.com> References: <545CFCCA.1070304@redhat.com> Date: Fri, 07 Nov 2014 17:18:00 -0000 Message-ID: Subject: Re: [PING][RFC][PATCH v2] Python API: add gdb.stack_may_be_invalid 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-11/txt/msg00145.txt.bz2 On Fri, Nov 7, 2014 at 2:09 PM, Pedro Alves wrote: > On 11/07/2014 01:32 PM, Martin Galvan wrote: >> 2) The behavior of handle_step_into_function and setting breakpoints >> is inconsistent for optimized code, at least in ARM. If you step into >> a function in a program compiled with gcc -O1, you'll see the PC ends >> up one instruction after the set of instructions that place the >> arguments passed as registers in the registers they'll be used in. If >> you do "break myFunction", however, the breakpoint will correctly be >> placed at the very first instruction. Both handle_step.. and setting >> breakpoints have the same effect on -O0 code. > > We should really fix this. I can't imagine we do this on purpose. Indeed we should. I'll gladly fix this myself once we're done with this pat= ch. >> If we look at how "break myFunction" works, we'll see that we end up >> calling find_function_start_sal to determine at which PC we have to >> place our breakpoint. Therefore, that's the function we should be >> calling when checking whether the stack frame will be valid at a >> prologue, as it also accounts for optimizations. > > We expose functions and sals as python objects. > Shouldn't we instead consider exposing find_function_start_sal > in the function object? Or maybe symbol_to_sal in the Symbol object? > I can well imagine these being useful to other use cases. We could do so, but for this use case we'd still need a way to check if the stack has been destroyed by e.g. an epilogue. If we want to make the API as primitive as possible, we could again expose two functions instead of one (as in my previous patch). --=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