* i387-fp.c, linux-arm-low.c, linux-cris-low.c,

linux-crisv32-low.c, linux-i386-low.c, linux-low.c,
	linux-mips-low.c, linux-s390-low.c, linux-sparc-low.c,
	linux-x86-64-low.c, linux-xtensa-low.c, proc-service.c,
	regcache.c, remote-utils.c, server.c, spu-low.c, target.h,
	thread-db.c, win32-low.c, xtensa-xtregs.c, gdbreplay.c,
	Makefile.in, configure.ac: Fix whitespace throughout.
	* configure: Regenerate.
This commit is contained in:
Pedro Alves 2009-03-22 23:57:10 +00:00
parent a07b2135db
commit 1b3f60162b
25 changed files with 279 additions and 265 deletions

View File

@ -1,3 +1,14 @@
2009-03-22 Pedro Alves <pedro@codesourcery.com>
* i387-fp.c, linux-arm-low.c, linux-cris-low.c,
linux-crisv32-low.c, linux-i386-low.c, linux-low.c,
linux-mips-low.c, linux-s390-low.c, linux-sparc-low.c,
linux-x86-64-low.c, linux-xtensa-low.c, proc-service.c,
regcache.c, remote-utils.c, server.c, spu-low.c, target.h,
thread-db.c, win32-low.c, xtensa-xtregs.c, gdbreplay.c,
Makefile.in, configure.ac: Fix whitespace throughout.
* configure: Regenerate.
2009-03-22 Pedro Alves <pedro@codesourcery.com>
* inferiors.c (find_inferior): Make it safe for the callback

View File

@ -8,12 +8,12 @@
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 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.
#
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
@ -57,7 +57,7 @@ srcdir = @srcdir@
VPATH = @srcdir@
# It is also possible that you will need to add -I/usr/include/sys to the
# CFLAGS section if your system doesn't have fcntl.h in /usr/include (which
# CFLAGS section if your system doesn't have fcntl.h in /usr/include (which
# is where it should be according to Posix).
# Set this up with gcc if you have gnu ld and the loader will print out
@ -122,7 +122,7 @@ DEPFILES = @GDBSERVER_DEPFILES@
LIBOBJS = @LIBOBJS@
SOURCES = $(SFILES)
TAGFILES = $(SOURCES) ${HFILES} ${ALLPARAM} ${POSSLIBS}
TAGFILES = $(SOURCES) ${HFILES} ${ALLPARAM} ${POSSLIBS}
OBS = inferiors.o regcache.o remote-utils.o server.o signals.o target.o \
utils.o version.o \
@ -146,12 +146,12 @@ XML_BUILTIN = @srv_xmlbuiltin@
all: gdbserver$(EXEEXT) gdbreplay$(EXEEXT)
# Traditionally "install" depends on "all". But it may be useful
# not to; for example, if the user has made some trivial change to a
# not to; for example, if the user has made some trivial change to a
# source file and doesn't care about rebuilding or just wants to save the
# time it takes for make to check that all is up to date.
# install-only is intended to address that need.
install: all install-only
install-only:
install-only:
n=`echo gdbserver | sed '$(program_transform_name)'`; \
if [ x$$n = x ]; then n=gdbserver; else true; fi; \
$(SHELL) $(srcdir)/../../mkinstalldirs $(DESTDIR)$(bindir); \

View File

@ -2984,7 +2984,7 @@ done
for ac_header in sgtty.h termio.h termios.h sys/reg.h string.h proc_service.h sys/procfs.h thread_db.h linux/elf.h stdlib.h unistd.h errno.h fcntl.h signal.h sys/file.h malloc.h sys/ioctl.h netinet/in.h sys/socket.h netdb.h netinet/tcp.h arpa/inet.h sys/wait.h
for ac_header in sgtty.h termio.h termios.h sys/reg.h string.h proc_service.h sys/procfs.h thread_db.h linux/elf.h stdlib.h unistd.h errno.h fcntl.h signal.h sys/file.h malloc.h sys/ioctl.h netinet/in.h sys/socket.h netdb.h netinet/tcp.h arpa/inet.h sys/wait.h
do
as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
if eval "test \"\${$as_ac_Header+set}\" = set"; then

View File

@ -39,7 +39,7 @@ AC_HEADER_STDC
AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h dnl
proc_service.h sys/procfs.h thread_db.h linux/elf.h dnl
stdlib.h unistd.h dnl
errno.h fcntl.h signal.h sys/file.h malloc.h dnl
errno.h fcntl.h signal.h sys/file.h malloc.h dnl
sys/ioctl.h netinet/in.h sys/socket.h netdb.h dnl
netinet/tcp.h arpa/inet.h sys/wait.h)
AC_CHECK_FUNCS(pread pwrite pread64)
@ -159,8 +159,8 @@ if test "$srv_linux_thread_db" = "yes"; then
USE_THREAD_DB="-DUSE_THREAD_DB"
AC_CACHE_CHECK([for TD_VERSION], gdbsrv_cv_have_td_version,
[AC_TRY_COMPILE([#include <thread_db.h>], [TD_VERSION;],
[gdbsrv_cv_have_td_version=yes],
[gdbsrv_cv_have_td_version=no])])
[gdbsrv_cv_have_td_version=yes],
[gdbsrv_cv_have_td_version=no])])
if test $gdbsrv_cv_have_td_version = yes; then
AC_DEFINE(HAVE_TD_VERSION, 1, [Define if TD_VERSION is available.])
fi

View File

@ -236,7 +236,7 @@ remote_open (char *name)
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, IPPROTO_TCP, TCP_NODELAY,
(char *) &tmp, sizeof (tmp));

View File

