2000-05-05 Michael Snyder <msnyder@seadog.cygnus.com>
* procfs.c: Cleanup of procfs tracing. Move defines and prototypes to proc-utils.h * proc-utils.h: Define tracing macros. Declare trace functions. * proc-api.c: Make procfs tracing a runtime option. (prepare_to_trace): New function, abstracted out of several places. Open a trace file if one is required. (ioctl_with_trace, write_with_trace, open_with_trace, close_with_trace, wait_with_trace, lseek_with_trace): Report errno if an error occurs in a system call. (write_with_trace): Make 2nd arg void *, to agree with write.
This commit is contained in:
parent
b8d39351ea
commit
103b3ef54f
@ -1,3 +1,16 @@
|
|||||||
|
2000-05-05 Michael Snyder <msnyder@seadog.cygnus.com>
|
||||||
|
|
||||||
|
* procfs.c: Cleanup of procfs tracing. Move defines and
|
||||||
|
prototypes to proc-utils.h
|
||||||
|
* proc-utils.h: Define tracing macros. Declare trace functions.
|
||||||
|
* proc-api.c: Make procfs tracing a runtime option.
|
||||||
|
(prepare_to_trace): New function, abstracted out of several
|
||||||
|
places. Open a trace file if one is required.
|
||||||
|
(ioctl_with_trace, write_with_trace, open_with_trace,
|
||||||
|
close_with_trace, wait_with_trace, lseek_with_trace):
|
||||||
|
Report errno if an error occurs in a system call.
|
||||||
|
(write_with_trace): Make 2nd arg void *, to agree with write.
|
||||||
|
|
||||||
2000-05-05 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
|
2000-05-05 Elena Zannoni <ezannoni@kwikemart.cygnus.com>
|
||||||
|
|
||||||
* elfread.c (elf_symtab_read): The calculation of 'offset'
|
* elfread.c (elf_symtab_read): The calculation of 'offset'
|
||||||
|
152
gdb/proc-api.c
152
gdb/proc-api.c
@ -53,11 +53,19 @@ struct trans {
|
|||||||
char *desc; /* Short description of value */
|
char *desc; /* Short description of value */
|
||||||
};
|
};
|
||||||
|
|
||||||
static int procfs_trace = 1;
|
static int procfs_trace = 0;
|
||||||
/*static int info_verbose = 1;*/ /* kludge */
|
|
||||||
static FILE *procfs_file = NULL;
|
static FILE *procfs_file = NULL;
|
||||||
static char *procfs_filename = "procfs_trace";
|
static char *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 */
|
||||||
|
if (procfs_filename != NULL) /* if output filename known */
|
||||||
|
procfs_file = fopen (procfs_filename, "a"); /* open output file */
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_procfs_trace_cmd (args, from_tty, c)
|
set_procfs_trace_cmd (args, from_tty, c)
|
||||||
char *args;
|
char *args;
|
||||||
@ -218,11 +226,10 @@ ioctl_with_trace (fd, opcode, ptr, file, line)
|
|||||||
{
|
{
|
||||||
int i, ret, arg1;
|
int i, ret, arg1;
|
||||||
|
|
||||||
|
prepare_to_trace ();
|
||||||
|
|
||||||
if (procfs_trace)
|
if (procfs_trace)
|
||||||
{
|
{
|
||||||
if (procfs_file == NULL && procfs_filename != NULL)
|
|
||||||
procfs_file = fopen (procfs_filename, "a");
|
|
||||||
|
|
||||||
for (i = 0; ioctl_table[i].name != NULL; i++)
|
for (i = 0; ioctl_table[i].name != NULL; i++)
|
||||||
if (ioctl_table[i].value == opcode)
|
if (ioctl_table[i].value == opcode)
|
||||||
break;
|
break;
|
||||||
@ -364,13 +371,15 @@ ioctl_with_trace (fd, opcode, ptr, file, line)
|
|||||||
if (procfs_file)
|
if (procfs_file)
|
||||||
fflush (procfs_file);
|
fflush (procfs_file);
|
||||||
}
|
}
|
||||||
|
errno = 0;
|
||||||
ret = ioctl (fd, opcode, ptr);
|
ret = ioctl (fd, opcode, ptr);
|
||||||
if (procfs_trace && ret < 0)
|
if (procfs_trace && ret < 0)
|
||||||
{
|
{
|
||||||
fprintf (procfs_file ? procfs_file : stdout,
|
fprintf (procfs_file ? procfs_file : stdout,
|
||||||
"[ioctl (%s) FAILED!]\n",
|
"[ioctl (%s) FAILED! (%s)]\n",
|
||||||
ioctl_table[i].name != NULL ?
|
ioctl_table[i].name != NULL ?
|
||||||
ioctl_table[i].name : "<unknown>");
|
ioctl_table[i].name : "<unknown>",
|
||||||
|
safe_strerror (errno));
|
||||||
if (procfs_file)
|
if (procfs_file)
|
||||||
fflush (procfs_file);
|
fflush (procfs_file);
|
||||||
}
|
}
|
||||||
@ -438,22 +447,21 @@ static struct trans rw_table[] = {
|
|||||||
static off_t lseek_offset;
|
static off_t lseek_offset;
|
||||||
|
|
||||||
int
|
int
|
||||||
write_with_trace (fd, arg, len, file, line)
|
write_with_trace (fd, varg, len, file, line)
|
||||||
int fd;
|
int fd;
|
||||||
long *arg;
|
void *varg;
|
||||||
size_t len;
|
size_t len;
|
||||||
char *file;
|
char *file;
|
||||||
int line;
|
int line;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int ret;
|
int ret;
|
||||||
long opcode = arg[0];
|
long *arg = (long *) varg;
|
||||||
|
|
||||||
|
prepare_to_trace ();
|
||||||
if (procfs_trace)
|
if (procfs_trace)
|
||||||
{
|
{
|
||||||
if (procfs_file == NULL && procfs_filename != NULL)
|
long opcode = arg[0];
|
||||||
procfs_file = fopen (procfs_filename, "a");
|
|
||||||
|
|
||||||
for (i = 0; rw_table[i].name != NULL; i++)
|
for (i = 0; rw_table[i].name != NULL; i++)
|
||||||
if (rw_table[i].value == opcode)
|
if (rw_table[i].value == opcode)
|
||||||
break;
|
break;
|
||||||
@ -582,13 +590,15 @@ write_with_trace (fd, arg, len, file, line)
|
|||||||
if (procfs_file)
|
if (procfs_file)
|
||||||
fflush (procfs_file);
|
fflush (procfs_file);
|
||||||
}
|
}
|
||||||
|
errno = 0;
|
||||||
ret = write (fd, (void *) arg, len);
|
ret = write (fd, (void *) arg, len);
|
||||||
if (procfs_trace && ret != len)
|
if (procfs_trace && ret != len)
|
||||||
{
|
{
|
||||||
fprintf (procfs_file ? procfs_file : stdout,
|
fprintf (procfs_file ? procfs_file : stdout,
|
||||||
"[write (%s) FAILED!\n",
|
"[write (%s) FAILED! (%s)]\n",
|
||||||
rw_table[i].name != NULL ?
|
rw_table[i].name != NULL ?
|
||||||
rw_table[i].name : "<unknown>");
|
rw_table[i].name : "<unknown>",
|
||||||
|
safe_strerror (errno));
|
||||||
if (procfs_file)
|
if (procfs_file)
|
||||||
fflush (procfs_file);
|
fflush (procfs_file);
|
||||||
}
|
}
|
||||||
@ -607,34 +617,15 @@ lseek_with_trace (fd, offset, whence, file, line)
|
|||||||
{
|
{
|
||||||
off_t ret;
|
off_t ret;
|
||||||
|
|
||||||
#if 0 /* don't need output, just need address */
|
prepare_to_trace ();
|
||||||
if (procfs_trace)
|
errno = 0;
|
||||||
{
|
|
||||||
if (procfs_file == NULL && procfs_filename != NULL)
|
|
||||||
procfs_file = fopen (procfs_filename, "a");
|
|
||||||
|
|
||||||
if (info_verbose)
|
|
||||||
fprintf (procfs_file ? procfs_file : stdout,
|
|
||||||
"%s:%d -- ", file, line);
|
|
||||||
fprintf (procfs_file ? procfs_file : stdout,
|
|
||||||
"lseek (0x%08x, %s) \n", offset,
|
|
||||||
whence == SEEK_SET ? "SEEK_SET" :
|
|
||||||
whence == SEEK_CUR ? "SEEK_CUR" :
|
|
||||||
whence == SEEK_END ? "SEEK_END" :
|
|
||||||
"<unknown whence>");
|
|
||||||
if (procfs_file)
|
|
||||||
fflush (procfs_file);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
ret = lseek (fd, offset, whence);
|
ret = lseek (fd, offset, whence);
|
||||||
lseek_offset = ret;
|
lseek_offset = ret;
|
||||||
if (procfs_trace && ret == -1)
|
if (procfs_trace && (ret == -1 || errno != 0))
|
||||||
{
|
{
|
||||||
if (procfs_file == NULL && procfs_filename != NULL)
|
|
||||||
procfs_file = fopen (procfs_filename, "a");
|
|
||||||
|
|
||||||
fprintf (procfs_file ? procfs_file : stdout,
|
fprintf (procfs_file ? procfs_file : stdout,
|
||||||
"[lseek (0x%08lx) FAILED!\n", (unsigned long) offset);
|
"[lseek (0x%08lx) FAILED! (%s)]\n",
|
||||||
|
(unsigned long) offset, safe_strerror (errno));
|
||||||
if (procfs_file)
|
if (procfs_file)
|
||||||
fflush (procfs_file);
|
fflush (procfs_file);
|
||||||
}
|
}
|
||||||
@ -651,24 +642,37 @@ open_with_trace (filename, mode, file, line)
|
|||||||
char *file;
|
char *file;
|
||||||
int line;
|
int line;
|
||||||
{
|
{
|
||||||
int ret = open (filename, mode);
|
int ret;
|
||||||
|
|
||||||
|
prepare_to_trace ();
|
||||||
|
errno = 0;
|
||||||
|
ret = open (filename, mode);
|
||||||
if (procfs_trace)
|
if (procfs_trace)
|
||||||
{
|
{
|
||||||
if (procfs_file == NULL && procfs_filename != NULL)
|
|
||||||
procfs_file = fopen (procfs_filename, "a");
|
|
||||||
|
|
||||||
if (info_verbose)
|
if (info_verbose)
|
||||||
fprintf (procfs_file ? procfs_file : stdout,
|
fprintf (procfs_file ? procfs_file : stdout,
|
||||||
"%s:%d -- ", file, line);
|
"%s:%d -- ", file, line);
|
||||||
fprintf (procfs_file ? procfs_file : stdout,
|
|
||||||
"%d = open (%s, ", ret, filename);
|
if (errno)
|
||||||
if (mode == O_RDONLY)
|
{
|
||||||
fprintf (procfs_file ? procfs_file : stdout, "O_RDONLY) %d\n", line);
|
fprintf (procfs_file ? procfs_file : stdout,
|
||||||
else if (mode == O_WRONLY)
|
"[open FAILED! (%s) line %d]\\n",
|
||||||
fprintf (procfs_file ? procfs_file : stdout, "O_WRONLY) %d\n", line);
|
safe_strerror (errno), line);
|
||||||
else if (mode == O_RDWR)
|
}
|
||||||
fprintf (procfs_file ? procfs_file : stdout, "O_RDWR) %d\n", line);
|
else
|
||||||
|
{
|
||||||
|
fprintf (procfs_file ? procfs_file : stdout,
|
||||||
|
"%d = open (%s, ", ret, filename);
|
||||||
|
if (mode == O_RDONLY)
|
||||||
|
fprintf (procfs_file ? procfs_file : stdout, "O_RDONLY) %d\n",
|
||||||
|
line);
|
||||||
|
else if (mode == O_WRONLY)
|
||||||
|
fprintf (procfs_file ? procfs_file : stdout, "O_WRONLY) %d\n",
|
||||||
|
line);
|
||||||
|
else if (mode == O_RDWR)
|
||||||
|
fprintf (procfs_file ? procfs_file : stdout, "O_RDWR) %d\n",
|
||||||
|
line);
|
||||||
|
}
|
||||||
if (procfs_file)
|
if (procfs_file)
|
||||||
fflush (procfs_file);
|
fflush (procfs_file);
|
||||||
}
|
}
|
||||||
@ -682,18 +686,22 @@ close_with_trace (fd, file, line)
|
|||||||
char *file;
|
char *file;
|
||||||
int line;
|
int line;
|
||||||
{
|
{
|
||||||
int ret = close (fd);
|
int ret;
|
||||||
|
|
||||||
|
prepare_to_trace ();
|
||||||
|
errno = 0;
|
||||||
|
ret = close (fd);
|
||||||
if (procfs_trace)
|
if (procfs_trace)
|
||||||
{
|
{
|
||||||
if (procfs_file == NULL && procfs_filename != NULL)
|
|
||||||
procfs_file = fopen (procfs_filename, "a");
|
|
||||||
|
|
||||||
if (info_verbose)
|
if (info_verbose)
|
||||||
fprintf (procfs_file ? procfs_file : stdout,
|
fprintf (procfs_file ? procfs_file : stdout,
|
||||||
"%s:%d -- ", file, line);
|
"%s:%d -- ", file, line);
|
||||||
fprintf (procfs_file ? procfs_file : stdout,
|
if (errno)
|
||||||
"%d = close (%d)\n", ret, fd);
|
fprintf (procfs_file ? procfs_file : stdout,
|
||||||
|
"[close FAILED! (%s)]\n", safe_strerror (errno));
|
||||||
|
else
|
||||||
|
fprintf (procfs_file ? procfs_file : stdout,
|
||||||
|
"%d = close (%d)\n", ret, fd);
|
||||||
if (procfs_file)
|
if (procfs_file)
|
||||||
fflush (procfs_file);
|
fflush (procfs_file);
|
||||||
}
|
}
|
||||||
@ -701,7 +709,7 @@ close_with_trace (fd, file, line)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
pid_t
|
||||||
wait_with_trace (wstat, file, line)
|
wait_with_trace (wstat, file, line)
|
||||||
int *wstat;
|
int *wstat;
|
||||||
char *file;
|
char *file;
|
||||||
@ -709,11 +717,9 @@ wait_with_trace (wstat, file, line)
|
|||||||
{
|
{
|
||||||
int ret, lstat = 0;
|
int ret, lstat = 0;
|
||||||
|
|
||||||
|
prepare_to_trace ();
|
||||||
if (procfs_trace)
|
if (procfs_trace)
|
||||||
{
|
{
|
||||||
if (procfs_file == NULL && procfs_filename != NULL)
|
|
||||||
procfs_file = fopen (procfs_filename, "a");
|
|
||||||
|
|
||||||
if (info_verbose)
|
if (info_verbose)
|
||||||
fprintf (procfs_file ? procfs_file : stdout,
|
fprintf (procfs_file ? procfs_file : stdout,
|
||||||
"%s:%d -- ", file, line);
|
"%s:%d -- ", file, line);
|
||||||
@ -722,11 +728,16 @@ wait_with_trace (wstat, file, line)
|
|||||||
if (procfs_file)
|
if (procfs_file)
|
||||||
fflush (procfs_file);
|
fflush (procfs_file);
|
||||||
}
|
}
|
||||||
|
errno = 0;
|
||||||
ret = wait (&lstat);
|
ret = wait (&lstat);
|
||||||
if (procfs_trace)
|
if (procfs_trace)
|
||||||
{
|
{
|
||||||
fprintf (procfs_file ? procfs_file : stdout,
|
if (errno)
|
||||||
"returned pid %d, status 0x%x\n", ret, lstat);
|
fprintf (procfs_file ? procfs_file : stdout,
|
||||||
|
"[wait FAILED! (%s)]\n", safe_strerror (errno));
|
||||||
|
else
|
||||||
|
fprintf (procfs_file ? procfs_file : stdout,
|
||||||
|
"returned pid %d, status 0x%x\n", ret, lstat);
|
||||||
if (procfs_file)
|
if (procfs_file)
|
||||||
fflush (procfs_file);
|
fflush (procfs_file);
|
||||||
}
|
}
|
||||||
@ -742,11 +753,9 @@ procfs_note (msg, file, line)
|
|||||||
char *file;
|
char *file;
|
||||||
int line;
|
int line;
|
||||||
{
|
{
|
||||||
|
prepare_to_trace ();
|
||||||
if (procfs_trace)
|
if (procfs_trace)
|
||||||
{
|
{
|
||||||
if (procfs_file == NULL && procfs_filename != NULL)
|
|
||||||
procfs_file = fopen (procfs_filename, "a");
|
|
||||||
|
|
||||||
if (info_verbose)
|
if (info_verbose)
|
||||||
fprintf (procfs_file ? procfs_file : stdout,
|
fprintf (procfs_file ? procfs_file : stdout,
|
||||||
"%s:%d -- ", file, line);
|
"%s:%d -- ", file, line);
|
||||||
@ -763,11 +772,9 @@ proc_prettyfprint_status (flags, why, what, thread)
|
|||||||
int what;
|
int what;
|
||||||
int thread;
|
int thread;
|
||||||
{
|
{
|
||||||
|
prepare_to_trace ();
|
||||||
if (procfs_trace)
|
if (procfs_trace)
|
||||||
{
|
{
|
||||||
if (procfs_file == NULL && procfs_filename != NULL)
|
|
||||||
procfs_file = fopen (procfs_filename, "a");
|
|
||||||
|
|
||||||
if (thread)
|
if (thread)
|
||||||
fprintf (procfs_file ? procfs_file : stdout,
|
fprintf (procfs_file ? procfs_file : stdout,
|
||||||
"Thread %d: ", thread);
|
"Thread %d: ", thread);
|
||||||
@ -791,7 +798,7 @@ _initialize_proc_api ()
|
|||||||
|
|
||||||
c = add_set_cmd ("procfs-trace", no_class,
|
c = add_set_cmd ("procfs-trace", no_class,
|
||||||
var_boolean, (char *) &procfs_trace,
|
var_boolean, (char *) &procfs_trace,
|
||||||
"Set tracing for /proc ioctl calls.\n", &setlist);
|
"Set tracing for /proc api calls.\n", &setlist);
|
||||||
|
|
||||||
add_show_from_set (c, &showlist);
|
add_show_from_set (c, &showlist);
|
||||||
c->function.sfunc = set_procfs_trace_cmd;
|
c->function.sfunc = set_procfs_trace_cmd;
|
||||||
@ -802,9 +809,4 @@ _initialize_proc_api ()
|
|||||||
|
|
||||||
add_show_from_set (c, &showlist);
|
add_show_from_set (c, &showlist);
|
||||||
c->function.sfunc = set_procfs_file_cmd;
|
c->function.sfunc = set_procfs_file_cmd;
|
||||||
|
|
||||||
#ifdef TRACE_PROCFS
|
|
||||||
if (procfs_file == NULL && procfs_filename != NULL)
|
|
||||||
procfs_file = fopen (procfs_filename, "a");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
@ -18,12 +18,18 @@ along with this program; if not, write to the Free Software Foundation,
|
|||||||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Pretty-print functions for /proc data
|
||||||
|
*/
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
proc_prettyprint_why (unsigned long why, unsigned long what, int verbose);
|
proc_prettyprint_why (unsigned long why, unsigned long what, int verbose);
|
||||||
|
|
||||||
extern void proc_prettyprint_syscalls (sysset_t *sysset, int verbose);
|
extern void
|
||||||
|
proc_prettyprint_syscalls (sysset_t *sysset, int verbose);
|
||||||
|
|
||||||
extern void proc_prettyprint_syscall (int num, int verbose);
|
extern void
|
||||||
|
proc_prettyprint_syscall (int num, int verbose);
|
||||||
|
|
||||||
extern void proc_prettyprint_flags (unsigned long flags, int verbose);
|
extern void proc_prettyprint_flags (unsigned long flags, int verbose);
|
||||||
|
|
||||||
@ -43,10 +49,46 @@ extern void
|
|||||||
proc_prettyfprint_flags (FILE *file, unsigned long flags, int verbose);
|
proc_prettyfprint_flags (FILE *file, unsigned long flags, int verbose);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
proc_prettyfprint_why (FILE *file, unsigned long why, unsigned long what, int verbose);
|
proc_prettyfprint_why (FILE *file, unsigned long why,
|
||||||
|
unsigned long what, int verbose);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
proc_prettyfprint_fault (FILE *file, int faultno, int verbose);
|
proc_prettyfprint_fault (FILE *file, int faultno, int verbose);
|
||||||
|
|
||||||
extern void
|
extern void
|
||||||
proc_prettyfprint_syscalls (FILE *file, sysset_t *sysset, int verbose);
|
proc_prettyfprint_syscalls (FILE *file, sysset_t *sysset, int verbose);
|
||||||
|
|
||||||
|
extern void
|
||||||
|
proc_prettyfprint_status (long, int, int, int);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Trace functions for /proc api.
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int write_with_trace (int, void *, size_t, char *, int);
|
||||||
|
extern off_t lseek_with_trace (int, off_t, int, char *, int);
|
||||||
|
extern int ioctl_with_trace (int, long, void *, char *, int);
|
||||||
|
extern pid_t wait_with_trace (int *, char *, int);
|
||||||
|
extern int open_with_trace (char *, int, char *, int);
|
||||||
|
extern int close_with_trace (int, char *, int);
|
||||||
|
extern void procfs_note (char *, char *, int);
|
||||||
|
|
||||||
|
#ifdef PROCFS_TRACE
|
||||||
|
/*
|
||||||
|
* Debugging code:
|
||||||
|
*
|
||||||
|
* These macros allow me to trace the system calls that we make
|
||||||
|
* to control the child process. This is quite handy for comparing
|
||||||
|
* with the older version of procfs.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define write(X,Y,Z) write_with_trace (X, Y, Z, __FILE__, __LINE__)
|
||||||
|
#define lseek(X,Y,Z) lseek_with_trace (X, Y, Z, __FILE__, __LINE__)
|
||||||
|
#define ioctl(X,Y,Z) ioctl_with_trace (X, Y, Z, __FILE__, __LINE__)
|
||||||
|
#define open(X,Y) open_with_trace (X, Y, __FILE__, __LINE__)
|
||||||
|
#define close(X) close_with_trace (X, __FILE__, __LINE__)
|
||||||
|
#define wait(X) wait_with_trace (X, __FILE__, __LINE__)
|
||||||
|
#define PROCFS_NOTE(X) procfs_note (X, __FILE__, __LINE__)
|
||||||
|
#define PROC_PRETTYFPRINT_STATUS(X,Y,Z,T) \
|
||||||
|
proc_prettyfprint_status (X, Y, Z, T)
|
||||||
|
#endif
|
||||||
|
45
gdb/procfs.c
45
gdb/procfs.c
@ -38,8 +38,6 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "proc-utils.h"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* PROCFS.C
|
* PROCFS.C
|
||||||
*
|
*
|
||||||
@ -85,6 +83,13 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
|||||||
#include <unistd.h> /* for "X_OK" */
|
#include <unistd.h> /* for "X_OK" */
|
||||||
#include "gdb_stat.h" /* for struct stat */
|
#include "gdb_stat.h" /* for struct stat */
|
||||||
|
|
||||||
|
/* Note: procfs-utils.h must be included after the above system header
|
||||||
|
files, because it redefines various system calls using macros.
|
||||||
|
This may be incompatible with the prototype declarations. */
|
||||||
|
|
||||||
|
#define PROCFS_TRACE
|
||||||
|
#include "proc-utils.h"
|
||||||
|
|
||||||
/* =================== TARGET_OPS "MODULE" =================== */
|
/* =================== TARGET_OPS "MODULE" =================== */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -154,8 +159,8 @@ init_procfs_ops ()
|
|||||||
procfs_ops.to_thread_alive = procfs_thread_alive;
|
procfs_ops.to_thread_alive = procfs_thread_alive;
|
||||||
procfs_ops.to_pid_to_str = procfs_pid_to_str;
|
procfs_ops.to_pid_to_str = procfs_pid_to_str;
|
||||||
|
|
||||||
procfs_ops.to_has_all_memory = 1;
|
procfs_ops.to_has_all_memory = 1;
|
||||||
procfs_ops.to_has_memory = 1;
|
procfs_ops.to_has_memory = 1;
|
||||||
procfs_ops.to_has_execution = 1;
|
procfs_ops.to_has_execution = 1;
|
||||||
procfs_ops.to_has_stack = 1;
|
procfs_ops.to_has_stack = 1;
|
||||||
procfs_ops.to_has_registers = 1;
|
procfs_ops.to_has_registers = 1;
|
||||||
@ -166,36 +171,6 @@ init_procfs_ops ()
|
|||||||
|
|
||||||
/* =================== END, TARGET_OPS "MODULE" =================== */
|
/* =================== END, TARGET_OPS "MODULE" =================== */
|
||||||
|
|
||||||
/*
|
|
||||||
* Temporary debugging code:
|
|
||||||
*
|
|
||||||
* These macros allow me to trace the system calls that we make
|
|
||||||
* to control the child process. This is quite handy for comparing
|
|
||||||
* with the older version of procfs.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef TRACE_PROCFS
|
|
||||||
#ifdef NEW_PROC_API
|
|
||||||
extern int write_with_trace PARAMS ((int, void *, size_t, char *, int));
|
|
||||||
extern off_t lseek_with_trace PARAMS ((int, off_t, int, char *, int));
|
|
||||||
#define write(X,Y,Z) write_with_trace (X, Y, Z, __FILE__, __LINE__)
|
|
||||||
#define lseek(X,Y,Z) lseek_with_trace (X, Y, Z, __FILE__, __LINE__)
|
|
||||||
#else
|
|
||||||
extern int ioctl_with_trace PARAMS ((int, long, void *, char *, int));
|
|
||||||
#define ioctl(X,Y,Z) ioctl_with_trace (X, Y, Z, __FILE__, __LINE__)
|
|
||||||
#endif
|
|
||||||
#define open(X,Y) open_with_trace (X, Y, __FILE__, __LINE__)
|
|
||||||
#define close(X) close_with_trace (X, __FILE__, __LINE__)
|
|
||||||
#define wait(X) wait_with_trace (X, __FILE__, __LINE__)
|
|
||||||
#define PROCFS_NOTE(X) procfs_note (X, __FILE__, __LINE__)
|
|
||||||
#define PROC_PRETTYFPRINT_STATUS(X,Y,Z,T) \
|
|
||||||
proc_prettyfprint_status (X, Y, Z, T)
|
|
||||||
#else
|
|
||||||
#define PROCFS_NOTE(X)
|
|
||||||
#define PROC_PRETTYFPRINT_STATUS(X,Y,Z,T)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* World Unification:
|
* World Unification:
|
||||||
*
|
*
|
||||||
@ -4460,7 +4435,7 @@ unconditionally_kill_inferior (pi)
|
|||||||
}
|
}
|
||||||
#else /* PROCFS_NEED_PIOCSSIG_FOR_KILL */
|
#else /* PROCFS_NEED_PIOCSSIG_FOR_KILL */
|
||||||
if (!proc_kill (pi, SIGKILL))
|
if (!proc_kill (pi, SIGKILL))
|
||||||
proc_warn (pi, "unconditionally_kill, proc_kill", __LINE__);
|
proc_error (pi, "unconditionally_kill, proc_kill", __LINE__);
|
||||||
#endif /* PROCFS_NEED_PIOCSSIG_FOR_KILL */
|
#endif /* PROCFS_NEED_PIOCSSIG_FOR_KILL */
|
||||||
destroy_procinfo (pi);
|
destroy_procinfo (pi);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user