Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] gdb: Add support for dumping to verilog hex format.
@ 2015-04-22 22:25 Andrew Burgess
  2015-04-22 22:33 ` Pedro Alves
  2015-04-23  6:18 ` Eli Zaretskii
  0 siblings, 2 replies; 10+ messages in thread
From: Andrew Burgess @ 2015-04-22 22:25 UTC (permalink / raw)
  To: gdb-patches; +Cc: Andrew Burgess

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  <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-22  Jon Turney  <jon.turney@dronecode.org.uk>
 
 	* 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  <andrew.burgess@embecosm.com>
+
+	* gdb.texinfo (Dump/Restore Files): Add detail about verilog dump
+	format.
+
 2015-04-17  Gary Benson <gbenson@redhat.com>
 
 	* 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
-- 
2.2.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] gdb: Add support for dumping to verilog hex format.
  2015-04-22 22:25 [PATCH] gdb: Add support for dumping to verilog hex format Andrew Burgess
@ 2015-04-22 22:33 ` Pedro Alves
  2015-04-22 23:04   ` Andrew Burgess
  2015-04-23  6:18 ` Eli Zaretskii
  1 sibling, 1 reply; 10+ messages in thread
From: Pedro Alves @ 2015-04-22 22:33 UTC (permalink / raw)
  To: Andrew Burgess, gdb-patches

Hi Andrew,

On 04/22/2015 11:24 PM, Andrew Burgess wrote:
> This patch extends the 'dump' command to generate output in the
> verilog hex format supported by bfd.
> 
> OK to apply?

Sounds like gdb.base/dump.exp should be extended to cover this?

Thanks,
Pedro Alves


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] gdb: Add support for dumping to verilog hex format.
  2015-04-22 22:33 ` Pedro Alves
@ 2015-04-22 23:04   ` Andrew Burgess
  2015-04-23 10:41     ` Pedro Alves
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Burgess @ 2015-04-22 23:04 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

* Pedro Alves <palves@redhat.com> [2015-04-22 23:33:22 +0100]:

> On 04/22/2015 11:24 PM, Andrew Burgess wrote:
> > This patch extends the 'dump' command to generate output in the
> > verilog hex format supported by bfd.
> > 
> > OK to apply?
> 
> Sounds like gdb.base/dump.exp should be extended to cover this?

Of course, sorry.

New version, including tests.  Given that bfd (currently) only
supports writing to verilog format, and not reading, then the tests
(obviously) only cover 'dump' and not 'restore'.

Within dump.exp I reordered the 'all_files' list a little in order to
make it easier to insert new files.  Everything else should be
straight forward.

Thanks,
Andrew

---

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                   | 10 ++++++++++
 gdb/NEWS                        |  2 ++
 gdb/cli/cli-dump.c              | 38 ++++++++++++++++++++++++++++++++++++++
 gdb/doc/ChangeLog               |  5 +++++
 gdb/doc/gdb.texinfo             |  2 ++
 gdb/testsuite/ChangeLog         |  5 +++++
 gdb/testsuite/gdb.base/dump.exp | 24 ++++++++++++++++++++----
 7 files changed, 82 insertions(+), 4 deletions(-)

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  <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-22  Jon Turney  <jon.turney@dronecode.org.uk>
 
 	* 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  <andrew.burgess@embecosm.com>
+
+	* gdb.texinfo (Dump/Restore Files): Add detail about verilog dump
+	format.
+
 2015-04-17  Gary Benson <gbenson@redhat.com>
 
 	* 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
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 04ec209..8c26ed6 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-04-22  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-21  Pierre Muller  <muller@sourceware.org>
 
 	PR pascal/17815
diff --git a/gdb/testsuite/gdb.base/dump.exp b/gdb/testsuite/gdb.base/dump.exp
index 9685549..21aca35 100644
--- a/gdb/testsuite/gdb.base/dump.exp
+++ b/gdb/testsuite/gdb.base/dump.exp
@@ -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" \
-- 
2.2.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] gdb: Add support for dumping to verilog hex format.
  2015-04-22 22:25 [PATCH] gdb: Add support for dumping to verilog hex format Andrew Burgess
  2015-04-22 22:33 ` Pedro Alves
@ 2015-04-23  6:18 ` Eli Zaretskii
  1 sibling, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2015-04-23  6:18 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: gdb-patches