@ -124,7 +124,7 @@ i387_fsave_to_cache (const void *buf)
supply_register_by_name ("fioff", &fp->fioff);
supply_register_by_name ("fooff", &fp->fooff);
/* Some registers are 16-bit. */
val = fp->fctrl & 0xFFFF;
supply_register_by_name ("fctrl", &val);
@ -163,7 +163,7 @@ i387_cache_to_fxsave (void *buf)
collect_register_by_name ("fioff", &fp->fioff);
collect_register_by_name ("fooff", &fp->fooff);
collect_register_by_name ("mxcsr", &fp->mxcsr);
/* This one's 11 bits... */
collect_register_by_name ("fop", &val2);
fp->fop = (val2 & 0x7FF) | (fp->fop & 0xF800);
@ -207,7 +207,7 @@ i387_ftag (struct i387_fxsave *fp, int regno)
exponent = (((raw[9] & 0x7f) << 8) | raw[8]);
fraction[0] = ((raw[3] << 24) | (raw[2] << 16) | (raw[1] << 8) | raw[0]);
fraction[1] = (((raw[7] & 0x7f) << 24) | (raw[6] << 16)
| (raw[5] << 8) | raw[4]);
| (raw[5] << 8) | raw[4]);
if (exponent == 0x7fff)
{
@ -217,28 +217,28 @@ i387_ftag (struct i387_fxsave *fp, int regno)
else if (exponent == 0x0000)
{
if (fraction[0] == 0x0000 && fraction[1] == 0x0000 && !integer)
{
/* Zero. */
return (1);
}
{
/* Zero. */
return (1);
}
else
{
/* Special. */
return (2);
}
{
/* Special. */
return (2);
}
}
else
{
if (integer)
{
/* Valid. */
return (0);
}
{
/* Valid. */
return (0);
}
else
{
/* Special. */
return (2);
}
{
/* Special. */
return (2);
}
}
}
@ -259,7 +259,7 @@ i387_fxsave_to_cache (const void *buf)
supply_register_by_name ("fioff", &fp->fioff);
supply_register_by_name ("fooff", &fp->fooff);
supply_register_by_name ("mxcsr", &fp->mxcsr);
/* Some registers are 16-bit. */
val = fp->fctrl & 0xFFFF;
supply_register_by_name ("fctrl", &val);

View File

