This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 0/2] Use std::hashmap and MI commands classes in mi-cmds.c
- From: didier dot nadeau at gmail dot com
- To: gdb-patches at sourceware dot org
- Cc: didier dot nadeau at gmail dot com
- Date: Fri, 3 Feb 2017 00:46:01 -0500
- Subject: [PATCH 0/2] Use std::hashmap and MI commands classes in mi-cmds.c
- Authentication-results: sourceware.org; auth=none
From: Didier Nadeau <didier.nadeau@gmail.com>
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