From patchwork Sat Sep 2 21:36:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 22575 Received: (qmail 127428 invoked by alias); 2 Sep 2017 21:37:00 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 127383 invoked by uid 89); 2 Sep 2017 21:37:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.2 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.2 spammy=4006 X-HELO: sesbmg23.ericsson.net Received: from sesbmg23.ericsson.net (HELO sesbmg23.ericsson.net) (193.180.251.37) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 02 Sep 2017 21:36:54 +0000 Received: from ESESSHC009.ericsson.se (Unknown_Domain [153.88.183.45]) by sesbmg23.ericsson.net (Symantec Mail Security) with SMTP id 72.A1.21299.3742BA95; Sat, 2 Sep 2017 23:36:52 +0200 (CEST) Received: from EUR03-VE1-obe.outbound.protection.outlook.com (153.88.183.145) by oa.msg.ericsson.com (153.88.183.45) with Microsoft SMTP Server (TLS) id 14.3.352.0; Sat, 2 Sep 2017 23:36:51 +0200 Received: from elxacz23q12.localdomain (80.216.43.226) by AM3PR07MB305.eurprd07.prod.outlook.com (2a01:111:e400:881b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.35.3; Sat, 2 Sep 2017 21:36:49 +0000 From: Simon Marchi To: CC: Simon Marchi Subject: [PATCH 1/3] Move command lines types/declarations to cli-script.h Date: Sat, 2 Sep 2017 23:36:17 +0200 Message-ID: <1504388179-579-2-git-send-email-simon.marchi@ericsson.com> In-Reply-To: <1504388179-579-1-git-send-email-simon.marchi@ericsson.com> References: <1504388179-579-1-git-send-email-simon.marchi@ericsson.com> MIME-Version: 1.0 X-ClientProxiedBy: DB6P193CA0003.EURP193.PROD.OUTLOOK.COM (2603:10a6:6:29::13) To AM3PR07MB305.eurprd07.prod.outlook.com (2a01:111:e400:881b::13) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 47d975a7-0e1d-44a3-e2c8-08d4f24ab815 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(300000503095)(300135400095)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:AM3PR07MB305; X-Microsoft-Exchange-Diagnostics: 1; AM3PR07MB305; 3:YSbi7L6/NIO3P/9In7gffPDL3TWRGsn0TDo8egbBbgUStUt3k7QEEkQUx5VMcO25ndzKP+3BKRb1UW1zPuhTj4vy3gNpGw3iP5TJKWhvI7EHfi7XtKtPuchjRd6J4PHKPPiPIVm5uVwh/S/0DGxV3KvBuxcR/lx4MoEhcEmoAJ0nLUU2PrCvo6d/ND8Qe3TMBXeSN4vboLc2cFcw5wlR6phHTcUkpNweaq6i+rCeQnCUvdIDPa3kZ8lXIdUtivak; 25:b022m7MCrXZbk+a9RA2cRVxc6DNT2wqqKe1AI6nLYqbofPLO15IFX0WD9Z+n7cuL39CGb2IxR8rgSiEZmz6AvXa8YQ1TuMRvGJJQimyfmVP/sl3J1ScRSRzDHdeqfmLmDps6corkBJZZKxMrmZjwSX1nvLIwclylWAMv2II7Jfc9gC/lP37RDN2QtzQZ+7G6U52N+42iQBxzd46sgcxYRmFJHb+VK86mih0eozXC3rEPB/ScYrQL1MnOwitwpZ+skpM2HVUghgvNgwA3O8oHkM3wjiq3468LZZ5rn/76xgozu4+RwSKfmq14BvYgh08D3kddB5iLNRLEYuipZQ5bcA==; 31:86fu9Rpo0M49MmgP6aT0jNN8XOuybXj/2to+fY0ORIYzOHFkYfbb3xkGEHrN4EZ6ZJSDPRytz0aM+hItBnBtXJC2k8WafRqZWKxEj0X0qQ68Ujl7lDmj96qHtaYwHkgqR6nAKYsjCzpbXXMx2ePM1S0zwIoKl0En79REH39LJKjIpQOtN46THsX4Lmyzh4C0Y+bQ7Se33DY32e3XCUupnuhQYozsJ91FO4cPLVlkmNE= X-MS-TrafficTypeDiagnostic: AM3PR07MB305: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=simon.marchi@ericsson.com; X-Microsoft-Exchange-Diagnostics: 1; AM3PR07MB305; 20:FZvzt3VbwPmo98H1VVQBJ20ojb5zMnG6nq4NPLtzxJ6LlMLv+OvwXQzN0EDsKiQEg7vtXt+VMw2KwDwUKAM2VdMKR37PqdfPCUC3sz0cRXucZTzlRsJ/45HRZ0xeHYe6XIAObC+cpq4zxe5VuyADx05V/Lxk9ZVmXWI9foQYwipeYLCDQ9r2vhiizQpqgYTlYFC4b7iNFjnbdywEiKilmZ5FyzvAELnLclnkaaY6UrClOAqfgvKZ13a/ZDiBKTAeqhmkovBYc82g02/v3qb6pWKr4G1n471Op3V0xJ35tSLKzVhaQDuBd6aKXhiXU5YHaf12WBYkAeRtRyFNdn9LHu3+ivEEXqXzVKwa4Iwggliu1QtjmLdVz8gmT7vjxHvl5YGAuBQfrtvCGcPZstETd3dC80vRBjY/UTcFTfjVX+iCuhPBkksm9UcJbFCSrXTSRriOLbh7RsadmYbzoWxLeaScZO0GFttsekXp52nhNLwzS1LEkC6/cjCTWYdiAX3e; 4:94512PwPAvoQ7a2wzfx+JumvuOx5eTIAX3Kvd/bWfBqofPnPl6CEQLIsqmb0fKrSJk2ywwe1uc8P8sxbNTEiwtTqEaWMIfdAgJnQWMMgFFwnx6EJw2lbMw2hbMf1WyxLwQjEz4tr8dWkeQdnm9AvFBAPHhkhw9x3dtwY5x1pJk+mWI12co64ICbgHcbzcZfi9Yrd52DUNnj+yyI3Rg1EGuCjOCWhtZgmT0WobyqB71Ml78DChaRI3ixKNrwigBMj3f8FOGRSWMerPLlC9T+ZDYAdTqKwdJqouo+K8de1rCk= X-Exchange-Antispam-Report-Test: UriScan:(131327999870524); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(3002001)(6041248)(20161123558100)(20161123555025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123562025)(20161123560025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:AM3PR07MB305; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:AM3PR07MB305; X-Forefront-PRVS: 04180B6720 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(7370300001)(4630300001)(6009001)(199003)(189002)(54534003)(6116002)(3846002)(48376002)(50226002)(25786009)(68736007)(2351001)(7350300001)(47776003)(6512007)(76176999)(189998001)(97736004)(53936002)(66066001)(2361001)(50466002)(101416001)(50986999)(33646002)(2906002)(478600001)(107886003)(8676002)(6486002)(305945005)(36756003)(42186005)(4326008)(6916009)(5003940100001)(2950100002)(5660300001)(81156014)(81166006)(106356001)(86362001)(7736002)(105586002)(6666003)(6506006)(110136004); DIR:OUT; SFP:1101; SCL:1; SRVR:AM3PR07MB305; H:elxacz23q12.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM3PR07MB305; 23:sevAsEQ0dZtkP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yiERycHtesxV8JNnU+eiFoD0yDmDasStPNsyPdskuPq71lISxcvDufNw6IubM3gye0h7TpDFK1dHSElfMY3MngNR/eF2lE3DKGJ7IolB6fMoLPtTMEHoVRS8ePW2BBcjfbX5AB7rryT9/vLUuu1idr6e70BLkGGtCrI8Lo0z8HXjvmfI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Sep 2017 21:36:49.3057 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR07MB305 X-OriginatorOrg: ericsson.com X-IsSubscribed: yes I think it would make more sense if the types and function declarations related to command lines were in cli-script.h rather than defs.h, since the related function definitions are in cli-script.c. I had to add a few includes here and there. I also had to rename the "lines" parameter of command_lines_deleter::operator(), because ncurses has a "#define lines ..." that was interfering when cli-script.h is included by some TUI source files that also include ncurses header files. gdb/ChangeLog: * cli/cli-script.h (enum misc_command_type): Move from defs.h. (enum command_control_type): Likewise. (struct command_line): Likewise. (free_command_lines): Likewise. (struct command_lines_deleter): Likewise. (command_line_up): Likewise. (read_command_lines): Likewise. (read_command_lines_1): Likewise. * defs.h (enum misc_command_type): Move to cli/cli-script.h. (enum command_control_type): Likewise. (struct command_line): Likewise. (free_command_lines): Likewise. (struct command_lines_deleter): Likewise. (command_line_up): Likewise. (read_command_lines): Likewise. (read_command_lines_1): Likewise. * breakpoint.h: Include cli/cli-script.h. * extension-priv.h: Likewise. * gdbcmd.h: Likewise. --- gdb/breakpoint.h | 1 + gdb/cli/cli-script.h | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++- gdb/defs.h | 74 -------------------------------------------------- gdb/extension-priv.h | 1 + gdb/gdbcmd.h | 1 + 5 files changed, 78 insertions(+), 75 deletions(-) diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index dc2b098..4bd407e 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -27,6 +27,7 @@ #include "break-common.h" #include "probe.h" #include "location.h" +#include "cli/cli-script.h" #include struct value; diff --git a/gdb/cli/cli-script.h b/gdb/cli/cli-script.h index 9514938..234faf7 100644 --- a/gdb/cli/cli-script.h +++ b/gdb/cli/cli-script.h @@ -18,9 +18,83 @@ #define CLI_SCRIPT_H 1 struct ui_file; -struct command_line; struct cmd_list_element; +/* * Control types for commands. */ + +enum misc_command_type +{ + ok_command, + end_command, + else_command, + nop_command +}; + +enum command_control_type +{ + simple_control, + break_control, + continue_control, + while_control, + if_control, + commands_control, + python_control, + compile_control, + guile_control, + while_stepping_control, + invalid_control +}; + +/* * Structure for saved commands lines (for breakpoints, defined + commands, etc). */ + +struct command_line +{ + struct command_line *next; + char *line; + enum command_control_type control_type; + union + { + struct + { + enum compile_i_scope_types scope; + void *scope_data; + } + compile; + } + control_u; + /* * The number of elements in body_list. */ + int body_count; + /* * For composite commands, the nested lists of commands. For + example, for "if" command this will contain the then branch and + the else branch, if that is available. */ + struct command_line **body_list; +}; + +extern void free_command_lines (struct command_line **); + +/* A deleter for command_line that calls free_command_lines. */ + +struct command_lines_deleter +{ + void operator() (command_line *cmd_lines) const + { + free_command_lines (&cmd_lines); + } +}; + +/* A unique pointer to a command_line. */ + +typedef std::unique_ptr command_line_up; + +extern command_line_up read_command_lines (char *, int, int, + void (*)(char *, void *), + void *); +extern command_line_up read_command_lines_1 (char * (*) (void), int, + void (*)(char *, void *), + void *); + + /* Exported to cli/cli-cmds.c */ extern void script_from_file (FILE *stream, const char *file); diff --git a/gdb/defs.h b/gdb/defs.h index e180523..af9e32e 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -400,80 +400,6 @@ enum lval_type lval_computed }; -/* * Control types for commands. */ - -enum misc_command_type - { - ok_command, - end_command, - else_command, - nop_command - }; - -enum command_control_type - { - simple_control, - break_control, - continue_control, - while_control, - if_control, - commands_control, - python_control, - compile_control, - guile_control, - while_stepping_control, - invalid_control - }; - -/* * Structure for saved commands lines (for breakpoints, defined - commands, etc). */ - -struct command_line - { - struct command_line *next; - char *line; - enum command_control_type control_type; - union - { - struct - { - enum compile_i_scope_types scope; - void *scope_data; - } - compile; - } - control_u; - /* * The number of elements in body_list. */ - int body_count; - /* * For composite commands, the nested lists of commands. For - example, for "if" command this will contain the then branch and - the else branch, if that is available. */ - struct command_line **body_list; - }; - -extern void free_command_lines (struct command_line **); - -/* A deleter for command_line that calls free_command_lines. */ - -struct command_lines_deleter -{ - void operator() (command_line *lines) const - { - free_command_lines (&lines); - } -}; - -/* A unique pointer to a command_line. */ - -typedef std::unique_ptr command_line_up; - -extern command_line_up read_command_lines (char *, int, int, - void (*)(char *, void *), - void *); -extern command_line_up read_command_lines_1 (char * (*) (void), int, - void (*)(char *, void *), - void *); - /* * Parameters of the "info proc" command. */ enum info_proc_what diff --git a/gdb/extension-priv.h b/gdb/extension-priv.h index f77f088..4d16ac5 100644 --- a/gdb/extension-priv.h +++ b/gdb/extension-priv.h @@ -23,6 +23,7 @@ #include "extension.h" #include +#include "cli/cli-script.h" /* The return code for some API calls. */ diff --git a/gdb/gdbcmd.h b/gdb/gdbcmd.h index 14c7f4e..3191ecd 100644 --- a/gdb/gdbcmd.h +++ b/gdb/gdbcmd.h @@ -26,6 +26,7 @@ #include "command.h" #include "ui-out.h" +#include "cli/cli-script.h" /* Chain containing all defined commands. */