Skip to content

Fixed an issue where breakpoints could only be triggered on some PCs. #355

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ override ARGS ?= --log=$(BUILD_DIR)/nemu-log.txt
override ARGS += $(ARGS_DIFF)

# Command to execute NEMU
IMG ?=
IMG_DIR = $(NEMU_HOME)/ready-to-run
img ?= microbench
IMG ?= $(IMG_DIR)/$(img).bin
NEMU_EXEC := $(BINARY) $(ARGS) $(IMG)

run-env: $(BINARY) $(DIFF_REF_SO)
Expand All @@ -166,6 +168,12 @@ run: run-env
$(call git_commit, "run")
$(NEMU_EXEC)

batch:
./build/riscv64-nemu-interpreter -b $(IMG)

step:
./build/riscv64-nemu-interpreter $(IMG)

gdb: run-env
$(call git_commit, "gdb")
gdb -s $(BINARY) --args $(NEMU_EXEC)
Expand Down
4 changes: 4 additions & 0 deletions src/cpu/cpu-exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ static int execute(int n) {
__attribute__((unused)) Decode *this_s = NULL;
__attribute__((unused)) bool br_taken = false;
__attribute__((unused)) bool is_ctrl = false;

while (true) {
#if defined(CONFIG_DEBUG) || defined(CONFIG_DIFFTEST) || defined(CONFIG_IQUEUE)
this_s = s;
Expand Down Expand Up @@ -343,7 +344,9 @@ static int execute(int n) {
Logti("prev pc = 0x%lx, pc = 0x%lx", prev_s->pc, s->pc);

save_globals(s);
cpu.pc = s->pc;
debug_difftest(this_s, s);
if (nemu_state.state == NEMU_STOP) break;
}

end_of_loop:
Expand Down Expand Up @@ -590,6 +593,7 @@ static void update_global() {
}
#endif


/* Simulate how the CPU works. */
void cpu_exec(uint64_t n) {
#ifndef CONFIG_LIGHTQS
Expand Down