> From: Andrew Burgess <andrew.burgess@embecosm.com>
> Cc: Andrew Burgess <andrew.burgess@embecosm.com>
> Date: Wed, 22 Apr 2015 23:24:59 +0100
> 
> 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.

This part is OK.

>  static void
> +verilog_dump_command (char *cmd, int from_tty)
> +{
> +  printf_unfiltered ("\"dump verilog\" must be followed by a subcommand.\n");

Shouldn't this message be in _()?

> 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

OK for this part.

Thanks.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] gdb: Add support for dumping to verilog hex format.
  2015-04-22 23:04   ` Andrew Burgess
@ 2015-04-23 10:41     ` Pedro Alves
  2015-04-23 21:31       ` Andrew Burgess
  2015-04-23 21:34       ` Andrew Burgess
  0 siblings, 2 replies; 10+ messages in thread
From: Pedro Alves @ 2015-04-23 10:41 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: gdb-patches

On 04/23/2015 12:04 AM, Andrew Burgess wrote:
> * Pedro Alves <palves@redhat.com> [2015-04-22 23:33:22 +0100]:
> 
>> On 04/22/2015 11:24 PM, Andrew Burgess wrote:
>>> This patch extends the 'dump' command to generate output in the
>>> verilog hex format supported by bfd.
>>>
>>> OK to apply?
>>
>> Sounds like gdb.base/dump.exp should be extended to cover this?
> 
> Of course, sorry.
> 
> New version, including tests.  Given that bfd (currently) only
> supports writing to verilog format, and not reading, then the tests
> (obviously) only cover 'dump' and not 'restore'.
> 
> Within dump.exp I reordered the 'all_files' list a little in order to
> make it easier to insert new files.  Everything else should be
> straight forward.

(Looks like the test could be simplified with something like
   foreach format $dump_formats {} { ... }.  Something for another
day.)

Thanks, this looks good to me with the missing _() Eli noticed, and ...


> 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

... at least this bit needs updating too:

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.

