From 575a9f605cf577036eea4d4f5ebf7a196aa129b5 Mon Sep 17 00:00:00 2001 From: liuwenxin Date: Mon, 25 Sep 2023 10:51:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=95=85=E9=9A=9C=E8=83=BD=E5=8A=9B?= =?UTF-8?q?=E6=B3=A8=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liuwenxin Change-Id: Ic1e1dd3ced9a9fb9d202a0d2d6c8270138b8593b --- shell/BUILD.gn | 3 +- shell/full/src/cmds/painc_shellcmd.c | 60 +++++++++++++++++++++++++ tools/build/mk/liteos_tables_ldflags.mk | 3 +- 3 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 shell/full/src/cmds/painc_shellcmd.c diff --git a/shell/BUILD.gn b/shell/BUILD.gn index 0eaa2922..45fad91a 100644 --- a/shell/BUILD.gn +++ b/shell/BUILD.gn @@ -43,11 +43,12 @@ kernel_module(module_name) { "full/src/cmds/hwi_shellcmd.c", "full/src/cmds/shell_shellcmd.c", "full/src/cmds/watch_shellcmd.c", + "full/src/cmds/painc_shellcmd.c" ] public_configs = [ ":public" ] } config("public") { - include_dirs = [ "full/include" ] + include_dirs = [ "full/include"] } diff --git a/shell/full/src/cmds/painc_shellcmd.c b/shell/full/src/cmds/painc_shellcmd.c new file mode 100644 index 00000000..2b870f9f --- /dev/null +++ b/shell/full/src/cmds/painc_shellcmd.c @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this list of + * conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright notice, this list + * of conditions and the following disclaimer in the documentation and/or other materials + * provided with the distribution. + * + * 3. Neither the name of the copyright holder nor the names of its contributors may be used + * to endorse or promote products derived from this software without specific prior written + * permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "shcmd.h" +#include "../../../../testsuites/unittest/process/lock/spinlock/it_spinlock_test.h" + +#define MAX_CMD_KEY_WIDTH 12 +#define CMD_ITEM_PER_LINE (DEFAULT_SCREEN_WIDTH / (MAX_CMD_KEY_WIDTH + 1)) + +/* Crash types. */ +struct crashtype +{ + void (*func)(void); +}; + +#define CRASHTYPE(_name) \ + { \ + .func = _name, \ + } + // /* Define the possible types of crashes that can be triggered. */ + static const struct crashtype crashtypes[] = { + CRASHTYPE(ItTestPthreadSpinlock001) + }; + +UINT32 OsShellCmdPainc(UINT32 argc, const CHAR **argv) +{ + const struct crashtype ct = crashtypes[0]; + ct.func(); + return 0; +} + +SHELLCMD_ENTRY(painc_shellcmd, CMD_TYPE_EX, "painc", 0, (CmdCallBackFunc)OsShellCmdPainc); \ No newline at end of file diff --git a/tools/build/mk/liteos_tables_ldflags.mk b/tools/build/mk/liteos_tables_ldflags.mk index eed3a4b9..de30e773 100644 --- a/tools/build/mk/liteos_tables_ldflags.mk +++ b/tools/build/mk/liteos_tables_ldflags.mk @@ -59,7 +59,8 @@ LITEOS_TABLES_KERNEL_LDFLAGS := \ -ukill_shellcmd \ -upmm_shellcmd \ -upanic_reset_shellcmd \ - -ushm_shellcmd + -ushm_shellcmd \ + -upainc_shellcmd ####Net command#### #api_shell.c -uarp_shellcmd -uifconfig_shellcmd -uping_shellcmd -utftp_shellcmd -unetstat_shellcmd -udns_shellcmd -untpdate_shellcmd -- Gitee