From patchwork Mon Apr 18 15:19:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 11786 Received: (qmail 100722 invoked by alias); 18 Apr 2016 15:19:17 -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 100654 invoked by uid 89); 18 Apr 2016 15:19:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.1 required=5.0 tests=AWL, BAYES_00, MIME_BASE64_BLANKS, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=NUMBERS, Disable, Evans, evans X-HELO: mail-pf0-f201.google.com Received: from mail-pf0-f201.google.com (HELO mail-pf0-f201.google.com) (209.85.192.201) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 18 Apr 2016 15:19:14 +0000 Received: by mail-pf0-f201.google.com with SMTP id e190so14540457pfe.0 for ; Mon, 18 Apr 2016 08:19:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:message-id:date:subject:from:to :content-transfer-encoding; bh=kGysQtUMw7EODw800AHBolerhMBMVB1qGQ66ERkkS9I=; b=f8VTNn5oYoWfTRPvX1bU/VDGM3/I8qaCbB6MCzaPCEpsK+Rgpukq0IywSNCTjWimB9 s6MfLvW1DFEwDTS/fCOP6zYUcb+hw4tsEi/UNDj1M+tfOJZcPAljWhBLCeoQX9tUe2i/ Cs2b/5qFDKtjdaoc32KnwJQ7+tIHbC1GXpm//9a3qwzW6vA153vsAHpjL4GvmUkfRJjG 5OdJjnpAtunnXeiJm55hDRp1lthxuCQAprjuIcbiUFf8UizsXw2dLp1wfVbKG1PjI/h5 nBkLhlaBdClnFFsz2XCNZtwuNlq3b5dtURyL1KtKYKBYoNMhw2RHQEl1T44sPIrkAn// S3hg== X-Gm-Message-State: AOPr4FXHowXrIVLjTSCASIVZZQ4BlygeNLJdRn3il6jkHCVGcXGZTuekS72DWSnd0QCO/r7vB61I6CqNWhObMjq4lhqBVu67WMmBbPctFXe9nn0MgOmfvzJEkJ45J72dOJHMV7+kj29sIdMPNvMoEtrHdgRoAUu621AK5gQuhdXkaAoPf7Yp7g== MIME-Version: 1.0 X-Received: by 10.66.101.212 with SMTP id fi20mr5518885pab.10.1460992752134; Mon, 18 Apr 2016 08:19:12 -0700 (PDT) Message-ID: <485b3978bc7f02ed740530c3e219@google.com> Date: Mon, 18 Apr 2016 15:19:12 +0000 Subject: [PATCH 1/3] deprecate "skip enable/etc.", doc string cleanup From: Doug Evans To: gdb-patches@sourceware.org, eliz@gnu.org X-IsSubscribed: yes This patch creates some macros for use in enable/disable/delete doc strings and then uses them in breakpoint.c. 2016-04-17 Doug Evans * breakpoint.h (EDDI_USAGE_DOC_STRING, EDD_DOC_STRING): New macros. (ENABLE_DOC_STRING, DISABLE_DOC_STRING, DELETE_DOC_STRING): New macros. * breakpoint.c (_initialize_breakpoint): Use new macros. /* Type of breakpoint. */ diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index f99a7ab..62bc3dd 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -16209,87 +16209,99 @@ so it will be deleted when hit.\n\ BREAK_ARGS_HELP ("thbreak"))); set_cmd_completer (c, location_completer); - add_prefix_cmd ("enable", class_breakpoint, enable_command, _("\ -Enable some breakpoints.\n\ -Give breakpoint numbers (separated by spaces) as arguments.\n\ -With no subcommand, breakpoints are enabled until you command otherwise.\n\ + add_prefix_cmd ("enable", class_breakpoint, enable_command, _( +ENABLE_DOC_STRING ("breakpoint", "enable") +"\n\ This is used to cancel the effect of the \"disable\" command.\n\ With a subcommand you can enable temporarily."), &enablelist, "enable ", 1, &cmdlist); add_com_alias ("en", "enable", class_breakpoint, 1); - add_prefix_cmd ("breakpoints", class_breakpoint, enable_command, _("\ -Enable some breakpoints.\n\ -Give breakpoint numbers (separated by spaces) as arguments.\n\ + add_prefix_cmd ("breakpoints", class_breakpoint, enable_command, _( +ENABLE_DOC_STRING ("breakpoint", "enable breakpoints") +"\n\ This is used to cancel the effect of the \"disable\" command.\n\ -May be abbreviated to simply \"enable\".\n"), +May be abbreviated to simply \"enable\"."), &enablebreaklist, "enable breakpoints ", 1, &enablelist); add_cmd ("once", no_class, enable_once_command, _("\ -Enable breakpoints for one hit. Give breakpoint numbers.\n\ +Enable breakpoints for one hit.\n" +EDDI_USAGE_DOC_STRING ("enable breakpoints once") +"\n\ +At least one breakpoint must be specified.\n\ If a breakpoint is hit while enabled in this fashion, it becomes disabled."), &enablebreaklist); add_cmd ("delete", no_class, enable_delete_command, _("\ -Enable breakpoints and delete when hit. Give breakpoint numbers.\n\ +Enable breakpoints and delete when hit.\n" +EDDI_USAGE_DOC_STRING ("enable breakpoints delete") +"\n\ +At least one breakpoint must be specified.\n\ If a breakpoint is hit while enabled in this fashion, it is deleted."), &enablebreaklist); add_cmd ("count", no_class, enable_count_command, _("\ -Enable breakpoints for COUNT hits. Give count and then breakpoint numbers.\n\ +Enable breakpoints for COUNT hits.\n" +EDDI_USAGE_DOC_STRING ("enable breakpoints count COUNT") +"\n\ +At least one breakpoint must be specified.\n\ If a breakpoint is hit while enabled in this fashion,\n\ the count is decremented; when it reaches zero, the breakpoint is disabled."), &enablebreaklist); add_cmd ("delete", no_class, enable_delete_command, _("\ -Enable breakpoints and delete when hit. Give breakpoint numbers.\n\ +Enable breakpoints and delete when hit.\n" +EDDI_USAGE_DOC_STRING ("enable delete") +"\n\ +At least one breakpoint must be specified.\n\ If a breakpoint is hit while enabled in this fashion, it is deleted."), &enablelist); add_cmd ("once", no_class, enable_once_command, _("\ -Enable breakpoints for one hit. Give breakpoint numbers.\n\ +Enable breakpoints for one hit.\n" +EDDI_USAGE_DOC_STRING ("enable once") +"\n\ +At least one breakpoint must be specified.\n\ If a breakpoint is hit while enabled in this fashion, it becomes disabled."), &enablelist); add_cmd ("count", no_class, enable_count_command, _("\ -Enable breakpoints for COUNT hits. Give count and then breakpoint numbers.\n\ +Enable breakpoints for COUNT hits.\n" +EDDI_USAGE_DOC_STRING ("enable count COUNT") +"\n\ +At least one breakpoint must be specified.\n\ If a breakpoint is hit while enabled in this fashion,\n\ the count is decremented; when it reaches zero, the breakpoint is disabled."), &enablelist); - add_prefix_cmd ("disable", class_breakpoint, disable_command, _("\ -Disable some breakpoints.\n\ -Arguments are breakpoint numbers with spaces in between.\n\ -To disable all breakpoints, give no argument.\n\ + add_prefix_cmd ("disable", class_breakpoint, disable_command, _( +DISABLE_DOC_STRING ("breakpoint", "disable") +"\n\ A disabled breakpoint is not forgotten, but has no effect until re-enabled."), &disablelist, "disable ", 1, &cmdlist); add_com_alias ("dis", "disable", class_breakpoint, 1); add_com_alias ("disa", "disable", class_breakpoint, 1); - add_cmd ("breakpoints", class_alias, disable_command, _("\ -Disable some breakpoints.\n\ -Arguments are breakpoint numbers with spaces in between.\n\ -To disable all breakpoints, give no argument.\n\ + add_cmd ("breakpoints", class_alias, disable_command, _( +DISABLE_DOC_STRING ("breakpoint", "disable breakpoints") +"\n\ A disabled breakpoint is not forgotten, but has no effect until re-enabled.\n\ This command may be abbreviated \"disable\"."), &disablelist); - add_prefix_cmd ("delete", class_breakpoint, delete_command, _("\ -Delete some breakpoints or auto-display expressions.\n\ -Arguments are breakpoint numbers with spaces in between.\n\ -To delete all breakpoints, give no argument.\n\ -\n\ + add_prefix_cmd ("delete", class_breakpoint, delete_command, _( +DELETE_DOC_STRING ("breakpoint", "delete") +"\n\ Also a prefix command for deletion of other GDB objects.\n\ The \"unset\" command is also an alias for \"delete\"."), &deletelist, "delete ", 1, &cmdlist); add_com_alias ("d", "delete", class_breakpoint, 1); add_com_alias ("del", "delete", class_breakpoint, 1); - add_cmd ("breakpoints", class_alias, delete_command, _("\ -Delete some breakpoints or auto-display expressions.\n\ -Arguments are breakpoint numbers with spaces in between.\n\ -To delete all breakpoints, give no argument.\n\ + add_cmd ("breakpoints", class_alias, delete_command, _( +DELETE_DOC_STRING ("breakpoint", "delete breakpoints") +"\n\ This command may be abbreviated \"delete\"."), &deletelist); diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 054eab4..84ba475 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -45,6 +45,34 @@ struct event_location; architecture. */ #define BREAKPOINT_MAX 16 + +/* The usage part of doc strings for enable/disable/delete/info commands. */ + +#define EDDI_USAGE_DOC_STRING(command_with_prefix) \ + "Usage: " command_with_prefix " [NUMBERS AND/OR RANGES]\n" \ + "You can specify numbers (e.g. \"" command_with_prefix " 1 3\"),\n" \ + "ranges (e.g. \"" command_with_prefix " 4-8\"),\n" \ + "or both (e.g. \"" command_with_prefix " 1 3 4-8\")." + +#define EDDI_USAGE_DOC_STRING_WITH_ALL(kind, command_with_prefix, actioned) \ + EDDI_USAGE_DOC_STRING (command_with_prefix) \ + "\nIf you don't specify any numbers or ranges,\n" \ + "all " kind " entries are " actioned "." + +/* Part of the doc string for enable/disable/delete commands. */ + +#define EDD_DOC_STRING(kind, command_with_prefix, Action, actioned) \ + Action " " kind " entries.\n" \ + EDDI_USAGE_DOC_STRING_WITH_ALL (kind, command_with_prefix, actioned) + +#define ENABLE_DOC_STRING(kind, command_with_prefix) \ + EDD_DOC_STRING (kind, command_with_prefix, "Enable", "enabled") + +#define DISABLE_DOC_STRING(kind, command_with_prefix) \ + EDD_DOC_STRING (kind, command_with_prefix, "Disable", "disabled") + +#define DELETE_DOC_STRING(kind, command_with_prefix) \ + EDD_DOC_STRING (kind, command_with_prefix, "Delete", "deleted")