From 2415d5400e083680af68a36728b9407fc7b6cf54 Mon Sep 17 00:00:00 2001 From: tracer-ysyx Date: Thu, 11 Jan 2024 20:18:53 +0800 Subject: [PATCH] =?UTF-8?q?>=20compile=20NEMU=20ysyx=5F22040000=20?= =?UTF-8?q?=E6=9D=8E=E5=BF=83=E6=9D=A8=20Linux=20calcite=206.1.69=20#1-Nix?= =?UTF-8?q?OS=20SMP=20PREEMPT=5FDYNAMIC=20Wed=20Dec=2020=2016:00:29=20UTC?= =?UTF-8?q?=202023=20x86=5F64=20GNU/Linux=20=2020:18:53=20=20up=203=20days?= =?UTF-8?q?=2019:19,=20=202=20users,=20=20load=20average:=200.34,=200.45,?= =?UTF-8?q?=200.52?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nemu/src/monitor/sdb/sdb.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/nemu/src/monitor/sdb/sdb.c b/nemu/src/monitor/sdb/sdb.c index a2d7dcd..1ac44f8 100644 --- a/nemu/src/monitor/sdb/sdb.c +++ b/nemu/src/monitor/sdb/sdb.c @@ -85,7 +85,7 @@ static int cmd_q(char *args) { * : execute step */ static int cmd_si(char *args) { - char *arg = strtok(args, " "); + char *arg = strtok(NULL, " "); if (arg == NULL) { cpu_exec(1); } else { @@ -138,10 +138,8 @@ static int cmd_help_print(char *args, struct CMDTable* cur_cmd_table) { int i; char *arg = strtok(NULL, " "); if (arg == NULL) { - // No more subcommand return -1; } else { - // Find sub-command for (i = 0; i < cur_cmd_table->nr_subcommand; i++) { if (strcmp(arg, cur_cmd_table[i].name) == 0) { printf("%s ", cur_cmd_table[i].name); @@ -164,14 +162,13 @@ static int cmd_help(char *args) { if (arg == NULL) { /* no argument given */ for (i = 0; i < NR_CMD; i++) { - printf("%s - %s\n", cmd_table[i].name, cmd_table[i].description); + printf("%s -- %s\n", cmd_table[i].name, cmd_table[i].description); } } else { for (i = 0; i < NR_CMD; i++) { if (strcmp(arg, cmd_table[i].name) == 0) { printf("%s ", cmd_table[i].name); if (cmd_help_print(args, cmd_table[i].subcommand) == -1) { - // Last avaliable command printf("-- %s\n", cmd_table[i].description); } return 0;