From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 50431 invoked by alias); 25 Apr 2019 19:34:48 -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 50422 invoked by uid 89); 25 Apr 2019 19:34:47 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.2 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.1 spammy=H*r:may, H*r:forged 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, 25 Apr 2019 19:34:45 +0000 Received: from imap.fit.cvut.cz (imap.fit.cvut.cz [147.32.232.238]) by relay.fit.cvut.cz (8.15.2/8.15.2) with ESMTPS id x3PJYdDP018196 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 25 Apr 2019 21:34:40 +0200 (CEST) (envelope-from jan.vrany@fit.cvut.cz) Received: from sao (02d97c6d.bb.sky.com [2.217.124.109] (may be forged)) (authenticated bits=0 as user vranyj1) by imap.fit.cvut.cz (8.15.2/8.15.2) with ESMTPSA id x3PJYc3x038428 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Thu, 25 Apr 2019 21:34:38 +0200 (CEST) (envelope-from jan.vrany@fit.cvut.cz) Message-ID: <19b368baa5d2b7dc1889aeb744434d7730bd60e3.camel@fit.cvut.cz> Subject: Re: [RFC 1/8] Use std::map for MI commands in mi-cmds.c From: Jan Vrany To: Tom Tromey Cc: gdb-patches@sourceware.org, Didier Nadeau Date: Thu, 25 Apr 2019 19:34:00 -0000 In-Reply-To: <87ef5p99qv.fsf@tromey.com> References: <20190418152337.6376-1-jan.vrany@fit.cvut.cz> <20190418152337.6376-2-jan.vrany@fit.cvut.cz> <87ef5p99qv.fsf@tromey.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5-1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-04/txt/msg00559.txt.bz2 On Thu, 2019-04-25 at 13:15 -0600, Tom Tromey wrote: > > > > > > "Jan" == Jan Vrany writes: > > Oh, I see now, sorry about that: > > Jan> + if (mi_cmd_table.fiund (name) != mi_cmd_table.end ()) > Jan> + return false; > > This disallows redefining a command, so it seems fine to me. Actually, you were right! I quickly realized that it is useful to refedine python MI coomands - mostly during development of commands itself. So last patch in a series allows that: @@ -43,7 +43,8 @@ insert_mi_cmd_entry (mi_cmd_up command) const std::string &name = command->name (); if (mi_cmd_table.find (name) != mi_cmd_table.end ()) - return false; + if (! mi_cmd_table[name]->is_py_command ()) + return false; mi_cmd_table[name] = std::move (command); Thanks! > > Tom