From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta36.uswest2.a.cloudfilter.net (omta36.uswest2.a.cloudfilter.net [35.89.44.35]) by sourceware.org (Postfix) with ESMTPS id 728D83857720 for ; Sat, 16 Dec 2023 00:30:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 728D83857720 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 728D83857720 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=35.89.44.35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702686634; cv=none; b=Tx+0vIxMH/skDa3RAGypRKNkO/9f0ZMii93JttAI/+kL2JJyTs418L5Iw10iznAWFcDGlRfoJeO9fSszgi9aibw8WWyFTD4kiGhnzwvgD9d8lPrIx1LMu12J+IeL8abczOOoupAOqh2YcROurbO0lA6Dpxu/7R0LXuWhNtSNViE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702686634; c=relaxed/simple; bh=FeJQAav7u6tkyvxzbumR6rZK4c44N5WJe9xL3DSHJ2w=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=nBh1T3N/ILSN5qn/7BWGLPp51+nL3Hksm52KI5ScPDKaQGkeMnwrGKQkfCmtt4npMjrNXuVRteqDwwK7dVrJPZVAw+Ymm0B2Fkmub2NcQ720l8j84Hn3X6yRXePcDiY2thwafRfilXKh/IVlFOlPIBNQpgmujRWfwK5MEm82DfE= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from eig-obgw-6005a.ext.cloudfilter.net ([10.0.30.201]) by cmsmtp with ESMTPS id EAUrrhNCkhqFdEIZarKbsu; Sat, 16 Dec 2023 00:30:30 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id EIZZrGggp8KNvEIZZrsFME; Sat, 16 Dec 2023 00:30:29 +0000 X-Authority-Analysis: v=2.4 cv=dp3Itns4 c=1 sm=1 tr=0 ts=657cefa5 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=OWjo9vPv0XrRhIrVQ50Ab3nP57M=:19 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=e2cXIFwxEfEA:10 a=Qbun_eYptAEA:10 a=joynDgTRh1ALAPSkP5cA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:References :Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=X9lXpbXVrLUcc5ng59Nk0wT29SDE21/F7U736nr3Dfs=; b=oC6K/Sv1rNWERxbFlYAk3xpvVJ jSDaX8AO/ZwhvmgPRGfSBze0JpwdFLbaG5tYGnym/ycOZMFiMUovphOpqD4Q/L4nGaU7x/1brnXJY 6F0E4W7TRYlXq0U17VRSiipWe; Received: from [161.98.8.3] (port=41264 helo=prentzel) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1rEIZZ-002EKT-0G; Fri, 15 Dec 2023 17:30:29 -0700 From: Tom Tromey To: Hannes Domani Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Allow calling of C++ methods from python References: <20231215151938.3887-1-ssbssa.ref@yahoo.de> <20231215151938.3887-1-ssbssa@yahoo.de> X-Attribution: Tom Date: Fri, 15 Dec 2023 17:30:27 -0700 In-Reply-To: <20231215151938.3887-1-ssbssa@yahoo.de> (Hannes Domani's message of "Fri, 15 Dec 2023 16:19:38 +0100") Message-ID: <87msub56qk.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 161.98.8.3 X-Source-L: No X-Exim-ID: 1rEIZZ-002EKT-0G X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (prentzel) [161.98.8.3]:41264 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfO003ZhzT+IbGAzFhk4wWTXLi/40xwhpUucLxCNGcbvK/e/GjhBoWlixnL9LhJDI8hn+RrchVPWoZwDwMkqPna0QK827fGq/4xPbxQ9H8ZGDeiszXlGw XPnl/6rp5CVc1uEh5qmxkINqgBZybEyONOQo9iIAExqvr+xTdK3rC/7PTmqTC206m4UYqX88EIwgjO9D2gPR1MKpXb8+nOI1YpY= X-Spam-Status: No, score=-3016.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,JMQ_SPF_NEUTRAL,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: >>>>> "Hannes" == Hannes Domani writes: Hannes> static int static_func (); Hannes> (gdb) py b_obj = gdb.parse_and_eval('b_obj') Hannes> (gdb) py print(b_obj['static_func']()) Hannes> Traceback (most recent call last): Hannes> File "", line 1, in Hannes> RuntimeError: Value is not callable (not TYPE_CODE_FUNC). I'm a bit surprised that a static method is not TYPE_CODE_FUNC. It seems like it should be, because these are really just functions. Hannes> (gdb) py print(b_obj['arg0_func']()) Hannes> Traceback (most recent call last): Hannes> File "", line 1, in Hannes> gdb.error: Too few arguments in function call. Hannes> Error while executing Python code. Hannes> (gdb) py print(b_obj['arg0_func'](b_obj)) Hannes> 198 How does this interact with overloading? It seems to me that either b_obj['name'] has to return some kind of overload set, or we need a different API, like b_obj.call_method('name', ...). In the latter case we could have it automatically supply 'this', at least when it's needed. Tom