default sim-run.c and sim_engine_run

Mike Frysinger
Mon Feb 8 07:55:00 GMT 2010

it doesnt look like any current sim ports use the common sim-run.c code (and 
thus the default sim_engine_run implementation), so perhaps it has broken over 
time and no one noticed.  while porting the Blackfin sim port to common/ code, 
i tried using this function but it doesn't seem to work or make much sense.

sim_engine_run (SIM_DESC sd,
		int next_cpu_nr, /* ignore */
		int nr_cpus, /* ignore */
		int siggnal) /* ignore */
  sim_cia cia;
  sim_cpu *cpu;
  cpu = STATE_CPU (sd, 0);
  cia = CIA_GET (cpu);
  while (1)
      instruction_word insn = IMEM32 (cia);
      cia = idecode_issue (sd, insn, cia);
      /* process any events */
      if (sim_events_tick (sd))
	  CIA_SET (cpu, cia);
	  sim_events_process (sd);

if the idea here is to basically do:
	while (1) {
		<process current instruction>
		if (<check for pending events>) {
			<back up the PC>
			<process pending events>

how does this work ?  processing the current instruction (idecode_issue) 
modifies the current processor state and returns the old PC.  rolling back the  
PC doesnt roll back the processor state, so it makes it hard to do things like 
single step.  while many instructions are OK to repeat, obviously there are 
many that are not.  like an incrementing instruction.

so what am i missing here ?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <>

More information about the Gdb mailing list