aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>1999-07-07 20:19:36 +0000
committerJason Molenda <jmolenda@apple.com>1999-07-07 20:19:36 +0000
commitc5aa993b1f4add48fbdc6cc3117059f616e49875 (patch)
treec809d06515a34428cc8df5f758fbc1b6117d4c30 /gdb/gdbserver
parent3a4b77d8bee950afce6f9702aa65dc0e60817a82 (diff)
downloadfsf-binutils-gdb-c5aa993b1f4add48fbdc6cc3117059f616e49875.zip
fsf-binutils-gdb-c5aa993b1f4add48fbdc6cc3117059f616e49875.tar.gz
fsf-binutils-gdb-c5aa993b1f4add48fbdc6cc3117059f616e49875.tar.bz2
import gdb-1999-07-07 post reformat
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r--gdb/gdbserver/gdbreplay.c83
-rw-r--r--gdb/gdbserver/low-hppabsd.c59
-rw-r--r--gdb/gdbserver/low-linux.c77
-rw-r--r--gdb/gdbserver/low-lynx.c345
-rw-r--r--gdb/gdbserver/low-sim.c57
-rw-r--r--gdb/gdbserver/low-sparc.c69
-rw-r--r--gdb/gdbserver/low-sun3.c51
-rw-r--r--gdb/gdbserver/remote-utils.c69
-rw-r--r--gdb/gdbserver/server.c53
-rw-r--r--gdb/gdbserver/server.h33
-rw-r--r--gdb/gdbserver/utils.c31
11 files changed, 476 insertions, 451 deletions
diff --git a/gdb/gdbserver/gdbreplay.c b/gdb/gdbserver/gdbreplay.c
index ebe06ba..5773962 100644
--- a/gdb/gdbserver/gdbreplay.c
+++ b/gdb/gdbserver/gdbreplay.c
@@ -2,21 +2,22 @@
Copyright (C) 1996 Free Software Foundation, Inc.
Written by Fred Fish (fnf@cygnus.com) from pieces of gdbserver.
-This file is part of GDB.
+ This file is part of GDB.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
#include <stdio.h>
#include <sys/file.h>
@@ -72,7 +73,7 @@ sync_error (fp, desc, expect, got)
}
void
-remote_close()
+remote_close ()
{
close (remote_desc);
}
@@ -111,19 +112,19 @@ remote_open (name)
/* Allow rapid reuse of this port. */
tmp = 1;
- setsockopt (tmp_desc, SOL_SOCKET, SO_REUSEADDR, (char *)&tmp,
- sizeof(tmp));
+ setsockopt (tmp_desc, SOL_SOCKET, SO_REUSEADDR, (char *) &tmp,
+ sizeof (tmp));
sockaddr.sin_family = PF_INET;
- sockaddr.sin_port = htons(port);
+ sockaddr.sin_port = htons (port);
sockaddr.sin_addr.s_addr = INADDR_ANY;
- if (bind (tmp_desc, (struct sockaddr *)&sockaddr, sizeof (sockaddr))
+ if (bind (tmp_desc, (struct sockaddr *) &sockaddr, sizeof (sockaddr))
|| listen (tmp_desc, 1))
perror_with_name ("Can't bind address");
tmp = sizeof (sockaddr);
- remote_desc = accept (tmp_desc, (struct sockaddr *)&sockaddr, &tmp);
+ remote_desc = accept (tmp_desc, (struct sockaddr *) &sockaddr, &tmp);
if (remote_desc == -1)
perror_with_name ("Accept failed");
@@ -133,18 +134,18 @@ remote_open (name)
/* Enable TCP keep alive process. */
tmp = 1;
- setsockopt (tmp_desc, SOL_SOCKET, SO_KEEPALIVE, (char *)&tmp, sizeof(tmp));
+ setsockopt (tmp_desc, SOL_SOCKET, SO_KEEPALIVE, (char *) &tmp, sizeof (tmp));
/* Tell TCP not to delay small packets. This greatly speeds up
- interactive response. */
+ interactive response. */
tmp = 1;
setsockopt (remote_desc, protoent->p_proto, TCP_NODELAY,
- (char *)&tmp, sizeof(tmp));
+ (char *) &tmp, sizeof (tmp));
close (tmp_desc); /* No longer need this */
- signal (SIGPIPE, SIG_IGN); /* If we don't do this, then gdbreplay simply
- exits when the remote side dies. */
+ signal (SIGPIPE, SIG_IGN); /* If we don't do this, then gdbreplay simply
+ exits when the remote side dies. */
}
fcntl (remote_desc, F_SETFL, FASYNC);
@@ -153,7 +154,8 @@ remote_open (name)
fflush (stderr);
}
-static int tohex (ch)
+static int
+tohex (ch)
int ch;
{
if (ch >= '0' && ch <= '9')
@@ -194,13 +196,26 @@ logchar (fp)
fflush (stdout);
switch (ch)
{
- case '\\': break;
- case 'b': ch = '\b'; break;
- case 'f': ch = '\f'; break;
- case 'n': ch = '\n'; break;
- case 'r': ch = '\r'; break;
- case 't': ch = '\t'; break;
- case 'v': ch = '\v'; break;
+ case '\\':
+ break;
+ case 'b':
+ ch = '\b';
+ break;
+ case 'f':
+ ch = '\f';
+ break;
+ case 'n':
+ ch = '\n';
+ break;
+ case 'r':
+ ch = '\r';
+ break;
+ case 't':
+ ch = '\t';
+ break;
+ case 'v':
+ ch = '\v';
+ break;
case 'x':
ch2 = fgetc (fp);
fputc (ch2, stdout);
@@ -244,7 +259,8 @@ expect (fp)
break;
}
read (remote_desc, &fromgdb, 1);
- } while (fromlog == fromgdb);
+ }
+ while (fromlog == fromgdb);
if (fromlog != EOL)
{
sync_error (fp, "Sync error during read of gdb packet", fromlog,
@@ -292,7 +308,7 @@ main (argc, argv)
if (fp == NULL)
{
perror_with_name (argv[1]);
- }
+ }
remote_open (argv[2]);
while ((ch = logchar (fp)) != EOF)
{
@@ -315,4 +331,3 @@ main (argc, argv)
remote_close ();
exit (0);
}
-
diff --git a/gdb/gdbserver/low-hppabsd.c b/gdb/gdbserver/low-hppabsd.c
index c784d0c..3c28a38 100644
--- a/gdb/gdbserver/low-hppabsd.c
+++ b/gdb/gdbserver/low-hppabsd.c
@@ -1,21 +1,22 @@
/* Low level interface to ptrace, for the remote server for GDB.
Copyright (C) 1995 Free Software Foundation, Inc.
-This file is part of GDB.
+ This file is part of GDB.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
#include "defs.h"
#include <sys/wait.h>
@@ -90,7 +91,7 @@ kill_inferior ()
return;
ptrace (8, inferior_pid, 0, 0, 0);
wait (0);
- /*************inferior_died ();****VK**************/
+/*************inferior_died ();****VK**************/
}
/* Return nonzero if the given thread is still alive. */
@@ -195,8 +196,8 @@ fetch_register (regno)
for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
{
errno = 0;
- *(int *) &registers[ regno * 4 + i] = ptrace (PT_RUREGS, inferior_pid,
- (PTRACE_ARG3_TYPE) regaddr, 0, 0);
+ *(int *) &registers[regno * 4 + i] = ptrace (PT_RUREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) regaddr, 0, 0);
regaddr += sizeof (int);
if (errno != 0)
{
@@ -209,7 +210,7 @@ fetch_register (regno)
goto error_exit;
}
}
- error_exit:;
+error_exit:;
}
/* Fetch all registers, or just one, from the child process. */
@@ -247,20 +248,20 @@ store_inferior_registers (regno)
regaddr = register_addr (regno, offset);
errno = 0;
if (regno == PCOQ_HEAD_REGNUM || regno == PCOQ_TAIL_REGNUM)
- {
- scratch = *(int *) &registers[REGISTER_BYTE (regno)] | 0x3;
- ptrace (PT_WUREGS, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
- scratch, 0);
- if (errno != 0)
- {
+ {
+ scratch = *(int *) &registers[REGISTER_BYTE (regno)] | 0x3;
+ ptrace (PT_WUREGS, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
+ scratch, 0);
+ if (errno != 0)
+ {
/* Error, even if attached. Failing to write these two
- registers is pretty serious. */
- sprintf (buf, "writing register number %d", regno);
- perror_with_name (buf);
- }
- }
+ registers is pretty serious. */
+ sprintf (buf, "writing register number %d", regno);
+ perror_with_name (buf);
+ }
+ }
else
- for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int))
+ for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
{
errno = 0;
ptrace (PT_WUREGS, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
@@ -276,7 +277,7 @@ store_inferior_registers (regno)
error (msg);
return;
}
- regaddr += sizeof(int);
+ regaddr += sizeof (int);
}
}
else
diff --git a/gdb/gdbserver/low-linux.c b/gdb/gdbserver/low-linux.c
index 1060210..32f10a1 100644
--- a/gdb/gdbserver/low-linux.c
+++ b/gdb/gdbserver/low-linux.c
@@ -1,21 +1,22 @@
/* Low level interface to ptrace, for the remote server for GDB.
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
-This file is part of GDB.
+ This file is part of GDB.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
#include "defs.h"
#include <sys/wait.h>
@@ -95,7 +96,7 @@ kill_inferior ()
return;
ptrace (PTRACE_KILL, inferior_pid, 0, 0);
wait (0);
- /*************inferior_died ();****VK**************/
+/*************inferior_died ();****VK**************/
}
/* Return nonzero if the given thread is still alive. */
@@ -169,7 +170,7 @@ myresume (step, signal)
#ifndef TARGET_M68K
/* this table must line up with REGISTER_NAMES in tm-i386v.h */
/* symbols like 'EAX' come from <sys/reg.h> */
-static int regmap[] =
+static int regmap[] =
{
EAX, ECX, EDX, EBX,
UESP, EBP, ESI, EDI,
@@ -187,22 +188,22 @@ i386_register_u_addr (blockend, regnum)
/* for now, you can look at them with 'info float'
* sys5 wont let you change them with ptrace anyway
*/
- if (regnum >= FP0_REGNUM && regnum <= FP7_REGNUM)
+ if (regnum >= FP0_REGNUM && regnum <= FP7_REGNUM)
{
int ubase, fpstate;
struct user u;
ubase = blockend + 4 * (SS + 1) - KSTKSZ;
- fpstate = ubase + ((char *)&u.u_fpstate - (char *)&u);
+ fpstate = ubase + ((char *) &u.u_fpstate - (char *) &u);
return (fpstate + 0x1c + 10 * (regnum - FP0_REGNUM));
- }
+ }
else
#endif
return (blockend + 4 * regmap[regnum]);
-
+
}
#else /* TARGET_M68K */
/* This table must line up with REGISTER_NAMES in tm-m68k.h */
-static int regmap[] =
+static int regmap[] =
{
#ifdef PT_D0
PT_D0, PT_D1, PT_D2, PT_D3, PT_D4, PT_D5, PT_D6, PT_D7,
@@ -228,7 +229,7 @@ m68k_linux_register_u_addr (blockend, regnum)
int blockend;
int regnum;
{
- return (blockend + 4 * regmap[regnum]);
+ return (blockend + 4 * regmap[regnum]);
}
#endif
@@ -265,8 +266,8 @@ fetch_register (regno)
for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
{
errno = 0;
- *(int *) &registers[ regno * 4 + i] = ptrace (PTRACE_PEEKUSR, inferior_pid,
- (PTRACE_ARG3_TYPE) regaddr, 0);
+ *(int *) &registers[regno * 4 + i] = ptrace (PTRACE_PEEKUSR, inferior_pid,
+ (PTRACE_ARG3_TYPE) regaddr, 0);
regaddr += sizeof (int);
if (errno != 0)
{
@@ -279,7 +280,7 @@ fetch_register (regno)
goto error_exit;
}
}
- error_exit:;
+error_exit:;
}
/* Fetch all registers, or just one, from the child process. */
@@ -289,7 +290,7 @@ fetch_inferior_registers (regno)
int regno;
{
if (regno == -1 || regno == 0)
- for (regno = 0; regno < NUM_REGS-NUM_FREGS; regno++)
+ for (regno = 0; regno < NUM_REGS - NUM_FREGS; regno++)
fetch_register (regno);
else
fetch_register (regno);
@@ -317,21 +318,21 @@ store_inferior_registers (regno)
errno = 0;
#if 0
if (regno == PCOQ_HEAD_REGNUM || regno == PCOQ_TAIL_REGNUM)
- {
- scratch = *(int *) &registers[REGISTER_BYTE (regno)] | 0x3;
- ptrace (PT_WUREGS, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
- scratch, 0);
- if (errno != 0)
- {
+ {
+ scratch = *(int *) &registers[REGISTER_BYTE (regno)] | 0x3;
+ ptrace (PT_WUREGS, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
+ scratch, 0);
+ if (errno != 0)
+ {
/* Error, even if attached. Failing to write these two
- registers is pretty serious. */
- sprintf (buf, "writing register number %d", regno);
- perror_with_name (buf);
- }
- }
+ registers is pretty serious. */
+ sprintf (buf, "writing register number %d", regno);
+ perror_with_name (buf);
+ }
+ }
else
#endif
- for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int))
+ for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
{
errno = 0;
ptrace (PTRACE_POKEUSR, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
@@ -347,11 +348,11 @@ store_inferior_registers (regno)
error (msg);
return;
}
- regaddr += sizeof(int);
+ regaddr += sizeof (int);
}
}
else
- for (regno = 0; regno < NUM_REGS-NUM_FREGS; regno++)
+ for (regno = 0; regno < NUM_REGS - NUM_FREGS; regno++)
store_inferior_registers (regno);
}
diff --git a/gdb/gdbserver/low-lynx.c b/gdb/gdbserver/low-lynx.c
index 3444f7a..ecc3318 100644
--- a/gdb/gdbserver/low-lynx.c
+++ b/gdb/gdbserver/low-lynx.c
@@ -1,21 +1,22 @@
/* Low level interface to ptrace, for the remote server for GDB.
Copyright (C) 1986, 1987, 1993 Free Software Foundation, Inc.
-This file is part of GDB.
+ This file is part of GDB.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
#include "server.h"
#include "frame.h"
@@ -66,18 +67,18 @@ create_inferior (program, allargs)
int pgrp;
/* Switch child to it's own process group so that signals won't
- directly affect gdbserver. */
+ directly affect gdbserver. */
- pgrp = getpid();
- setpgrp(0, pgrp);
+ pgrp = getpid ();
+ setpgrp (0, pgrp);
ioctl (0, TIOCSPGRP, &pgrp);
- ptrace (PTRACE_TRACEME, 0, (PTRACE_ARG3_TYPE)0, 0);
+ ptrace (PTRACE_TRACEME, 0, (PTRACE_ARG3_TYPE) 0, 0);
execv (program, allargs);
fprintf (stderr, "GDBserver (process %d): Cannot exec %s: %s.\n",
- getpid(), program,
+ getpid (), program,
errno < sys_nerr ? sys_errlist[errno] : "unknown error");
fflush (stderr);
_exit (0177);
@@ -128,34 +129,34 @@ mywait (status)
while (1)
{
- enable_async_io();
+ enable_async_io ();
pid = wait (&w);
- disable_async_io();
+ disable_async_io ();
- if (pid != PIDGET(inferior_pid))
+ if (pid != PIDGET (inferior_pid))
perror_with_name ("wait");
thread_from_wait = w.w_tid;
inferior_pid = BUILDPID (inferior_pid, w.w_tid);
- if (WIFSTOPPED(w)
- && WSTOPSIG(w) == SIGTRAP)
+ if (WIFSTOPPED (w)
+ && WSTOPSIG (w) == SIGTRAP)
{
int realsig;
realsig = ptrace (PTRACE_GETTRACESIG, inferior_pid,
- (PTRACE_ARG3_TYPE)0, 0);
+ (PTRACE_ARG3_TYPE) 0, 0);
if (realsig == SIGNEWTHREAD)
{
/* It's a new thread notification. Nothing to do here since
- the machine independent code in wait_for_inferior will
- add the thread to the thread list and restart the thread
- when pid != inferior_pid and pid is not in the thread list.
- We don't even want to muck with realsig -- the code in
- wait_for_inferior expects SIGTRAP. */
+ the machine independent code in wait_for_inferior will
+ add the thread to the thread list and restart the thread
+ when pid != inferior_pid and pid is not in the thread list.
+ We don't even want to muck with realsig -- the code in
+ wait_for_inferior expects SIGTRAP. */
;
}
}
@@ -209,22 +210,22 @@ myresume (step, signal)
static int regmap[] =
{
- X(eax),
- X(ecx),
- X(edx),
- X(ebx),
- X(esp), /* sp */
- X(ebp), /* fp */
- X(esi),
- X(edi),
- X(eip), /* pc */
- X(flags), /* ps */
- X(cs),
- X(ss),
- X(ds),
- X(es),
- X(ecode), /* Lynx doesn't give us either fs or gs, so */
- X(fault), /* we just substitute these two in the hopes
+ X (eax),
+ X (ecx),
+ X (edx),
+ X (ebx),
+ X (esp), /* sp */
+ X (ebp), /* fp */
+ X (esi),
+ X (edi),
+ X (eip), /* pc */
+ X (flags), /* ps */
+ X (cs),
+ X (ss),
+ X (ds),
+ X (es),
+ X (ecode), /* Lynx doesn't give us either fs or gs, so */
+ X (fault), /* we just substitute these two in the hopes
that they are useful. */
};
#endif
@@ -234,39 +235,39 @@ static int regmap[] =
static int regmap[] =
{
- X(regs[0]), /* d0 */
- X(regs[1]), /* d1 */
- X(regs[2]), /* d2 */
- X(regs[3]), /* d3 */
- X(regs[4]), /* d4 */
- X(regs[5]), /* d5 */
- X(regs[6]), /* d6 */
- X(regs[7]), /* d7 */
- X(regs[8]), /* a0 */
- X(regs[9]), /* a1 */
- X(regs[10]), /* a2 */
- X(regs[11]), /* a3 */
- X(regs[12]), /* a4 */
- X(regs[13]), /* a5 */
- X(regs[14]), /* fp */
+ X (regs[0]), /* d0 */
+ X (regs[1]), /* d1 */
+ X (regs[2]), /* d2 */
+ X (regs[3]), /* d3 */
+ X (regs[4]), /* d4 */
+ X (regs[5]), /* d5 */
+ X (regs[6]), /* d6 */
+ X (regs[7]), /* d7 */
+ X (regs[8]), /* a0 */
+ X (regs[9]), /* a1 */
+ X (regs[10]), /* a2 */
+ X (regs[11]), /* a3 */
+ X (regs[12]), /* a4 */
+ X (regs[13]), /* a5 */
+ X (regs[14]), /* fp */
0, /* sp */
- X(status), /* ps */
- X(pc),
-
- X(fregs[0*3]), /* fp0 */
- X(fregs[1*3]), /* fp1 */
- X(fregs[2*3]), /* fp2 */
- X(fregs[3*3]), /* fp3 */
- X(fregs[4*3]), /* fp4 */
- X(fregs[5*3]), /* fp5 */
- X(fregs[6*3]), /* fp6 */
- X(fregs[7*3]), /* fp7 */
-
- X(fcregs[0]), /* fpcontrol */
- X(fcregs[1]), /* fpstatus */
- X(fcregs[2]), /* fpiaddr */
- X(ssw), /* fpcode */
- X(fault), /* fpflags */
+ X (status), /* ps */
+ X (pc),
+
+ X (fregs[0 * 3]), /* fp0 */
+ X (fregs[1 * 3]), /* fp1 */
+ X (fregs[2 * 3]), /* fp2 */
+ X (fregs[3 * 3]), /* fp3 */
+ X (fregs[4 * 3]), /* fp4 */
+ X (fregs[5 * 3]), /* fp5 */
+ X (fregs[6 * 3]), /* fp6 */
+ X (fregs[7 * 3]), /* fp7 */
+
+ X (fcregs[0]), /* fpcontrol */
+ X (fcregs[1]), /* fpstatus */
+ X (fcregs[2]), /* fpiaddr */
+ X (ssw), /* fpcode */
+ X (fault), /* fpflags */
};
#endif
@@ -278,67 +279,67 @@ static int regmap[] =
static int regmap[] =
{
-1, /* g0 */
- X(g1),
- X(g2),
- X(g3),
- X(g4),
+ X (g1),
+ X (g2),
+ X (g3),
+ X (g4),
-1, /* g5->g7 aren't saved by Lynx */
-1,
-1,
- X(o[0]),
- X(o[1]),
- X(o[2]),
- X(o[3]),
- X(o[4]),
- X(o[5]),
- X(o[6]), /* sp */
- X(o[7]), /* ra */
-
- -1,-1,-1,-1,-1,-1,-1,-1, /* l0 -> l7 */
-
- -1,-1,-1,-1,-1,-1,-1,-1, /* i0 -> i7 */
-
- FX(f.fregs[0]), /* f0 */
- FX(f.fregs[1]),
- FX(f.fregs[2]),
- FX(f.fregs[3]),
- FX(f.fregs[4]),
- FX(f.fregs[5]),
- FX(f.fregs[6]),
- FX(f.fregs[7]),
- FX(f.fregs[8]),
- FX(f.fregs[9]),
- FX(f.fregs[10]),
- FX(f.fregs[11]),
- FX(f.fregs[12]),
- FX(f.fregs[13]),
- FX(f.fregs[14]),
- FX(f.fregs[15]),
- FX(f.fregs[16]),
- FX(f.fregs[17]),
- FX(f.fregs[18]),
- FX(f.fregs[19]),
- FX(f.fregs[20]),
- FX(f.fregs[21]),
- FX(f.fregs[22]),
- FX(f.fregs[23]),
- FX(f.fregs[24]),
- FX(f.fregs[25]),
- FX(f.fregs[26]),
- FX(f.fregs[27]),
- FX(f.fregs[28]),
- FX(f.fregs[29]),
- FX(f.fregs[30]),
- FX(f.fregs[31]),
-
- X(y),
- X(psr),
- X(wim),
- X(tbr),
- X(pc),
- X(npc),
- FX(fsr), /* fpsr */
+ X (o[0]),
+ X (o[1]),
+ X (o[2]),
+ X (o[3]),
+ X (o[4]),
+ X (o[5]),
+ X (o[6]), /* sp */
+ X (o[7]), /* ra */
+
+ -1, -1, -1, -1, -1, -1, -1, -1, /* l0 -> l7 */
+
+ -1, -1, -1, -1, -1, -1, -1, -1, /* i0 -> i7 */
+
+ FX (f.fregs[0]), /* f0 */
+ FX (f.fregs[1]),
+ FX (f.fregs[2]),
+ FX (f.fregs[3]),
+ FX (f.fregs[4]),
+ FX (f.fregs[5]),
+ FX (f.fregs[6]),
+ FX (f.fregs[7]),
+ FX (f.fregs[8]),
+ FX (f.fregs[9]),
+ FX (f.fregs[10]),
+ FX (f.fregs[11]),
+ FX (f.fregs[12]),
+ FX (f.fregs[13]),
+ FX (f.fregs[14]),
+ FX (f.fregs[15]),
+ FX (f.fregs[16]),
+ FX (f.fregs[17]),
+ FX (f.fregs[18]),
+ FX (f.fregs[19]),
+ FX (f.fregs[20]),
+ FX (f.fregs[21]),
+ FX (f.fregs[22]),
+ FX (f.fregs[23]),
+ FX (f.fregs[24]),
+ FX (f.fregs[25]),
+ FX (f.fregs[26]),
+ FX (f.fregs[27]),
+ FX (f.fregs[28]),
+ FX (f.fregs[29]),
+ FX (f.fregs[30]),
+ FX (f.fregs[31]),
+
+ X (y),
+ X (psr),
+ X (wim),
+ X (tbr),
+ X (pc),
+ X (npc),
+ FX (fsr), /* fpsr */
-1, /* cpsr */
};
#endif
@@ -371,7 +372,7 @@ fetch_inferior_registers (regno)
if (whatregs & WHATREGS_GEN)
{
- struct econtext ec; /* general regs */
+ struct econtext ec; /* general regs */
char buf[MAX_REGISTER_RAW_SIZE];
int retval;
int i;
@@ -379,25 +380,25 @@ fetch_inferior_registers (regno)
errno = 0;
retval = ptrace (PTRACE_GETREGS,
BUILDPID (inferior_pid, general_thread),
- (PTRACE_ARG3_TYPE) &ec,
+ (PTRACE_ARG3_TYPE) & ec,
0);
if (errno)
perror_with_name ("Sparc fetch_inferior_registers(ptrace)");
-
+
memset (buf, 0, REGISTER_RAW_SIZE (G0_REGNUM));
supply_register (G0_REGNUM, buf);
- supply_register (TBR_REGNUM, (char *)&ec.tbr);
+ supply_register (TBR_REGNUM, (char *) &ec.tbr);
memcpy (&registers[REGISTER_BYTE (G1_REGNUM)], &ec.g1,
4 * REGISTER_RAW_SIZE (G1_REGNUM));
for (i = G1_REGNUM; i <= G1_REGNUM + 3; i++)
register_valid[i] = 1;
- supply_register (PS_REGNUM, (char *)&ec.psr);
- supply_register (Y_REGNUM, (char *)&ec.y);
- supply_register (PC_REGNUM, (char *)&ec.pc);
- supply_register (NPC_REGNUM, (char *)&ec.npc);
- supply_register (WIM_REGNUM, (char *)&ec.wim);
+ supply_register (PS_REGNUM, (char *) &ec.psr);
+ supply_register (Y_REGNUM, (char *) &ec.y);
+ supply_register (PC_REGNUM, (char *) &ec.pc);
+ supply_register (NPC_REGNUM, (char *) &ec.npc);
+ supply_register (WIM_REGNUM, (char *) &ec.wim);
memcpy (&registers[REGISTER_BYTE (O0_REGNUM)], ec.o,
8 * REGISTER_RAW_SIZE (O0_REGNUM));
@@ -413,13 +414,13 @@ fetch_inferior_registers (regno)
sp = read_register (SP_REGNUM);
target_xfer_memory (sp + FRAME_SAVED_I0,
- &registers[REGISTER_BYTE(I0_REGNUM)],
+ &registers[REGISTER_BYTE (I0_REGNUM)],
8 * REGISTER_RAW_SIZE (I0_REGNUM), 0);
for (i = I0_REGNUM; i <= I7_REGNUM; i++)
register_valid[i] = 1;
target_xfer_memory (sp + FRAME_SAVED_L0,
- &registers[REGISTER_BYTE(L0_REGNUM)],
+ &registers[REGISTER_BYTE (L0_REGNUM)],
8 * REGISTER_RAW_SIZE (L0_REGNUM), 0);
for (i = L0_REGNUM; i <= L0_REGNUM + 7; i++)
register_valid[i] = 1;
@@ -427,22 +428,22 @@ fetch_inferior_registers (regno)
if (whatregs & WHATREGS_FLOAT)
{
- struct fcontext fc; /* fp regs */
+ struct fcontext fc; /* fp regs */
int retval;
int i;
errno = 0;
- retval = ptrace (PTRACE_GETFPREGS, BUILDPID (inferior_pid, general_thread), (PTRACE_ARG3_TYPE) &fc,
+ retval = ptrace (PTRACE_GETFPREGS, BUILDPID (inferior_pid, general_thread), (PTRACE_ARG3_TYPE) & fc,
0);
if (errno)
perror_with_name ("Sparc fetch_inferior_registers(ptrace)");
-
+
memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)], fc.f.fregs,
32 * REGISTER_RAW_SIZE (FP0_REGNUM));
for (i = FP0_REGNUM; i <= FP0_REGNUM + 31; i++)
register_valid[i] = 1;
- supply_register (FPS_REGNUM, (char *)&fc.fsr);
+ supply_register (FPS_REGNUM, (char *) &fc.fsr);
}
#endif
}
@@ -474,7 +475,7 @@ store_inferior_registers (regno)
if (whatregs & WHATREGS_GEN)
{
- struct econtext ec; /* general regs */
+ struct econtext ec; /* general regs */
int retval;
ec.tbr = read_register (TBR_REGNUM);
@@ -491,7 +492,7 @@ store_inferior_registers (regno)
8 * REGISTER_RAW_SIZE (O0_REGNUM));
errno = 0;
- retval = ptrace (PTRACE_SETREGS, BUILDPID (inferior_pid, general_thread), (PTRACE_ARG3_TYPE) &ec,
+ retval = ptrace (PTRACE_SETREGS, BUILDPID (inferior_pid, general_thread), (PTRACE_ARG3_TYPE) & ec,
0);
if (errno)
perror_with_name ("Sparc fetch_inferior_registers(ptrace)");
@@ -506,8 +507,8 @@ store_inferior_registers (regno)
if (regno == -1 || regno == SP_REGNUM)
{
- if (!register_valid[L0_REGNUM+5])
- abort();
+ if (!register_valid[L0_REGNUM + 5])
+ abort ();
target_xfer_memory (sp + FRAME_SAVED_I0,
&registers[REGISTER_BYTE (I0_REGNUM)],
8 * REGISTER_RAW_SIZE (I0_REGNUM), 1);
@@ -519,7 +520,7 @@ store_inferior_registers (regno)
else if (regno >= L0_REGNUM && regno <= I7_REGNUM)
{
if (!register_valid[regno])
- abort();
+ abort ();
if (regno >= L0_REGNUM && regno <= L0_REGNUM + 7)
regoffset = REGISTER_BYTE (regno) - REGISTER_BYTE (L0_REGNUM)
+ FRAME_SAVED_L0;
@@ -533,27 +534,27 @@ store_inferior_registers (regno)
if (whatregs & WHATREGS_FLOAT)
{
- struct fcontext fc; /* fp regs */
+ struct fcontext fc; /* fp regs */
int retval;
/* We read fcontext first so that we can get good values for fq_t... */
errno = 0;
- retval = ptrace (PTRACE_GETFPREGS, BUILDPID (inferior_pid, general_thread), (PTRACE_ARG3_TYPE) &fc,
+ retval = ptrace (PTRACE_GETFPREGS, BUILDPID (inferior_pid, general_thread), (PTRACE_ARG3_TYPE) & fc,
0);
if (errno)
perror_with_name ("Sparc fetch_inferior_registers(ptrace)");
-
+
memcpy (fc.f.fregs, &registers[REGISTER_BYTE (FP0_REGNUM)],
32 * REGISTER_RAW_SIZE (FP0_REGNUM));
fc.fsr = read_register (FPS_REGNUM);
errno = 0;
- retval = ptrace (PTRACE_SETFPREGS, BUILDPID (inferior_pid, general_thread), (PTRACE_ARG3_TYPE) &fc,
+ retval = ptrace (PTRACE_SETFPREGS, BUILDPID (inferior_pid, general_thread), (PTRACE_ARG3_TYPE) & fc,
0);
if (errno)
perror_with_name ("Sparc fetch_inferior_registers(ptrace)");
- }
+ }
#endif
}
#endif /* SPARC */
@@ -564,20 +565,20 @@ store_inferior_registers (regno)
saved context block. */
static unsigned long
-lynx_registers_addr()
+lynx_registers_addr ()
{
CORE_ADDR stblock;
- int ecpoff = offsetof(st_t, ecp);
+ int ecpoff = offsetof (st_t, ecp);
CORE_ADDR ecp;
errno = 0;
stblock = (CORE_ADDR) ptrace (PTRACE_THREADUSER, BUILDPID (inferior_pid, general_thread),
- (PTRACE_ARG3_TYPE)0, 0);
+ (PTRACE_ARG3_TYPE) 0, 0);
if (errno)
perror_with_name ("PTRACE_THREADUSER");
ecp = (CORE_ADDR) ptrace (PTRACE_PEEKTHREAD, BUILDPID (inferior_pid, general_thread),
- (PTRACE_ARG3_TYPE)ecpoff, 0);
+ (PTRACE_ARG3_TYPE) ecpoff, 0);
if (errno)
perror_with_name ("lynx_registers_addr(PTRACE_PEEKTHREAD)");
@@ -596,7 +597,7 @@ fetch_inferior_registers (ignored)
unsigned long reg;
unsigned long ecp;
- ecp = lynx_registers_addr();
+ ecp = lynx_registers_addr ();
for (regno = 0; regno < NUM_REGS; regno++)
{
@@ -611,8 +612,8 @@ fetch_inferior_registers (ignored)
(PTRACE_ARG3_TYPE) (ecp + regmap[regno]), 0);
if (errno)
perror_with_name ("fetch_inferior_registers(PTRACE_PEEKTHREAD)");
-
- *(unsigned long *)&registers[REGISTER_BYTE (regno)] = reg;
+
+ *(unsigned long *) &registers[REGISTER_BYTE (regno)] = reg;
}
}
@@ -628,7 +629,7 @@ store_inferior_registers (ignored)
unsigned long reg;
unsigned long ecp;
- ecp = lynx_registers_addr();
+ ecp = lynx_registers_addr ();
for (regno = 0; regno < NUM_REGS; regno++)
{
@@ -638,7 +639,7 @@ store_inferior_registers (ignored)
ptrace_fun = regno == SP_REGNUM ? PTRACE_POKEUSP : PTRACE_POKEUSER;
#endif
- reg = *(unsigned long *)&registers[REGISTER_BYTE (regno)];
+ reg = *(unsigned long *) &registers[REGISTER_BYTE (regno)];
errno = 0;
ptrace (ptrace_fun, BUILDPID (inferior_pid, general_thread),
@@ -730,12 +731,12 @@ write_inferior_memory (memaddr, myaddr, len)
ptrace (PTRACE_POKETEXT, BUILDPID (inferior_pid, general_thread), addr, buffer[i]);
if (errno)
{
- fprintf(stderr, "\
+ fprintf (stderr, "\
ptrace (PTRACE_POKETEXT): errno=%d, pid=0x%x, addr=0x%x, buffer[i] = 0x%x\n",
- errno, BUILDPID (inferior_pid, general_thread),
- addr, buffer[i]);
- fprintf(stderr, "Sleeping for 1 second\n");
- sleep(1);
+ errno, BUILDPID (inferior_pid, general_thread),
+ addr, buffer[i]);
+ fprintf (stderr, "Sleeping for 1 second\n");
+ sleep (1);
}
else
break;
diff --git a/gdb/gdbserver/low-sim.c b/gdb/gdbserver/low-sim.c
index 8ad6e91..ebd5f7d 100644
--- a/gdb/gdbserver/low-sim.c
+++ b/gdb/gdbserver/low-sim.c
@@ -1,27 +1,28 @@
/* Low level interface to simulators, for the remote server for GDB.
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
-This file is part of GDB.
+ This file is part of GDB.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
#include "defs.h"
#include "bfd.h"
#include "server.h"
-#include "callback.h" /* GDB simulator callback interface */
-#include "remote-sim.h" /* GDB simulator interface */
+#include "callback.h" /* GDB simulator callback interface */
+#include "remote-sim.h" /* GDB simulator interface */
extern int remote_debug;
@@ -29,7 +30,7 @@ extern host_callback default_callback; /* in sim/common/callback.c */
char registers[REGISTER_BYTES] __attribute__ ((aligned));
-int target_byte_order; /* used by simulator */
+int target_byte_order; /* used by simulator */
/* We record the result of sim_open so we can pass it
back to the other sim_foo routines. */
@@ -40,13 +41,13 @@ static SIM_DESC gdbsim_desc = 0;
static void
generic_load (loadfile_bfd)
- bfd *loadfile_bfd;
+ bfd *loadfile_bfd;
{
asection *s;
- for (s = loadfile_bfd->sections; s; s = s->next)
+ for (s = loadfile_bfd->sections; s; s = s->next)
{
- if (s->flags & SEC_LOAD)
+ if (s->flags & SEC_LOAD)
{
bfd_size_type size;
@@ -60,11 +61,11 @@ generic_load (loadfile_bfd)
lma = s->lma;
/* Is this really necessary? I guess it gives the user something
- to look at during a long download. */
+ to look at during a long download. */
printf ("Loading section %s, size 0x%lx lma 0x%lx\n",
bfd_get_section_name (loadfile_bfd, s),
(unsigned long) size,
- (unsigned long) lma); /* chops high 32 bits. FIXME!! */
+ (unsigned long) lma); /* chops high 32 bits. FIXME!! */
bfd_get_section_contents (loadfile_bfd, s, buffer, 0, size);
@@ -75,11 +76,11 @@ generic_load (loadfile_bfd)
}
printf ("Start address 0x%lx\n",
- (unsigned long)loadfile_bfd->start_address);
+ (unsigned long) loadfile_bfd->start_address);
/* We were doing this in remote-mips.c, I suspect it is right
for other targets too. */
- /* write_pc (loadfile_bfd->start_address); */ /* FIXME!! */
+ /* write_pc (loadfile_bfd->start_address); *//* FIXME!! */
}
int
@@ -95,9 +96,9 @@ create_inferior (program, argv)
#endif
abfd = bfd_openr (program, 0);
- if (!abfd)
+ if (!abfd)
{
- fprintf (stderr, "gdbserver: can't open %s: %s\n",
+ fprintf (stderr, "gdbserver: can't open %s: %s\n",
program, bfd_errmsg (bfd_get_error ()));
exit (1);
}
@@ -166,7 +167,7 @@ fetch_inferior_registers (regno)
int regno;
{
if (regno == -1 || regno == 0)
- for (regno = 0; regno < NUM_REGS/*-NUM_FREGS*/; regno++)
+ for (regno = 0; regno < NUM_REGS /*-NUM_FREGS*/ ; regno++)
fetch_register (regno);
else
fetch_register (regno);
@@ -180,7 +181,7 @@ void
store_inferior_registers (regno)
int regno;
{
- if (regno == -1)
+ if (regno == -1)
{
for (regno = 0; regno < NUM_REGS; regno++)
store_inferior_registers (regno);
@@ -224,7 +225,7 @@ mywait (status)
return sigrc;
#endif
- default: /* should this be sim_signalled or sim_stopped? FIXME!! */
+ default: /* should this be sim_signalled or sim_stopped? FIXME!! */
if (remote_debug)
printf ("\nChild received signal = %x \n", sigrc);
fetch_inferior_registers (0);
@@ -270,7 +271,7 @@ write_inferior_memory (memaddr, myaddr, len)
char *myaddr;
int len;
{
- sim_write (gdbsim_desc, memaddr, myaddr, len); /* should check for error. FIXME!! */
+ sim_write (gdbsim_desc, memaddr, myaddr, len); /* should check for error. FIXME!! */
return 0;
}
diff --git a/gdb/gdbserver/low-sparc.c b/gdb/gdbserver/low-sparc.c
index ddffaec..9dd70a2 100644
--- a/gdb/gdbserver/low-sparc.c
+++ b/gdb/gdbserver/low-sparc.c
@@ -1,21 +1,22 @@
/* Low level interface to ptrace, for the remote server for GDB.
Copyright (C) 1986, 1987, 1993 Free Software Foundation, Inc.
-This file is part of GDB.
+ This file is part of GDB.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
#include "defs.h"
#include <sys/wait.h>
@@ -95,7 +96,7 @@ kill_inferior ()
return;
ptrace (8, inferior_pid, 0, 0);
wait (0);
- /*************inferior_died ();****VK**************/
+/*************inferior_died ();****VK**************/
}
/* Return nonzero if the given thread is still alive. */
@@ -172,32 +173,32 @@ fetch_inferior_registers (ignored)
to the stack pointer. */
if (ptrace (PTRACE_GETREGS, inferior_pid,
- (PTRACE_ARG3_TYPE) &inferior_registers, 0))
- perror("ptrace_getregs");
-
+ (PTRACE_ARG3_TYPE) & inferior_registers, 0))
+ perror ("ptrace_getregs");
+
registers[REGISTER_BYTE (0)] = 0;
memcpy (&registers[REGISTER_BYTE (1)], &inferior_registers.r_g1,
15 * REGISTER_RAW_SIZE (G0_REGNUM));
- *(int *)&registers[REGISTER_BYTE (PS_REGNUM)] = inferior_registers.r_ps;
- *(int *)&registers[REGISTER_BYTE (PC_REGNUM)] = inferior_registers.r_pc;
- *(int *)&registers[REGISTER_BYTE (NPC_REGNUM)] = inferior_registers.r_npc;
- *(int *)&registers[REGISTER_BYTE (Y_REGNUM)] = inferior_registers.r_y;
+ *(int *) &registers[REGISTER_BYTE (PS_REGNUM)] = inferior_registers.r_ps;
+ *(int *) &registers[REGISTER_BYTE (PC_REGNUM)] = inferior_registers.r_pc;
+ *(int *) &registers[REGISTER_BYTE (NPC_REGNUM)] = inferior_registers.r_npc;
+ *(int *) &registers[REGISTER_BYTE (Y_REGNUM)] = inferior_registers.r_y;
/* Floating point registers */
if (ptrace (PTRACE_GETFPREGS, inferior_pid,
- (PTRACE_ARG3_TYPE) &inferior_fp_registers,
+ (PTRACE_ARG3_TYPE) & inferior_fp_registers,
0))
- perror("ptrace_getfpregs");
+ perror ("ptrace_getfpregs");
memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers,
sizeof inferior_fp_registers.fpu_fr);
/* These regs are saved on the stack by the kernel. Only read them
all (16 ptrace calls!) if we really need them. */
- read_inferior_memory (*(CORE_ADDR*)&registers[REGISTER_BYTE (SP_REGNUM)],
+ read_inferior_memory (*(CORE_ADDR *) & registers[REGISTER_BYTE (SP_REGNUM)],
&registers[REGISTER_BYTE (L0_REGNUM)],
- 16*REGISTER_RAW_SIZE (L0_REGNUM));
+ 16 * REGISTER_RAW_SIZE (L0_REGNUM));
}
/* Store our register values back into the inferior.
@@ -210,33 +211,33 @@ store_inferior_registers (ignored)
{
struct regs inferior_registers;
struct fp_status inferior_fp_registers;
- CORE_ADDR sp = *(CORE_ADDR *)&registers[REGISTER_BYTE (SP_REGNUM)];
+ CORE_ADDR sp = *(CORE_ADDR *) & registers[REGISTER_BYTE (SP_REGNUM)];
write_inferior_memory (sp, &registers[REGISTER_BYTE (L0_REGNUM)],
- 16*REGISTER_RAW_SIZE (L0_REGNUM));
+ 16 * REGISTER_RAW_SIZE (L0_REGNUM));
memcpy (&inferior_registers.r_g1, &registers[REGISTER_BYTE (G1_REGNUM)],
15 * REGISTER_RAW_SIZE (G1_REGNUM));
inferior_registers.r_ps =
- *(int *)&registers[REGISTER_BYTE (PS_REGNUM)];
+ *(int *) &registers[REGISTER_BYTE (PS_REGNUM)];
inferior_registers.r_pc =
- *(int *)&registers[REGISTER_BYTE (PC_REGNUM)];
+ *(int *) &registers[REGISTER_BYTE (PC_REGNUM)];
inferior_registers.r_npc =
- *(int *)&registers[REGISTER_BYTE (NPC_REGNUM)];
+ *(int *) &registers[REGISTER_BYTE (NPC_REGNUM)];
inferior_registers.r_y =
- *(int *)&registers[REGISTER_BYTE (Y_REGNUM)];
+ *(int *) &registers[REGISTER_BYTE (Y_REGNUM)];
if (ptrace (PTRACE_SETREGS, inferior_pid,
- (PTRACE_ARG3_TYPE) &inferior_registers, 0))
- perror("ptrace_setregs");
+ (PTRACE_ARG3_TYPE) & inferior_registers, 0))
+ perror ("ptrace_setregs");
memcpy (&inferior_fp_registers, &registers[REGISTER_BYTE (FP0_REGNUM)],
sizeof inferior_fp_registers.fpu_fr);
if (ptrace (PTRACE_SETFPREGS, inferior_pid,
- (PTRACE_ARG3_TYPE) &inferior_fp_registers, 0))
- perror("ptrace_setfpregs");
+ (PTRACE_ARG3_TYPE) & inferior_fp_registers, 0))
+ perror ("ptrace_setfpregs");
}
/* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory
diff --git a/gdb/gdbserver/low-sun3.c b/gdb/gdbserver/low-sun3.c
index c84b79f..11f1d8a 100644
--- a/gdb/gdbserver/low-sun3.c
+++ b/gdb/gdbserver/low-sun3.c
@@ -1,21 +1,22 @@
/* Low level interface to ptrace, for the remote server for GDB.
Copyright (C) 1986, 1987, 1993 Free Software Foundation, Inc.
-This file is part of GDB.
+ This file is part of GDB.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
#include "defs.h"
#include "<sys/wait.h>"
@@ -92,7 +93,7 @@ kill_inferior ()
return;
ptrace (8, inferior_pid, 0, 0);
wait (0);
- /*************inferior_died ();****VK**************/
+/*************inferior_died ();****VK**************/
}
/* Return nonzero if the given thread is still alive. */
@@ -162,25 +163,25 @@ fetch_inferior_registers (ignored)
struct fp_status inferior_fp_registers;
ptrace (PTRACE_GETREGS, inferior_pid,
- (PTRACE_ARG3_TYPE) &inferior_registers);
+ (PTRACE_ARG3_TYPE) & inferior_registers);
#ifdef FP0_REGNUM
ptrace (PTRACE_GETFPREGS, inferior_pid,
- (PTRACE_ARG3_TYPE) &inferior_fp_registers);
-#endif
-
+ (PTRACE_ARG3_TYPE) & inferior_fp_registers);
+#endif
+
memcpy (registers, &inferior_registers, 16 * 4);
#ifdef FP0_REGNUM
memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers,
sizeof inferior_fp_registers.fps_regs);
-#endif
- *(int *)&registers[REGISTER_BYTE (PS_REGNUM)] = inferior_registers.r_ps;
- *(int *)&registers[REGISTER_BYTE (PC_REGNUM)] = inferior_registers.r_pc;
+#endif
+ *(int *) &registers[REGISTER_BYTE (PS_REGNUM)] = inferior_registers.r_ps;
+ *(int *) &registers[REGISTER_BYTE (PC_REGNUM)] = inferior_registers.r_pc;
#ifdef FP0_REGNUM
memcpy
(&registers[REGISTER_BYTE (FPC_REGNUM)],
&inferior_fp_registers.fps_control,
sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs);
-#endif
+#endif
}
/* Store our register values back into the inferior.
@@ -200,8 +201,8 @@ store_inferior_registers (ignored)
&registers[REGISTER_BYTE (FP0_REGNUM)],
sizeof inferior_fp_registers.fps_regs);
#endif
- inferior_registers.r_ps = *(int *)&registers[REGISTER_BYTE (PS_REGNUM)];
- inferior_registers.r_pc = *(int *)&registers[REGISTER_BYTE (PC_REGNUM)];
+ inferior_registers.r_ps = *(int *) &registers[REGISTER_BYTE (PS_REGNUM)];
+ inferior_registers.r_pc = *(int *) &registers[REGISTER_BYTE (PC_REGNUM)];
#ifdef FP0_REGNUM
memcpy (&inferior_fp_registers.fps_control,
@@ -211,10 +212,10 @@ store_inferior_registers (ignored)
#endif
ptrace (PTRACE_SETREGS, inferior_pid,
- (PTRACE_ARG3_TYPE) &inferior_registers);
+ (PTRACE_ARG3_TYPE) & inferior_registers);
#if FP0_REGNUM
ptrace (PTRACE_SETFPREGS, inferior_pid,
- (PTRACE_ARG3_TYPE) &inferior_fp_registers);
+ (PTRACE_ARG3_TYPE) & inferior_fp_registers);
#endif
}
diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
index 0a7e0fb..4dab2ab 100644
--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -1,21 +1,22 @@
/* Remote utility routines for the remote server for GDB.
Copyright (C) 1986, 1989, 1993 Free Software Foundation, Inc.
-This file is part of GDB.
+ This file is part of GDB.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
#include "server.h"
#include "terminal.h"
@@ -53,17 +54,17 @@ remote_open (name)
#ifdef HAVE_TERMIOS
{
struct termios termios;
- tcgetattr(remote_desc, &termios);
+ tcgetattr (remote_desc, &termios);
termios.c_iflag = 0;
termios.c_oflag = 0;
termios.c_lflag = 0;
- termios.c_cflag &= ~(CSIZE|PARENB);
+ termios.c_cflag &= ~(CSIZE | PARENB);
termios.c_cflag |= CLOCAL | CS8;
termios.c_cc[VMIN] = 0;
termios.c_cc[VTIME] = 0;
- tcsetattr(remote_desc, TCSANOW, &termios);
+ tcsetattr (remote_desc, TCSANOW, &termios);
}
#endif
@@ -75,7 +76,7 @@ remote_open (name)
termio.c_iflag = 0;
termio.c_oflag = 0;
termio.c_lflag = 0;
- termio.c_cflag &= ~(CSIZE|PARENB);
+ termio.c_cflag &= ~(CSIZE | PARENB);
termio.c_cflag |= CLOCAL | CS8;
termio.c_cc[VMIN] = 0;
termio.c_cc[VTIME] = 0;
@@ -115,19 +116,19 @@ remote_open (name)
/* Allow rapid reuse of this port. */
tmp = 1;
- setsockopt (tmp_desc, SOL_SOCKET, SO_REUSEADDR, (char *)&tmp,
- sizeof(tmp));
+ setsockopt (tmp_desc, SOL_SOCKET, SO_REUSEADDR, (char *) &tmp,
+ sizeof (tmp));
sockaddr.sin_family = PF_INET;
- sockaddr.sin_port = htons(port);
+ sockaddr.sin_port = htons (port);
sockaddr.sin_addr.s_addr = INADDR_ANY;
- if (bind (tmp_desc, (struct sockaddr *)&sockaddr, sizeof (sockaddr))
+ if (bind (tmp_desc, (struct sockaddr *) &sockaddr, sizeof (sockaddr))
|| listen (tmp_desc, 1))
perror_with_name ("Can't bind address");
tmp = sizeof (sockaddr);
- remote_desc = accept (tmp_desc, (struct sockaddr *)&sockaddr, &tmp);
+ remote_desc = accept (tmp_desc, (struct sockaddr *) &sockaddr, &tmp);
if (remote_desc == -1)
perror_with_name ("Accept failed");
@@ -137,18 +138,18 @@ remote_open (name)
/* Enable TCP keep alive process. */
tmp = 1;
- setsockopt (tmp_desc, SOL_SOCKET, SO_KEEPALIVE, (char *)&tmp, sizeof(tmp));
+ setsockopt (tmp_desc, SOL_SOCKET, SO_KEEPALIVE, (char *) &tmp, sizeof (tmp));
/* Tell TCP not to delay small packets. This greatly speeds up
- interactive response. */
+ interactive response. */
tmp = 1;
setsockopt (remote_desc, protoent->p_proto, TCP_NODELAY,
- (char *)&tmp, sizeof(tmp));
+ (char *) &tmp, sizeof (tmp));
close (tmp_desc); /* No longer need this */
- signal (SIGPIPE, SIG_IGN); /* If we don't do this, then gdbserver simply
- exits when the remote side dies. */
+ signal (SIGPIPE, SIG_IGN); /* If we don't do this, then gdbserver simply
+ exits when the remote side dies. */
}
#if defined(F_SETFL) && defined (FASYNC)
@@ -160,7 +161,7 @@ remote_open (name)
}
void
-remote_close()
+remote_close ()
{
close (remote_desc);
}
@@ -260,7 +261,7 @@ putpkt (buf)
will cause us to send a SIGINT to the child. */
static void
-input_interrupt()
+input_interrupt ()
{
int cc;
char c;
@@ -269,7 +270,7 @@ input_interrupt()
if (cc != 1 || c != '\003')
{
- fprintf(stderr, "input_interrupt, cc = %d c = %d\n", cc, c);
+ fprintf (stderr, "input_interrupt, cc = %d c = %d\n", cc, c);
return;
}
@@ -277,13 +278,13 @@ input_interrupt()
}
void
-enable_async_io()
+enable_async_io ()
{
signal (SIGIO, input_interrupt);
}
void
-disable_async_io()
+disable_async_io ()
{
signal (SIGIO, SIG_IGN);
}
@@ -358,7 +359,7 @@ getpkt (buf)
c1 = fromhex (readchar ());
c2 = fromhex (readchar ());
-
+
if (csum == (c1 << 4) + c2)
break;
@@ -430,7 +431,7 @@ convert_ascii_to_int (from, to, n)
}
static char *
-outreg(regno, buf)
+outreg (regno, buf)
int regno;
char *buf;
{
@@ -479,7 +480,7 @@ prepare_resume_reply (buf, status, signo)
#endif
/* If the debugger hasn't used any thread features, don't burden it with
- threads. If we didn't check this, GDB 4.13 and older would choke. */
+ threads. If we didn't check this, GDB 4.13 and older would choke. */
if (cont_thread != 0)
{
if (old_thread_from_wait != thread_from_wait)
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index cdec0f8..66afb88 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -1,21 +1,22 @@
/* Main code for remote server for GDB.
Copyright (C) 1989, 1993 Free Software Foundation, Inc.
-This file is part of GDB.
+ This file is part of GDB.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
#include "server.h"
@@ -52,14 +53,14 @@ main (argc, argv)
unsigned int len;
CORE_ADDR mem_addr;
- if (setjmp(toplevel))
+ if (setjmp (toplevel))
{
- fprintf(stderr, "Exiting\n");
- exit(1);
+ fprintf (stderr, "Exiting\n");
+ exit (1);
}
if (argc < 3)
- error("Usage: gdbserver tty prog [args ...]");
+ error ("Usage: gdbserver tty prog [args ...]");
/* Wait till we are at first instruction in program. */
signal = start_inferior (&argv[2], &status);
@@ -70,8 +71,8 @@ main (argc, argv)
{
remote_open (argv[1]);
-restart:
- setjmp(toplevel);
+ restart:
+ setjmp (toplevel);
while (getpkt (own_buf) > 0)
{
unsigned char sig;
@@ -154,7 +155,7 @@ restart:
fprintf (stderr, "Killing inferior\n");
kill_inferior ();
/* When using the extended protocol, we start up a new
- debugging session. The traditional protocol will
+ debugging session. The traditional protocol will
exit instead. */
if (extended_protocol)
{
@@ -179,7 +180,7 @@ restart:
break;
case 'R':
/* Restarting the inferior is only supported in the
- extended protocol. */
+ extended protocol. */
if (extended_protocol)
{
kill_inferior ();
@@ -201,8 +202,8 @@ restart:
}
default:
/* It is a request we don't understand. Respond with an
- empty packet so that gdb knows that we don't support this
- request. */
+ empty packet so that gdb knows that we don't support this
+ request. */
own_buf[0] = '\0';
break;
}
@@ -238,11 +239,11 @@ restart:
/* We come here when getpkt fails.
- For the extended remote protocol we exit (and this is the only
- way we gracefully exit!).
+ For the extended remote protocol we exit (and this is the only
+ way we gracefully exit!).
- For the traditional remote protocol close the connection,
- and re-open it at the top of the loop. */
+ For the traditional remote protocol close the connection,
+ and re-open it at the top of the loop. */
if (extended_protocol)
{
remote_close ();
diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h
index e23c773..bfc89c7 100644
--- a/gdb/gdbserver/server.h
+++ b/gdb/gdbserver/server.h
@@ -1,21 +1,22 @@
/* Common definitions for remote server for GDB.
Copyright (C) 1993 Free Software Foundation, Inc.
-This file is part of GDB.
+ This file is part of GDB.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
#include "defs.h"
#include <setjmp.h>
@@ -61,10 +62,10 @@ void convert_ascii_to_int PARAMS ((char *from, char *to, int n));
void convert_int_to_ascii PARAMS ((char *from, char *to, int n));
void prepare_resume_reply PARAMS ((char *buf, char status, unsigned char sig));
-void decode_m_packet PARAMS ((char *from, CORE_ADDR *mem_addr_ptr,
- unsigned int *len_ptr));
-void decode_M_packet PARAMS ((char *from, CORE_ADDR *mem_addr_ptr,
- unsigned int *len_ptr, char *to));
+void decode_m_packet PARAMS ((char *from, CORE_ADDR * mem_addr_ptr,
+ unsigned int *len_ptr));
+void decode_M_packet PARAMS ((char *from, CORE_ADDR * mem_addr_ptr,
+ unsigned int *len_ptr, char *to));
/* Functions from utils.c */
diff --git a/gdb/gdbserver/utils.c b/gdb/gdbserver/utils.c
index 63d522c..ecff057 100644
--- a/gdb/gdbserver/utils.c
+++ b/gdb/gdbserver/utils.c
@@ -1,21 +1,22 @@
/* General utility routines for the remote server for GDB.
Copyright (C) 1986, 1989, 1993 Free Software Foundation, Inc.
-This file is part of GDB.
+ This file is part of GDB.
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
#include "server.h"
#include <stdio.h>
@@ -56,7 +57,7 @@ perror_with_name (string)
#ifdef ANSI_PROTOTYPES
NORETURN void
-error (const char *string, ...)
+error (const char *string,...)
#else
void
error (va_alist)
@@ -82,7 +83,7 @@ error (va_alist)
}
#endif
fprintf (stderr, "\n");
- longjmp(toplevel, 1);
+ longjmp (toplevel, 1);
}
/* Print an error message and exit reporting failure.
@@ -92,7 +93,7 @@ error (va_alist)
/* VARARGS */
NORETURN void
#ifdef ANSI_PROTOTYPES
-fatal (char *string, ...)
+fatal (char *string,...)
#else
fatal (va_alist)
va_dcl