aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli/cli-dump.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2015-04-22 22:52:36 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2015-04-24 22:49:59 +0100
commitcf75d6c37e15e321e82e7f4ceebcf847b4f057fc (patch)
tree2afef4c763a792185d4364f300ed1414c3e0509d /gdb/cli/cli-dump.c
parentdcbd20eb1499db937785881aca2f9584a330723c (diff)
downloadgdb-cf75d6c37e15e321e82e7f4ceebcf847b4f057fc.zip
gdb-cf75d6c37e15e321e82e7f4ceebcf847b4f057fc.tar.gz
gdb-cf75d6c37e15e321e82e7f4ceebcf847b4f057fc.tar.bz2
gdb: Add support for dumping to verilog hex format.
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.
Diffstat (limited to 'gdb/cli/cli-dump.c')
-rw-r--r--gdb/cli/cli-dump.c38
1 files changed, 38 insertions, 0 deletions
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\