Skip to content
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

Can't run after hitting breakpoint without turning breakpoint off #60

Open
jbodwin opened this issue Aug 6, 2019 · 0 comments
Open

Comments

@jbodwin
Copy link

jbodwin commented Aug 6, 2019

Once you hit a breakpoint a subsequent run command remains stuck at the breakpoint - unless you "break off". There is an easy fix for this: Move the breakpoint check in the run loop from the top of the loop to the bottom of the loop. This will still hit the initial breakpoint but will cause subsequent run command to execute at least one instruction - getting past the breakpoint. Here is the changed code from processor-runloop.h (at the bottom):

		/* step the processor */
		while (P::instret != inststop) {
			inst = P::mmu.inst_fetch(*this, P::pc, pc_offset);
			inst_cache_key = inst % inst_cache_size;
			if (inst_cache[inst_cache_key].inst == inst) {
				dec = inst_cache[inst_cache_key].dec;
			} else {
				P::inst_decode(dec, inst);
				inst_cache[inst_cache_key].inst = inst;
				inst_cache[inst_cache_key].dec = dec;
			}
			if ((new_offset = P::inst_exec(dec, pc_offset)) != typename P::ux(-1)  ||
				(new_offset = P::inst_priv(dec, pc_offset)) != typename P::ux(-1))
			{
				if (P::log) P::print_log(dec, inst);
				P::pc += new_offset;
				P::instret++;
			} else {
				P::raise(rv_cause_illegal_instruction, P::pc);
			}
			if (P::pc == P::breakpoint && P::breakpoint != 0) {
				return exit_cause_cli;
			}
		}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant