mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-16 12:24:19 +08:00
Mon Aug 2 08:42:50 1993 Stu Grossman (grossman at cygnus.com)
* gdbserver/remote-inflow.c (create_inferior): Fix comments, and error msg. Setup seperate process group for child. * (write_inferior_memory): Sleep for 1 second and retry on ptrace failure.
This commit is contained in:
@ -1,3 +1,10 @@
|
|||||||
|
Mon Aug 2 08:42:50 1993 Stu Grossman (grossman at cygnus.com)
|
||||||
|
|
||||||
|
* gdbserver/remote-inflow.c (create_inferior): Fix comments, and
|
||||||
|
error msg. Setup seperate process group for child.
|
||||||
|
* (write_inferior_memory): Sleep for 1 second and retry on ptrace
|
||||||
|
failure.
|
||||||
|
|
||||||
Sun Aug 1 22:58:18 1993 Stu Grossman (grossman at cygnus.com)
|
Sun Aug 1 22:58:18 1993 Stu Grossman (grossman at cygnus.com)
|
||||||
|
|
||||||
* config/i386/i386lynx.mh (NATDEPFILES): Drop coredep (for now).
|
* config/i386/i386lynx.mh (NATDEPFILES): Drop coredep (for now).
|
||||||
|
@ -44,8 +44,7 @@ char registers[REGISTER_BYTES];
|
|||||||
#include <sys/ptrace.h>
|
#include <sys/ptrace.h>
|
||||||
|
|
||||||
/* Start an inferior process and returns its pid.
|
/* Start an inferior process and returns its pid.
|
||||||
ALLARGS is a vector of program-name and args.
|
ALLARGS is a vector of program-name and args. */
|
||||||
ENV is the environment vector to pass. */
|
|
||||||
|
|
||||||
int
|
int
|
||||||
create_inferior (program, allargs)
|
create_inferior (program, allargs)
|
||||||
@ -60,11 +59,21 @@ create_inferior (program, allargs)
|
|||||||
|
|
||||||
if (pid == 0)
|
if (pid == 0)
|
||||||
{
|
{
|
||||||
|
int pgrp;
|
||||||
|
|
||||||
|
/* Switch child to it's own process group so that signals won't
|
||||||
|
directly affect gdbserver. */
|
||||||
|
|
||||||
|
pgrp = getpid();
|
||||||
|
setpgrp(0, pgrp);
|
||||||
|
ioctl (0, TIOCSPGRP, &pgrp);
|
||||||
|
|
||||||
ptrace (PTRACE_TRACEME);
|
ptrace (PTRACE_TRACEME);
|
||||||
|
|
||||||
execv (program, allargs);
|
execv (program, allargs);
|
||||||
|
|
||||||
fprintf (stderr, "Cannot exec %s: %s.\n", program,
|
fprintf (stderr, "GDBserver (process %d): Cannot exec %s: %s.\n",
|
||||||
|
getpid(), program,
|
||||||
errno < sys_nerr ? sys_errlist[errno] : "unknown error");
|
errno < sys_nerr ? sys_errlist[errno] : "unknown error");
|
||||||
fflush (stderr);
|
fflush (stderr);
|
||||||
_exit (0177);
|
_exit (0177);
|
||||||
@ -317,10 +326,19 @@ write_inferior_memory (memaddr, myaddr, len)
|
|||||||
|
|
||||||
for (i = 0; i < count; i++, addr += sizeof (int))
|
for (i = 0; i < count; i++, addr += sizeof (int))
|
||||||
{
|
{
|
||||||
errno = 0;
|
while (1)
|
||||||
ptrace (PTRACE_POKETEXT, inferior_pid, addr, buffer[i]);
|
{
|
||||||
if (errno)
|
errno = 0;
|
||||||
return errno;
|
ptrace (PTRACE_POKETEXT, inferior_pid, addr, buffer[i]);
|
||||||
|
if (errno)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "ptrace (PTRACE_POKETEXT): errno=%d, inferior_pid=0x%x, addr=0x%x, buffer[i] = 0x%x\n", errno, inferior_pid, addr, buffer[i]);
|
||||||
|
fprintf(stderr, "Sleeping for 1 second\n");
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user