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 1BC413858421 for ; Tue, 14 Mar 2023 10:18:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1BC413858421 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=1678789093; 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=qVctNpHOR5D4SqOy9O4znwAag2GoKJbPWN5o+NI2DL8=; b=Rm9SuHTV/Yfol6ebeiOzAp0Cg8KU3sqxHbRwel4oTp1Xic+q2efWgt3k9GpX3EOwgqzjFv iKX0K8/G2r6ImKtPWOShp6Rq3++P337DKIjcKzUMKUj59Y5l120Vc4Sn/FHCdwzLqYXMOe 6ntQR0+WqRG1fbUUxK3ZJ226oUvClRc= 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-121-IHNAlKurOkaqdQpSYaNURQ-1; Tue, 14 Mar 2023 06:18:12 -0400 X-MC-Unique: IHNAlKurOkaqdQpSYaNURQ-1 Received: by mail-ed1-f69.google.com with SMTP id j21-20020a508a95000000b004fd82403c91so2399397edj.3 for ; Tue, 14 Mar 2023 03:18:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678789091; 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=qVctNpHOR5D4SqOy9O4znwAag2GoKJbPWN5o+NI2DL8=; b=SJoCBtUwojX8d50ZW+HBMMQTa1CECQ3NaM6oh0W8s/KmouwA+Xf+l6KuBSrKWTAoAL 7f1ZMnKaJnWXTNvA2yosBWtP6aCsG6MuiH/1r/fabSC6rYk7adqzqU73xDoTnyA6FBmg BL2zNNRe+VszRjqBRxIIYYmEOyA6m4757gc5aBsMEPR4fAJkpe/Ueer1KIgTksitzRvt lfaq89/dJxmExWNRZ/LqD4VShK6av3h4euepNaK4kghaSPAullH9GJFheBwzPgGBlFpU vCUobA1t3Vm87keNCPSd7MlQmDkN0XVwQyHTXbZnP65hGrF0NDTq4gzw9Z5Yah90f9Vz QW4A== X-Gm-Message-State: AO0yUKVNi50iEl9lBODg1nCPqgNX8cTHpULSOAO+CMJIRqPwem4Xtu0t Wb+pzoISKFaqxV+ircbsmh6qLrXCwxOZ/KKZ7imqvGIc3yd2d6Z0DcGhGd1L7fgOjrLW+TcyJjG WOSMFuDyQ8zZ+x1jEeyUXIyHrXXhBQw== X-Received: by 2002:a17:907:2d21:b0:92b:e949:8007 with SMTP id gs33-20020a1709072d2100b0092be9498007mr2831513ejc.55.1678789091280; Tue, 14 Mar 2023 03:18:11 -0700 (PDT) X-Google-Smtp-Source: AK7set/PuOgiQtzDaw08EAD7NqNWBZ6wiYGkBIavLpCxSSYaWl+RZwLkwgCjVZHGTjswqPFnWRRTfA== X-Received: by 2002:a17:907:2d21:b0:92b:e949:8007 with SMTP id gs33-20020a1709072d2100b0092be9498007mr2831491ejc.55.1678789091044; Tue, 14 Mar 2023 03:18:11 -0700 (PDT) Received: from localhost (95.72.115.87.dyn.plus.net. [87.115.72.95]) by smtp.gmail.com with ESMTPSA id hb25-20020a170906b89900b009294524ac21sm949129ejb.60.2023.03.14.03.18.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 03:18:10 -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: <83y1o4y5nu.fsf@gnu.org> References: <5bd7327ee61fd1634235cd4ffddbfbc91d392e03.1678460067.git.aburgess@redhat.com> <83y1o4y5nu.fsf@gnu.org> Date: Tue, 14 Mar 2023 10:18:09 +0000 Message-ID: <87h6unfxge.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=-11.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,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: >> Cc: Andrew Burgess >> Date: Fri, 10 Mar 2023 14:55:22 +0000 >> From: Andrew Burgess via Gdb-patches >> >> gdb/NEWS | 20 +++ >> gdb/doc/python.texi | 40 +++++ >> gdb/python/py-unwind.c | 221 +++++++++++++++++++++++++ >> gdb/testsuite/gdb.python/py-unwind.exp | 33 +++- >> gdb/testsuite/gdb.python/py-unwind.py | 104 ++++++++++++ >> 5 files changed, 417 insertions(+), 1 deletion(-) > > Thanks. > >> diff --git a/gdb/NEWS b/gdb/NEWS >> index ed0f86e79ec..0d9049ff134 100644 >> --- a/gdb/NEWS >> +++ b/gdb/NEWS >> @@ -110,6 +110,26 @@ show always-read-ctf >> without the particular unwinder, depending on how 'enabled' was >> changed. >> >> + ** New methods added to the gdb.PendingFrame class. These methods >> + have the same behaviour as the corresponding methods on >> + gdb.Frame. The new methods are: >> + >> + - gdb.PendingFrame.name(): Return the name for the frame's >> + function, or None. >> + - gdb.PendingFrame.is_valid(): Return True if the pending frame >> + object is valid. >> + - gdb.PendingFrame.pc(): Return the $pc register value for this >> + frame. >> + - gdb.PendingFrame.language(): Return a string containing the >> + language for this frame, or None. > > "containing the language"? I think this is better: > > Return the language of this frame, as a string, or None. Changed to use your wording. > >> + - 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() Maybe you thought these would be better implemented as attributes? If you did then I 100% agree, but I think these have to be methods in order to match the existing Frame API. If we use the same API for PendingFrame and Frame then a user can write code that will work on either object type. Does this address your concerns? Or did I not understand? Thanks, Andrew