aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-11-18 05:36:18 -0800
committerZachary T Welch <zw@superlucidity.net>2009-11-18 15:51:07 -0800
commit410fab9ea8c6632da2e4967d960f66eecc7821ec (patch)
tree51f6d5146aa04bc13ea8809963f31d03b71fd3bc /src/server
parent75a37eb5b37386768327e9670acfedc7811d529f (diff)
downloadriscv-openocd-410fab9ea8c6632da2e4967d960f66eecc7821ec.zip
riscv-openocd-410fab9ea8c6632da2e4967d960f66eecc7821ec.tar.gz
riscv-openocd-410fab9ea8c6632da2e4967d960f66eecc7821ec.tar.bz2
use COMMAND_PARSE_ENABLE macro where appropriate
Updates all command parsing of simple "enable" and "disable" arguments. A few case in the tree use a tri-state or extended arguments, which cannot use this simple macro. Simlifies the xscale icache/dcache command handler logic.
Diffstat (limited to 'src/server')
-rw-r--r--src/server/gdb_server.c45
1 files changed, 3 insertions, 42 deletions
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c
index 9605f81..21dc24c 100644
--- a/src/server/gdb_server.c
+++ b/src/server/gdb_server.c
@@ -2271,20 +2271,7 @@ COMMAND_HANDLER(handle_gdb_port_command)
COMMAND_HANDLER(handle_gdb_memory_map_command)
{
if (CMD_ARGC == 1)
- {
- if (strcmp(CMD_ARGV[0], "enable") == 0)
- {
- gdb_use_memory_map = 1;
- return ERROR_OK;
- }
- else if (strcmp(CMD_ARGV[0], "disable") == 0)
- {
- gdb_use_memory_map = 0;
- return ERROR_OK;
- }
- else
- LOG_WARNING("invalid gdb_memory_map configuration directive %s", CMD_ARGV[0]);
- }
+ COMMAND_PARSE_ENABLE(CMD_ARGV[0], gdb_use_memory_map);
return ERROR_COMMAND_SYNTAX_ERROR;
}
@@ -2292,20 +2279,7 @@ COMMAND_HANDLER(handle_gdb_memory_map_command)
COMMAND_HANDLER(handle_gdb_flash_program_command)
{
if (CMD_ARGC == 1)
- {
- if (strcmp(CMD_ARGV[0], "enable") == 0)
- {
- gdb_flash_program = 1;
- return ERROR_OK;
- }
- else if (strcmp(CMD_ARGV[0], "disable") == 0)
- {
- gdb_flash_program = 0;
- return ERROR_OK;
- }
- else
- LOG_WARNING("invalid gdb_flash_program configuration directive: %s", CMD_ARGV[0]);
- }
+ COMMAND_PARSE_ENABLE(CMD_ARGV[0], gdb_flash_program);
return ERROR_COMMAND_SYNTAX_ERROR;
}
@@ -2313,20 +2287,7 @@ COMMAND_HANDLER(handle_gdb_flash_program_command)
COMMAND_HANDLER(handle_gdb_report_data_abort_command)
{
if (CMD_ARGC == 1)
- {
- if (strcmp(CMD_ARGV[0], "enable") == 0)
- {
- gdb_report_data_abort = 1;
- return ERROR_OK;
- }
- else if (strcmp(CMD_ARGV[0], "disable") == 0)
- {
- gdb_report_data_abort = 0;
- return ERROR_OK;
- }
- else
- LOG_WARNING("invalid gdb_report_data_abort configuration directive: %s", CMD_ARGV[0]);
- }
+ COMMAND_PARSE_ENABLE(CMD_ARGV[0], gdb_report_data_abort);
return ERROR_COMMAND_SYNTAX_ERROR;
}