From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id fU+nImtAw2EbYwAAWB0awg (envelope-from ) for ; Wed, 22 Dec 2021 10:12:43 -0500 Received: by simark.ca (Postfix, from userid 112) id 7DAB81F0D4; Wed, 22 Dec 2021 10:12:43 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 0494D1F0CC for ; Wed, 22 Dec 2021 10:12:43 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 58B44385842E for ; Wed, 22 Dec 2021 15:12:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 58B44385842E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1640185962; bh=9eTZWYg7OLNMiZT12yntPY/MHNgASQJPS9hf+xNc0x8=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Up2cYto1gfAwzgQjn8fSfDYst8lPzE2mDArhKwPRuEb5A0U57VGxf3ekBtSVC0QdL b3pGtqhQI6YWZADcDSEOtv7Vwal56igdEW0VN104qqZwIrHSJ35h1Bdi37/pjFRJ57 YUraoGDNIx7EVH1JA46ujYhcZHGYkGep3FKsLx6Y= 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 Subject: gdb.error: "define PI" is not a prefix command. Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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: , From: Simon Sobisch via Gdb Reply-To: Simon Sobisch Errors-To: gdb-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb" 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