+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
# 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/>.
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
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 \
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); \
-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
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)
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
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));
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);
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);
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)
{
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);
+ }
}
}
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);
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;
-1, 17*4, -1, 16*4,
-1, -1, -1, 18*4,
-1, 17*4, -1, -1
-
+
};
static int
{
if (cris_regmap[regno] == -1)
return 1;
-
+
return (regno >= cris_num_regs);
}
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;
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)
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;
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. */
/* 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;
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)
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. */
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. */
}
}
}
-
+
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. */
/* 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,
/* 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];
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
/* 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)
{
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);
}
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);
{
int ret = syscall (SYS_tkill, lwpid, signo);
if (errno != ENOSYS)
- return ret;
+ return ret;
errno = 0;
tkill_failed = 1;
}
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
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))
{
*(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;
/* 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
}
}
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
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;
}
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
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. */
dirp = opendir ("/proc");
if (dirp)
{
- 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;
-
- 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);
-
- 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 (
+ 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;
+
+ 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);
+
+ 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,
"<item>"
"<column name=\"pid\">%s</column>"
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);
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;
s390_collect_ptrace_register,
s390_supply_ptrace_register,
};
-
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 */
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 */
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);
{
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);
}
{
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
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));
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);
}
{
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]);
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;
NULL, NULL, NULL, NULL,
NULL, NULL
};
-
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,
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)
{
static const unsigned char x86_64_breakpoint[] = { 0xCC };
#define x86_64_breakpoint_len 1
-
+
extern int debug_threads;
static CORE_ADDR
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,
R_LBEG, R_LEND, R_LCOUNT,
R_SAR,
R_WS, R_WB,
- R_A0 = 64
+ R_A0 = 64
};
static void
set_register_cache (struct reg *regs, int n)
{
int offset, i;
-
+
reg_defs = regs;
num_registers = n;
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;
}
(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));
#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;
}
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;
}
if (len < 0)
return -1;
}
-
+
if (strncmp (own_buf, "qSymbol:", strlen ("qSymbol:")) != 0)
{
warning ("Malformed response to qSymbol, ignoring: %s\n", own_buf);
{
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;
{
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");
{
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;
}
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;
}
(long)text, (long)data, (long)data);
else
write_enn (own_buf);
-
+
return;
}
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);
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)
{
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);
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;
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);
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)
{
strcat (own_buf, ";QStartNoAckMode+");
if (the_target->qxfer_osdata != NULL)
- strcat (own_buf, ";qXfer:osdata:read+");
+ strcat (own_buf, ";qXfer:osdata:read+");
return;
}
/* FIXME: new_argv memory leak */
write_enn (own_buf);
return 0;
- }
+ }
}
/* Free the old argv and install the new one. */
response_needed = 0;
/* Restarting the inferior is only supported in the
- extended protocol. */
+ extended protocol. */
if (extended_protocol)
{
if (target_running ())
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;
}
/* 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
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];
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)
/* 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];
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
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);
/* 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
/* 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. */
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;
}
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) };
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]);
}
DebugSetProcessKillOnExit (FALSE);
/* win32_wait needs to know we're attaching. */
- attaching = 1;
+ attaching = 1;
do_initial_child_stuff (h, pid);
return 0;
}
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;
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 ();
#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:
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.
-
- 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. */
+ 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. */
current_event.dwDebugEventCode = 0;
if (!WaitForDebugEvent (¤t_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 (¤t_event, 250))
- return 0;
+ return 0;
}
gotevent:
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));
}
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;
{ 44, 176, 0, 0, 4, -1, 0x020c, "scompare1" },
{ 0 }
};
-