From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 99740 invoked by alias); 14 May 2019 11:24:42 -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 97948 invoked by uid 89); 14 May 2019 11:24:39 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 spammy=micmdsh, mi-cmds.h, mi-main.h, UD:mi-cmds.c 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; Tue, 14 May 2019 11:24:36 +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 x4EBOU0f033246 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 14 May 2019 13:24:32 +0200 (CEST) (envelope-from jan.vrany@fit.cvut.cz) Received: from localhost (02791bac.bb.sky.com [2.121.27.172] (may be forged)) (authenticated bits=0 as user vranyj1) by imap.fit.cvut.cz (8.15.2/8.15.2) with ESMTPSA id x4EBOUVb096908 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Tue, 14 May 2019 13:24:30 +0200 (CEST) (envelope-from jan.vrany@fit.cvut.cz) From: Jan Vrany To: gdb-patches@sourceware.org Cc: Jan Vrany Subject: [PATCH v2 0/5] Create MI commands using python Date: Tue, 14 May 2019 11:24:00 -0000 Message-Id: <20190514112418.24091-1-jan.vrany@fit.cvut.cz> In-Reply-To: <20190418152337.6376-1-jan.vrany@fit.cvut.cz> References: <20190418152337.6376-1-jan.vrany@fit.cvut.cz> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SW-Source: 2019-05/txt/msg00313.txt.bz2 This is a rework of previous patch series based on Tom's and Simon's comments. I may happen that I overlooked something since some of the issues were addressed in subsequent commits and a lot of code was moved around. This version *does not* use std::shared_ptr to hold on MI commands, instead it makes sure that `this` pointer is not used after it me become stale. 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 | 501 +++++++++++++------------ gdb/mi/mi-cmds.h | 87 +++-- gdb/mi/mi-main.c | 18 +- gdb/mi/mi-main.h | 1 + gdb/mi/mi-parse.c | 20 +- gdb/mi/mi-parse.h | 6 +- gdb/python/py-micmd.c | 308 +++++++++++++++ gdb/python/py-micmd.h | 52 +++ gdb/python/python-internal.h | 2 + gdb/python/python.c | 13 +- gdb/testsuite/ChangeLog | 5 + gdb/testsuite/gdb.python/py-mi-cmd.exp | 109 ++++++ gdb/testsuite/gdb.python/py-mi-cmd.py | 39 ++ 16 files changed, 959 insertions(+), 295 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