@ -195,7 +195,7 @@ arm_reinsert_addr ()
ps_err_e
ps_get_thread_area (const struct ps_prochandle *ph,
lwpid_t lwpid, int idx, void **base)
lwpid_t lwpid, int idx, void **base)
{
if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
return PS_ERR;

View File

@ -38,7 +38,7 @@ static int cris_regmap[] = {
-1, 17*4, -1, 16*4,
-1, -1, -1, 18*4,
-1, 17*4, -1, -1
};
static int
@ -46,7 +46,7 @@ cris_cannot_store_register (int regno)
{
if (cris_regmap[regno] == -1)
return 1;
return (regno >= cris_num_regs);
}

View File

@ -44,11 +44,11 @@ static int cris_regmap[] = {
25*4,
26*4, -1, -1, 29*4,
26*4, -1, -1, 29*4,
30*4, 31*4, 32*4, 33*4,
34*4, 35*4, 36*4, 37*4,
38*4, 39*4, 40*4, -1
};
extern int debug_threads;
@ -143,7 +143,7 @@ cris_insert_watchpoint (char type, CORE_ADDR addr, int len)
unsigned long bp_ctrl;
unsigned long start, end;
unsigned long ccs;
/* Breakpoint/watchpoint types (GDB terminology):
0 = memory breakpoint for instructions
(not supported; done via memory write instead)
@ -151,8 +151,8 @@ cris_insert_watchpoint (char type, CORE_ADDR addr, int len)
2 = write watchpoint (supported)
3 = read watchpoint (supported)
4 = access watchpoint (supported). */
if (type < '2' || type > '4')
if (type < '2' || type > '4')
{
/* Unsupported. */
return 1;
@ -172,17 +172,17 @@ cris_insert_watchpoint (char type, CORE_ADDR addr, int len)
be used. Also, if a watch for a region that is already
covered by one or more existing watchpoints, a new
watchpoint will be used. */
/* First, find a free data watchpoint. */
for (bp = 0; bp < 6; bp++)
{
/* Each data watchpoint's control registers occupy 2 bits
(hence the 3), starting at bit 2 for D0 (hence the 2)
with 4 bits between for each watchpoint (yes, the 4). */
if (!(bp_ctrl & (0x3 << (2 + (bp * 4)))))
if (!(bp_ctrl & (0x3 << (2 + (bp * 4)))))
break;
}
if (bp > 5)
{
/* We're out of watchpoints. */
@ -195,15 +195,15 @@ cris_insert_watchpoint (char type, CORE_ADDR addr, int len)
/* Trigger on read. */
bp_ctrl |= (1 << (2 + bp * 4));
}
if (type == '2' || type == '4')
if (type == '2' || type == '4')
{
/* Trigger on write. */
bp_ctrl |= (2 << (2 + bp * 4));
}
/* Setup the configuration register. */
supply_register_by_name ("s0", &bp_ctrl);
/* Setup the range. */
start = addr;
end = addr + len - 1;
@ -225,7 +225,7 @@ cris_remove_watchpoint (char type, CORE_ADDR addr, int len)
int bp;
unsigned long bp_ctrl;
unsigned long start, end;
/* Breakpoint/watchpoint types:
0 = memory breakpoint for instructions
(not supported; done via memory write instead)
@ -235,18 +235,18 @@ cris_remove_watchpoint (char type, CORE_ADDR addr, int len)
4 = access watchpoint (supported). */
if (type < '2' || type > '4')
return -1;
/* Read watchpoints are set as access watchpoints, because of GDB's
inability to deal with pure read watchpoints. */
if (type == '3')
type = '4';
/* Get the configuration register. */
collect_register_by_name ("s0", &bp_ctrl);
/* Try to find a watchpoint that is configured for the
specified range, then check that read/write also matches. */
/* Ugly pointer arithmetic, since I cannot rely on a
single switch (addr) as there may be several watchpoints with
the same start address for example. */
@ -267,19 +267,19 @@ cris_remove_watchpoint (char type, CORE_ADDR addr, int len)
collect_register_by_name ("s13", &bp_d_regs[10]);
collect_register_by_name ("s14", &bp_d_regs[11]);
for (bp = 0; bp < 6; bp++)
for (bp = 0; bp < 6; bp++)
{
if (bp_d_regs[bp * 2] == addr
if (bp_d_regs[bp * 2] == addr
&& bp_d_regs[bp * 2 + 1] == (addr + len - 1)) {
/* Matching range. */
int bitpos = 2 + bp * 4;
int rw_bits;
/* Read/write bits for this BP. */
rw_bits = (bp_ctrl & (0x3 << bitpos)) >> bitpos;
if ((type == '3' && rw_bits == 0x1)
|| (type == '2' && rw_bits == 0x2)
|| (type == '2' && rw_bits == 0x2)
|| (type == '4' && rw_bits == 0x3))
{
/* Read/write matched. */
@ -287,13 +287,13 @@ cris_remove_watchpoint (char type, CORE_ADDR addr, int len)
}
}
}
if (bp > 5)
{
/* No watchpoint matched. */
return -1;
}
/* Found a matching watchpoint. Now, deconfigure it by
both disabling read/write in bp_ctrl and zeroing its
start/end addresses. */

View File

@ -45,7 +45,7 @@ void init_registers_i386_linux (void);
/* Mapping between the general-purpose registers in `struct user'
format and GDB's register array layout. */
static int i386_regmap[] =
static int i386_regmap[] =
{
EAX * 4, ECX * 4, EDX * 4, EBX * 4,
UESP * 4, EBP * 4, ESI * 4, EDI * 4,
@ -56,7 +56,7 @@ static int i386_regmap[] =
/* Called by libthread_db. */
ps_err_e
ps_get_thread_area (const struct ps_prochandle *ph,
ps_get_thread_area (const struct ps_prochandle *ph,
lwpid_t lwpid, int idx, void **base)
{
unsigned int desc[4];

View File

@ -340,25 +340,25 @@ linux_attach_lwp (unsigned long pid)
There are several cases to consider here:
1) gdbserver has already attached to the process and is being notified
of a new thread that is being created.
In this case we should ignore that SIGSTOP and resume the process.
This is handled below by setting stop_expected = 1.
of a new thread that is being created.
In this case we should ignore that SIGSTOP and resume the process.
This is handled below by setting stop_expected = 1.
2) This is the first thread (the process thread), and we're attaching
to it via attach_inferior.
In this case we want the process thread to stop.
This is handled by having linux_attach clear stop_expected after
we return.
??? If the process already has several threads we leave the other
threads running.
to it via attach_inferior.
In this case we want the process thread to stop.
This is handled by having linux_attach clear stop_expected after
we return.
??? If the process already has several threads we leave the other
threads running.
3) GDB is connecting to gdbserver and is requesting an enumeration of all
existing threads.
In this case we want the thread to stop.
FIXME: This case is currently not properly handled.
We should wait for the SIGSTOP but don't. Things work apparently
because enough time passes between when we ptrace (ATTACH) and when
gdb makes the next ptrace call on the thread.
existing threads.
In this case we want the thread to stop.
FIXME: This case is currently not properly handled.
We should wait for the SIGSTOP but don't. Things work apparently
because enough time passes between when we ptrace (ATTACH) and when
gdb makes the next ptrace call on the thread.
On the other hand, if we are currently trying to stop all threads, we
should treat the new thread as if we had sent it a SIGSTOP. This works
@ -900,11 +900,11 @@ linux_wait_for_event (struct thread_info *child)
/* If we were single-stepping, we definitely want to report the
SIGTRAP. The single-step operation has completed, so also
clear the stepping flag; in general this does not matter,
clear the stepping flag; in general this does not matter,
because the SIGTRAP will be reported to the client, which
will give us a new action for this thread, but clear it for
consistency anyway. It's safe to clear the stepping flag
because the only consumer of get_stop_pc () after this point
because the only consumer of get_stop_pc () after this point
is check_removed_breakpoint, and pending_is_breakpoint is not
set. It might be wiser to use a step_completed flag instead. */
if (event_child->stepping)
@ -989,7 +989,8 @@ retry:
{
if (WIFEXITED (w))
{
fprintf (stderr, "\nChild exited with retcode = %x \n", WEXITSTATUS (w));
fprintf (stderr, "\nChild exited with retcode = %x \n",
WEXITSTATUS (w));
*status = 'W';
clear_inferiors ();
free (all_lwps.head);
@ -998,7 +999,8 @@ retry:
}
else if (!WIFSTOPPED (w))
{
fprintf (stderr, "\nChild terminated with signal = %x \n", WTERMSIG (w));
fprintf (stderr, "\nChild terminated with signal = %x \n",
WTERMSIG (w));
*status = 'X';
clear_inferiors ();
free (all_lwps.head);
@ -1031,7 +1033,7 @@ kill_lwp (unsigned long lwpid, int signo)
{
int ret = syscall (SYS_tkill, lwpid, signo);
if (errno != ENOSYS)
return ret;
return ret;
errno = 0;
tkill_failed = 1;
}
@ -1160,8 +1162,8 @@ linux_resume_one_lwp (struct inferior_list_entry *entry,
current_inferior = get_lwp_thread (lwp);
if (debug_threads)
fprintf (stderr, "Resuming lwp %ld (%s, signal %d, stop %s)\n", inferior_pid,
step ? "step" : "continue", signal,
fprintf (stderr, "Resuming lwp %ld (%s, signal %d, stop %s)\n",
inferior_pid, step ? "step" : "continue", signal,
lwp->stop_expected ? "expected" : "not expected");
/* This bit needs some thinking about. If we get a signal that
@ -1423,8 +1425,8 @@ fetch_register (int regno)
regaddr = register_addr (regno);
if (regaddr == -1)
return;
size = (register_size (regno) + sizeof (PTRACE_XFER_TYPE) - 1)
& - sizeof (PTRACE_XFER_TYPE);
size = ((register_size (regno) + sizeof (PTRACE_XFER_TYPE) - 1)
& - sizeof (PTRACE_XFER_TYPE));
buf = alloca (size);
for (i = 0; i < size; i += sizeof (PTRACE_XFER_TYPE))
{
@ -1502,9 +1504,10 @@ usr_store_inferior_registers (int regno)
*(PTRACE_XFER_TYPE *) (buf + i));
if (errno != 0)
{
/* At this point, ESRCH should mean the process is already gone,
in which case we simply ignore attempts to change its registers.
See also the related comment in linux_resume_one_lwp. */
/* At this point, ESRCH should mean the process is
already gone, in which case we simply ignore attempts
to change its registers. See also the related
comment in linux_resume_one_lwp. */
if (errno == ESRCH)
return;
@ -1621,9 +1624,9 @@ regsets_store_inferior_registers ()
/* Only now do we write the register set. */
#ifndef __sparc__
res = ptrace (regset->set_request, inferior_pid, 0, buf);
res = ptrace (regset->set_request, inferior_pid, 0, buf);
#else
res = ptrace (regset->set_request, inferior_pid, buf, 0);
res = ptrace (regset->set_request, inferior_pid, buf, 0);
#endif
}
@ -1638,9 +1641,10 @@ regsets_store_inferior_registers ()
}
else if (errno == ESRCH)
{
/* At this point, ESRCH should mean the process is already gone,
in which case we simply ignore attempts to change its registers.
See also the related comment in linux_resume_one_lwp. */
/* At this point, ESRCH should mean the process is
already gone, in which case we simply ignore attempts
to change its registers. See also the related
comment in linux_resume_one_lwp. */
return 0;
}
else
@ -1740,13 +1744,16 @@ linux_read_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len)
for (i = 0; i < count; i++, addr += sizeof (PTRACE_XFER_TYPE))
{
errno = 0;
buffer[i] = ptrace (PTRACE_PEEKTEXT, inferior_pid, (PTRACE_ARG3_TYPE) addr, 0);
buffer[i] = ptrace (PTRACE_PEEKTEXT, inferior_pid,
(PTRACE_ARG3_TYPE) addr, 0);
if (errno)
return errno;
}
/* Copy appropriate bytes out of the buffer. */
memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (PTRACE_XFER_TYPE) - 1)), len);
memcpy (myaddr,
(char *) buffer + (memaddr & (sizeof (PTRACE_XFER_TYPE) - 1)),
len);
return 0;
}
@ -2059,17 +2066,17 @@ linux_read_offsets (CORE_ADDR *text_p, CORE_ADDR *data_p)
if (errno == 0)
{
/* Both text and data offsets produced at compile-time (and so
used by gdb) are relative to the beginning of the program,
with the data segment immediately following the text segment.
However, the actual runtime layout in memory may put the data
somewhere else, so when we send gdb a data base-address, we
use the real data base address and subtract the compile-time
data base-address from it (which is just the length of the
text segment). BSS immediately follows data in both
cases. */
used by gdb) are relative to the beginning of the program,
with the data segment immediately following the text segment.
However, the actual runtime layout in memory may put the data
somewhere else, so when we send gdb a data base-address, we
use the real data base address and subtract the compile-time
data base-address from it (which is just the length of the
text segment). BSS immediately follows data in both
cases. */
*text_p = text;
*data_p = data - (text_end - text);
return 1;
}
#endif
@ -2079,8 +2086,8 @@ linux_read_offsets (CORE_ADDR *text_p, CORE_ADDR *data_p)
static int
linux_qxfer_osdata (const char *annex,
unsigned char *readbuf, unsigned const char *writebuf,
CORE_ADDR offset, int len)
unsigned char *readbuf, unsigned const char *writebuf,
CORE_ADDR offset, int len)
{
/* We make the process list snapshot when the object starts to be
read. */
@ -2108,40 +2115,40 @@ linux_qxfer_osdata (const char *annex,
dirp = opendir ("/proc");
if (dirp)
{
struct dirent *dp;
while ((dp = readdir (dirp)) != NULL)
{
struct stat statbuf;
char procentry[sizeof ("/proc/4294967295")];
struct dirent *dp;
while ((dp = readdir (dirp)) != NULL)
{
struct stat statbuf;
char procentry[sizeof ("/proc/4294967295")];
if (!isdigit (dp->d_name[0])
|| strlen (dp->d_name) > sizeof ("4294967295") - 1)
continue;
if (!isdigit (dp->d_name[0])
|| strlen (dp->d_name) > sizeof ("4294967295") - 1)
continue;
sprintf (procentry, "/proc/%s", dp->d_name);
if (stat (procentry, &statbuf) == 0
&& S_ISDIR (statbuf.st_mode))
{
char pathname[128];
FILE *f;
char cmd[MAXPATHLEN + 1];
struct passwd *entry;
sprintf (procentry, "/proc/%s", dp->d_name);
if (stat (procentry, &statbuf) == 0
&& S_ISDIR (statbuf.st_mode))
{
char pathname[128];
FILE *f;
char cmd[MAXPATHLEN + 1];
struct passwd *entry;
sprintf (pathname, "/proc/%s/cmdline", dp->d_name);
entry = getpwuid (statbuf.st_uid);
sprintf (pathname, "/proc/%s/cmdline", dp->d_name);
entry = getpwuid (statbuf.st_uid);
if ((f = fopen (pathname, "r")) != NULL)
{
size_t len = fread (cmd, 1, sizeof (cmd) - 1, f);
if (len > 0)
{
int i;
for (i = 0; i < len; i++)
if (cmd[i] == '\0')
cmd[i] = ' ';
cmd[len] = '\0';
if ((f = fopen (pathname, "r")) != NULL)
{
size_t len = fread (cmd, 1, sizeof (cmd) - 1, f);
if (len > 0)
{
int i;
for (i = 0; i < len; i++)
if (cmd[i] == '\0')
cmd[i] = ' ';
cmd[len] = '\0';
buffer_xml_printf (
buffer_xml_printf (
&buffer,
"<item>"
"<column name=\"pid\">%s</column>"
@ -2151,13 +2158,13 @@ linux_qxfer_osdata (const char *annex,
dp->d_name,
entry ? entry->pw_name : "?",
cmd);
}
fclose (f);
}
}
}
}
fclose (f);
}
}
}
closedir (dirp);
closedir (dirp);
}
buffer_grow_str0 (&buffer, "</osdata>\n");
buf = buffer_finish (&buffer);

View File

@ -167,7 +167,7 @@ mips_breakpoint_at (CORE_ADDR where)
ps_err_e
ps_get_thread_area (const struct ps_prochandle *ph,
lwpid_t lwpid, int idx, void **base)
lwpid_t lwpid, int idx, void **base)
{
if (ptrace (PTRACE_GET_THREAD_AREA, lwpid, NULL, base) != 0)
return PS_ERR;

View File

@ -225,4 +225,3 @@ struct linux_target_ops the_low_target = {
s390_collect_ptrace_register,
s390_supply_ptrace_register,
};

View File

@ -49,10 +49,10 @@
static int sparc_regmap[] = {
/* These offsets correspond to GET/SETREGSET. */
-1, 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, /* g0 .. g7 */
7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, /* o0 .. o5, sp, o7 */
-1, -1, -1, -1, -1, -1, -1, -1, /* l0 .. l7 */
-1, -1, -1, -1, -1, -1, -1, -1, /* i0 .. i5, fp, i7 */
-1, 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, /* g0 .. g7 */
7*8, 8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, /* o0 .. o5, sp, o7 */
-1, -1, -1, -1, -1, -1, -1, -1, /* l0 .. l7 */
-1, -1, -1, -1, -1, -1, -1, -1, /* i0 .. i5, fp, i7 */
/* Floating point registers offsets correspond to GET/SETFPREGSET. */
0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4, /* f0 .. f7 */
@ -61,8 +61,8 @@ static int sparc_regmap[] = {
24*4, 25*4, 26*4, 27*4, 28*4, 29*4, 30*4, 31*4, /* f24 .. f31 */
/* F32 offset starts next to f31: 31*4+4 = 16 * 8. */
16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8, /* f32 .. f46 */
24*8, 25*8, 26*8, 27*8, 28*8, 29*8, 30*8, 31*8, /* f48 .. f62 */
16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8, /* f32 .. f46 */
24*8, 25*8, 26*8, 27*8, 28*8, 29*8, 30*8, 31*8, /* f48 .. f62 */
17 *8, /* pc */
18 *8, /* npc */
@ -125,7 +125,7 @@ sparc_fill_gregset_to_stack (const void *buf)
memcpy(&addr, ((char *) buf) + sparc_regmap[find_regno("sp")], sizeof(addr));
addr += BIAS;
for (i = l0_regno; i <= i7_regno; i++)
{
collect_register (i, tmp_reg_buf);
@ -139,12 +139,12 @@ sparc_fill_gregset (void *buf)
{
int i;
int range;
for (range = 0; range < N_GREGS_RANGES; range++)
for (i = gregs_ranges[range].regno_start; i <= gregs_ranges[range].regno_end; i++)
if (sparc_regmap[i] != -1)
collect_register (i, ((char *) buf) + sparc_regmap[i]);
collect_register (i, ((char *) buf) + sparc_regmap[i]);
sparc_fill_gregset_to_stack (buf);
}
@ -153,11 +153,11 @@ sparc_fill_fpregset (void *buf)
{
int i;
int range;
for (range = 0; range < N_FPREGS_RANGES; range++)
for (i = fpregs_ranges[range].regno_start; i <= fpregs_ranges[range].regno_end; i++)
collect_register (i, ((char *) buf) + sparc_regmap[i]);
}
static void
@ -173,7 +173,7 @@ sparc_store_gregset_from_stack (const void *buf)
memcpy(&addr, ((char *) buf) + sparc_regmap[find_regno("sp")], sizeof(addr));
addr += BIAS;
for (i = l0_regno; i <= i7_regno; i++)
{
(*the_target->read_memory) (addr, tmp_reg_buf, sizeof(tmp_reg_buf));
@ -190,14 +190,14 @@ sparc_store_gregset (const void *buf)
int range;
memset (zerobuf, 0, sizeof(zerobuf));
for (range = 0; range < N_GREGS_RANGES; range++)
for (i = gregs_ranges[range].regno_start; i <= gregs_ranges[range].regno_end; i++)
if (sparc_regmap[i] != -1)
supply_register (i, ((char *) buf) + sparc_regmap[i]);
supply_register (i, ((char *) buf) + sparc_regmap[i]);
else
supply_register (i, zerobuf);
supply_register (i, zerobuf);
sparc_store_gregset_from_stack (buf);
}
@ -206,7 +206,7 @@ sparc_store_fpregset (const void *buf)
{
int i;
int range;
for (range = 0; range < N_FPREGS_RANGES; range++)
for (i = fpregs_ranges[range].regno_start; i <= fpregs_ranges[range].regno_end; i++)
supply_register (i, ((char *) buf) + sparc_regmap[i]);
@ -234,7 +234,7 @@ sparc_breakpoint_at (CORE_ADDR where)
unsigned char insn[INSN_SIZE];
(*the_target->read_memory) (where, (unsigned char *) insn, sizeof(insn));
if (memcmp(sparc_breakpoint, insn, sizeof(insn)) == 0)
return 1;
@ -284,4 +284,3 @@ struct linux_target_ops the_low_target = {
NULL, NULL, NULL, NULL,
NULL, NULL
};

View File

@ -50,7 +50,7 @@ static int x86_64_regmap[] = {
RSI * 8, RDI * 8, RBP * 8, RSP * 8,
R8 * 8, R9 * 8, R10 * 8, R11 * 8,
R12 * 8, R13 * 8, R14 * 8, R15 * 8,
RIP * 8, EFLAGS * 8, CS * 8, SS * 8,
RIP * 8, EFLAGS * 8, CS * 8, SS * 8,
DS * 8, ES * 8, FS * 8, GS * 8,
-1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1,
@ -65,7 +65,7 @@ static int x86_64_regmap[] = {
ps_err_e
ps_get_thread_area (const struct ps_prochandle *ph,
lwpid_t lwpid, int idx, void **base)
lwpid_t lwpid, int idx, void **base)
{
switch (idx)
{
@ -127,7 +127,7 @@ struct regset_info target_regsets[] = {
static const unsigned char x86_64_breakpoint[] = { 0xCC };
#define x86_64_breakpoint_len 1
extern int debug_threads;
static CORE_ADDR
@ -170,9 +170,9 @@ struct linux_target_ops the_low_target = {
NULL,
x86_64_get_pc,
x86_64_set_pc,
x86_64_breakpoint,
x86_64_breakpoint,
x86_64_breakpoint_len,
NULL,
NULL,
1,
x86_64_breakpoint_at,
NULL,

View File

@ -33,7 +33,7 @@ enum regnum {
R_LBEG, R_LEND, R_LCOUNT,
R_SAR,
R_WS, R_WB,
R_A0 = 64
R_A0 = 64
};
static void

View File

@ -159,5 +159,3 @@ ps_getpid (gdb_ps_prochandle_t ph)
{
return ph->pid;
}

View File

@ -132,7 +132,7 @@ void
set_register_cache (struct reg *regs, int n)
{
int offset, i;
reg_defs = regs;
num_registers = n;
@ -169,7 +169,8 @@ registers_from_string (char *buf)
if (len != register_bytes * 2)
{
warning ("Wrong sized register packet (expected %d bytes, got %d)", 2*register_bytes, len);
warning ("Wrong sized register packet (expected %d bytes, got %d)",
2*register_bytes, len);
if (len > register_bytes * 2)
len = register_bytes * 2;
}

View File

@ -256,7 +256,7 @@ remote_open (char *name)
(char *) &tmp, sizeof (tmp));
/* Tell TCP not to delay small packets. This greatly speeds up
interactive response. */
interactive response. */
tmp = 1;
setsockopt (remote_desc, IPPROTO_TCP, TCP_NODELAY,
(char *) &tmp, sizeof (tmp));
@ -272,8 +272,8 @@ remote_open (char *name)
#endif
/* Convert IP address to string. */
fprintf (stderr, "Remote debugging from host %s\n",
inet_ntoa (sockaddr.sin_addr));
fprintf (stderr, "Remote debugging from host %s\n",
inet_ntoa (sockaddr.sin_addr));
transport_is_reliable = 1;
}
@ -319,11 +319,11 @@ unhexify (char *bin, const char *hex, int count)
for (i = 0; i < count; i++)
{
if (hex[0] == 0 || hex[1] == 0)
{
/* Hex string is short, or of uneven length.
Return the count that has been converted so far. */
return i;
}
{
/* Hex string is short, or of uneven length.
Return the count that has been converted so far. */
return i;
}
*bin++ = fromhex (hex[0]) * 16 + fromhex (hex[1]);
hex += 2;
}
@ -1198,7 +1198,7 @@ look_up_one_symbol (const char *name, CORE_ADDR *addrp)
if (len < 0)
return -1;
}
if (strncmp (own_buf, "qSymbol:", strlen ("qSymbol:")) != 0)
{
warning ("Malformed response to qSymbol, ignoring: %s\n", own_buf);
@ -1368,21 +1368,21 @@ buffer_xml_printf (struct buffer *buffer, const char *format, ...)
{
if (percent)
{
switch (*f)
{
case 's':
{
char *p;
char *a = va_arg (ap, char *);
buffer_grow (buffer, prev, f - prev - 1);
p = xml_escape_text (a);
buffer_grow_str (buffer, p);
free (p);
prev = f + 1;
}
break;
}
percent = 0;
switch (*f)
{
case 's':
{
char *p;
char *a = va_arg (ap, char *);
buffer_grow (buffer, prev, f - prev - 1);
p = xml_escape_text (a);
buffer_grow_str (buffer, p);
free (p);
prev = f + 1;
}
break;
}
percent = 0;
}
else if (*f == '%')
percent = 1;

View File

@ -331,7 +331,7 @@ monitor_show_help (void)
{
monitor_output ("The following monitor commands are supported:\n");
monitor_output (" set debug <0|1>\n");
monitor_output (" Enable general debugging messages\n");
monitor_output (" Enable general debugging messages\n");
monitor_output (" set remote-debug <0|1>\n");
monitor_output (" Enable remote protocol debugging messages\n");
monitor_output (" exit\n");
@ -523,7 +523,8 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
{
require_running (own_buf);
thread_ptr = all_threads.head;
sprintf (own_buf, "m%x", thread_to_gdb_id ((struct thread_info *)thread_ptr));
sprintf (own_buf, "m%x",
thread_to_gdb_id ((struct thread_info *)thread_ptr));
thread_ptr = thread_ptr->next;
return;
}
@ -533,7 +534,8 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
require_running (own_buf);
if (thread_ptr != NULL)
{
sprintf (own_buf, "m%x", thread_to_gdb_id ((struct thread_info *)thread_ptr));
sprintf (own_buf, "m%x",
thread_to_gdb_id ((struct thread_info *)thread_ptr));
thread_ptr = thread_ptr->next;
return;
}
@ -556,7 +558,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
(long)text, (long)data, (long)data);
else
write_enn (own_buf);
return;
}
@ -577,15 +579,15 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
len = PBUFSIZ - 2;
spu_buf = malloc (len + 1);
if (!spu_buf)
return;
return;
n = (*the_target->qxfer_spu) (annex, spu_buf, NULL, ofs, len + 1);
if (n < 0)
if (n < 0)
write_enn (own_buf);
else if (n > len)
*new_packet_len_p = write_qxfer_response
(own_buf, spu_buf, len, 1);
else
else
*new_packet_len_p = write_qxfer_response
(own_buf, spu_buf, n, 0);
@ -606,7 +608,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
strcpy (own_buf, "E00");
spu_buf = malloc (packet_len - 15);
if (!spu_buf)
return;
return;
if (decode_xfer_write (own_buf + 16, packet_len - 16, &annex,
&ofs, &len, spu_buf) < 0)
{
@ -614,7 +616,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
return;
}
n = (*the_target->qxfer_spu)
n = (*the_target->qxfer_spu)
(annex, NULL, (unsigned const char *)spu_buf, ofs, len);
if (n < 0)
write_enn (own_buf);
@ -794,17 +796,15 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
len = PBUFSIZ - 2;
workbuf = malloc (len + 1);
if (!workbuf)
return;
return;
n = (*the_target->qxfer_osdata) (annex, workbuf, NULL, ofs, len + 1);
if (n < 0)
write_enn (own_buf);
else if (n > len)
*new_packet_len_p = write_qxfer_response
(own_buf, workbuf, len, 1);
*new_packet_len_p = write_qxfer_response (own_buf, workbuf, len, 1);
else
*new_packet_len_p = write_qxfer_response
(own_buf, workbuf, n, 0);
*new_packet_len_p = write_qxfer_response (own_buf, workbuf, n, 0);
free (workbuf);
return;
@ -835,7 +835,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
len = PBUFSIZ - 2;
data = malloc (len + 1);
if (!data)
return;
return;
n = (*the_target->qxfer_siginfo) (annex, data, NULL, ofs, len + 1);
if (n < 0)
write_enn (own_buf);
@ -862,7 +862,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
strcpy (own_buf, "E00");
data = malloc (packet_len - 19);
if (!data)
return;
return;
if (decode_xfer_write (own_buf + 20, packet_len - 20, &annex,
&ofs, &len, data) < 0)
{
@ -910,7 +910,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
strcat (own_buf, ";QStartNoAckMode+");
if (the_target->qxfer_osdata != NULL)
strcat (own_buf, ";qXfer:osdata:read+");
strcat (own_buf, ";qXfer:osdata:read+");
return;
}
@ -1254,7 +1254,7 @@ handle_v_run (char *own_buf, char *status, int *signal)
/* FIXME: new_argv memory leak */
write_enn (own_buf);
return 0;
}
}
}
/* Free the old argv and install the new one. */
@ -1898,7 +1898,7 @@ main (int argc, char *argv[])
response_needed = 0;
/* Restarting the inferior is only supported in the
extended protocol. */
extended protocol. */
if (extended_protocol)
{
if (target_running ())
@ -1931,8 +1931,8 @@ main (int argc, char *argv[])
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;
}

View File

@ -33,7 +33,7 @@
/* Some older glibc versions do not define this. */
#ifndef __WNOTHREAD
#define __WNOTHREAD 0x20000000 /* Don't wait on children of other
threads in this group */
threads in this group */
#endif
#define PTRACE_TYPE_RET long
@ -90,7 +90,7 @@ fetch_ppc_register (int regno)
errno = 0;
res = ptrace (PT_READ_U, tid,
(PTRACE_TYPE_ARG3) (regno * sizeof (PTRACE_TYPE_RET)), 0);
(PTRACE_TYPE_ARG3) (regno * sizeof (PTRACE_TYPE_RET)), 0);
if (errno != 0)
{
char mess[128];
@ -190,7 +190,7 @@ store_ppc_memory (CORE_ADDR memaddr, char *myaddr, int len)
return ret;
memcpy ((char *) buffer + (memaddr & (sizeof (PTRACE_TYPE_RET) - 1)),
myaddr, len);
myaddr, len);
for (i = 0; i < count; i++, addr += sizeof (PTRACE_TYPE_RET))
if ((ret = store_ppc_memory_1 (tid, addr, buffer[i])) != 0)
@ -203,7 +203,7 @@ store_ppc_memory (CORE_ADDR memaddr, char *myaddr, int len)
/* If the PPU thread is currently stopped on a spu_run system call,
return to FD and ADDR the file handle and NPC parameter address
used with the system call. Return non-zero if successful. */
static int
static int
parse_spufs_run (int *fd, CORE_ADDR *addr)
{
char buf[4];

View File

@ -147,7 +147,7 @@ struct target_ops
unsigned int len);
/* Insert and remove a hardware watchpoint.
Returns 0 on success, -1 on failure and 1 on unsupported.
Returns 0 on success, -1 on failure and 1 on unsupported.
The type is coded as follows:
2 = write watchpoint
3 = read watchpoint
@ -161,7 +161,7 @@ struct target_ops
int (*stopped_by_watchpoint) (void);
/* Returns the address associated with the watchpoint that hit, if any;
/* Returns the address associated with the watchpoint that hit, if any;
returns 0 otherwise. */
CORE_ADDR (*stopped_data_address) (void);
@ -169,7 +169,7 @@ struct target_ops
/* Reports the text, data offsets of the executable. This is
needed for uclinux where the executable is relocated during load
time. */
int (*read_offsets) (CORE_ADDR *text, CORE_ADDR *data);
/* Fetch the address associated with a specific thread local storage
@ -191,7 +191,7 @@ struct target_ops
/* Read/Write OS data using qXfer packets. */
int (*qxfer_osdata) (const char *annex, unsigned char *readbuf,
unsigned const char *writebuf, CORE_ADDR offset,
unsigned const char *writebuf, CORE_ADDR offset,
int len);
/* Read/Write extra signal info. */

View File

@ -196,7 +196,7 @@ thread_db_enable_reporting ()
if (err != TD_OK)
{
warning ("Unable to set global thread event mask: %s",
thread_db_err_str (err));
thread_db_err_str (err));
return 0;
}

View File

@ -458,15 +458,15 @@ create_process (const char *program, char *args,
mbstowcs (wargs, args, argslen + 1);
ret = CreateProcessW (wprogram, /* image name */
wargs, /* command line */
NULL, /* security, not supported */
NULL, /* thread, not supported */
FALSE, /* inherit handles, not supported */
flags, /* start flags */
NULL, /* environment, not supported */
NULL, /* current directory, not supported */
NULL, /* start info, not supported */
pi); /* proc info */
wargs, /* command line */
NULL, /* security, not supported */
NULL, /* thread, not supported */
FALSE, /* inherit handles, not supported */
flags, /* start flags */
NULL, /* environment, not supported */
NULL, /* current directory, not supported */
NULL, /* start info, not supported */
pi); /* proc info */
#else
STARTUPINFOA si = { sizeof (STARTUPINFOA) };
@ -537,7 +537,7 @@ win32_create_inferior (char *program, char **program_args)
for (argc = 1; program_args[argc]; argc++)
{
/* FIXME: Can we do better about quoting? How does Cygwin
handle this? */
handle this? */
strcat (args, " ");
strcat (args, program_args[argc]);
}
@ -609,7 +609,7 @@ win32_attach (unsigned long pid)
DebugSetProcessKillOnExit (FALSE);
/* win32_wait needs to know we're attaching. */
attaching = 1;
attaching = 1;
do_initial_child_stuff (h, pid);
return 0;
}
@ -642,7 +642,7 @@ handle_output_debug_string (struct target_waitstatus *ourstatus)
if (current_event.u.DebugString.fUnicode)
{
/* The event tells us how many bytes, not chars, even
in Unicode. */
in Unicode. */
WCHAR buffer[(READ_BUFFER_LEN + 1) / sizeof (WCHAR)] = { 0 };
if (read_inferior_memory (addr, (unsigned char *) buffer, nbytes) != 0)
return;
@ -695,9 +695,9 @@ win32_kill (void)
break;
else if (current_event.dwDebugEventCode == OUTPUT_DEBUG_STRING_EVENT)
{
struct target_waitstatus our_status = { 0 };
struct target_waitstatus our_status = { 0 };
handle_output_debug_string (&our_status);
}
}
}
win32_clear_inferiors ();
@ -1242,7 +1242,7 @@ handle_exception (struct target_waitstatus *ourstatus)
#ifdef _WIN32_WCE
/* Remove the initial breakpoint. */
check_breakpoints ((CORE_ADDR) (long) current_event
.u.Exception.ExceptionRecord.ExceptionAddress);
.u.Exception.ExceptionRecord.ExceptionAddress);
#endif
break;
case DBG_CONTROL_C:
@ -1354,37 +1354,37 @@ get_child_debug_event (struct target_waitstatus *ourstatus)
if (attaching)
{
/* WinCE doesn't set an initial breakpoint automatically. To
stop the inferior, we flush all currently pending debug
events -- the thread list and the dll list are always
reported immediatelly without delay, then, we suspend all
threads and pretend we saw a trap at the current PC of the
main thread.
stop the inferior, we flush all currently pending debug
events -- the thread list and the dll list are always
reported immediatelly without delay, then, we suspend all
threads and pretend we saw a trap at the current PC of the
main thread.
Contrary to desktop Windows, Windows CE *does* report the dll
names on LOAD_DLL_DEBUG_EVENTs resulting from a
DebugActiveProcess call. This limits the way we can detect
if all the dlls have already been reported. If we get a real
debug event before leaving attaching, the worst that will
happen is the user will see a spurious breakpoint. */
Contrary to desktop Windows, Windows CE *does* report the dll
names on LOAD_DLL_DEBUG_EVENTs resulting from a
DebugActiveProcess call. This limits the way we can detect
if all the dlls have already been reported. If we get a real
debug event before leaving attaching, the worst that will
happen is the user will see a spurious breakpoint. */
current_event.dwDebugEventCode = 0;
if (!WaitForDebugEvent (&current_event, 0))
{
OUTMSG2(("no attach events left\n"));
fake_breakpoint_event ();
attaching = 0;
}
{
OUTMSG2(("no attach events left\n"));
fake_breakpoint_event ();
attaching = 0;
}
else
OUTMSG2(("got attach event\n"));
OUTMSG2(("got attach event\n"));
}
else
#endif
{
/* Keep the wait time low enough for confortable remote
interruption, but high enough so gdbserver doesn't become a
bottleneck. */
interruption, but high enough so gdbserver doesn't become a
bottleneck. */
if (!WaitForDebugEvent (&current_event, 250))
return 0;
return 0;
}
gotevent:
@ -1537,7 +1537,7 @@ win32_wait (char *status)
win32_clear_inferiors ();
return our_status.value.integer;
case TARGET_WAITKIND_STOPPED:
case TARGET_WAITKIND_LOADED:
case TARGET_WAITKIND_LOADED:
OUTMSG2 (("Child Stopped with signal = %d \n",
our_status.value.sig));
@ -1555,11 +1555,11 @@ win32_wait (char *status)
}
return our_status.value.sig;
default:
default:
OUTMSG (("Ignoring unknown internal event, %d\n", our_status.kind));
/* fall-through */
case TARGET_WAITKIND_SPURIOUS:
case TARGET_WAITKIND_EXECD:
/* fall-through */
case TARGET_WAITKIND_SPURIOUS:
case TARGET_WAITKIND_EXECD:
/* do nothing, just continue */
child_continue (DBG_CONTINUE, -1);
break;

View File

@ -35,4 +35,3 @@ const xtensa_regtable_t xtensa_regmap_table[] = {
{ 44, 176, 0, 0, 4, -1, 0x020c, "scompare1" },
{ 0 }
};