gdb: Add support for dumping to verilog hex format.
authorAndrew Burgess <andrew.burgess@embecosm.com>
Wed, 22 Apr 2015 21:52:36 +0000 (22:52 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Fri, 24 Apr 2015 21:49:59 +0000 (22:49 +0100)
Extend the gdb 'dump' command to allow creating output in verilog hex
format.  Add some tests to cover new functionality.  As bfd does not
currently support reading in verilog hex formats the tests only cover
the 'dump' command, not the 'restore' command.

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/testsuite/ChangeLog:

* gdb.base/dump.exp: Add *.verilog files to all_files list.  Add
new tests for verilog output.

gdb/ChangeLog
gdb/NEWS
gdb/cli/cli-dump.c
gdb/doc/ChangeLog
gdb/doc/gdb.texinfo
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/dump.exp

index ff2e2463fda02aee7e64a1ba8215732593710246..5898ec98c35f31d2fefa944d3553a0b12c6b8eda 100644 (file)
@@ -1,3 +1,13 @@
+2015-04-24  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * 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-24  Pierre-Marie de Rodat  <derodat@adacore.com>
 
        * gdbtypes.c (print_gnat_stuff): Do not recurse on the
index 62cbdcb944102bb3b41d8e871c12e8cbacd4a1cc..6ad68ac03cb5047360f2c27edabc5d5c74887ec9 100644 (file)
--- 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",
index 0f9485f85e421b26bbd702a22b7dc5c60aef7f69..08ff941f81e5e9682f0c1b2990d52d6714b75317 100644 (file)
@@ -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;
@@ -334,6 +335,18 @@ dump_ihex_value (char *args, int from_tty)
   dump_value_to_file (args, FOPEN_WB, "ihex");
 }
 
+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)
 {
@@ -635,6 +648,13 @@ ihex_dump_command (char *cmd, int from_tty)
   help_list (ihex_cmdlist, "dump ihex ", all_commands, gdb_stdout);
 }
 
+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)
 {
@@ -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\
index 23b2e685f5b66a5a8ac75185db12978dd8313e94..5da994333fc2f3fb9a23c6126eb2d9aef334db76 100644 (file)
@@ -1,3 +1,8 @@
+2015-04-24  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * gdb.texinfo (Dump/Restore Files): Add detail about verilog dump
+       format.
+
 2015-04-24  Doug Evans  <dje@google.com>
 
        * python.texi (Xmethods In Python): Fix name of method to call the
index 04107026328d05e04e11fc58bd4f1f1fcbc69894..9e2787d0af09621eead96b057869ece09d8168f5 100644 (file)
@@ -10868,9 +10868,9 @@ You can use the commands @code{dump}, @code{append}, and
 @code{restore} to copy data between target memory and a file.  The
 @code{dump} and @code{append} commands write data to a file, and the
 @code{restore} command reads data from a file back into the inferior's
-memory.  Files may be in binary, Motorola S-record, Intel hex, or
-Tektronix Hex format; however, @value{GDBN} can only append to binary
-files.
+memory.  Files may be in binary, Motorola S-record, Intel hex,
+Tektronix Hex, or Verilog Hex format; however, @value{GDBN} can only
+append to binary files, and cannot read from Verilog Hex files.
 
 @table @code
 
@@ -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
index bd0f14624b06a186d65df38df7b4d8b01d3bf259..c37d84a8551e300d2b9389481817aac35d71c30b 100644 (file)
@@ -1,3 +1,8 @@
+2015-04-24  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * gdb.base/dump.exp: Add *.verilog files to all_files list.  Add
+       new tests for verilog output.
+
 2015-04-24  Yao Qi  <yao.qi@linaro.org>
 
        * boards/remote-gdbserver-on-localhost.exp: New file.
index 968554910fb044cd8574d5d7aa70da47bf7dda2a..21aca35158bc16a588b964b4094626efbde1280f 100644 (file)
@@ -66,10 +66,14 @@ if {${data_address} > ${max_32bit_address}} then {
 set filenames {}
 set all_files {
     intarr1.bin intarr1b.bin intarr1.ihex
-    intarr1.srec intarr1.tekhex intarr2.bin intarr2b.bin intarr2.ihex
-    intarr2.srec intarr2.tekhex intstr1.bin intstr1b.bin intstr1.ihex
-    intstr1.srec intstr1.tekhex intstr2.bin intstr2b.bin intstr2.ihex
-    intstr2.srec intstr2.tekhex intarr3.srec
+    intarr1.srec intarr1.tekhex intarr1.verilog
+    intarr2.bin intarr2b.bin intarr2.ihex
+    intarr2.srec intarr2.tekhex intarr2.verilog
+    intstr1.bin intstr1b.bin intstr1.ihex
+    intstr1.srec intstr1.tekhex intstr1.verilog
+    intstr2.bin intstr2b.bin intstr2.ihex
+    intstr2.srec intstr2.tekhex intstr2.verilog
+    intarr3.srec
 }
 
 # This loop sets variables dynamically -- each name listed in
@@ -147,6 +151,12 @@ make_dump_file "dump tekhex val [set intarr1.tekhex] intarray" \
 make_dump_file "dump tekhex val [set intstr1.tekhex] intstruct" \
        "dump struct as value, tekhex"
 
+make_dump_file "dump verilog val [set intarr1.verilog] intarray" \
+       "dump array as value, intel hex"
+
+make_dump_file "dump verilog val [set intstr1.verilog] intstruct" \
+       "dump struct as value, intel hex"
+
 proc capture_value { expression args } {
     global gdb_prompt
     global expect_out
@@ -242,6 +252,12 @@ make_dump_file "dump tekhex mem [set intarr2.tekhex] $array_start $array_end" \
 make_dump_file "dump tekhex mem [set intstr2.tekhex] $struct_start $struct_end" \
        "dump struct as memory, tekhex"
 
+make_dump_file "dump verilog mem [set intarr2.verilog] $array_start $array_end" \
+       "dump array as memory, verilog"
+
+make_dump_file "dump verilog mem [set intstr2.verilog] $struct_start $struct_end" \
+       "dump struct as memory, verilog"
+
 # test complex expressions
 make_dump_file \
     "dump srec mem [set intarr3.srec] &intarray \(char *\) &intarray + sizeof intarray" \
This page took 0.064101 seconds and 4 git commands to generate.