From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [209.51.188.92]) by sourceware.org (Postfix) with ESMTPS id 65B773858C2C for ; Wed, 22 Dec 2021 15:12:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 65B773858C2C Received: from [2001:470:142:3::e] (port=42976 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n03Hs-0001Qr-Cv for gdb@sourceware.org; Wed, 22 Dec 2021 10:12:16 -0500 Received: from ip5f5a8896.dynamic.kabel-deutschland.de ([95.90.136.150]:58412 helo=[192.168.111.41]) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n03Hs-0003oi-1k for gdb@sourceware.org; Wed, 22 Dec 2021 10:12:16 -0500 Message-ID: <0de334d3-d226-5d85-e517-946254380c7c@gnu.org> Date: Wed, 22 Dec 2021 16:12:11 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 To: gdb@sourceware.org Content-Language: en-US From: Simon Sobisch Subject: gdb.error: "define PI" is not a prefix command. Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Dec 2021 15:12:18 -0000 The following shows the issue quite well: (gdb) macro define PI1 (3.1415926) (gdb) print PI1 $1 = 3.1415926000000001 (gdb) py gdb.execute("print PI1", True, False) $2 = 3.1415926000000001 (gdb) py gdb.execute("macro define PI2 (3.1415926)", True, False) Traceback (most recent call last): File "", line 1, in gdb.error: "define PI2" is not a prefix command. Error while executing Python code. (gdb) print PI2 No symbol "PI2" in current context. This is happening with GDB 8.2, Python 3.6.8. It did work with GDB 7.6: (gdb) macro define PI1 (3.1415926) (gdb) print PI1 $1 = 3.1415925999999996 (gdb) py gdb.execute("print PI1", True, False) $2 = 3.1415925999999996 (gdb) py gdb.execute("macro define PI2 (3.1415926)", True, False) (gdb) print PI2 $3 = 3.1415925999999996 (gdb) py gdb.execute("print PI1", True, False) $24 = 3.1415925999999996 I've thought that this was related to the different python version (2.7.5 on GDB 7.6), but it isn't. After building GDB 11.1 on the test machine (same Python, obviously) it also works there. Question: Is there any way to execute this command with Python in GDB 8.2 (= without upgrading GDB)? Thanks for any pointers / ideas, Simon