From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 3621D385800A for ; Thu, 16 Mar 2023 14:28:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3621D385800A Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678976930; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LlqoIfnX2uZbMNQVfRrSeBkee3jNXDVnhSsz9y37ccI=; b=YzA9U7TpTztGpWxphuL912xplQ0+esk2Hkkt2IAnpnZtQsUNBNPbqZsnvwh+y4+11Nkxoe gHvRC9BZ/2yWmZj61Wvi05mYEUp6+gVGwYmjidzgDyFo1KteEz14kNsKWNOMEanu4kRIpd lExjZe/qMM0N0AZULmYxWPr4nPULGn0= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-3-LkukL7h1PaWiIi6rHHjcxA-1; Thu, 16 Mar 2023 10:28:49 -0400 X-MC-Unique: LkukL7h1PaWiIi6rHHjcxA-1 Received: by mail-ed1-f69.google.com with SMTP id b1-20020aa7dc01000000b004ad062fee5eso3270877edu.17 for ; Thu, 16 Mar 2023 07:28:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678976928; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LlqoIfnX2uZbMNQVfRrSeBkee3jNXDVnhSsz9y37ccI=; b=v/TNsNhLH6S7O2dq0bU65WBRHKAq4EwGQOdhCgeDsDK9lCNRnwlkSvcYEZfxwbZhBr zdet0gq0ovfIogWGJapIj5ZKWXyjahj2Z1RsTZbbX146bO98d6KmONPev10LrvZXcnzi pmSsDRQIcIGDA9fgIwHc+mkkx5r/V7hYYCNWNuBBUnRRKRrwFYxzbGmZca76GfQ1FL2M n+3geA4DUJvoaS8mHvW2+fn+iEV39JIL4EFmqVnIvpeBDFpKBFZ1omT6XMDMMHwsGLAs II0biUf/j7lG6Qz94BtOu0tzT/BG0AIUmWkUqGxGTWl8yp2lnzbBBGzCgUibWuL55/z2 WWig== X-Gm-Message-State: AO0yUKXh9zl66KU19Zka8Ce+VfqM6r7ZFijVg37JT4/oLgV4YmgPDBYJ zYCRGvnnz6aPNWaEcJw65Ta/1F5ltoTqUGCceaen3mpHYPHW5pJzoaDNKzRR5T8IP2TUZw8p6Am ltAHUH16il55cwuJfhozH07msk729CQ== X-Received: by 2002:a17:906:fd8c:b0:92f:fc08:bb0a with SMTP id xa12-20020a170906fd8c00b0092ffc08bb0amr4786523ejb.37.1678976927951; Thu, 16 Mar 2023 07:28:47 -0700 (PDT) X-Google-Smtp-Source: AK7set+gRmGdoIJMCu+8/IvVhfEeOFXoJ2Bu33uRvZsm0PprnXS7iG90JD9iZH2SjfoiqX7wkxoKOw== X-Received: by 2002:a17:906:fd8c:b0:92f:fc08:bb0a with SMTP id xa12-20020a170906fd8c00b0092ffc08bb0amr4786503ejb.37.1678976927684; Thu, 16 Mar 2023 07:28:47 -0700 (PDT) Received: from localhost (95.72.115.87.dyn.plus.net. [87.115.72.95]) by smtp.gmail.com with ESMTPSA id vs6-20020a170907a58600b0092bef8ad0basm3858070ejc.183.2023.03.16.07.28.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Mar 2023 07:28:47 -0700 (PDT) From: Andrew Burgess To: Eli Zaretskii Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 05/10] gdb/python: add some additional methods to gdb.PendingFrame In-Reply-To: <83lejzsd2x.fsf@gnu.org> References: <5bd7327ee61fd1634235cd4ffddbfbc91d392e03.1678460067.git.aburgess@redhat.com> <83y1o4y5nu.fsf@gnu.org> <87h6unfxge.fsf@redhat.com> <83lejzsd2x.fsf@gnu.org> Date: Thu, 16 Mar 2023 14:28:46 +0000 Message-ID: <878rfwg481.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Eli Zaretskii writes: >> From: Andrew Burgess >> Cc: gdb-patches@sourceware.org >> Date: Tue, 14 Mar 2023 10:18:09 +0000 >> >> Eli Zaretskii writes: >> >> >> + - gdb.PendingFrame.find_sal(): Return a gdb.Symtab_and_line >> >> + object for the current location within the pending frame, or >> >> + None. >> >> + - gdb.PendingFrame.block(): Return a gdb.Block for the current >> >> + pending frame, or None. >> >> + - gdb.PendingFrame.function(): Return a gdb.Symbol for the >> >> + current pending frame, or None. >> > >> > Btw, why do you follow each method name with a "()"? That looks like >> > a call with no arguments, which is not what you mean, right? >> >> I did indeed mean a call with no arguments. These would be used like >> this: >> >> class TestUnwinder(Unwinder): >> def __init__(self): >> super().__init__("Unwinder_Name") >> >> def __call__(self, pending_frame): >> is_valid = pending_frame.is_valid() >> name = pending_frame.name() >> pc = pending_frame.pc() >> language = pending_frame.language() >> sal = pending_frame.find_sal() >> block = pending_frame.block() >> function = pending_frame.function() > > That's not my point. AFAIU, the text on which I commented documents > the methods and what each one of them does. Then the "()" has no > place there, since you are naming the methods, not showing how to call > them. Right? I like to think we're documenting how to use the API, which includes how to call them. I do end up being a user of the Python API docs pretty extensively, and when I do I'm looking for how do I call this method, and what arguments should I be passing. As far as I can tell the most common style in the docs is to include the argument list, and I think it would be more confusing if we only included the argument list for the case when there were some actual arguments. Why leave the user to infer the empty argument list when we can just go ahead and say it. Finally, this becomes more confusing I think with Python that supports both methods (requires parenthesis to call) and attributes which don't require parenthesis to access. Thus under the current scheme we have: @defvar ClassName.Attribute Contains a value. @end defvar @defun ClassName.NoArgsMethod() Does stuff. @end defun @defun ClassName.TakesArgs(@var{arg1}, @var{arg2}) Does other stuff. @end defun If I've understood your correctly (sorry if I have not), then you are suggesting dropping the '()' from the 'NoArgsMethod' case. But I think this would be inconsistent with the 'TakesArgs' method, and risks confusion with the 'Attribute'. Thanks, Andrew