/* Ada Ravenscar thread support.
- Copyright 2004, 2009, 2010 Free Software Foundation, Inc.
+ Copyright 2004, 2009-2012 Free Software Foundation, Inc.
This file is part of GDB.
static const char running_thread_name[] = "__gnat_running_thread_table";
static const char known_tasks_name[] = "system__tasking__debug__known_tasks";
+static const char first_task_name[] = "system__tasking__debug__first_task";
-static const char ravenscar_runtime_initializer[] = "system__bb__threads__initialize";
+static const char ravenscar_runtime_initializer[] =
+ "system__bb__threads__initialize";
static struct observer *update_target_observer = NULL;
static void ravenscar_prepare_to_store (struct regcache *regcache);
static void ravenscar_initialize (char *name, int from_tty);
static void ravenscar_resume (struct target_ops *ops, ptid_t ptid, int step,
- enum target_signal siggnal);
+ enum gdb_signal siggnal);
static void ravenscar_mourn_inferior (struct target_ops *ops);
static void ravenscar_update_inferior_ptid (void);
static int has_ravenscar_runtime (void);
lookup_minimal_symbol (ravenscar_runtime_initializer, NULL, NULL);
struct minimal_symbol *msym_known_tasks =
lookup_minimal_symbol (known_tasks_name, NULL, NULL);
+ struct minimal_symbol *msym_first_task =
+ lookup_minimal_symbol (first_task_name, NULL, NULL);
struct minimal_symbol *msym_running_thread = get_running_thread_msymbol ();
return (msym_ravenscar_runtime_initializer
- && msym_known_tasks
+ && (msym_known_tasks || msym_first_task)
&& msym_running_thread);
}
char *buf;
CORE_ADDR object_addr;
struct type *builtin_type_void_data_ptr =
- builtin_type (target_gdbarch)->builtin_data_ptr;
+ builtin_type (target_gdbarch ())->builtin_data_ptr;
if (!object_msym)
return 0;
static void
ravenscar_resume (struct target_ops *ops, ptid_t ptid, int step,
- enum target_signal siggnal)
+ enum gdb_signal siggnal)
{
struct target_ops *beneath = find_target_beneath (ops);
inferior_ptid = base_ptid;
beneath->to_wait (beneath, base_ptid, status, 0);
- ravenscar_find_new_threads (ops);
- ravenscar_update_inferior_ptid ();
+ /* Find any new threads that might have been created, and update
+ inferior_ptid to the active thread.
+
+ Only do it if the program is still alive, though. Otherwise,
+ this causes problems when debugging through the remote protocol,
+ because we might try switching threads (and thus sending packets)
+ after the remote has disconnected. */
+ if (status->kind != TARGET_WAITKIND_EXITED
+ && status->kind != TARGET_WAITKIND_SIGNALLED)
+ {
+ ravenscar_find_new_threads (ops);
+ ravenscar_update_inferior_ptid ();
+ }
return inferior_ptid;
}
static void
ravenscar_find_new_threads (struct target_ops *ops)
{
- ada_build_task_list (0);
+ ada_build_task_list ();
/* Do not clear the thread list before adding the Ada task, to keep
the thread that the process stratum has included into it
architectures, just like in remote-wtx-hw.c. However, for now the
only Ravenscar run-time for bare board that is implemented in
GNAT is for only one architecture: erc32-elf. So no need to care about
- that for now...*/
+ that for now... */
current_arch_ops = ops;
}
Support for Ravenscar task/thread switching is disabled\n"));
}
+/* Provide a prototype to silence -Wmissing-prototypes. */
+extern void _initialize_ravenscar (void);
+
/* Module startup initialization function, automagically called by
init.c. */