From 8007332ab188b51a5bf2edfa1e9791f712433175 Mon Sep 17 00:00:00 2001 From: Ian McAfee Date: Wed, 26 Apr 2017 17:54:56 -0600 Subject: [PATCH] I need to look at the registers that are at or around 0xe000ef90. Using mw and xd, I see that nsh does not support pointers greater than 0x7fffffff. A quick look at the source shows that the pointers for those two commands are set with calls to strtol() rather than strtoul(). Changing the two pointer-setting instances to strtoul() fixes the problem, at least for my architecture/config. --- nshlib/nsh_dbgcmds.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nshlib/nsh_dbgcmds.c b/nshlib/nsh_dbgcmds.c index e123f45e1..c86d77109 100644 --- a/nshlib/nsh_dbgcmds.c +++ b/nshlib/nsh_dbgcmds.c @@ -99,7 +99,7 @@ static int mem_parse(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv, *pcvalue = '\0'; pcvalue++; - lvalue = (unsigned long)strtol(pcvalue, NULL, 16); + lvalue = strtoul(pcvalue, NULL, 16); if (lvalue > 0xffffffffL) { return -EINVAL; @@ -116,13 +116,13 @@ static int mem_parse(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv, /* Get the address to be accessed */ - mem->dm_addr = (void*)((uintptr_t)strtol(argv[1], NULL, 16)); + mem->dm_addr = (FAR void *)((uintptr_t)strtoul(argv[1], NULL, 16)); /* Get the number of bytes to access */ if (argc > 2) { - mem->dm_count = (unsigned int)strtol(argv[2], NULL, 16); + mem->dm_count = (unsigned int)strtoul(argv[2], NULL, 16); } else { @@ -346,7 +346,7 @@ int cmd_xd(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv) FAR char *endptr; int nbytes; - addr = (char*)((uintptr_t)strtol(argv[1], &endptr, 16)); + addr = (FAR char*)((uintptr_t)strtoul(argv[1], &endptr, 16)); if (argv[0][0] == '\0' || *endptr != '\0') { return ERROR;