You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2023/05/20 16:08:54 UTC
[nuttx-apps] branch master updated: support memdump can dump by seq number
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new e68d5ffb9 support memdump can dump by seq number
e68d5ffb9 is described below
commit e68d5ffb98a0d84410cce36e60d8f3c24e67605f
Author: anjiahao <an...@xiaomi.com>
AuthorDate: Tue May 9 12:06:05 2023 +0800
support memdump can dump by seq number
Signed-off-by: anjiahao <an...@xiaomi.com>
---
nshlib/nsh_command.c | 3 ++-
nshlib/nsh_mmcmds.c | 15 ++++++++++++---
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/nshlib/nsh_command.c b/nshlib/nsh_command.c
index a137f4d2b..930e7f8a0 100644
--- a/nshlib/nsh_command.c
+++ b/nshlib/nsh_command.c
@@ -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
diff --git a/nshlib/nsh_mmcmds.c b/nshlib/nsh_mmcmds.c
index 8f5953a99..0b25becb0 100644
--- a/nshlib/nsh_mmcmds.c
+++ b/nshlib/nsh_mmcmds.c
@@ -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),