/* Machine independent support for Solaris /proc (process file system) for GDB.
- Copyright (C) 1999-2018 Free Software Foundation, Inc.
+ Copyright (C) 1999-2022 Free Software Foundation, Inc.
Written by Michael Snyder at Cygnus Solutions.
Based on work by Fred Fish, Stu Grossman, Geoff Noer, and others.
#include "gdbcmd.h"
#include "completer.h"
-#define _STRUCTURED_PROC 1
-
#include <sys/types.h>
#include <sys/procfs.h>
#include <sys/proc.h> /* for struct proc */
#include <sys/user.h> /* for struct user */
#include <fcntl.h> /* for O_RDWR etc. */
-#include "gdb_wait.h"
+#include "gdbsupport/gdb_wait.h"
#include "proc-utils.h"
const char *desc; /* Short description of value */
};
-static int procfs_trace = 0;
+static bool procfs_trace = false;
static FILE *procfs_file = NULL;
-static char *procfs_filename;
+static std::string procfs_filename = "procfs_trace";
static void
prepare_to_trace (void)
{
if (procfs_trace) /* if procfs tracing turned on */
if (procfs_file == NULL) /* if output file not yet open */
- procfs_file = fopen (procfs_filename, "a"); /* open output file */
+ procfs_file = fopen (procfs_filename.c_str (), "a"); /* open output file */
}
static void
"write (PCSSIG) ");
proc_prettyfprint_signal (procfs_file ? procfs_file : stdout,
arg[1] ? ((siginfo_t *) &arg[1])->si_signo
- : 0,
+ : 0,
0);
fprintf (procfs_file ? procfs_file : stdout, "\n");
break;
}
}
+void _initialize_proc_api ();
void
-_initialize_proc_api (void)
+_initialize_proc_api ()
{
- struct cmd_list_element *c;
-
add_setshow_boolean_cmd ("procfs-trace", no_class, &procfs_trace, _("\
Set tracing for /proc api calls."), _("\
Show tracing for /proc api calls."), NULL,
NULL, /* FIXME: i18n: */
&setlist, &showlist);
- procfs_filename = xstrdup ("procfs_trace");
add_setshow_filename_cmd ("procfs-file", no_class, &procfs_filename, _("\
Set filename for /proc tracefile."), _("\
Show filename for /proc tracefile."), NULL,