From 7ccd5d8e83e63e9e483480d895f3c0a0348bde07 Mon Sep 17 00:00:00 2001 From: tracer-ysyx Date: Mon, 15 Jan 2024 16:27:37 +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.71=20#1-Nix?= =?UTF-8?q?OS=20SMP=20PREEMPT=5FDYNAMIC=20Fri=20Jan=20=205=2014:18:41=20UT?= =?UTF-8?q?C=202024=20x86=5F64=20GNU/Linux=20=2016:27:37=20=20up=202=20day?= =?UTF-8?q?s=20=205:22,=20=202=20users,=20=20load=20average:=200.21,=200.5?= =?UTF-8?q?9,=200.70?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nemu/src/monitor/sdb/addrexp.l | 1 + nemu/src/monitor/sdb/addrexp.y | 1 + nemu/src/monitor/sdb/sdb.h | 15 +++++++++++++++ nemu/src/monitor/sdb/watchpoint.c | 10 +++++++--- 4 files changed, 24 insertions(+), 3 deletions(-) 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 */