diff --git a/nemu/src/monitor/sdb/addrexp.l b/nemu/src/monitor/sdb/addrexp.l index 137d042..da00e36 100644 --- a/nemu/src/monitor/sdb/addrexp.l +++ b/nemu/src/monitor/sdb/addrexp.l @@ -5,6 +5,7 @@ %% +$[a-zA-Z] { } 0[xX][0-9a-fA-F]+ { yylval = strtoul(yytext, NULL, 16); return HEX_NUMBER; } [0-9]+ { yylval = strtoul(yytext, NULL, 10); return NUMBER; } [+\-*/()] { return *yytext; } diff --git a/nemu/src/monitor/sdb/addrexp.y b/nemu/src/monitor/sdb/addrexp.y index 9e296ba..1d72129 100644 --- a/nemu/src/monitor/sdb/addrexp.y +++ b/nemu/src/monitor/sdb/addrexp.y @@ -14,6 +14,7 @@ %} %token NUMBER HEX_NUMBER +%token REGISTER %start input %define api.value.type { word_t } %parse-param { uint32_t *result } diff --git a/nemu/src/monitor/sdb/sdb.h b/nemu/src/monitor/sdb/sdb.h index e94846c..c6fa9a2 100644 --- a/nemu/src/monitor/sdb/sdb.h +++ b/nemu/src/monitor/sdb/sdb.h @@ -18,4 +18,19 @@ #include +enum ExprType { + EXPR_TYPE_MEM_ADDR, + EXPR_TYPE_REG +}; + +union ExprValue { + word_t addr; + word_t *reg; +}; + +typedef struct ExprResult { + union ExprValue val; + enum ExprType type; +} ExprResult; + #endif diff --git a/nemu/src/monitor/sdb/watchpoint.c b/nemu/src/monitor/sdb/watchpoint.c index fcbe7ef..d6440d3 100644 --- a/nemu/src/monitor/sdb/watchpoint.c +++ b/nemu/src/monitor/sdb/watchpoint.c @@ -97,8 +97,12 @@ int wp_remove_by_number(int number) { return 0; } -// int wp_eval_all(char *) { - -// } +int wp_eval_all() { + WP *wp; + for (wp = head; wp != NULL; wp = wp->next) { + + } + return 0; +} /* TODO: Implement the functionality of watchpoint */