/* Machine independent support for QNX Neutrino /proc (process file system)
for GDB. Written by Colin Burgess at QNX Software Systems Limited.
- Copyright (C) 2003-2019 Free Software Foundation, Inc.
+ Copyright (C) 2003-2020 Free Software Foundation, Inc.
Contributed by QNX Software Systems Ltd.
prune_threads ();
- pid = inferior_ptid.pid ();
+ pid = current_inferior ()->pid;
status.tid = 1;
(e.g. thread exited). */
continue;
ptid = ptid_t (pid, 0, tid);
- new_thread = find_thread_ptid (ptid);
+ new_thread = find_thread_ptid (this, ptid);
if (!new_thread)
new_thread = add_thread (ptid);
update_thread_private_data (new_thread, tid, status.state, 0);
if (strcmp (map.info.path, printme.name))
continue;
- /* Lower debug_vaddr is always text, if nessessary, swap. */
+ /* Lower debug_vaddr is always text, if necessary, swap. */
if ((int) map.info.vaddr < (int) printme.text.debug_vaddr)
{
memcpy (&(printme.data), &(printme.text),
void
nto_procfs_target::attach (const char *args, int from_tty)
{
- char *exec_file;
int pid;
struct inferior *inf;
if (from_tty)
{
- exec_file = (char *) get_exec_file (0);
+ const char *exec_file = get_exec_file (0);
if (exec_file)
printf_unfiltered ("Attaching to program `%s', %s\n", exec_file,
printf_unfiltered ("Attaching to %s\n",
target_pid_to_str (ptid_t (pid)).c_str ());
}
- inferior_ptid = do_attach (ptid_t (pid));
+ ptid_t ptid = do_attach (ptid_t (pid));
inf = current_inferior ();
inferior_appeared (inf, pid);
inf->attach_flag = 1;
if (!target_is_pushed (ops))
push_target (ops);
- procfs_update_thread_list (ops);
+ update_thread_list ();
+
+ switch_to_thread (find_thread_ptid (this, ptid));
}
void
void
nto_procfs_target::detach (inferior *inf, int from_tty)
{
- int pid;
-
target_announce_detach ();
if (siggnal)
- SignalKill (nto_node (), inferior_ptid.pid (), 0, 0, 0, 0);
+ SignalKill (nto_node (), inf->pid, 0, 0, 0, 0);
close (ctl_fd);
ctl_fd = -1;
- pid = inferior_ptid.pid ();
- inferior_ptid = null_ptid;
- detach_inferior (pid);
+ switch_to_no_thread ();
+ detach_inferior (inf->pid);
init_thread_list ();
inf_child_maybe_unpush_target (ops);
}
SignalKill (nto_node (), inferior_ptid.pid (), 0, SIGKILL, 0, 0);
close (ctl_fd);
}
- inferior_ptid = null_ptid;
+ switch_to_no_thread ();
init_thread_list ();
inf_child_mourn_inferior (ops);
}
argv = xmalloc ((allargs.size () / (unsigned) 2 + 2) *
sizeof (*argv));
- argv[0] = get_exec_file (1);
+ argv[0] = const_cast<char *> (get_exec_file (1));
if (!argv[0])
{
if (exec_file)
if (fds[2] != STDERR_FILENO)
close (fds[2]);
- inferior_ptid = do_attach (ptid_t (pid));
- procfs_update_thread_list (ops);
+ ptid_t ptid = do_attach (ptid_t (pid));
+ update_thread_list ();
+ switch_to_thread (find_thread_ptid (this, ptid));
inf = current_inferior ();
inferior_appeared (inf, pid);
{
/* FIXME: expected warning? */
/* warning( "Failed to set Kill-on-Last-Close flag: errno = %d(%s)\n",
- errn, strerror(errn) ); */
+ errn, safe_strerror(errn) ); */
}
if (!target_is_pushed (ops))
push_target (ops);
#define OSTYPE_NTO 1
+void _initialize_procfs ();
void
-_initialize_procfs (void)
+_initialize_procfs ()
{
sigset_t set;