Ejemplo n.º 1
0
static void
fbsd_thread_attach (char *args, int from_tty)
{
  fbsd_thread_core = 0;

  child_ops.to_attach (args, from_tty);

  /* Must get symbols from solibs before libthread_db can run! */
  SOLIB_ADD ((char *) 0, from_tty, (struct target_ops *) 0, auto_solib_add);

  if (fbsd_thread_present && !fbsd_thread_active)
    push_target(&fbsd_thread_ops);
}
Ejemplo n.º 2
0
static void
sol_thread_attach (char *args, int from_tty)
{
  procfs_ops.to_attach (args, from_tty);

  /* Must get symbols from solibs before libthread_db can run! */
  SOLIB_ADD ((char *) 0, from_tty, (struct target_ops *) 0, auto_solib_add);

  if (sol_thread_active)
    {
      printf_filtered ("sol-thread active.\n");
      main_ph.ptid = inferior_ptid;		/* Save for xfer_memory */
      push_target (&sol_thread_ops);
      inferior_ptid = lwp_to_thread (inferior_ptid);
      if (PIDGET (inferior_ptid) == -1)
	inferior_ptid = main_ph.ptid;
      else
	add_thread (inferior_ptid);
    }
  /* XXX - might want to iterate over all the threads and register them. */
}
Ejemplo n.º 3
0
static void
haiku_init_debug_create_inferior(int pid)
{
	extern int stop_after_trap;

	// fix inferior_ptid -- fork_inferior() sets the process ID only
	inferior_ptid = ptid_build (pid, 0, pid);
		// team ID == team main thread ID under Haiku

	haiku_init_child_debugging(pid, false);

	// eat the initial `debugged' event caused by wait_for_inferior()
// TODO: Maybe we should just dequeue the event and continue the thread instead
// of using gdb's mechanism, since I don't know what undesired side-effects
// they may have.
	clear_proceed_status ();
	init_wait_for_inferior ();

	if (STARTUP_WITH_SHELL)
		inferior_ignoring_startup_exec_events = 2;
	else
		inferior_ignoring_startup_exec_events = 1;
	inferior_ignoring_leading_exec_events = 0;

	while (true) {
		thread_debug_info *thread;

		stop_soon = STOP_QUIETLY;
		wait_for_inferior();

		if (stop_signal == TARGET_SIGNAL_TRAP) {
			thread = haiku_find_thread(&sTeamDebugInfo, pid);

			if (thread && thread->stopped
				&& thread->last_event->message
					== B_DEBUGGER_MESSAGE_IMAGE_CREATED
				&& thread->last_event->data.image_created.info.type
					== B_APP_IMAGE
				&& thread->reprocess_event == 0
				&& inferior_ignoring_startup_exec_events <= 0) {
				// This is the trap for the last (second, if started via shell)
				// `load app image' event. Be done.
				break;
			}
		}

		resume(0, stop_signal);
	}
	stop_soon = NO_STOP_QUIETLY;

	// load shared library symbols
	target_terminal_ours_for_output ();
	SOLIB_ADD (NULL, 0, &current_target, auto_solib_add);
	target_terminal_inferior ();

//	startup_inferior (START_INFERIOR_TRAPS_EXPECTED);

//while (1) {
//	stop_after_trap = 1;
//	wait_for_inferior ();
//	if (debugThread && stop_signal != TARGET_SIGNAL_TRAP)
//		resume (0, stop_signal);
//	else
//		break;
//}
//stop_after_trap = 0;



//	while (1) {
//		thread_debug_info *thread;
//
//		stop_after_trap = 1;
//		wait_for_inferior ();
//// TODO: Catch deadly events, so that we won't block here.
//
//		thread = haiku_find_thread(&sTeamDebugInfo, pid);
//TRACE(("haiku_init_debug_create_inferior(): wait_for_inferior() returned: "
//"thread: %p (%ld)\n", thread, (thread ? thread->thread : -1)));
//		if (thread && thread->stopped
//			&& thread->last_event->message
//				== B_DEBUGGER_MESSAGE_IMAGE_CREATED
//			&& thread->last_event->data.image_created.info.type
//				== B_APP_IMAGE) {
//TRACE(("haiku_init_debug_create_inferior(): Got an `app image created' "
//"message\n"));
//			break;
//		}
//
//		resume (0, stop_signal);
//	}
}