Thanks,
Pedro Alves


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] gdb: Add support for dumping to verilog hex format.
  2015-04-23 10:41     ` Pedro Alves
@ 2015-04-23 21:31       ` Andrew Burgess
  2015-04-24  6:17         ` Eli Zaretskii
  2015-04-24 13:50         ` Pedro Alves
  2015-04-23 21:34       ` Andrew Burgess
  1 sibling, 2 replies; 10+ messages in thread
From: Andrew Burgess @ 2015-04-23 21:31 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches, Eli Zaretskii

* Pedro Alves <palves@redhat.com> [2015-04-23 11:41:27 +0100]:

>
> Thanks, this looks good to me with the missing _() Eli noticed, and ...
>
> ... at least this bit needs updating too:
>
> You can use the commands @code{dump}, @code{append}, and
> @code{restore} to copy data between target memory and a file.  The

<snip>

New version includes string internationalisation change, and
additional doc changes.

Thanks,
Andrew

---

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                   | 10 ++++++++++
 gdb/NEWS                        |  2 ++
 gdb/cli/cli-dump.c              | 38 ++++++++++++++++++++++++++++++++++++++
 gdb/doc/ChangeLog               |  5 +++++
 gdb/doc/gdb.texinfo             |  8 +++++---
 gdb/testsuite/ChangeLog         |  5 +++++
 gdb/testsuite/gdb.base/dump.exp | 24 ++++++++++++++++++++----
 7 files changed, 85 insertions(+), 7 deletions(-)

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  <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-22  Jon Turney  <jon.turney@dronecode.org.uk>
 
 	* 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..08ff941 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  <andrew.burgess@embecosm.com>
+
+	* gdb.texinfo (Dump/Restore Files): Add detail about verilog dump
+	format.
+
 2015-04-17  Gary Benson <gbenson@redhat.com>
 
 	* gdb.texinfo (Connecting to a Remote Target): Mention that
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 0410702..9e2787d 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -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
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 04ec209..8c26ed6 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-04-22  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-21  Pierre Muller  <muller@sourceware.org>
 
 	PR pascal/17815
diff --git a/gdb/testsuite/gdb.base/dump.exp b/gdb/testsuite/gdb.base/dump.exp
index 9685549..21aca35 100644
--- a/gdb/testsuite/gdb.base/dump.exp
+++ b/gdb/testsuite/gdb.base/dump.exp
@@ -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" \
-- 
2.2.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] gdb: Add support for dumping to verilog hex format.
  2015-04-23 10:41     ` Pedro Alves
  2015-04-23 21:31       ` Andrew Burgess
@ 2015-04-23 21:34       ` Andrew Burgess
  2015-04-24 13:51         ` Pedro Alves
  1 sibling, 1 reply; 10+ messages in thread
From: Andrew Burgess @ 2015-04-23 21:34 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

* Pedro Alves <palves@redhat.com> [2015-04-23 11:41:27 +0100]:

> Thanks, this looks good to me with the missing _() Eli noticed, and ...

The _() I wised was a result of copy 'n' pasting some code that
already lacks internationalisation support.  This patch fixes those
strings in the immediate area of where I was working.

This applies on top of the verilog dump patch, and I'll push it as
obvious once that patch is merged.

Thanks,
Andrew

--

Spotted a few strings that were missing internationalization support.

gdb/ChangeLog:

	* cli/cli-dump.c (srec_dump_command): Add internationalization
	mark ups.
	(ihex_dump_command): Likewise.
	(tekhex_dump_command): Likewise.
	(binary_dump_command): Likewise.
	(binary_append_command): Likewise.
---
 gdb/ChangeLog      |  9 +++++++++
 gdb/cli/cli-dump.c | 10 +++++-----
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 410f1b7..08912fd 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+2015-04-23  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+	* cli/cli-dump.c (srec_dump_command): Add internationalization
+	mark ups.
+	(ihex_dump_command): Likewise.
+	(tekhex_dump_command): Likewise.
+	(binary_dump_command): Likewise.
+	(binary_append_command): Likewise.
+
 2015-04-22  Andrew Burgess  <andrew.burgess@embecosm.com>
 
 	* cli/cli-dump.c (verilog_cmdlist): New variable.
diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c
index 08ff941..2449dc5 100644
--- a/gdb/cli/cli-dump.c
+++ b/gdb/cli/cli-dump.c
@@ -637,14 +637,14 @@ restore_command (char *args_in, int from_tty)
 static void
 srec_dump_command (char *cmd, int from_tty)
 {
-  printf_unfiltered ("\"dump srec\" must be followed by a subcommand.\n");
+  printf_unfiltered (_("\"dump srec\" must be followed by a subcommand.\n"));
   help_list (srec_cmdlist, "dump srec ", all_commands, gdb_stdout);
 }
 
 static void
 ihex_dump_command (char *cmd, int from_tty)
 {
-  printf_unfiltered ("\"dump ihex\" must be followed by a subcommand.\n");
+  printf_unfiltered (_("\"dump ihex\" must be followed by a subcommand.\n"));
   help_list (ihex_cmdlist, "dump ihex ", all_commands, gdb_stdout);
 }
 
@@ -658,21 +658,21 @@ verilog_dump_command (char *cmd, int from_tty)
 static void
 tekhex_dump_command (char *cmd, int from_tty)
 {
-  printf_unfiltered ("\"dump tekhex\" must be followed by a subcommand.\n");
+  printf_unfiltered (_("\"dump tekhex\" must be followed by a subcommand.\n"));
   help_list (tekhex_cmdlist, "dump tekhex ", all_commands, gdb_stdout);
 }
 
 static void
 binary_dump_command (char *cmd, int from_tty)
 {
-  printf_unfiltered ("\"dump binary\" must be followed by a subcommand.\n");
+  printf_unfiltered (_("\"dump binary\" must be followed by a subcommand.\n"));
   help_list (binary_dump_cmdlist, "dump binary ", all_commands, gdb_stdout);
 }
 
 static void
 binary_append_command (char *cmd, int from_tty)
 {
-  printf_unfiltered ("\"append binary\" must be followed by a subcommand.\n");
+  printf_unfiltered (_("\"append binary\" must be followed by a subcommand.\n"));
   help_list (binary_append_cmdlist, "append binary ", all_commands,
 	     gdb_stdout);
 }
-- 
2.2.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] gdb: Add support for dumping to verilog hex format.
  2015-04-23 21:31       ` Andrew Burgess
