From 9674f3b0c23080a2dc58efff459d34de39eedee6 Mon Sep 17 00:00:00 2001 From: tracer-ysyx Date: Thu, 11 Jan 2024 22:25:29 +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=2022:25:29=20=20up=203=20days?= =?UTF-8?q?=2021:26,=20=202=20users,=20=20load=20average:=201.44,=201.34,?= =?UTF-8?q?=200.97?= 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, 6 insertions(+), 1 deletion(-) diff --git a/nemu/src/monitor/sdb/sdb.c b/nemu/src/monitor/sdb/sdb.c index b0a6bc5..3c08795 100644 --- a/nemu/src/monitor/sdb/sdb.c +++ b/nemu/src/monitor/sdb/sdb.c @@ -52,7 +52,7 @@ static struct CMDTable { NULL, 0}, {"c", "Continue the execution of the program", cmd_c, NULL, 0}, {"q", "Exit NEMU", cmd_q, NULL, 0}, - {"x", "Examine content of physical memory address", cmd_x, NULL, 0}, + {"x", "Examine content of physical memory address", cmd_x, NULL, 0}, {"si", "Execute next [n] program line", cmd_si, NULL, 0}, {"info", "Print information of registers or watchpoints", cmd_info, cmd_info_table, ARRLEN(cmd_info_table)}, @@ -88,6 +88,11 @@ static char *rl_gets() { * uint. */ static word_t parse_uint(const char *arg, bool *success) { + if (arg == NULL) { + puts("Invalid uint argument."); + *success = false; + return 0; + } int base = 10; int token_length = strnlen(arg, 34); if (token_length > 2) {