Skip to content

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

Open
@jbodwin

Description

@jbodwin

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;
			}
		}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions