* configure.tgt: Move mips*-*-pe and sh*-*-pe to
	the obsoletion stanza.
	* NEWS: Mention deleted targets.

	* config/sh/tm-wince.h: Remove.
	* config/sh/wince.mt: Remove.
	* config/mips/tm-wince.h: Remove.
	* config/mips/wince.mt: Remove.

	* wince.c: Remove.
	* wince-stub.c: Remove.
	* wince-stub.h: Remove.
	* Makefile.in (wince.o): Remove rule.
	(wince-stub.o): Likewise.

	* mips-tdep.c (mips_next_pc): Make static.
	* mips-tdep.h (mips_next_pc): Remove declaration.
	* arm-tdep.c (arm_pc_is_thumb): Make static.
	(thumb_get_next_pc): Likewise.
	(arm_get_next_pc): Likewise.
	* arm-tdep.h (arm_pc_is_thumb_dummy): Remove declaration.
	(arm_pc_is_thumb): Likewise.
	(thumb_get_next_pc): Likewise.
	(arm_get_next_pc): Likewise.

gdb/doc/

	* gdb.texinfo (WinCE): Delete obsolete subsection.
This commit is contained in:
Pedro Alves 2007-03-30 22:50:33 +00:00
parent ed50f18f18
commit ad527d2e20
17 changed files with 39 additions and 2874 deletions

View File

@ -1,3 +1,30 @@
2007-03-30 Pedro Alves <pedro_alves@portugalmail.pt>
* configure.tgt: Move mips*-*-pe and sh*-*-pe to
the obsoletion stanza.
* NEWS: Mention deleted targets.
* config/sh/tm-wince.h: Remove.
* config/sh/wince.mt: Remove.
* config/mips/tm-wince.h: Remove.
* config/mips/wince.mt: Remove.
* wince.c: Remove.
* wince-stub.c: Remove.
* wince-stub.h: Remove.
* Makefile.in (wince.o): Remove rule.
(wince-stub.o): Likewise.
* mips-tdep.c (mips_next_pc): Make static.
* mips-tdep.h (mips_next_pc): Remove declaration.
* arm-tdep.c (arm_pc_is_thumb): Make static.
(thumb_get_next_pc): Likewise.
(arm_get_next_pc): Likewise.
* arm-tdep.h (arm_pc_is_thumb_dummy): Remove declaration.
(arm_pc_is_thumb): Likewise.
(thumb_get_next_pc): Likewise.
(arm_get_next_pc): Likewise.
2007-03-30 Daniel Jacobowitz <dan@codesourcery.com>
* MAINTAINERS: Remove d10v entry.

View File

@ -833,7 +833,6 @@ varobj_h = varobj.h $(symtab_h) $(gdbtypes_h)
vax_tdep_h = vax-tdep.h
vec_h = vec.h $(gdb_assert_h) $(gdb_string_h)
version_h = version.h
wince_stub_h = wince-stub.h
wrapper_h = wrapper.h $(gdb_h)
xcoffsolib_h = xcoffsolib.h
xml_support_h = xml-support.h $(gdb_obstack_h) $(vec_h)
@ -2866,11 +2865,6 @@ win32-nat.o: win32-nat.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
$(regcache_h) $(top_h) $(buildsym_h) $(symfile_h) $(objfiles_h) \
$(gdb_string_h) $(gdbthread_h) $(gdbcmd_h) $(exec_h) $(solist_h) \
$(solib_h) $(i386_tdep_h) $(i387_tdep_h)
wince.o: wince.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
$(exceptions_h) $(gdbcore_h) $(command_h) $(buildsym_h) $(symfile_h) \
$(objfiles_h) $(gdb_string_h) $(gdbthread_h) $(gdbcmd_h) \
$(wince_stub_h) $(regcache_h) $(mips_tdep_h)
wince-stub.o: wince-stub.c $(wince_stub_h)
wrapper.o: wrapper.c $(defs_h) $(value_h) $(exceptions_h) $(wrapper_h) \
$(ui_out_h)
xcoffread.o: xcoffread.c $(defs_h) $(bfd_h) $(gdb_string_h) $(gdb_stat_h) \

View File

@ -105,7 +105,9 @@ i[34567]86-*-sysv*
i[34567]86-*-isc*
m68*-cisco*-*
m68*-tandem-*
mips*-*-pe
rs6000-*-lynxos*
sh*-*-pe
* Other removed features

View File

@ -217,7 +217,7 @@ int arm_apcs_32 = 1;
/* Determine if the program counter specified in MEMADDR is in a Thumb
function. */
int
static int
arm_pc_is_thumb (CORE_ADDR memaddr)
{
struct minimal_symbol *sym;
@ -1603,7 +1603,7 @@ bitcount (unsigned long val)
return nbits;
}
CORE_ADDR
static CORE_ADDR
thumb_get_next_pc (CORE_ADDR pc)
{
unsigned long pc_val = ((unsigned long) pc) + 4; /* PC after prefetch */
@ -1659,7 +1659,7 @@ thumb_get_next_pc (CORE_ADDR pc)
return nextpc;
}
CORE_ADDR
static CORE_ADDR
arm_get_next_pc (CORE_ADDR pc)
{
unsigned long pc_val;

View File

@ -187,15 +187,6 @@ struct gdbarch_tdep
#define LOWEST_PC (gdbarch_tdep (current_gdbarch)->lowest_pc)
#endif
/* Prototypes for internal interfaces needed by more than one MD file. */
int arm_pc_is_thumb_dummy (CORE_ADDR);
int arm_pc_is_thumb (CORE_ADDR);
CORE_ADDR thumb_get_next_pc (CORE_ADDR);
CORE_ADDR arm_get_next_pc (CORE_ADDR);
/* Functions exported from armbsd-tdep.h. */
/* Return the appropriate register set for the core section identified

View File

@ -1,31 +0,0 @@
/* Definitions to make GDB run on a Windows CE system.
Copyright 2000, 2007 Free Software Foundation, Inc.
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 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. */
#ifndef TM_WINCE_H
#define TM_WINCE_H 1
#undef SOFTWARE_SINGLE_STEP_P
#define SOFTWARE_SINGLE_STEP_P() 1
#define SOFTWARE_SINGLE_STEP(sig, bp_p) wince_software_single_step (sig, bp_p)
void wince_software_single_step (unsigned int, int);
#endif /* TM_WINCE_H */

View File

@ -1,5 +0,0 @@
# Target: Little-endian MIPS machine such as DECstation.
TDEPFILES= mips-tdep.o wince.o
DEPRECATED_TM_FILE= tm-wince.h
MT_CFLAGS=-DMIPS -U_X86_ -U_M_IX86 -U__i386__ -U__i486__ -U__i586__ -U__i686__ -DUNICODE -D_WIN32_WCE -DWINCE_STUB='"${target_alias}-stub.exe"'
TM_CLIBS=-lrapi

View File

@ -1,31 +0,0 @@
/* Target-specific definition for Window CE
Copyright 2000, 2007 Free Software Foundation, Inc.
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 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. */
#ifndef TM_WINCE_H
#define TM_WINCE_H 1
#undef SOFTWARE_SINGLE_STEP_P
#define SOFTWARE_SINGLE_STEP_P() 1
#undef SOFTWARE_SINGLE_STEP
#define SOFTWARE_SINGLE_STEP(sig, bp_p) wince_software_single_step (sig, bp_p)
void wince_software_single_step (unsigned int, int);
#endif /* TM_WINCE_H */

View File

@ -1,5 +0,0 @@
# Target: Renesas Super-H running on Windows CE
TDEPFILES= sh-tdep.o wince.o
DEPRECATED_TM_FILE= tm-wince.h
MT_CFLAGS=-DSHx -U_X86_ -U_M_IX86 -U__i386__ -U__i486__ -U__i586__ -U__i686__ -DUNICODE -D_WIN32_WCE -DWINCE_STUB='"${target_alias}-stub.exe"'
TM_CLIBS=-lrapi

View File

@ -13,7 +13,9 @@ case $target in
m68*-cisco*-* | \
m68*-tandem-* | \
m68*-*-os68k* | \
mips*-*-pe | \
rs6000-*-lynxos* | \
sh*-*-pe | \
null)
echo "*** Configuration $target is obsolete." >&2
echo "*** Support has been REMOVED." >&2
@ -153,7 +155,6 @@ m88*-*-openbsd*) gdb_target=obsd ;;
mep-*-*) gdb_target=mep ;;
mips*-*-pe) gdb_target=wince ;;
mips*-sgi-irix5*) gdb_target=irix5 ;;
mips*-sgi-irix6*) gdb_target=irix6 ;;
mips*-*-linux*) gdb_target=linux
@ -192,7 +193,6 @@ s390*-*-*) gdb_target=s390
;;
score-*-*) gdb_target=embed ;;
sh*-*-pe) gdb_target=wince ;;
sh-*-coff*) gdb_target=embed ;;
sh-*-elf*) gdb_target=embed ;;
# FIXME should that be sh*-*-linux*, perhaps?

View File

@ -1,3 +1,7 @@
2007-03-30 Pedro Alves <pedro_alves@portugalmail.pt>
* gdb.texinfo (WinCE): Delete obsolete subsection.
2007-03-30 Daniel Jacobowitz <dan@codesourcery.com>
* gdb.texinfo (M68K): Remove obsolete ROM monitors.

View File

@ -14274,7 +14274,6 @@ acceptable commands.
* AVR:: Atmel AVR
* CRIS:: CRIS
* Super-H:: Renesas Super-H
* WinCE:: Windows CE child processes
@end menu
@node ARM
@ -15390,44 +15389,6 @@ commands:
Show the values of all Super-H registers.
@end table
@node WinCE
@subsection Windows CE
@cindex Windows CE
The following commands are available for Windows CE:
@table @code
@item set remotedirectory @var{dir}
@kindex set remotedirectory
Tell @value{GDBN} to upload files from the named directory @var{dir}.
The default is @file{/gdb}, i.e.@: the root directory on the current
drive.
@item show remotedirectory
@kindex show remotedirectory
Show the current value of the upload directory.
@item set remoteupload @var{method}
@kindex set remoteupload
Set the method used to upload files to remote device. Valid values
for @var{method} are @samp{always}, @samp{newer}, and @samp{never}.
The default is @samp{newer}.
@item show remoteupload
@kindex show remoteupload
Show the current setting of the upload method.
@item set remoteaddhost
@kindex set remoteaddhost
Tell @value{GDBN} whether to add this host to the remote stub's
arguments when you debug over a network.
@item show remoteaddhost
@kindex show remoteaddhost
Show whether to add this host to remote stub's arguments when
debugging over a network.
@end table
@node Architectures
@section Architectures

View File

@ -1352,7 +1352,7 @@ mips16_next_pc (CORE_ADDR pc)
It works by decoding the current instruction and predicting where a
branch will go. This isnt hard because all the data is available.
The MIPS32 and MIPS16 variants are quite different */
CORE_ADDR
static CORE_ADDR
mips_next_pc (CORE_ADDR pc)
{
if (pc & 0x01)

View File

@ -40,9 +40,6 @@ enum mips_abi
/* Return the MIPS ABI associated with GDBARCH. */
enum mips_abi mips_abi (struct gdbarch *gdbarch);
/* For wince :-(. */
extern CORE_ADDR mips_next_pc (CORE_ADDR pc);
/* Return the MIPS ISA's register size. Just a short cut to the BFD
architecture's word size. */
extern int mips_isa_regsize (struct gdbarch *gdbarch);

View File

@ -1,592 +0,0 @@
/* wince-stub.c -- debugging stub for a Windows CE device
Copyright (C) 1999, 2000, 2007 Free Software Foundation, Inc.
Contributed by Cygnus Solutions, A Red Hat Company.
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 distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without eve nthe 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., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
/* by Christopher Faylor (cgf@cygnus.com) */
#include <stdarg.h>
#include <windows.h>
#include <winsock.h>
#include "wince-stub.h"
#define MALLOC(n) (void *) LocalAlloc (LMEM_MOVEABLE | LMEM_ZEROINIT, (UINT)(n))
#define REALLOC(s, n) (void *) LocalReAlloc ((HLOCAL)(s), (UINT)(n), LMEM_MOVEABLE)
#define FREE(s) LocalFree ((HLOCAL)(s))
static int skip_next_id = 0; /* Don't read next API code from socket */
/* v-style interface for handling varying argument list error messages.
Displays the error message in a dialog box and exits when user clicks
on OK. */
static void
vstub_error (LPCWSTR fmt, va_list args)
{
WCHAR buf[4096];
wvsprintfW (buf, fmt, args);
MessageBoxW (NULL, buf, L"GDB", MB_ICONERROR);
WSACleanup ();
ExitThread (1);
}
/* The standard way to display an error message and exit. */
static void
stub_error (LPCWSTR fmt, ...)
{
va_list args;
va_start (args, fmt);
vstub_error (fmt, args);
}
/* Allocate a limited pool of memory, reallocating over unused
buffers. This assumes that there will never be more than four
"buffers" required which, so far, is a safe assumption. */
static LPVOID
mempool (unsigned int len)
{
static int outn = -1;
static LPWSTR outs[4] = {NULL, NULL, NULL, NULL};
if (++outn >= (sizeof (outs) / sizeof (outs[0])))
outn = 0;
/* Allocate space for the converted string, reusing any previously allocated
space, if applicable. */
if (outs[outn])
FREE (outs[outn]);
outs[outn] = (LPWSTR) MALLOC (len);
return outs[outn];
}
/* Standard "oh well" can't communicate error. Someday this might attempt
synchronization. */
static void
attempt_resync (LPCWSTR huh, int s)
{
stub_error (L"lost synchronization with host attempting %s. Error %d", huh, WSAGetLastError ());
}
/* Read arbitrary stuff from a socket. */
static int
sockread (LPCWSTR huh, int s, void *str, size_t n)
{
for (;;)
{
if (recv (s, str, n, 0) == (int) n)
return n;
attempt_resync (huh, s);
}
}
/* Write arbitrary stuff to a socket. */
static int
sockwrite (LPCWSTR huh, int s, const void *str, size_t n)
{
for (;;)
{
if (send (s, str, n, 0) == (int) n)
return n;
attempt_resync (huh, s);
}
}
/* Get a an ID (possibly) and a DWORD from the host gdb.
Don't bother with the id if the main loop has already
read it. */
static DWORD
getdword (LPCWSTR huh, int s, gdb_wince_id what_this)
{
DWORD n;
gdb_wince_id what;
if (skip_next_id)
skip_next_id = 0;
else
do
if (sockread (huh, s, &what, sizeof (what)) != sizeof (what))
stub_error (L"error getting record type from host - %s.", huh);
while (what_this != what);
if (sockread (huh, s, &n, sizeof (n)) != sizeof (n))
stub_error (L"error getting %s from host.", huh);
return n;
}
/* Get a an ID (possibly) and a WORD from the host gdb.
Don't bother with the id if the main loop has already
read it. */
static WORD
getword (LPCWSTR huh, int s, gdb_wince_id what_this)
{
WORD n;
gdb_wince_id what;
if (skip_next_id)
skip_next_id = 0;
else
do
if (sockread (huh, s, &what, sizeof (what)) != sizeof (what))
stub_error (L"error getting record type from host - %s.", huh);
while (what_this != what);
if (sockread (huh, s, &n, sizeof (n)) != sizeof (n))
stub_error (L"error getting %s from host.", huh);
return n;
}
/* Handy defines for getting various types of values. */
#define gethandle(huh, s, what) (HANDLE) getdword ((huh), (s), (what))
#define getpvoid(huh, s, what) (LPVOID) getdword ((huh), (s), (what))
#define getlen(huh, s, what) (gdb_wince_len) getword ((huh), (s), (what))
/* Get an arbitrary block of memory from the gdb host. This comes in
two chunks an id/dword representing the length and the stream of memory
itself. Returns a pointer, allocated via mempool, to a memory buffer. */
static LPWSTR
getmemory (LPCWSTR huh, int s, gdb_wince_id what, gdb_wince_len *inlen)
{
LPVOID p;
gdb_wince_len dummy;
if (!inlen)
inlen = &dummy;
*inlen = getlen (huh, s, what);
p = mempool ((unsigned int) *inlen); /* FIXME: check for error */
if ((gdb_wince_len) sockread (huh, s, p, *inlen) != *inlen)
stub_error (L"error getting string from host.");
return p;
}
/* Output an id/dword to the host */
static void
putdword (LPCWSTR huh, int s, gdb_wince_id what, DWORD n)
{
if (sockwrite (huh, s, &what, sizeof (what)) != sizeof (what))
stub_error (L"error writing record id for %s to host.", huh);
if (sockwrite (huh, s, &n, sizeof (n)) != sizeof (n))
stub_error (L"error writing %s to host.", huh);
}
/* Output an id/word to the host */
static void
putword (LPCWSTR huh, int s, gdb_wince_id what, WORD n)
{
if (sockwrite (huh, s, &what, sizeof (what)) != sizeof (what))
stub_error (L"error writing record id for %s to host.", huh);
if (sockwrite (huh, s, &n, sizeof (n)) != sizeof (n))
stub_error (L"error writing %s to host.", huh);
}
/* Convenience define for outputting a "gdb_wince_len" type. */
#define putlen(huh, s, what, n) putword ((huh), (s), (what), (gdb_wince_len) (n))
/* Put an arbitrary block of memory to the gdb host. This comes in
two chunks an id/dword representing the length and the stream of memory
itself. */
static void
putmemory (LPCWSTR huh, int s, gdb_wince_id what, const void *mem, gdb_wince_len len)
{
putlen (huh, s, what, len);
if (((short) len > 0) && (gdb_wince_len) sockwrite (huh, s, mem, len) != len)
stub_error (L"error writing memory to host.");
}
/* Output the result of an operation to the host. If res != 0, sends a block of
memory starting at mem of len bytes. If res == 0, sends -GetLastError () and
avoids sending the mem. */
static void
putresult (LPCWSTR huh, gdb_wince_result res, int s, gdb_wince_id what, const void *mem, gdb_wince_len len)
{
if (!res)
len = -(int) GetLastError ();
putmemory (huh, s, what, mem, len);
}
static HANDLE curproc; /* Currently unused, but nice for debugging */
/* Emulate CreateProcess. Returns &pi if no error. */
static void
create_process (int s)
{
LPWSTR exec_file = getmemory (L"CreateProcess exec_file", s, GDB_CREATEPROCESS, NULL);
LPWSTR args = getmemory (L"CreateProcess args", s, GDB_CREATEPROCESS, NULL);
DWORD flags = getdword (L"CreateProcess flags", s, GDB_CREATEPROCESS);
PROCESS_INFORMATION pi;
gdb_wince_result res;
res = CreateProcessW (exec_file,
args, /* command line */
NULL, /* Security */
NULL, /* thread */
FALSE, /* inherit handles */
flags, /* start flags */
NULL,
NULL, /* current directory */
NULL,
&pi);
putresult (L"CreateProcess", res, s, GDB_CREATEPROCESS, &pi, sizeof (pi));
curproc = pi.hProcess;
}
/* Emulate TerminateProcess. Returns return value of TerminateProcess if
no error.
*** NOTE: For some unknown reason, TerminateProcess seems to always return
an ACCESS_DENIED (on Windows CE???) error. So, force a TRUE value for now. */
static void
terminate_process (int s)
{
gdb_wince_result res;
HANDLE h = gethandle (L"TerminateProcess handle", s, GDB_TERMINATEPROCESS);
res = TerminateProcess (h, 0) || 1; /* Doesn't seem to work on SH so default to TRUE */
putresult (L"Terminate process result", res, s, GDB_TERMINATEPROCESS,
&res, sizeof (res));
}
static int stepped = 0;
/* Handle single step instruction. FIXME: unneded? */
static void
flag_single_step (int s)
{
stepped = 1;
skip_next_id = 0;
}
struct skipper
{
wchar_t *s;
int nskip;
} skippy[] =
{
{L"Undefined Instruction:", 1},
{L"Data Abort:", 2},
{NULL, 0}
};
static int
skip_message (DEBUG_EVENT *ev)
{
char s[80];
DWORD nread;
struct skipper *skp;
int nbytes = ev->u.DebugString.nDebugStringLength;
if (nbytes > sizeof(s))
nbytes = sizeof(s);
memset (s, 0, sizeof (s));
if (!ReadProcessMemory (curproc, ev->u.DebugString.lpDebugStringData,
s, nbytes, &nread))
return 0;
for (skp = skippy; skp->s != NULL; skp++)
if (wcsncmp ((wchar_t *) s, skp->s, wcslen (skp->s)) == 0)
return skp->nskip;
return 0;
}
/* Emulate WaitForDebugEvent. Returns the debug event on success. */
static void
wait_for_debug_event (int s)
{
DWORD ms = getdword (L"WaitForDebugEvent ms", s, GDB_WAITFORDEBUGEVENT);
gdb_wince_result res;
DEBUG_EVENT ev;
static int skip_next = 0;
for (;;)
{
res = WaitForDebugEvent (&ev, ms);
if (ev.dwDebugEventCode == OUTPUT_DEBUG_STRING_EVENT)
{
if (skip_next)
{
skip_next--;
goto ignore;
}
if (skip_next = skip_message (&ev))
goto ignore;
}
putresult (L"WaitForDebugEvent event", res, s, GDB_WAITFORDEBUGEVENT,
&ev, sizeof (ev));
break;
ignore:
ContinueDebugEvent (ev.dwProcessId, ev.dwThreadId, DBG_CONTINUE);
}
return;
}
/* Emulate GetThreadContext. Returns CONTEXT structure on success. */
static void
get_thread_context (int s)
{
CONTEXT c;
HANDLE h = gethandle (L"GetThreadContext handle", s, GDB_GETTHREADCONTEXT);
gdb_wince_result res;
memset (&c, 0, sizeof (c));
c.ContextFlags = getdword (L"GetThreadContext flags", s, GDB_GETTHREADCONTEXT);
res = (gdb_wince_result) GetThreadContext (h, &c);
putresult (L"GetThreadContext data", res, s, GDB_GETTHREADCONTEXT,
&c, sizeof (c));
}
/* Emulate GetThreadContext. Returns success of SetThreadContext. */
static void
set_thread_context (int s)
{
gdb_wince_result res;
HANDLE h = gethandle (L"SetThreadContext handle", s, GDB_SETTHREADCONTEXT);
LPCONTEXT pc = (LPCONTEXT) getmemory (L"SetThreadContext context", s,
GDB_SETTHREADCONTEXT, NULL);
res = SetThreadContext (h, pc);
putresult (L"SetThreadContext result", res, s, GDB_SETTHREADCONTEXT,
&res, sizeof (res));
}
/* Emulate ReadProcessMemory. Returns memory read on success. */
static void
read_process_memory (int s)
{
HANDLE h = gethandle (L"ReadProcessMemory handle", s, GDB_READPROCESSMEMORY);
LPVOID p = getpvoid (L"ReadProcessMemory base", s, GDB_READPROCESSMEMORY);
gdb_wince_len len = getlen (L"ReadProcessMemory size", s, GDB_READPROCESSMEMORY);
LPVOID buf = mempool ((unsigned int) len);
DWORD outlen;
gdb_wince_result res;
outlen = 0;
res = (gdb_wince_result) ReadProcessMemory (h, p, buf, len, &outlen);
putresult (L"ReadProcessMemory data", res, s, GDB_READPROCESSMEMORY,
buf, (gdb_wince_len) outlen);
}
/* Emulate WriteProcessMemory. Returns WriteProcessMemory success. */
static void
write_process_memory (int s)
{
HANDLE h = gethandle (L"WriteProcessMemory handle", s, GDB_WRITEPROCESSMEMORY);
LPVOID p = getpvoid (L"WriteProcessMemory base", s, GDB_WRITEPROCESSMEMORY);
gdb_wince_len len;
LPVOID buf = getmemory (L"WriteProcessMemory buf", s, GDB_WRITEPROCESSMEMORY, &len);
DWORD outlen;
gdb_wince_result res;
outlen = 0;
res = WriteProcessMemory (h, p, buf, (DWORD) len, &outlen);
putresult (L"WriteProcessMemory data", res, s, GDB_WRITEPROCESSMEMORY,
(gdb_wince_len *) & outlen, sizeof (gdb_wince_len));
}
/* Return non-zero to gdb host if given thread is alive. */
static void
thread_alive (int s)
{
HANDLE h = gethandle (L"ThreadAlive handle", s, GDB_THREADALIVE);
gdb_wince_result res;
res = WaitForSingleObject (h, 0) == WAIT_OBJECT_0 ? 1 : 0;
putresult (L"WriteProcessMemory data", res, s, GDB_THREADALIVE,
&res, sizeof (res));
}
/* Emulate SuspendThread. Returns value returned from SuspendThread. */
static void
suspend_thread (int s)
{
DWORD res;
HANDLE h = gethandle (L"SuspendThread handle", s, GDB_SUSPENDTHREAD);
res = SuspendThread (h);
putdword (L"SuspendThread result", s, GDB_SUSPENDTHREAD, res);
}
/* Emulate ResumeThread. Returns value returned from ResumeThread. */
static void
resume_thread (int s)
{
DWORD res;
HANDLE h = gethandle (L"ResumeThread handle", s, GDB_RESUMETHREAD);
res = ResumeThread (h);
putdword (L"ResumeThread result", s, GDB_RESUMETHREAD, res);
}
/* Emulate ContinueDebugEvent. Returns ContinueDebugEvent success. */
static void
continue_debug_event (int s)
{
gdb_wince_result res;
DWORD pid = getdword (L"ContinueDebugEvent pid", s, GDB_CONTINUEDEBUGEVENT);
DWORD tid = getdword (L"ContinueDebugEvent tid", s, GDB_CONTINUEDEBUGEVENT);
DWORD status = getdword (L"ContinueDebugEvent status", s, GDB_CONTINUEDEBUGEVENT);
res = (gdb_wince_result) ContinueDebugEvent (pid, tid, status);
putresult (L"ContinueDebugEvent result", res, s, GDB_CONTINUEDEBUGEVENT, &res, sizeof (res));
}
/* Emulate CloseHandle. Returns CloseHandle success. */
static void
close_handle (int s)
{
gdb_wince_result res;
HANDLE h = gethandle (L"CloseHandle handle", s, GDB_CLOSEHANDLE);
res = (gdb_wince_result) CloseHandle (h);
putresult (L"CloseHandle result", res, s, GDB_CLOSEHANDLE, &res, sizeof (res));
}
/* Main loop for reading requests from gdb host on the socket. */
static void
dispatch (int s)
{
gdb_wince_id id;
/* Continue reading from socket until receive a GDB_STOPSUB. */
while (sockread (L"Dispatch", s, &id, sizeof (id)) > 0)
{
skip_next_id = 1;
switch (id)
{
case GDB_CREATEPROCESS:
create_process (s);
break;
case GDB_TERMINATEPROCESS:
terminate_process (s);
break;
case GDB_WAITFORDEBUGEVENT:
wait_for_debug_event (s);
break;
case GDB_GETTHREADCONTEXT:
get_thread_context (s);
break;
case GDB_SETTHREADCONTEXT:
set_thread_context (s);
break;
case GDB_READPROCESSMEMORY:
read_process_memory (s);
break;
case GDB_WRITEPROCESSMEMORY:
write_process_memory (s);
break;
case GDB_THREADALIVE:
thread_alive (s);
break;
case GDB_SUSPENDTHREAD:
suspend_thread (s);
break;
case GDB_RESUMETHREAD:
resume_thread (s);
break;
case GDB_CONTINUEDEBUGEVENT:
continue_debug_event (s);
break;
case GDB_CLOSEHANDLE:
close_handle (s);
break;
case GDB_STOPSTUB:
terminate_process (s);
return;
case GDB_SINGLESTEP:
flag_single_step (s);
break;
default:
{
WCHAR buf[80];
wsprintfW (buf, L"Invalid command id received: %d", id);
MessageBoxW (NULL, buf, L"GDB", MB_ICONERROR);
skip_next_id = 0;
}
}
}
}
/* The Windows Main entry point */
int WINAPI
WinMain (HINSTANCE hi, HINSTANCE hp, LPWSTR cmd, int show)
{
struct hostent *h;
int s;
struct WSAData wd;
struct sockaddr_in sin;
int tmp;
LPWSTR whost;
char host[80];
whost = wcschr (cmd, L' '); /* Look for argument. */
/* If no host is specified, just use default */
if (whost)
{
/* Eat any spaces. */
while (*whost == L' ' || *whost == L'\t')
whost++;
wcstombs (host, whost, 80); /* Convert from UNICODE to ascii */
}
/* Winsock initialization. */
if (WSAStartup (MAKEWORD (1, 1), &wd))
stub_error (L"Couldn't initialize WINSOCK.");
/* If whost was specified, first try it. If it was not specified or the
host lookup failed, try the Windows CE magic ppp_peer lookup. ppp_peer
is supposed to be the Windows host sitting on the other end of the
serial cable. */
if (whost && *whost && (h = gethostbyname (host)) != NULL)
/* nothing to do */ ;
else if ((h = gethostbyname ("ppp_peer")) == NULL)
stub_error (L"Couldn't get IP address of host system. Error %d", WSAGetLastError ());
/* Get a socket. */
if ((s = socket (AF_INET, SOCK_STREAM, 0)) < 0)
stub_error (L"Couldn't connect to host system. Error %d", WSAGetLastError ());
/* Allow rapid reuse of the port. */
tmp = 1;
setsockopt (s, SOL_SOCKET, SO_REUSEADDR, (char *) &tmp, sizeof (tmp));
/* Set up the information for connecting to the host gdb process. */
memset (&sin, 0, sizeof (sin));
sin.sin_family = h->h_addrtype;
memcpy (&sin.sin_addr, h->h_addr, h->h_length);
sin.sin_port = htons (7000); /* FIXME: This should be configurable */
/* Connect to host */
if (connect (s, (struct sockaddr *) &sin, sizeof (sin)) < 0)
stub_error (L"Couldn't connect to host gdb.");
/* Read from socket until told to exit. */
dispatch (s);
WSACleanup ();
return 0;
}

View File

@ -1,48 +0,0 @@
/* wince-stub.h -- Definitions for commnicating with the WinCE stub.
Copyright (C) 1999, 2000, 2007 Free Software Foundation, Inc.
Contributed by Cygnus Solutions, A Red Hat Company.
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 distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without eve nthe 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., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
/* by Christopher Faylor (cgf@cygnus.com) */
enum win_func
{
GDB_CREATEPROCESS = 42,
GDB_TERMINATEPROCESS,
GDB_WAITFORDEBUGEVENT,
GDB_GETTHREADCONTEXT,
GDB_SETTHREADCONTEXT,
GDB_READPROCESSMEMORY,
GDB_WRITEPROCESSMEMORY,
GDB_THREADALIVE,
GDB_SUSPENDTHREAD,
GDB_RESUMETHREAD,
GDB_CONTINUEDEBUGEVENT,
GDB_CLOSEHANDLE,
GDB_STOPSTUB,
GDB_SINGLESTEP,
GDB_SETBREAK,
GDB_INVALID
};
typedef unsigned char gdb_wince_id;
typedef unsigned short gdb_wince_len;
typedef short gdb_wince_result;

File diff suppressed because it is too large Load Diff