#include "gdbcore.h"
#include "linux-nat.h"
+#include <signal.h>
+
#ifdef HAVE_GNU_LIBC_VERSION_H
#include <gnu/libc-version.h>
#endif
if (!target_has_execution)
return;
+ /* Don't attempt to use thread_db for remote targets. */
+ if (!target_can_run (¤t_target))
+ return;
+
/* Initialize the structure that identifies the child process. */
proc_handle.pid = GET_PID (inferior_ptid);
post-processing and bail out early. */
return ptid;
- if (ourstatus->kind == TARGET_WAITKIND_EXITED)
+ if (ourstatus->kind == TARGET_WAITKIND_EXITED
+ || ourstatus->kind == TARGET_WAITKIND_SIGNALLED)
return pid_to_ptid (-1);
+ if (ourstatus->kind == TARGET_WAITKIND_EXECD)
+ {
+ remove_thread_event_breakpoints ();
+ unpush_target (&thread_db_ops);
+ using_thread_db = 0;
+
+ return pid_to_ptid (GET_PID (ptid));
+ }
+
if (ourstatus->kind == TARGET_WAITKIND_STOPPED
&& ourstatus->value.sig == TARGET_SIGNAL_TRAP)
/* Check for a thread event. */
thread_db_map_id2thr (thread_info, 1);
/* Finally, get the address of the variable. */
- err = td_thr_tls_get_addr_p (&thread_info->private->th, (void *) lm,
+ err = td_thr_tls_get_addr_p (&thread_info->private->th,
+ (void *)(size_t) lm,
offset, &address);
#ifdef THREAD_DB_HAS_TD_NOTALLOC