summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDean Glazeski <dnglaze@gmail.com>2009-11-14 12:39:08 -0600
committerZachary T Welch <zw@superlucidity.net>2009-11-14 10:58:35 -0800
commitc93ae60bce40b196cb5594e8e4723f3d567ff22e (patch)
tree99555e8e68df4e671a45ac2de4f5321263868e54 /src
parent4088b1e622cff0673f2859de5ee611da736bdba7 (diff)
downloadopenocd_libswd-c93ae60bce40b196cb5594e8e4723f3d567ff22e.tar.gz
openocd_libswd-c93ae60bce40b196cb5594e8e4723f3d567ff22e.tar.bz2
openocd_libswd-c93ae60bce40b196cb5594e8e4723f3d567ff22e.tar.xz
openocd_libswd-c93ae60bce40b196cb5594e8e4723f3d567ff22e.zip
Invalid command syntax errors with MWW.
This fixes an issue due to the new command handler syntax caused by the mw handler playing with the args pointer before using the CMD_NAME macro. Fix is to move this call above the lines changing args.
Diffstat (limited to 'src')
-rw-r--r--src/target/target.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/target/target.c b/src/target/target.c
index cc8d500f..6ecf16a1 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -2308,6 +2308,7 @@ COMMAND_HANDLER(handle_mw_command)
bool physical=strcmp(args[0], "phys")==0;
int (*fn)(struct target *target,
uint32_t address, uint32_t size, uint32_t count, uint8_t *buffer);
+ const char *cmd_name = CMD_NAME;
if (physical)
{
argc--;
@@ -2333,7 +2334,7 @@ COMMAND_HANDLER(handle_mw_command)
struct target *target = get_current_target(cmd_ctx);
unsigned wordsize;
uint8_t value_buf[4];
- switch (CMD_NAME[2])
+ switch (cmd_name[6])
{
case 'w':
wordsize = 4;