diff --git a/nemu/src/monitor/sdb/addrexp.l b/nemu/src/monitor/sdb/addrexp.l index 124b8a3..274f3ce 100644 --- a/nemu/src/monitor/sdb/addrexp.l +++ b/nemu/src/monitor/sdb/addrexp.l @@ -11,7 +11,6 @@ 0[xX][0-9a-fA-F]+ { yylval = strtoul(yytext, NULL, 16); return HEX_NUMBER; } [0-9]+ { yylval = strtoul(yytext, NULL, 10); return NUMBER; } $[a-zA-Z]{2,3} { - puts(yytext); yylval = isa_reg_str2val(yytext + 1, &success); if(!success) { yyerror(NULL, "Failed to convert reg to value"); diff --git a/nemu/tests/expr_test.c b/nemu/tests/expr_test.c index 18f8435..8ffbc6a 100644 --- a/nemu/tests/expr_test.c +++ b/nemu/tests/expr_test.c @@ -175,6 +175,12 @@ START_TEST(test_expr_plain_register) { ck_assert(strcpy(buf + 1, regs[i])); gpr(i) = i; } + yy_scan_string(buf); + uint32_t value; + ck_assert(!yyparse(&value)); + yylex_destroy(); + + ck_assert(value == i); for (i = 1; i < 5; i++) { buf[i] = '\0'; }