@ 2015-04-24  6:17         ` Eli Zaretskii
  2015-04-24 13:50         ` Pedro Alves
  1 sibling, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2015-04-24  6:17 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: palves, gdb-patches

> Date: Thu, 23 Apr 2015 22:31:30 +0100
> From: Andrew Burgess <andrew.burgess@embecosm.com>
> Cc: gdb-patches@sourceware.org, Eli Zaretskii <eliz@gnu.org>
> 
> * Pedro Alves <palves@redhat.com> [2015-04-23 11:41:27 +0100]:
> 
> >
> > Thanks, this looks good to me with the missing _() Eli noticed, and ...
> >
> > ... at least this bit needs updating too:
> >
> > You can use the commands @code{dump}, @code{append}, and
> > @code{restore} to copy data between target memory and a file.  The
> 
> <snip>
> 
> New version includes string internationalisation change, and
> additional doc changes.

Thanks, the documentation parts are OK.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] gdb: Add support for dumping to verilog hex format.
  2015-04-23 21:31       ` Andrew Burgess
  2015-04-24  6:17         ` Eli Zaretskii
@ 2015-04-24 13:50         ` Pedro Alves
  1 sibling, 0 replies; 10+ messages in thread
From: Pedro Alves @ 2015-04-24 13:50 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: gdb-patches, Eli Zaretskii

On 04/23/2015 10:31 PM, Andrew Burgess wrote:
> * Pedro Alves <palves@redhat.com> [2015-04-23 11:41:27 +0100]:
> 
>>
>> Thanks, this looks good to me with the missing _() Eli noticed, and ...
>>
>> ... at least this bit needs updating too:
>>
>> You can use the commands @code{dump}, @code{append}, and
>> @code{restore} to copy data between target memory and a file.  The
> 
> <snip>
> 
> New version includes string internationalisation change, and
> additional doc changes.
> 

Thanks, this version is OK.

-- 
Pedro Alves


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] gdb: Add support for dumping to verilog hex format.
  2015-04-23 21:34       ` Andrew Burgess
@ 2015-04-24 13:51         ` Pedro Alves
  0 siblings, 0 replies; 10+ messages in thread
From: Pedro Alves @ 2015-04-24 13:51 UTC (permalink / raw)
  To: Andrew Burgess; +Cc: gdb-patches

On 04/23/2015 10:34 PM, Andrew Burgess wrote:
> * Pedro Alves <palves@redhat.com> [2015-04-23 11:41:27 +0100]:
> 
>> Thanks, this looks good to me with the missing _() Eli noticed, and ...
> 
> The _() I wised was a result of copy 'n' pasting some code that
> already lacks internationalisation support.  This patch fixes those
> strings in the immediate area of where I was working.
> 
> This applies on top of the verilog dump patch, and I'll push it as
> obvious once that patch is merged.

Awesome, thanks for doing this.

Thanks,
Pedro Alves


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-04-24 13:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-22 22:25 [PATCH] gdb: Add support for dumping to verilog hex format Andrew Burgess
2015-04-22 22:33 ` Pedro Alves
2015-04-22 23:04   ` Andrew Burgess
2015-04-23 10:41     ` Pedro Alves
2015-04-23 21:31       ` Andrew Burgess
2015-04-24  6:17         ` Eli Zaretskii
2015-04-24 13:50         ` Pedro Alves
2015-04-23 21:34       ` Andrew Burgess
2015-04-24 13:51         ` Pedro Alves
2015-04-23  6:18 ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox