From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id Y4JKOiZqgWE5HgAAWB0awg (envelope-from ) for ; Tue, 02 Nov 2021 12:41:10 -0400 Received: by simark.ca (Postfix, from userid 112) id DD92A1F0C1; Tue, 2 Nov 2021 12:41:10 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=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 6E6771EDDB for ; Tue, 2 Nov 2021 12:41:07 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8EFA43858D39 for ; Tue, 2 Nov 2021 16:41:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8EFA43858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1635871266; bh=+Y8GTNN8Mm8nM+ZJxKdV1wZW/tLVHtgBgGMGWoHDuqs=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=jQKqpZGtMtAjdjh5S2sQN7XF8lIVT3Pw/CVCo2R7iCXHBScHHg+d/hlFGtnCyYEIg 57SFZk5TJlPu2C0pHRISuSttcVcny7ginRT83p3svodZifmUl2z0vv5P79357dN8Xl nPHh9B7zVQpWoO5yNuiXsjS2ndE73EDDUKgwM1cQ= Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 71B143858D39 for ; Tue, 2 Nov 2021 16:40:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 71B143858D39 Received: from fencepost.gnu.org ([2001:470:142:3::e]:46978) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhwpz-0003A2-Q3 for gdb@sourceware.org; Tue, 02 Nov 2021 12:40:39 -0400 Received: from ip5f5a8d68.dynamic.kabel-deutschland.de ([95.90.141.104]:51289 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 1mhwpz-0000Ol-Fx for gdb@sourceware.org; Tue, 02 Nov 2021 12:40:39 -0400 To: gdb@sourceware.org Subject: How to create new mi commands via python / get current interpreter in python Message-ID: Date: Tue, 2 Nov 2021 17:40:35 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit 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" It is possible to send `interpreter-exec mi "command"` from a python extension, but how can we check the _current_ interpreter a python create gdb command was executed in? The reason: depending on the interpreter the return value should be different interpreter-exec console "break" --> returns user output (which may be parsed) vs. interpreter-exec mi "-break-insert" --> returns interpreter output intended to be parsed Additional to this question: is there an option to create new MI commands from python (instead of "console commands"), or python helper functions which provide better ways to return mi-messages than plain "print" with self-formatting? Thanks for any insights, Simon