> compile NEMU

ysyx_22040000 李心杨
Linux calcite 6.1.69 #1-NixOS SMP PREEMPT_DYNAMIC Wed Dec 20 16:00:29 UTC 2023 x86_64 GNU/Linux
 21:25:07  up  21:40,  2 users,  load average: 0.81, 0.77, 0.89
This commit is contained in:
tracer-ysyx 2024-01-12 21:25:07 +08:00 committed by xinyangli
parent 74fcff1ca7
commit 4c1ec5b003
4 changed files with 36 additions and 35 deletions

View file

@ -71,12 +71,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
extern int yylex(void);
void yyerror(const char *s) {
fprintf(stderr, "Error: %s\n", s);
}
#line 80 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
#line 81 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
# ifndef YY_CAST
# ifdef __cplusplus
@ -505,8 +506,8 @@ static const yytype_int8 yytranslate[] =
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_int8 yyrline[] =
{
0, 15, 15, 19, 20, 21, 25, 26, 27, 31,
32, 33, 34
0, 17, 17, 21, 22, 23, 27, 28, 29, 33,
34, 35, 36
};
#endif
@ -1074,73 +1075,73 @@ yyreduce:
switch (yyn)
{
case 2: /* input: expression */
#line 15 "src/monitor/sdb/addrexp.y"
#line 17 "src/monitor/sdb/addrexp.y"
{ printf("Final Result: %d\n", yyvsp[0]); }
#line 1080 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
#line 1081 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
break;
case 3: /* expression: term */
#line 19 "src/monitor/sdb/addrexp.y"
#line 21 "src/monitor/sdb/addrexp.y"
{ yyval = yyvsp[0]; }
#line 1086 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
#line 1087 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
break;
case 4: /* expression: expression '+' term */
#line 20 "src/monitor/sdb/addrexp.y"
#line 22 "src/monitor/sdb/addrexp.y"
{ yyval = yyvsp[-2] + yyvsp[0]; }
#line 1092 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
#line 1093 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
break;
case 5: /* expression: expression '-' term */
#line 21 "src/monitor/sdb/addrexp.y"
#line 23 "src/monitor/sdb/addrexp.y"
{ yyval = yyvsp[-2] - yyvsp[0]; }
#line 1098 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
#line 1099 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
break;
case 6: /* term: factor */
#line 25 "src/monitor/sdb/addrexp.y"
#line 27 "src/monitor/sdb/addrexp.y"
{ yyval = yyvsp[0]; }
#line 1104 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
#line 1105 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
break;
case 7: /* term: term '*' factor */
#line 26 "src/monitor/sdb/addrexp.y"
#line 28 "src/monitor/sdb/addrexp.y"
{ yyval = yyvsp[-2] * yyvsp[0]; }
#line 1110 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
#line 1111 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
break;
case 8: /* term: term '/' factor */
#line 27 "src/monitor/sdb/addrexp.y"
#line 29 "src/monitor/sdb/addrexp.y"
{ yyval = yyvsp[-2] / yyvsp[0]; }
#line 1116 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
#line 1117 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
break;
case 9: /* factor: NUMBER */
#line 31 "src/monitor/sdb/addrexp.y"
#line 33 "src/monitor/sdb/addrexp.y"
{ yyval = yyvsp[0]; }
#line 1122 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
#line 1123 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
break;
case 10: /* factor: HEX_NUMBER */
#line 32 "src/monitor/sdb/addrexp.y"
#line 34 "src/monitor/sdb/addrexp.y"
{ yyval = yyvsp[0]; }
#line 1128 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
#line 1129 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
break;
case 11: /* factor: '-' factor */
#line 33 "src/monitor/sdb/addrexp.y"
#line 35 "src/monitor/sdb/addrexp.y"
{ yyval = -yyvsp[0]; }
#line 1134 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
#line 1135 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
break;
case 12: /* factor: '(' expression ')' */
#line 34 "src/monitor/sdb/addrexp.y"
#line 36 "src/monitor/sdb/addrexp.y"
{ yyval = yyvsp[-1]; }
#line 1140 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
#line 1141 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
break;
#line 1144 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
#line 1145 "/home/xin/repo/ysyx-workbench/nemu/build/obj-riscv32-nemu-interpreter/src/monitor/sdb/addrexp.tag.c"
default: break;
}
@ -1333,5 +1334,5 @@ yyreturnlab:
return yyresult;
}
#line 37 "src/monitor/sdb/addrexp.y"
#line 39 "src/monitor/sdb/addrexp.y"

View file

@ -45,17 +45,17 @@ $(OBJ_DIR)/%.tag.c: %.y
@mkdir -p $(dir $@)
@$(YACC) $(YFLAGS) --header=$(<:.y=.h) -o $@ $<
$(OBJ_DIR)/%.yy.c: %.l $(OBJ_DIR)/%.tag.c
@echo + LEX $<
@mkdir -p $(dir $@)
@$(LEX) $(LFLAGS) -o $@ $<
$(OBJ_DIR)/%.tag.o: $(OBJ_DIR)/%.tag.c
@echo + CC $<
@mkdir -p $(dir $@)
@$(CC) $(CFLAGS) -c -o $@ $<
$(call call_fixdep, $(@:.o=.d), $@)
$(OBJ_DIR)/%.yy.c: %.l $(OBJ_DIR)/%.tag.c
@echo + LEX $<
@mkdir -p $(dir $@)
@$(LEX) $(LFLAGS) -o $@ $<
$(OBJ_DIR)/%.yy.o: $(OBJ_DIR)/%.yy.c
@echo + CC $<
@mkdir -p $(dir $@)

View file

@ -69,7 +69,7 @@ extern int yydebug;
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef int YYSTYPE;
typedef uint32_t YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
#endif

View file

@ -326,8 +326,8 @@ void sdb_mainloop() {
}
void init_sdb() {
/* Compile the regular expressions. */
init_regex();
// /* Compile the regular expressions. */
// init_regex();
/* Initialize the watchpoint pool. */
init_wp_pool();