support memdump can dump by seq number
Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
parent
db767b6f45
commit
e68d5ffb98
@ -224,7 +224,8 @@ static const struct cmdmap_s g_cmdmap[] =
|
||||
|
||||
#ifdef CONFIG_DEBUG_MM
|
||||
# ifndef CONFIG_NSH_DISABLE_MEMDUMP
|
||||
{ "memdump", cmd_memdump, 1, 3, "[pid/used/free/on/off]" },
|
||||
{ "memdump", cmd_memdump, 1, 4, "[pid/used/free/on/off]"
|
||||
" <minseq> <maxseq>"},
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
@ -56,11 +56,20 @@ int cmd_free(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
|
||||
|
||||
int cmd_memdump(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv)
|
||||
{
|
||||
FAR const char *arg = "used";
|
||||
char arg[CONFIG_NSH_LINELEN] = "";
|
||||
int i;
|
||||
|
||||
if (argc > 1)
|
||||
if (argc == 1)
|
||||
{
|
||||
arg = argv[1];
|
||||
strlcpy(arg, "used", CONFIG_NSH_LINELEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
strlcat(arg, argv[i], CONFIG_NSH_LINELEN);
|
||||
strlcat(arg, " ", CONFIG_NSH_LINELEN);
|
||||
}
|
||||
}
|
||||
|
||||
return nsh_writefile(vtbl, argv[0], arg, strlen(arg),
|
||||
|
Loading…
Reference in New Issue
Block a user