aboutsummaryrefslogtreecommitdiff
path: root/gdb/mi
diff options
context:
space:
mode:
authorLuis Machado <lgustavo@codesourcery.com>2017-01-20 08:13:03 -0600
committerLuis Machado <lgustavo@codesourcery.com>2017-01-20 08:13:03 -0600
commit78cbbba8e0bc8b0288f5ce4360b4689ab893aa13 (patch)
treec5a8f0de7e5bfc097b12bd94b47808c71628e53f /gdb/mi
parent7f784814df7067396e9c00b5cdc0eff9cd5c68de (diff)
downloadgdb-78cbbba8e0bc8b0288f5ce4360b4689ab893aa13.zip
gdb-78cbbba8e0bc8b0288f5ce4360b4689ab893aa13.tar.gz
gdb-78cbbba8e0bc8b0288f5ce4360b4689ab893aa13.tar.bz2
Add command to erase all flash memory regions
Changes in v4: - Replaced phex call with hex_string. Changes in v3: - Addressed comments by Pedro. - Output of memory region size now in hex format. - Misc formatting fixups. - Addressed Simon's comments on formatting. - Adjusted command text in the manual entry. - Fixed up ChangeLog. - Renamed flash_erase_all_command to flash_erase_command. Changes in v2: - Added NEWS entry. - Fixed long lines. - Address printing with paddress. Years ago we contributed flash programming patches upstream. The following patch is a leftover one that complements that functionality by adding a new command to erase all reported flash memory blocks. The command is most useful when we're dealing with flash-enabled targets (mostly bare-metal) and we need to reset the board for some reason. The wiping out of flash memory regions should help the target come up with a known clean state from which the user can load a new image and resume debugging. It is convenient enough to do this from the debugger, and there is also an MI command to expose this functionality to the IDE's. gdb/doc/ChangeLog: 2017-01-20 Mike Wrighton <mike_wrighton@codesourcery.com> Luis Machado <lgustavo@codesourcery.com> * gdb.texinfo (-target-flash-erase): New MI command description. (flash-erase): New CLI command description. gdb/ChangeLog: 2017-01-20 Mike Wrighton <mike_wrighton@codesourcery.com> Luis Machado <lgustavo@codesourcery.com> * NEWS (New commands): Mention flash-erase. (New MI commands): Mention target-flash-erase. * mi/mi-cmds.c (mi_cmd_target_flash_erase): Add target-flash-erase MI command. * mi/mi-cmds.h (mi_cmd_target_flash_erase): New declaration. * mi/mi-main.c (mi_cmd_target_flash_erase): New function. * target.c (flash_erase_command): New function. (initialize_targets): Add new flash-erase command. * target.h (flash_erase_command): New declaration.
Diffstat (limited to 'gdb/mi')
-rw-r--r--gdb/mi/mi-cmds.c1
-rw-r--r--gdb/mi/mi-cmds.h1
-rw-r--r--gdb/mi/mi-main.c6
3 files changed, 8 insertions, 0 deletions
diff --git a/gdb/mi/mi-cmds.c b/gdb/mi/mi-cmds.c
index cdea008..abb70bd 100644
--- a/gdb/mi/mi-cmds.c
+++ b/gdb/mi/mi-cmds.c
@@ -147,6 +147,7 @@ static struct mi_cmd mi_cmds[] =
DEF_MI_CMD_MI ("target-file-delete", mi_cmd_target_file_delete),
DEF_MI_CMD_MI ("target-file-get", mi_cmd_target_file_get),
DEF_MI_CMD_MI ("target-file-put", mi_cmd_target_file_put),
+ DEF_MI_CMD_MI ("target-flash-erase", mi_cmd_target_flash_erase),
DEF_MI_CMD_CLI ("target-select", "target", 1),
DEF_MI_CMD_MI ("thread-info", mi_cmd_thread_info),
DEF_MI_CMD_MI ("thread-list-ids", mi_cmd_thread_list_ids),
diff --git a/gdb/mi/mi-cmds.h b/gdb/mi/mi-cmds.h
index 8bd947b..d0906e6 100644
--- a/gdb/mi/mi-cmds.h
+++ b/gdb/mi/mi-cmds.h
@@ -93,6 +93,7 @@ extern mi_cmd_argv_ftype mi_cmd_target_detach;
extern mi_cmd_argv_ftype mi_cmd_target_file_get;
extern mi_cmd_argv_ftype mi_cmd_target_file_put;
extern mi_cmd_argv_ftype mi_cmd_target_file_delete;
+extern mi_cmd_argv_ftype mi_cmd_target_flash_erase;
extern mi_cmd_argv_ftype mi_cmd_thread_info;
extern mi_cmd_argv_ftype mi_cmd_thread_list_ids;
extern mi_cmd_argv_ftype mi_cmd_thread_select;
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index 22803cb..57c23eb 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -553,6 +553,12 @@ mi_cmd_target_detach (char *command, char **argv, int argc)
}
void
+mi_cmd_target_flash_erase (char *command, char **argv, int argc)
+{
+ flash_erase_command (NULL, 0);
+}
+
+void
mi_cmd_thread_select (char *command, char **argv, int argc)
{
enum gdb_rc rc;