From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31397 invoked by alias); 30 May 2019 13:49:09 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 30717 invoked by uid 89); 30 May 2019 13:49:09 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.9 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 spammy=python.c, sk:python-, UD:python.c, pythonc X-HELO: relay.fit.cvut.cz Received: from relay.fit.cvut.cz (HELO relay.fit.cvut.cz) (147.32.232.237) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 30 May 2019 13:49:06 +0000 Received: from imap.fit.cvut.cz (imap.fit.cvut.cz [IPv6:2001:718:2:2901:0:0:0:238]) by relay.fit.cvut.cz (8.15.2/8.15.2) with ESMTPS id x4UDn21k039362 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 May 2019 15:49:03 +0200 (CEST) (envelope-from jan.vrany@fit.cvut.cz) Received: from localhost ([IPv6:2a02:c7d:2fcb:c700:6267:20ff:fee4:3e2c]) (authenticated bits=0 as user vranyj1) by imap.fit.cvut.cz (8.15.2/8.15.2) with ESMTPSA id x4UDn1Rr097688 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Thu, 30 May 2019 15:49:01 +0200 (CEST) (envelope-from jan.vrany@fit.cvut.cz) From: Jan Vrany To: gdb-patches@sourceware.org Cc: Jan Vrany Subject: [PATCH v3 0/5] Create MI commands using python. Date: Thu, 30 May 2019 13:49:00 -0000 Message-Id: <20190530134850.3236-1-jan.vrany@fit.cvut.cz> In-Reply-To: <20190128124101.26243-1-jan.vrany@fit.cvut.cz> References: <20190128124101.26243-1-jan.vrany@fit.cvut.cz> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SW-Source: 2019-05/txt/msg00687.txt.bz2 This version mainly addresses comments raised by Simon. Tested with both Python 2.7 and Python 3(.7). Changes v2 -> v3 * addressed Simon's comments: - https://sourceware.org/ml/gdb-patches/2019-05/msg00406.html - https://sourceware.org/ml/gdb-patches/2019-05/msg00407.html * checked that it compiles with both Python 2.7 and Python 3(.7) * add tests for MI command returning dictionary with non-string keys * add tests for creating MI commands with invalid names Changes v1 -> v2 * squashed following commits into one: - 8e65585bdab0 Create MI commands using python. - 9e2afadd2d4d03 mi/python: C++ify python MI command handling code - 0491a0634f7de4 mi/python: Polish MI output of python commands * moved class mi_command_py to python code * use gdbpy_ref<> instead of void* to hold on Python object in mi_command_py * release python objects held on by mi_command_py objects when finalizing Python * merged py_mi_invoke() into mi_command_py::invoke() * added missing copyright headers * dropped micmdpy_parse_command_name() * prefixed error messages by MI command name except for "Problem parsing arguments:" since old C-implemented MI commands do not prefix command name. * make do_suppress_notification() to return gdb::optional * split invoke to invoke and do_invoke, making invoke to perform common initialization * add test redefining Python MI command while the very same command is running * documented the fact that in mi_command_py::do_invoke() `this` pointer cannot be used after invoking python code since it may got stale. Didier Nadeau (3): Use std::map for MI commands in mi-cmds.c Use classes to represent MI Command instead of structures Create MI commands using python. Jan Vrany (2): mi/python: Allow redefinition of python MI commands mi/python: Add tests for python-defined MI commands gdb/ChangeLog | 88 +++++ gdb/Makefile.in | 1 + gdb/mi/mi-cmd-info.c | 4 +- gdb/mi/mi-cmds.c | 510 +++++++++++++------------ gdb/mi/mi-cmds.h | 87 ++++- gdb/mi/mi-main.c | 22 +- gdb/mi/mi-main.h | 1 + gdb/mi/mi-parse.c | 20 +- gdb/mi/mi-parse.h | 6 +- gdb/python/py-micmd.c | 307 +++++++++++++++ gdb/python/py-micmd.h | 60 +++ gdb/python/python-internal.h | 2 + gdb/python/python.c | 13 +- gdb/testsuite/ChangeLog | 5 + gdb/testsuite/gdb.python/py-mi-cmd.exp | 132 +++++++ gdb/testsuite/gdb.python/py-mi-cmd.py | 54 +++ 16 files changed, 1007 insertions(+), 305 deletions(-) create mode 100644 gdb/python/py-micmd.c create mode 100644 gdb/python/py-micmd.h create mode 100644 gdb/testsuite/gdb.python/py-mi-cmd.exp create mode 100644 gdb/testsuite/gdb.python/py-mi-cmd.py -- 2.20.1