From patchwork Wed Apr 22 22:24:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Burgess X-Patchwork-Id: 6396 Received: (qmail 28432 invoked by alias); 22 Apr 2015 22:25:09 -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 28418 invoked by uid 89); 22 Apr 2015 22:25:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: mail-wi0-f172.google.com Received: from mail-wi0-f172.google.com (HELO mail-wi0-f172.google.com) (209.85.212.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 22 Apr 2015 22:25:07 +0000 Received: by wizk4 with SMTP id k4so194997933wiz.1 for ; Wed, 22 Apr 2015 15:25:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=udshL6gS7NDayGIQMg9tYF2Ufo3WKqqkoyFj/UEGb9s=; b=Xkbd0/2nqNeqtWr3NlrlvESw23ZWL7vMazpklmbWqHNZGffsTOw8qvCnpGgE9E3iSq D23AIvuAf+2o7YV7vRoQ/FY9EUUJedS4TGCYWoxMSzzfnpxwFm7jN12a+3G1O5FUftTp hbw8o7Ntg4OucarAAS3V/bVKGiPxZVgh7M1K9TUbMJalZHDmGIcoKSWcoANeKnb9EwjH Y6ClVqVft2XjkbO9DOqJ0GZYLbiZ3AqwT9hmR8JP9G/L/cBWnWPhF6z6wg3CiUhCZgYZ CR+XiDKTw+D2z4FblcNmCLV71zd666Ck6xqaQMILJ6neLqNbyUjC3YnyqdAX/mhu0BqE rZKQ== X-Gm-Message-State: ALoCoQkIZn38q8x+BvCN1w2dE82VJjj/cvuf8VZHCfGAz5KGdEJD3Ezum3uvxb03AIUd2JRngVxW X-Received: by 10.180.81.104 with SMTP id z8mr9800205wix.5.1429741504649; Wed, 22 Apr 2015 15:25:04 -0700 (PDT) Received: from localhost (host86-133-100-115.range86-133.btcentralplus.com. [86.133.100.115]) by mx.google.com with ESMTPSA id u9sm2794584wjx.15.2015.04.22.15.25.03 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Apr 2015 15:25:03 -0700 (PDT) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCH] gdb: Add support for dumping to verilog hex format. Date: Wed, 22 Apr 2015 23:24:59 +0100 Message-Id: X-IsSubscribed: yes This patch extends the 'dump' command to generate output in the verilog hex format supported by bfd. OK to apply? Thanks, Andrew --- Extend the gdb 'dump' command to allow creating output in verilog hex format. gdb/ChangeLog: * cli/cli-dump.c (verilog_cmdlist): New variable. (dump_verilog_memory): New function. (dump_verilog_value): New function. (verilog_dump_command): New function. (_initialize_cli_dump): Add new commands to support verilog dump format. * NEWS: Add entry for "dump verilog". gdb/doc/ChangeLog: * gdb.texinfo (Dump/Restore Files): Add detail about verilog dump format. --- gdb/ChangeLog | 10 ++++++++++ gdb/NEWS | 2 ++ gdb/cli/cli-dump.c | 38 ++++++++++++++++++++++++++++++++++++++ gdb/doc/ChangeLog | 5 +++++ gdb/doc/gdb.texinfo | 2 ++ 5 files changed, 57 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f5ea395..410f1b7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,13 @@ +2015-04-22 Andrew Burgess + + * cli/cli-dump.c (verilog_cmdlist): New variable. + (dump_verilog_memory): New function. + (dump_verilog_value): New function. + (verilog_dump_command): New function. + (_initialize_cli_dump): Add new commands to support verilog dump + format. + * NEWS: Add entry for "dump verilog". + 2015-04-22 Jon Turney * windows-nat.c (handle_output_debug_string): Don't change diff --git a/gdb/NEWS b/gdb/NEWS index 62cbdcb..6ad68ac 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -42,6 +42,8 @@ (no "set sysroot" or "file" commands are required). See "New remote packets" below. +* The "dump" command now supports verilog hex format. + * Python Scripting ** gdb.Objfile objects have a new attribute "username", diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c index 0f9485f..2af56e5 100644 --- a/gdb/cli/cli-dump.c +++ b/gdb/cli/cli-dump.c @@ -150,6 +150,7 @@ static struct cmd_list_element *dump_cmdlist; static struct cmd_list_element *append_cmdlist; static struct cmd_list_element *srec_cmdlist; static struct cmd_list_element *ihex_cmdlist; +static struct cmd_list_element *verilog_cmdlist; static struct cmd_list_element *tekhex_cmdlist; static struct cmd_list_element *binary_dump_cmdlist; static struct cmd_list_element *binary_append_cmdlist; @@ -335,6 +336,18 @@ dump_ihex_value (char *args, int from_tty) } static void +dump_verilog_memory (char *args, int from_tty) +{ + dump_memory_to_file (args, FOPEN_WB, "verilog"); +} + +static void +dump_verilog_value (char *args, int from_tty) +{ + dump_value_to_file (args, FOPEN_WB, "verilog"); +} + +static void dump_tekhex_memory (char *args, int from_tty) { dump_memory_to_file (args, FOPEN_WB, "tekhex"); @@ -636,6 +649,13 @@ ihex_dump_command (char *cmd, int from_tty) } static void +verilog_dump_command (char *cmd, int from_tty) +{ + printf_unfiltered ("\"dump verilog\" must be followed by a subcommand.\n"); + help_list (verilog_cmdlist, "dump verilog ", all_commands, gdb_stdout); +} + +static void tekhex_dump_command (char *cmd, int from_tty) { printf_unfiltered ("\"dump tekhex\" must be followed by a subcommand.\n"); @@ -697,6 +717,12 @@ the specified FILE in raw target ordered bytes."); 0 /*allow-unknown*/, &dump_cmdlist); + add_prefix_cmd ("verilog", all_commands, verilog_dump_command, + _("Write target code/data to a verilog hex file."), + &verilog_cmdlist, "dump verilog ", + 0 /*allow-unknown*/, + &dump_cmdlist); + add_prefix_cmd ("tekhex", all_commands, tekhex_dump_command, _("Write target code/data to a tekhex file."), &tekhex_cmdlist, "dump tekhex ", @@ -739,6 +765,18 @@ Arguments are FILE EXPRESSION. Writes the value of EXPRESSION\n\ to the specified FILE in intel hex format."), &ihex_cmdlist); + add_cmd ("memory", all_commands, dump_verilog_memory, _("\ +Write contents of memory to a verilog hex file.\n\ +Arguments are FILE START STOP. Writes the contents of memory within\n\ +the range [START .. STOP) to the specified FILE in verilog hex format."), + &verilog_cmdlist); + + add_cmd ("value", all_commands, dump_verilog_value, _("\ +Write the value of an expression to a verilog hex file.\n\ +Arguments are FILE EXPRESSION. Writes the value of EXPRESSION\n\ +to the specified FILE in verilog hex format."), + &verilog_cmdlist); + add_cmd ("memory", all_commands, dump_tekhex_memory, _("\ Write contents of memory to a tekhex file.\n\ Arguments are FILE START STOP. Writes the contents of memory\n\ diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 2335bc1..aa93751 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,8 @@ +2015-04-22 Andrew Burgess + + * gdb.texinfo (Dump/Restore Files): Add detail about verilog dump + format. + 2015-04-17 Gary Benson * gdb.texinfo (Connecting to a Remote Target): Mention that diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 0410702..4b78fb4 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -10890,6 +10890,8 @@ Intel hex format. Motorola S-record format. @item tekhex Tektronix Hex format. +@item verilog +Verilog Hex format. @end table @value{GDBN} uses the same definitions of these formats as the