mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
system/system: add config SYSTEM_SYSTEM_DUMPINFO
In some cases, applicationes use system() to excute the nsh command, but it's hard to find out who used the system function to execute the nsh command, so add this config to print the call backtrace and the command content. Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
This commit is contained in:
parent
3fef38c96d
commit
048f9d7720
2 changed files with 13 additions and 0 deletions
|
|
@ -41,4 +41,10 @@ config SYSTEM_SYSTEM_PRIORITY
|
|||
---help---
|
||||
The priority of the shell.
|
||||
|
||||
config SYSTEM_SYSTEM_DUMPINFO
|
||||
bool "dump the system information"
|
||||
default n
|
||||
---help---
|
||||
Dump the system information when the system() command is executed.
|
||||
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@
|
|||
#include <assert.h>
|
||||
#include <debug.h>
|
||||
#include <errno.h>
|
||||
#include <execinfo.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include "nshlib/nshlib.h"
|
||||
|
||||
|
|
@ -68,6 +70,11 @@ int system(FAR const char *cmd)
|
|||
int rc;
|
||||
int ret;
|
||||
|
||||
#ifdef CONFIG_SYSTEM_SYSTEM_DUMPINFO
|
||||
syslog(LOG_INFO, "SYSTEM cmd=%s\n", cmd);
|
||||
dump_stack();
|
||||
#endif
|
||||
|
||||
/* REVISIT: If cmd is NULL, then system() should return a non-zero value to
|
||||
* indicate if the command processor is available or zero if it is not.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue