Ejemplo n.º 1
0
/* General function to handle events in the inferior. So far it just
   takes care of detecting errors reported by select() or poll(),
   otherwise it assumes that all is OK, and goes on reading data from
   the fd. This however may not always be what we want to do. */
void
inferior_event_handler (enum inferior_event_type event_type, 
			gdb_client_data client_data)
{
  switch (event_type)
    {
    case INF_ERROR:
      printf_unfiltered ("error detected from target.\n");
      target_async (NULL, 0);
      pop_target ();
      discard_all_continuations ();
      do_exec_error_cleanups (ALL_CLEANUPS);
      break;

    case INF_REG_EVENT:
      /* Use catch errors for now, until the inner layers of
	 fetch_inferior_event (i.e. readchar) can return meaningful
	 error status.  If an error occurs while getting an event from
	 the target, just get rid of the target. */
      if (!catch_errors (fetch_inferior_event_wrapper, 
			 client_data, "", RETURN_MASK_ALL))
	{
	  target_async (NULL, 0);
	  pop_target ();
	  discard_all_continuations ();
	  do_exec_error_cleanups (ALL_CLEANUPS);
	  display_gdb_prompt (0);
	}
      break;

    case INF_EXEC_COMPLETE:
      /* Is there anything left to do for the command issued to
         complete? */
      do_all_continuations ();
      /* Reset things after target has stopped for the async commands. */
      complete_execution ();
      break;

    case INF_EXEC_CONTINUE:
      /* Is there anything left to do for the command issued to
         complete? */
      do_all_intermediate_continuations ();
      break;

    case INF_QUIT_REQ: 
      /* FIXME: ezannoni 1999-10-04. This call should really be a
	 target vector entry, so that it can be used for any kind of
	 targets. */
      async_remote_interrupt_twice (NULL);
      break;

    case INF_TIMER:
    default:
      printf_unfiltered ("Event type not recognized.\n");
      break;
    }
}
Ejemplo n.º 2
0
static void
gdbsim_detach (char *args, int from_tty)
{
  if (sr_get_debug ())
    printf_filtered ("gdbsim_detach: args \"%s\"\n", args);

  pop_target ();		/* calls gdbsim_close to do the real work */
  if (from_tty)
    printf_filtered ("Ending simulator %s debugging\n", target_shortname);
}
Ejemplo n.º 3
0
void
generic_remote_create_inferior (char *execfile, char *args, char **env,
				int from_tty)
{
  if (remote_debug)
    fprintf_unfiltered (gdb_stdlog, "generic_remote_create_inferior:\n");

  if (reopen_p ())
    {
      if (remote_debug)
	fprintf_unfiltered (gdb_stdlog, "  no need to reopen target\n");

      /* Reset stop_soon to print breakpoint information after
	 disabling it in start_remote().  */
      init_wait_for_inferior ();
      
      return;
    }

  if (remote_debug)
    fprintf_unfiltered (gdb_stdlog, "  reopening target %s with %s\n",
			last_to_shortname, last_args);

  /* We are already killed at this point so don't prompt the user
     again in target_preopen() if the target is still alive.  */
  if (last_to_shortname
      && strcmp (current_target.to_shortname, last_to_shortname) == 0)
    pop_target ();

  /* Don't print the frame where we stop after connecting only the one
     after continue.  */
  never_print_frame = 1;
  /* No need to reset nr_resumes here as this will call back to us as
     setup_generic_remote_run below.  */
  last_target_to_open (last_args, 0);
  never_print_frame = 0;

  /* Reset stop_soon to print breakpoint information after disabling
     it in start_remote().  */
  init_wait_for_inferior ();
}