feature:the feature of saving system exception information to the
storage medium is separated from the shell module. Change-Id: Id56939001d70bb92d9cc02bd7c9f55ca8b61cf5b
This commit is contained in:
@@ -398,7 +398,7 @@ extern UINT32 __heap_end;
|
||||
#endif
|
||||
|
||||
/****************************** exception information configuration ******************************/
|
||||
#ifdef LOSCFG_SHELL_EXCINFO
|
||||
#ifdef LOSCFG_SAVE_EXCINFO
|
||||
/**
|
||||
* @ingroup los_config
|
||||
* the size of space for recording exception information
|
||||
|
||||
@@ -34,9 +34,11 @@
|
||||
#ifdef LOSCFG_FS_VFS
|
||||
#include "fs/fs.h"
|
||||
#endif
|
||||
#ifdef LOSCFG_SHELL
|
||||
#include "shcmd.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef LOSCFG_SHELL_EXCINFO
|
||||
#ifdef LOSCFG_SAVE_EXCINFO
|
||||
STATIC log_read_write_fn g_excInfoRW = NULL; /* the hook of read-writing exception information */
|
||||
STATIC CHAR *g_excInfoBuf = NULL; /* pointer to the buffer for storing the exception information */
|
||||
STATIC UINT32 g_excInfoIndex = 0xFFFFFFFF; /* the index of the buffer for storing the exception information */
|
||||
@@ -164,5 +166,32 @@ VOID OsRecordExcInfoTime(VOID)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef LOSCFG_SHELL
|
||||
INT32 OsShellCmdReadExcInfo(INT32 argc, CHAR **argv)
|
||||
{
|
||||
UINT32 recordSpace = GetRecordSpace();
|
||||
|
||||
(VOID)argc;
|
||||
(VOID)argv;
|
||||
|
||||
CHAR *buf = (CHAR*)LOS_MemAlloc((void *)OS_SYS_MEM_ADDR, recordSpace + 1);
|
||||
if (buf == NULL) {
|
||||
return LOS_NOK;
|
||||
}
|
||||
(void)memset_s(buf, recordSpace + 1, 0, recordSpace + 1);
|
||||
|
||||
log_read_write_fn hook = GetExcInfoRW();
|
||||
if (hook != NULL) {
|
||||
hook(GetRecordAddr(), recordSpace, 1, buf);
|
||||
}
|
||||
PRINTK("%s\n", buf);
|
||||
(VOID)LOS_MemFree((void *)OS_SYS_MEM_ADDR, buf);
|
||||
buf = NULL;
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
SHELLCMD_ENTRY(readExcInfo_shellcmd, CMD_TYPE_EX, "excInfo", 0, (CmdCallBackFunc)OsShellCmdReadExcInfo);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifdef LOSCFG_SHELL_EXCINFO
|
||||
#ifdef LOSCFG_SAVE_EXCINFO
|
||||
extern VOID SetExcInfoRW(log_read_write_fn func);
|
||||
extern log_read_write_fn GetExcInfoRW(VOID);
|
||||
extern VOID SetExcInfoBuf(CHAR *buf);
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
#ifdef LOSCFG_SHELL_DMESG
|
||||
#include "dmesg_pri.h"
|
||||
#endif
|
||||
#ifdef LOSCFG_SHELL_EXCINFO
|
||||
#ifdef LOSCFG_SAVE_EXCINFO
|
||||
#include "los_excinfo_pri.h"
|
||||
#endif
|
||||
#include "los_exc_pri.h"
|
||||
@@ -250,7 +250,7 @@ VOID PrintExcInfo(const CHAR *fmt, ...)
|
||||
va_start(ap, fmt);
|
||||
/* uart output without print-spinlock */
|
||||
OsVprintf(fmt, ap, EXC_OUTPUT);
|
||||
#ifdef LOSCFG_SHELL_EXCINFO
|
||||
#ifdef LOSCFG_SAVE_EXCINFO
|
||||
WriteExcBufVa(fmt, ap);
|
||||
#endif
|
||||
va_end(ap);
|
||||
|
||||
Reference in New Issue
Block a user