/* Machine independent support for Solaris /proc (process file system) for GDB.
- Copyright (C) 1999-2018 Free Software Foundation, Inc.
+ Copyright (C) 1999-2019 Free Software Foundation, Inc.
Written by Michael Snyder at Cygnus Solutions.
Based on work by Fred Fish, Stu Grossman, Geoff Noer, and others.
#include "regcache.h"
#include "inf-child.h"
#include "nat/fork-inferior.h"
-#include "filestuff.h"
+#include "common/filestuff.h"
#define _STRUCTURED_PROC 1 /* Should be done by configure script. */
#include <sys/procfs.h>
#include <sys/fault.h>
#include <sys/syscall.h>
-#include "gdb_wait.h"
+#include "common/gdb_wait.h"
#include <signal.h>
#include <ctype.h>
#include "gdb_bfd.h"
#include "procfs.h"
#include "observable.h"
#include "common/scoped_fd.h"
+#include "common/pathstuff.h"
/* This module provides the interface between GDB and the
/proc file system, which is used on many versions of Unix
ULONGEST offset, ULONGEST len,
ULONGEST *xfered_len) override;
- void pass_signals (int, unsigned char *) override;
+ void pass_signals (gdb::array_view<const unsigned char>) override;
void files_info () override;
procfs_ctl_t cmd = PCWSTOP;
+ set_sigint_trap ();
+
win = (write (pi->ctl_fd, (char *) &cmd, sizeof (cmd)) == sizeof (cmd));
+
+ clear_sigint_trap ();
+
/* We been runnin' and we stopped -- need to update status. */
pi->status_valid = 0;
printf_filtered (_("Detaching from program: %s, %s\n"), exec_file,
target_pid_to_str (ptid_t (pid)));
- gdb_flush (gdb_stdout);
}
do_detach ();
/* Set up to trace signals in the child process. */
void
-procfs_target::pass_signals (int numsigs, unsigned char *pass_signals)
+procfs_target::pass_signals (gdb::array_view<const unsigned char> pass_signals)
{
sigset_t signals;
procinfo *pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
for (signo = 0; signo < NSIG; signo++)
{
int target_signo = gdb_signal_from_host (signo);
- if (target_signo < numsigs && pass_signals[target_signo])
+ if (target_signo < pass_signals.size () && pass_signals[target_signo])
prdelset (&signals, signo);
}
const std::string &allargs,
char **env, int from_tty)
{
- char *shell_file = getenv ("SHELL");
+ const char *shell_file = get_shell ();
char *tryname;
int pid;
- if (shell_file != NULL && strchr (shell_file, '/') == NULL)
+ if (strchr (shell_file, '/') == NULL)
{
/* We will be looking down the PATH to find shell_file. If we
{
ptid_t gdb_threadid = ptid_t (pi->pid, thread->tid, 0);
- if (!in_thread_list (gdb_threadid) || is_exited (gdb_threadid))
+ thread_info *thr = find_thread_ptid (gdb_threadid);
+ if (thr == NULL || thr->state == THREAD_EXITED)
add_thread (gdb_threadid);
return 0;