OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [gdb/] [remote-or1k.c] - Diff between revs 593 and 607

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 593 Rev 607
Line 164... Line 164...
int debug_regs_changed;
int debug_regs_changed;
 
 
/* Number of interrupts while waiting for process.  */
/* Number of interrupts while waiting for process.  */
static int interrupt_count = 0;
static int interrupt_count = 0;
 
 
 
/* Last value of step in resume function */
 
static int resume_stepped = 0;
 
 
/* Reason of last stop.  */
/* Reason of last stop.  */
static int hit_watchpoint = 0;
static int hit_watchpoint = 0;
static int hit_breakpoint = 0;
static int hit_breakpoint = 0;
static int step_link_insn = 0;
static int step_link_insn = 0;
static int new_pc_set = 0;
static int new_pc_set = 0;
Line 725... Line 728...
     int signo;
     int signo;
{
{
  /* If this doesn't work, try more severe steps. */
  /* If this doesn't work, try more severe steps. */
  signal (signo, or1k_interrupt_twice);
  signal (signo, or1k_interrupt_twice);
 
 
  if (remote_debug)
  /* If we are stepping we should stop the command, rather than stop
    fprintf_unfiltered (gdb_stdlog, "or1k_interrupt called\n");
     the processor */
 
  if (resume_stepped)
 
    quit_flag = 1;
 
 
  interrupt_count++;
  interrupt_count++;
 
 
 
  if (remote_debug)
 
    fprintf_unfiltered (gdb_stdlog, "or1k_interrupt called\n");
}
}
 
 
/* The user typed ^C twice.  */
/* The user typed ^C twice.  */
 
 
static void
static void
or1k_interrupt_twice (signo)
or1k_interrupt_twice (signo)
     int signo;
     int signo;
{
{
 
  /* Try everything */
  quit_flag = 1;
  quit_flag = 1;
  if (interrupt_count++ >= 2) {
 
    or1k_stop ();
    or1k_stop ();
    signal (signo, ofunc);
    signal (signo, ofunc);
    interrupt_query ();
    interrupt_query ();
    signal (signo, or1k_interrupt_twice);
    signal (signo, or1k_interrupt_twice);
    interrupt_count = 1;
 
  }
 
}
}
 
 
/* Resume execution of the target process.  STEP says whether to single-step
/* Resume execution of the target process.  STEP says whether to single-step
   or to run free; SIGGNAL is the signal value (e.g. SIGINT) to be given
   or to run free; SIGGNAL is the signal value (e.g. SIGINT) to be given
   to the target, or zero for no signal.  */
   to the target, or zero for no signal.  */
Line 763... Line 769...
  unsigned int npc;
  unsigned int npc;
  unsigned int val;
  unsigned int val;
  unsigned int ppc_insn;
  unsigned int ppc_insn;
  unsigned int pc_insn;
  unsigned int pc_insn;
 
 
  /* We must accumulate interrupt counts, when stepping.  This may cause some
  /* Save step value for wait function */
     unwanted questions, if step is interrupted several consequtive times,
  resume_stepped = step;
     but this should not be the issue with normal usage */
 
  if (step == 0)
 
    interrupt_count = 0;
 
 
 
  pc = read_pc();
  pc = read_pc();
  npc = or1k_read_spr_reg (PC_SPRNUM);
  npc = or1k_read_spr_reg (PC_SPRNUM);
  ppc = or1k_read_spr_reg (PPC_SPRNUM);
  ppc = or1k_read_spr_reg (PPC_SPRNUM);
  debug ("pc = %08x BP = %x npc = %08x ppc = %08x\n", pc, breakpoint_here_p (pc), npc, ppc);
  debug ("pc = %08x BP = %x npc = %08x ppc = %08x\n", pc, breakpoint_here_p (pc), npc, ppc);
Line 998... Line 1001...
    }
    }
 
 
  if (err)
  if (err)
    or1k_error ("Remote failure: %s", or1k_err_name (err));
    or1k_error ("Remote failure: %s", or1k_err_name (err));
 
 
 
  interrupt_count = 0;
 
 
  /* Set new signal handler */
  /* Set new signal handler */
  if (interrupt_count)
 
    ofunc = signal (SIGINT, or1k_interrupt_twice);
 
  else
 
    ofunc = signal (SIGINT, or1k_interrupt);
    ofunc = signal (SIGINT, or1k_interrupt);
 
 
  /* Wait for risc to stop.  */
  /* Wait for risc to stop.  */
  do {
  do {
    or1k_set_chain (SC_REGISTER);
    or1k_set_chain (SC_REGISTER);
Line 1018... Line 1020...
 
 
    usleep (10);
    usleep (10);
    debug ("%i", val);
    debug ("%i", val);
  } while ((val & 1) == 0);
  } while ((val & 1) == 0);
 
 
  //sleep(1);
  /* If we had an error, wait just a while, so user can press another ^C */
 
  if (quit_flag)
 
    sleep(1);
 
 
  drr = or1k_read_spr_reg (DRR_SPRNUM);
  drr = or1k_read_spr_reg (DRR_SPRNUM);
 
 
  /* Restore old INT signal handler */
  /* Restore old INT signal handler */
  signal (SIGINT, ofunc);
  signal (SIGINT, ofunc);
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.