From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 58306 invoked by alias); 3 Feb 2017 05:46:12 -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 58287 invoked by uid 89); 3 Feb 2017 05:46:11 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=serie, 1.9.1, H*r:8.14.3 X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 03 Feb 2017 05:46:09 +0000 Received: from didier-gpu.dorsal.polymtl.ca (dyn48.dorsal.polymtl.ca [132.207.72.48]) by smtp.polymtl.ca (8.14.3/8.14.3) with ESMTP id v135k6qu024185; Fri, 3 Feb 2017 00:46:07 -0500 From: didier.nadeau@gmail.com To: gdb-patches@sourceware.org Cc: didier.nadeau@gmail.com Subject: [PATCH 0/2] Use std::hashmap and MI commands classes in mi-cmds.c Date: Fri, 03 Feb 2017 05:46:00 -0000 Message-Id: <1486100763-16933-1-git-send-email-didier.nadeau@gmail.com> X-Poly-FromMTA: (dyn48.dorsal.polymtl.ca [132.207.72.48]) at Fri, 3 Feb 2017 05:46:06 +0000 X-IsSubscribed: yes X-SW-Source: 2017-02/txt/msg00088.txt.bz2 From: Didier Nadeau This is a serie of two patches in preparation to a next patch that will allows users to define custom MI commands using Python, similarly to what is currently possible for Python CLI commands. The first patch modify mi-cmds.c to use an std::hashmap to store MI commands instead of the custom structure. It allows to insert new MI commands at runtime as it does not use a fixed size array anymore. The second patch removes structures mi_cli and mi_cmd from mi-cmds.c and replace them with a hierarchy of classes. This way, each subtype of MI command inherits from the base virtual class and register itself into the hashmap. Classes mi_command_mi for pure MI commands and mi_command_cli for MI commands over CLI commands have been implemented. MI commands are now all called from a common invoke virtual function. Logic for suppress_notification and ARGV/ARGC parsing has been moved to the classes implementation. Didier Nadeau (2): Use std::map for MI commands in mi-cmds.c Use classes to represent MI Command instead of structures gdb/mi/mi-cmd-info.c | 4 +- gdb/mi/mi-cmds.c | 490 ++++++++++++++++++++++++++------------------------- gdb/mi/mi-cmds.h | 70 +++++--- gdb/mi/mi-main.c | 21 +-- gdb/mi/mi-main.h | 2 + gdb/mi/mi-parse.c | 20 +-- gdb/mi/mi-parse.h | 6 +- 7 files changed, 316 insertions(+), 297 deletions(-) -- 1.9.1