darling-gdb/gdb/wince.c

2099 lines
57 KiB
C
Raw Normal View History

2000-02-24 21:39:15 +00:00
/* Target-vector operations for controlling Windows CE child processes, for GDB.
Copyright (C) 1999, 2000, 2001, 2004, 2006 Free Software Foundation, Inc.
2000-02-24 21:39:15 +00:00
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,
2000-04-22 15:54:56 +00:00
but WITHOUT ANY WARRANTY; without even the implied warranty of
2000-02-24 21:39:15 +00:00
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
* breakpoint.c: * arm-tdep.c: * ia64-tdep.c: * i386-tdep.c: * hpread.c: * hppa-tdep.c: * hppa-hpux-tdep.c: * gnu-nat.c: * gdbtypes.c: * gdbarch.h: * gdbarch.c: * eval.c: * dwarf2read.c: * dbxread.c: * copying: * symfile.c: * stabsread.c: * sh64-tdep.c: * sh-tdep.c: * s390-tdep.c: * rs6000-tdep.c: * remote.c: * remote-mips.c: * mips-tdep.c: * mdebugread.c: * linux-nat.c: * infrun.c: * xcoffread.c: * win32-nat.c: * valops.c: * utils.c: * tracepoint.c: * target.c: * symtab.c: * c-exp.y: * ada-valprint.c: * ada-typeprint.c: * ada-lex.l: * ada-lang.h: * ada-lang.c: * ada-exp.y: * alphafbsd-tdep.c: * alphabsd-tdep.h: * alphabsd-tdep.c: * alphabsd-nat.c: * alpha-tdep.h: * alpha-tdep.c: * alpha-osf1-tdep.c: * alpha-nat.c: * alpha-mdebug-tdep.c: * alpha-linux-tdep.c: * alpha-linux-nat.c: * aix-thread.c: * abug-rom.c: * arch-utils.c: * annotate.h: * annotate.c: * amd64obsd-tdep.c: * amd64obsd-nat.c: * amd64nbsd-tdep.c: * amd64nbsd-nat.c: * amd64fbsd-tdep.c: * amd64fbsd-nat.c: * amd64bsd-nat.c: * amd64-tdep.h: * amd64-tdep.c: * amd64-sol2-tdep.c: * amd64-nat.h: * amd64-nat.c: * amd64-linux-tdep.c: * amd64-linux-nat.c: * alphanbsd-tdep.c: * block.h: * block.c: * bfd-target.h: * bfd-target.c: * bcache.h: * bcache.c: * ax.h: * ax-general.c: * ax-gdb.h: * ax-gdb.c: * avr-tdep.c: * auxv.h: * auxv.c: * armnbsd-tdep.c: * armnbsd-nat.c: * arm-tdep.h: * arm-linux-nat.c: * arch-utils.h: * charset.c: * call-cmds.h: * c-valprint.c: * c-typeprint.c: * c-lang.h: * c-lang.c: * buildsym.h: * buildsym.c: * bsd-uthread.h: * bsd-uthread.c: * bsd-kvm.h: * bsd-kvm.c: * breakpoint.h: * core-regset.c: * core-aout.c: * completer.h: * completer.c: * complaints.h: * complaints.c: * command.h: * coffread.c: * coff-solib.h: * coff-solib.c: * coff-pe-read.h: * coff-pe-read.c: * cli-out.h: * cli-out.c: * charset.h: * dink32-rom.c: * dictionary.h: * dictionary.c: * demangle.c: * defs.h: * dcache.h: * dcache.c: * d10v-tdep.c: * cpu32bug-rom.c: * cp-valprint.c: * cp-support.h: * cp-support.c: * cp-namespace.c: * cp-abi.h: * cp-abi.c: * corelow.c: * corefile.c: * environ.c: * elfread.c: * dwarfread.c: * dwarf2loc.c: * dwarf2expr.h: * dwarf2expr.c: * dwarf2-frame.h: * dwarf2-frame.c: * dve3900-rom.c: * dummy-frame.h: * dummy-frame.c: * dsrec.c: * doublest.h: * doublest.c: * disasm.h: * disasm.c: * fork-child.c: * findvar.c: * fbsd-nat.h: * fbsd-nat.c: * f-valprint.c: * f-typeprint.c: * f-lang.h: * f-lang.c: * expression.h: * expprint.c: * exec.h: * exec.c: * exceptions.h: * exceptions.c: * event-top.h: * event-top.c: * event-loop.h: * event-loop.c: * gdb.c: * gdb-stabs.h: * gdb-events.h: * gdb-events.c: * gcore.c: * frv-tdep.h: * frv-tdep.c: * frv-linux-tdep.c: * frame.h: * frame.c: * frame-unwind.h: * frame-unwind.c: * frame-base.h: * frame-base.c: * gdb_vfork.h: * gdb_thread_db.h: * gdb_string.h: * gdb_stat.h: * gdb_regex.h: * gdb_ptrace.h: * gdb_proc_service.h: * gdb_obstack.h: * gdb_locale.h: * gdb_dirent.h: * gdb_curses.h: * gdb_assert.h: * gdbarch.sh: * gdb.h: * hpux-thread.c: * hppabsd-nat.c: * hppa-tdep.h: * hpacc-abi.c: * h8300-tdep.c: * gregset.h: * go32-nat.c: * gnu-v3-abi.c: * gnu-v2-abi.h: * gnu-v2-abi.c: * gnu-nat.h: * glibc-tdep.c: * gdbtypes.h: * gdbcore.h: * gdbcmd.h: * i386nbsd-tdep.c: * i386nbsd-nat.c: * i386gnu-tdep.c: * i386gnu-nat.c: * i386fbsd-tdep.c: * i386fbsd-nat.c: * i386bsd-tdep.c: * i386bsd-nat.h: * i386bsd-nat.c: * i386-tdep.h: * i386-sol2-nat.c: * i386-nto-tdep.c: * i386-nat.c: * i386-linux-tdep.h: * i386-linux-tdep.c: * i386-linux-nat.c: * i386-cygwin-tdep.c: * inf-ttrace.c: * inf-ptrace.h: * inf-ptrace.c: * inf-loop.h: * inf-loop.c: * inf-child.h: * inf-child.c: * ia64-tdep.h: * ia64-linux-nat.c: * i387-tdep.h: * i387-tdep.c: * i386v4-nat.c: * i386v-nat.c: * i386obsd-tdep.c: * i386obsd-nat.c: * kod.c: * jv-valprint.c: * jv-typeprint.c: * jv-lang.h: * jv-lang.c: * irix5-nat.c: * iq2000-tdep.c: * interps.h: * interps.c: * inftarg.c: * inflow.h: * inflow.c: * inferior.h: * infcmd.c: * infcall.h: * infcall.c: * inf-ttrace.h: * m32r-tdep.h: * m32r-tdep.c: * m32r-rom.c: * m32r-linux-tdep.c: * m32r-linux-nat.c: * m2-valprint.c: * m2-typeprint.c: * m2-lang.h: * m2-lang.c: * lynx-nat.c: * linux-thread-db.c: * linux-nat.h: * linespec.c: * libunwind-frame.h: * libunwind-frame.c: * language.h: * language.c: * macroexp.c: * macrocmd.c: * m88kbsd-nat.c: * m88k-tdep.h: * m88k-tdep.c: * m68klinux-tdep.c: * m68klinux-nat.c: * m68kbsd-tdep.c: * m68kbsd-nat.c: * m68k-tdep.h: * m68k-tdep.c: * mips-linux-nat.c: * mips-irix-tdep.c: * minsyms.c: * memattr.h: * memattr.c: * mem-break.c: * mdebugread.h: * main.h: * main.c: * macrotab.h: * macrotab.c: * macroscope.h: * macroscope.c: * macroexp.h: * nbsd-tdep.c: * mt-tdep.c: * monitor.h: * monitor.c: * mn10300-tdep.h: * mn10300-tdep.c: * mn10300-linux-tdep.c: * mipsv4-nat.c: * mipsread.c: * mipsnbsd-tdep.h: * mipsnbsd-tdep.c: * mipsnbsd-nat.c: * mips64obsd-tdep.c: * mips64obsd-nat.c: * mips-tdep.h: * mips-mdebug-tdep.c: * mips-linux-tdep.c: * osabi.h: * osabi.c: * ocd.h: * ocd.c: * observer.c: * objfiles.h: * objfiles.c: * objc-lang.h: * objc-lang.c: * objc-exp.y: * nto-tdep.h: * nto-tdep.c: * nto-procfs.c: * nlmread.c: * nbsd-tdep.h: * ppcobsd-tdep.c: * ppcobsd-nat.c: * ppcnbsd-tdep.h: * ppcnbsd-tdep.c: * ppcnbsd-nat.c: * ppcbug-rom.c: * ppc-tdep.h: * ppc-sysv-tdep.c: * ppc-linux-tdep.c: * ppc-linux-nat.c: * ppc-bdm.c: * parser-defs.h: * parse.c: * p-valprint.c: * p-typeprint.c: * p-lang.h: * p-lang.c: * remote-fileio.h: * remote-fileio.c: * remote-est.c: * remote-e7000.c: * regset.h: * regset.c: * reggroups.h: * reggroups.c: * regcache.h: * regcache.c: * proc-why.c: * proc-service.c: * proc-events.c: * printcmd.c: * ppcobsd-tdep.h: * sentinel-frame.h: * sentinel-frame.c: * scm-valprint.c: * scm-tags.h: * scm-lang.h: * scm-lang.c: * scm-exp.c: * s390-tdep.h: * rom68k-rom.c: * remote.h: * remote-utils.c: * remote-st.c: * remote-sim.c: * remote-sds.c: * remote-rdp.c: * remote-rdi.c: * remote-hms.c: * sim-regno.h: * shnbsd-tdep.h: * shnbsd-tdep.c: * shnbsd-nat.c: * sh-tdep.h: * serial.h: * serial.c: * ser-unix.h: * ser-unix.c: * ser-tcp.c: * ser-pipe.c: * ser-go32.c: * ser-e7kpc.c: * ser-base.h: * ser-base.c: * solib.c: * solib-svr4.h: * solib-svr4.c: * solib-sunos.c: * solib-som.h: * solib-som.c: * solib-pa64.h: * solib-pa64.c: * solib-osf.c: * solib-null.c: * solib-legacy.c: * solib-irix.c: * solib-frv.c: * solib-aix5.c: * sol-thread.c: * sparc64-linux-tdep.c: * sparc64-linux-nat.c: * sparc-tdep.h: * sparc-tdep.c: * sparc-sol2-tdep.c: * sparc-sol2-nat.c: * sparc-nat.h: * sparc-nat.c: * sparc-linux-tdep.c: * sparc-linux-nat.c: * source.h: * source.c: * somread.c: * solist.h: * solib.h: * std-regs.c: * stack.h: * stack.c: * stabsread.h: * sparcobsd-tdep.c: * sparcnbsd-tdep.c: * sparcnbsd-nat.c: * sparc64obsd-tdep.c: * sparc64nbsd-tdep.c: * sparc64nbsd-nat.c: * sparc64fbsd-tdep.c: * sparc64fbsd-nat.c: * sparc64-tdep.h: * sparc64-tdep.c: * sparc64-sol2-tdep.c: * sparc64-nat.c: * ui-file.c: * typeprint.h: * typeprint.c: * tramp-frame.h: * tramp-frame.c: * trad-frame.h: * trad-frame.c: * tracepoint.h: * top.c: * tobs.inc: * thread.c: * terminal.h: * target.h: * symfile.h: * stop-gdb.c: * vaxbsd-nat.c: * vax-tdep.h: * vax-tdep.c: * vax-nat.c: * varobj.h: * varobj.c: * value.h: * value.c: * valprint.h: * valprint.c: * v850-tdep.c: * uw-thread.c: * user-regs.c: * ui-out.h: * ui-out.c: * ui-file.h: * xcoffsolib.h: * xcoffsolib.c: * wrapper.c: * wince.c: * wince-stub.h: * wince-stub.c: * vaxobsd-tdep.c: * vaxnbsd-tdep.c: * gdb_gcore.sh: * copying.c: * configure.ac: * aclocal.m4: * acinclude.m4: * reply_mig_hack.awk: * observer.sh: * gdb_mbuild.sh: * arm-linux-tdep.c: * blockframe.c: * dbug-rom.c: * environ.h: * dwarf2loc.h: * gdb-events.sh: * glibc-tdep.h: * gdb_wait.h: * gdbthread.h: * i386-sol2-tdep.c: * hppabsd-tdep.c: * hppa-linux-nat.c: * hppa-hpux-nat.c: * ia64-linux-tdep.c: * infptrace.c: * linespec.h: * maint.c: * mips-mdebug-tdep.h: * remote-m32r-sdi.c: * s390-nat.c: * rs6000-nat.c: * remote-utils.h: * sh3-rom.c: * sh-linux-tdep.c: * top.h: * symtab.h: * symmisc.c: * symfile-mem.c: * srec.h: * user-regs.h: * version.h: * valarith.c: * xstormy16-tdep.c: * wrapper.h: * Makefile.in: * f-exp.y: * cris-tdep.c: * cp-name-parser.y: * procfs.c: * proc-utils.h: * proc-flags.c: * proc-api.c: * p-exp.y: * m68hc11-tdep.c: * m2-exp.y: * kod.h: * kod-cisco.c: * jv-exp.y: * hppa-linux-tdep.c: Add (c) after Copyright. Update the FSF address.
2005-12-17 22:34:03 +00:00
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
2000-02-24 21:39:15 +00:00
*/
/* by Christopher Faylor (cgf@cygnus.com) */
/* We assume we're being built with and will be used for cygwin. */
#ifdef SHx
#undef SH4
#define SH4 /* Just to get all of the CONTEXT defines. */
2000-02-24 21:39:15 +00:00
#endif
#include "defs.h"
#include "frame.h" /* required by inferior.h */
2000-02-24 21:39:15 +00:00
#include "inferior.h"
#include "target.h"
#include "exceptions.h"
2000-02-24 21:39:15 +00:00
#include "gdbcore.h"
#include "command.h"
#include <signal.h>
#include <sys/types.h>
#include <fcntl.h>
#include <stdlib.h>
#include <windows.h>
#include <rapi.h>
#include <netdb.h>
#include <cygwin/in.h>
#include <cygwin/socket.h>
#include "buildsym.h"
#include "symfile.h"
#include "objfiles.h"
#include "gdb_string.h"
#include "gdbthread.h"
#include "gdbcmd.h"
#include <sys/param.h>
#include "wince-stub.h"
#include <time.h>
#include "regcache.h"
#ifdef MIPS
#include "mips-tdep.h"
#endif
2000-02-24 21:39:15 +00:00
/* If we're not using the old Cygwin header file set, define the
following which never should have been in the generic Win32 API
headers in the first place since they were our own invention... */
2000-02-24 21:39:15 +00:00
#ifndef _GNU_H_WINDOWS_H
#define FLAG_TRACE_BIT 0x100
#ifdef CONTEXT_FLOATING_POINT
#define CONTEXT_DEBUGGER0 (CONTEXT_FULL | CONTEXT_FLOATING_POINT)
#else
#define CONTEXT_DEBUGGER0 (CONTEXT_FULL)
#endif
#endif
#ifdef SH4
#define CONTEXT_DEBUGGER ((CONTEXT_DEBUGGER0 & ~(CONTEXT_SH4 | CONTEXT_FLOATING_POINT)) | CONTEXT_SH3)
#else
#define CONTEXT_DEBUGGER CONTEXT_DEBUGGER0
#endif
/* The string sent by cygwin when it processes a signal.
FIXME: This should be in a cygwin include file. */
2000-02-24 21:39:15 +00:00
#define CYGWIN_SIGNAL_STRING "cygwin: signal"
#define CHECK(x) check (x, __FILE__,__LINE__)
#define DEBUG_EXEC(x) if (debug_exec) printf x
#define DEBUG_EVENTS(x) if (debug_events) printf x
#define DEBUG_MEM(x) if (debug_memory) printf x
#define DEBUG_EXCEPT(x) if (debug_exceptions) printf x
static int connection_initialized = 0; /* True if we've initialized a
RAPI session. */
2000-02-24 21:39:15 +00:00
/* The directory where the stub and executable files are uploaded. */
2000-02-24 21:39:15 +00:00
static const char *remote_directory = "\\gdb";
/* The types automatic upload available. */
2000-02-24 21:39:15 +00:00
static enum
{
UPLOAD_ALWAYS = 0,
UPLOAD_NEWER = 1,
UPLOAD_NEVER = 2
}
upload_when = UPLOAD_NEWER;
/* Valid options for 'set remoteupload'. Note that options
must track upload_when enum. */
2000-02-24 21:39:15 +00:00
static struct opts
{
const char *name;
int abbrev;
}
upload_options[3] =
{
{
"always", 1
}
,
{
"newer", 3
}
,
{
"never", 3
}
};
static char *remote_upload = NULL; /* Set by set remoteupload. */
2000-02-24 21:39:15 +00:00
static int remote_add_host = 0;
2001-05-04 04:15:33 +00:00
static int win32_child_thread_alive (ptid_t);
2000-05-28 01:12:42 +00:00
void child_kill_inferior (void);
2000-02-24 21:39:15 +00:00
static int last_sig = 0; /* Set if a signal was received from
the debugged process. */
2000-02-24 21:39:15 +00:00
/* Thread information structure used to track information that is
not available in gdb's thread structure. */
2000-02-24 21:39:15 +00:00
typedef struct thread_info_struct
{
struct thread_info_struct *next;
DWORD id;
HANDLE h;
char *name;
int suspend_count;
int stepped; /* True if stepped. */
2000-02-24 21:39:15 +00:00
CORE_ADDR step_pc;
CONTEXT context;
}
thread_info;
static thread_info thread_head =
{NULL};
static thread_info * thread_rec (DWORD id, int get_context);
2000-02-24 21:39:15 +00:00
/* The process and thread handles for the above context. */
2000-02-24 21:39:15 +00:00
static DEBUG_EVENT current_event; /* The current debug event from
WaitForDebugEvent. */
static HANDLE current_process_handle; /* Currently executing process. */
static thread_info *current_thread; /* Info on currently selected
thread. */
static thread_info *this_thread; /* Info on thread returned by
wait_for_debug_event. */
static DWORD main_thread_id; /* Thread ID of the main thread. */
/* Counts of things. */
2000-02-24 21:39:15 +00:00
static int exception_count = 0;
static int event_count = 0;
/* User options. */
static int debug_exec = 0; /* show execution */
static int debug_events = 0; /* show events from kernel */
static int debug_memory = 0; /* show target memory accesses */
2000-02-24 21:39:15 +00:00
static int debug_exceptions = 0; /* show target exceptions */
/* An array of offset mappings into a Win32 Context structure.
This is a one-to-one mapping which is indexed by gdb's register
numbers. It retrieves an offset into the context structure where
the 4 byte register is located.
An offset value of -1 indicates that Win32 does not provide this
register in it's CONTEXT structure. regptr will return zero for this
register.
This is used by the regptr function. */
2000-02-24 21:39:15 +00:00
#define context_offset(x) ((int)&(((PCONTEXT)NULL)->x))
static const int mappings[NUM_REGS + 1] =
{
#ifdef __i386__
context_offset (Eax),
context_offset (Ecx),
context_offset (Edx),
context_offset (Ebx),
context_offset (Esp),
context_offset (Ebp),
context_offset (Esi),
context_offset (Edi),
context_offset (Eip),
context_offset (EFlags),
context_offset (SegCs),
context_offset (SegSs),
context_offset (SegDs),
context_offset (SegEs),
context_offset (SegFs),
context_offset (SegGs),
context_offset (FloatSave.RegisterArea[0 * 10]),
context_offset (FloatSave.RegisterArea[1 * 10]),
context_offset (FloatSave.RegisterArea[2 * 10]),
context_offset (FloatSave.RegisterArea[3 * 10]),
context_offset (FloatSave.RegisterArea[4 * 10]),
context_offset (FloatSave.RegisterArea[5 * 10]),
context_offset (FloatSave.RegisterArea[6 * 10]),
context_offset (FloatSave.RegisterArea[7 * 10]),
#elif defined(SHx)
context_offset (R0),
context_offset (R1),
context_offset (R2),
context_offset (R3),
context_offset (R4),
context_offset (R5),
context_offset (R6),
context_offset (R7),
context_offset (R8),
context_offset (R9),
context_offset (R10),
context_offset (R11),
context_offset (R12),
context_offset (R13),
context_offset (R14),
context_offset (R15),
context_offset (Fir),
context_offset (PR), /* Procedure Register */
context_offset (GBR), /* Global Base Register */
context_offset (MACH), /* Accumulate */
context_offset (MACL), /* Multiply */
context_offset (Psr),
context_offset (Fpul),
context_offset (Fpscr),
context_offset (FRegs[0]),
context_offset (FRegs[1]),
context_offset (FRegs[2]),
context_offset (FRegs[3]),
context_offset (FRegs[4]),
context_offset (FRegs[5]),
context_offset (FRegs[6]),
context_offset (FRegs[7]),
context_offset (FRegs[8]),
context_offset (FRegs[9]),
context_offset (FRegs[10]),
context_offset (FRegs[11]),
context_offset (FRegs[12]),
context_offset (FRegs[13]),
context_offset (FRegs[14]),
context_offset (FRegs[15]),
context_offset (xFRegs[0]),
context_offset (xFRegs[1]),
context_offset (xFRegs[2]),
context_offset (xFRegs[3]),
context_offset (xFRegs[4]),
context_offset (xFRegs[5]),
context_offset (xFRegs[6]),
context_offset (xFRegs[7]),
context_offset (xFRegs[8]),
context_offset (xFRegs[9]),
context_offset (xFRegs[10]),
context_offset (xFRegs[11]),
context_offset (xFRegs[12]),
context_offset (xFRegs[13]),
context_offset (xFRegs[14]),
context_offset (xFRegs[15]),
#elif defined(MIPS)
context_offset (IntZero),
context_offset (IntAt),
context_offset (IntV0),
context_offset (IntV1),
context_offset (IntA0),
context_offset (IntA1),
context_offset (IntA2),
context_offset (IntA3),
context_offset (IntT0),
context_offset (IntT1),
context_offset (IntT2),
context_offset (IntT3),
context_offset (IntT4),
context_offset (IntT5),
context_offset (IntT6),
context_offset (IntT7),
context_offset (IntS0),
context_offset (IntS1),
context_offset (IntS2),
context_offset (IntS3),
context_offset (IntS4),
context_offset (IntS5),
context_offset (IntS6),
context_offset (IntS7),
context_offset (IntT8),
context_offset (IntT9),
context_offset (IntK0),
context_offset (IntK1),
context_offset (IntGp),
context_offset (IntSp),
context_offset (IntS8),
context_offset (IntRa),
context_offset (Psr),
context_offset (IntLo),
context_offset (IntHi),
-1, /* bad */
-1, /* cause */
context_offset (Fir),
context_offset (FltF0),
context_offset (FltF1),
context_offset (FltF2),
context_offset (FltF3),
context_offset (FltF4),
context_offset (FltF5),
context_offset (FltF6),
context_offset (FltF7),
context_offset (FltF8),
context_offset (FltF9),
context_offset (FltF10),
context_offset (FltF11),
context_offset (FltF12),
context_offset (FltF13),
context_offset (FltF14),
context_offset (FltF15),
context_offset (FltF16),
context_offset (FltF17),
context_offset (FltF18),
context_offset (FltF19),
context_offset (FltF20),
context_offset (FltF21),
context_offset (FltF22),
context_offset (FltF23),
context_offset (FltF24),
context_offset (FltF25),
context_offset (FltF26),
context_offset (FltF27),
context_offset (FltF28),
context_offset (FltF29),
context_offset (FltF30),
context_offset (FltF31),
context_offset (Fsr),
context_offset (Fir),
-1, /* fp */
#elif defined(ARM)
context_offset (R0),
context_offset (R1),
context_offset (R2),
context_offset (R3),
context_offset (R4),
context_offset (R5),
context_offset (R6),
context_offset (R7),
context_offset (R8),
context_offset (R9),
context_offset (R10),
context_offset (R11),
context_offset (R12),
context_offset (Sp),
context_offset (Lr),
context_offset (Pc),
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
-1,
context_offset (Psr),
#endif
-1
};
/* Return a pointer into a CONTEXT field indexed by gdb register number.
Return a pointer to an address pointing to zero if there is no
corresponding CONTEXT field for the given register number.
*/
static ULONG *
regptr (LPCONTEXT c, int r)
2000-02-24 21:39:15 +00:00
{
static ULONG zero = 0;
ULONG *p;
if (mappings[r] < 0)
p = &zero;
else
p = (ULONG *) (((char *) c) + mappings[r]);
return p;
}
2000-02-24 21:39:15 +00:00
/******************** Beginning of stub interface ********************/
/* Stub interface description:
The Windows CE stub implements a crude RPC. The hand-held device
connects to gdb using port 7000. gdb and the stub then communicate
using packets where:
byte 0: command id (e.g. Create Process)
byte 1-4: DWORD
byte 1-2: WORD
byte 1-2: length
byte 3-n: arbitrary memory.
The interface is deterministic, i.e., if the stub expects a DWORD
then the gdb server should send a DWORD.
2000-02-24 21:39:15 +00:00
*/
/* Note: In the functions below, the `huh' parameter is a string
passed from the function containing a descriptive string concerning
the current operation. This is used for error reporting.
2000-02-24 21:39:15 +00:00
The 'what' parameter is a command id as found in wince-stub.h.
Hopefully, the rest of the parameters are self-explanatory.
*/
static int s; /* communication socket */
/* v-style interface for handling varying argyment list error messages.
Displays the error message in a dialog box and exits when user clicks
on OK. */
2000-02-24 21:39:15 +00:00
static void
vstub_error (LPCSTR fmt, va_list * args)
{
char buf[4096];
vsprintf (buf, fmt, args);
s = -1;
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
error (("%s"), buf);
2000-02-24 21:39:15 +00:00
}
/* The standard way to display an error message and exit. */
2000-02-24 21:39:15 +00:00
static void
stub_error (LPCSTR fmt,...)
{
va_list args;
va_start (args, fmt);
vstub_error (fmt, args);
}
/* Standard "oh well" can't communicate error. Someday this might
attempt synchronization. */
2000-02-24 21:39:15 +00:00
static void
attempt_resync (LPCSTR huh, int s)
{
stub_error ("lost synchronization with target attempting %s", huh);
}
/* Read arbitrary stuff from a socket. */
2000-02-24 21:39:15 +00:00
static int
sockread (LPCSTR huh, int s, void *str, size_t n)
{
for (;;)
{
if (recv (s, str, n, 0) == n)
return n;
attempt_resync (huh, s);
}
}
/* Write arbitrary stuff to a socket. */
2000-02-24 21:39:15 +00:00
static int
sockwrite (LPCSTR huh, const void *str, size_t n)
{
for (;;)
{
if (send (s, str, n, 0) == n)
return n;
attempt_resync (huh, s);
}
}
/* Output an id/dword to the host. */
2000-02-24 21:39:15 +00:00
static void
putdword (LPCSTR huh, gdb_wince_id what, DWORD n)
{
if (sockwrite (huh, &what, sizeof (what)) != sizeof (what))
stub_error ("error writing record id to host for %s", huh);
if (sockwrite (huh, &n, sizeof (n)) != sizeof (n))
stub_error ("error writing %s to host.", huh);
}
/* Output an id/word to the host. */
2000-02-24 21:39:15 +00:00
static void
putword (LPCSTR huh, gdb_wince_id what, WORD n)
{
if (sockwrite (huh, &what, sizeof (what)) != sizeof (what))
stub_error ("error writing record id to host for %s", huh);
if (sockwrite (huh, &n, sizeof (n)) != sizeof (n))
stub_error ("error writing %s host.", huh);
}
/* Convenience define for outputting a "gdb_wince_len" type. */
2000-02-24 21:39:15 +00:00
#define putlen(huh, what, n) putword((huh), (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. */
2000-02-24 21:39:15 +00:00
static void
putmemory (LPCSTR huh, gdb_wince_id what,
const void *mem, gdb_wince_len len)
2000-02-24 21:39:15 +00:00
{
putlen (huh, what, len);
if (((short) len > 0) && sockwrite (huh, mem, len) != len)
stub_error ("error writing %s to host.", huh);
}
/* 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. */
2000-02-24 21:39:15 +00:00
static DWORD
getdword (LPCSTR huh, gdb_wince_id what_this)
{
DWORD n;
gdb_wince_id what;
do
if (sockread (huh, s, &what, sizeof (what)) != sizeof (what))
stub_error ("error getting record type from host - %s.", huh);
while (what_this != what);
if (sockread (huh, s, &n, sizeof (n)) != sizeof (n))
stub_error ("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. */
2000-02-24 21:39:15 +00:00
static WORD
getword (LPCSTR huh, gdb_wince_id what_this)
{
WORD n;
gdb_wince_id what;
do
if (sockread (huh, s, &what, sizeof (what)) != sizeof (what))
stub_error ("error getting record type from host - %s.", huh);
while (what_this != what);
if (sockread (huh, s, &n, sizeof (n)) != sizeof (n))
stub_error ("error getting %s from host.", huh);
return n;
}
/* Handy defines for getting/putting various types of values. */
2000-02-24 21:39:15 +00:00
#define gethandle(huh, what) (HANDLE) getdword ((huh), (what))
#define getpvoid(huh, what) (LPVOID) getdword ((huh), (what))
#define getlen(huh, what) (gdb_wince_len) getword ((huh), (what))
#define puthandle(huh, what, h) putdword ((huh), (what), (DWORD) (h))
#define putpvoid(huh, what, p) putdword ((huh), (what), (DWORD) (p))
/* Retrieve the result of an operation from the stub. If nbytes < 0)
then nbytes is actually an error and nothing else follows. Use
SetLastError to remember this. if nbytes > 0, retrieve a block of
*nbytes into buf.
2000-02-24 21:39:15 +00:00
*/
int
getresult (LPCSTR huh, gdb_wince_id what, LPVOID buf,
gdb_wince_len * nbytes)
2000-02-24 21:39:15 +00:00
{
gdb_wince_len dummy;
if (nbytes == NULL)
nbytes = &dummy;
*nbytes = getlen (huh, what);
if ((short) *nbytes < 0)
{
SetLastError (-(short) *nbytes);
return 0;
}
if ((gdb_wince_len) sockread (huh, s, buf, *nbytes) != *nbytes)
stub_error ("couldn't read information from wince stub - %s", huh);
return 1;
}
/* Convert "narrow" string to "wide". Manipulates a buffer ring of 8
buffers which hold the translated string. This is an arbitrary limit
but it is approximately double the current needs of this module.
*/
LPWSTR
towide (const char *s, gdb_wince_len * out_len)
{
static int n = -1;
static LPWSTR outs[8] =
{NULL /*, NULL, etc. */ };
2000-02-24 21:39:15 +00:00
gdb_wince_len dummy;
if (!out_len)
out_len = &dummy;
/* First determine the length required to hold the converted string. */
*out_len = sizeof (WCHAR) * MultiByteToWideChar (CP_ACP, 0, s,
-1, NULL, 0);
2000-02-24 21:39:15 +00:00
if (!*out_len)
return NULL; /* The conversion failed. */
2000-02-24 21:39:15 +00:00
if (++n >= (sizeof (outs) / sizeof (outs[0])))
n = 0; /* wrap */
/* Allocate space for the converted string, reusing any previously
allocated space, if applicable. Note that if outs[n] is NULL,
xrealloc will act as a malloc (under cygwin, at least).
2000-02-24 21:39:15 +00:00
*/
outs[n] = (LPWSTR) xrealloc (outs[n], *out_len);
2000-02-24 21:39:15 +00:00
memset (outs[n], 0, *out_len);
(void) MultiByteToWideChar (CP_ACP, 0, s, -1, outs[n], *out_len);
return outs[n];
}
/******************** Emulation routines start here. ********************
The functions below are modelled after their Win32 counterparts.
They are named similarly to Win32 and take exactly the same
arguments except where otherwise noted. They communicate with the
stub on the hand-held device by sending their arguments over the
socket and waiting for results from the socket.
There is one universal change. In cases where a length is expected
to be returned in a DWORD, we use a gdb_wince_len type instead.
Currently this is an unsigned short which is smaller than the
standard Win32 DWORD. This is done to minimize unnecessary traffic
since the connection to Windows CE can be slow. To change this,
modify the typedef in wince-stub.h and change the putlen/getlen
macros in this file and in the stub.
2000-02-24 21:39:15 +00:00
*/
2000-02-24 21:39:15 +00:00
static int
create_process (LPSTR exec_file, LPSTR args, DWORD flags,
PROCESS_INFORMATION * pi)
2000-02-24 21:39:15 +00:00
{
gdb_wince_len len;
LPWSTR buf;
buf = towide (exec_file, &len);
putmemory ("CreateProcess exec_file", GDB_CREATEPROCESS, buf, len);
buf = towide (args, &len);
putmemory ("CreateProcess args", GDB_CREATEPROCESS, buf, len);
putdword ("CreateProcess flags", GDB_CREATEPROCESS, flags);
return getresult ("CreateProcess result", GDB_CREATEPROCESS, pi, NULL);
}
/* Emulate TerminateProcess.
Don't bother with the second argument since CE ignores it.
2000-02-24 21:39:15 +00:00
*/
static int
terminate_process (HANDLE h)
{
gdb_wince_result res;
if (s < 0)
return 1;
puthandle ("TerminateProcess handle", GDB_TERMINATEPROCESS, h);
return getresult ("TerminateProcess result",
GDB_TERMINATEPROCESS, &res, NULL);
2000-02-24 21:39:15 +00:00
}
static int
wait_for_debug_event (DEBUG_EVENT * ev, DWORD ms)
{
if (s < 0)
return 1;
putdword ("WaitForDebugEvent ms", GDB_WAITFORDEBUGEVENT, ms);
return getresult ("WaitForDebugEvent event",
GDB_WAITFORDEBUGEVENT, ev, NULL);
2000-02-24 21:39:15 +00:00
}
static int
get_thread_context (HANDLE h, CONTEXT * c)
{
if (s < 0)
return 1;
puthandle ("GetThreadContext handle", GDB_GETTHREADCONTEXT, h);
putdword ("GetThreadContext flags", GDB_GETTHREADCONTEXT,
c->ContextFlags);
return getresult ("GetThreadContext context",
GDB_GETTHREADCONTEXT, c, NULL);
2000-02-24 21:39:15 +00:00
}
static int
set_thread_context (HANDLE h, CONTEXT * c)
{
gdb_wince_result res;
if (s < 0)
return 1;
puthandle ("SetThreadContext handle", GDB_SETTHREADCONTEXT, h);
putmemory ("SetThreadContext context", GDB_SETTHREADCONTEXT,
c, sizeof (*c));
return getresult ("SetThreadContext context",
GDB_SETTHREADCONTEXT, &res, NULL);
2000-02-24 21:39:15 +00:00
}
static int
read_process_memory (HANDLE h, LPCVOID where,
LPVOID buf, gdb_wince_len len,
gdb_wince_len * nbytes)
2000-02-24 21:39:15 +00:00
{
if (s < 0)
return 1;
puthandle ("ReadProcessMemory handle", GDB_READPROCESSMEMORY, h);
putpvoid ("ReadProcessMemory location", GDB_READPROCESSMEMORY, where);
putlen ("ReadProcessMemory size", GDB_READPROCESSMEMORY, len);
return getresult ("ReadProcessMemory buf",
GDB_READPROCESSMEMORY, buf, nbytes);
2000-02-24 21:39:15 +00:00
}
static int
write_process_memory (HANDLE h, LPCVOID where,
LPCVOID buf, gdb_wince_len len,
gdb_wince_len * nbytes)
2000-02-24 21:39:15 +00:00
{
if (s < 0)
return 1;
puthandle ("WriteProcessMemory handle", GDB_WRITEPROCESSMEMORY, h);
putpvoid ("WriteProcessMemory location", GDB_WRITEPROCESSMEMORY, where);
putmemory ("WriteProcProcessMemory buf", GDB_WRITEPROCESSMEMORY, buf, len);
return getresult ("WriteProcessMemory result",
GDB_WRITEPROCESSMEMORY, nbytes, NULL);
2000-02-24 21:39:15 +00:00
}
static int
remote_read_bytes (CORE_ADDR memaddr, char *myaddr, int len)
{
gdb_wince_len nbytes;
if (!read_process_memory (current_process_handle,
(LPCVOID) memaddr,
(LPVOID) myaddr,
len, &nbytes))
2000-02-24 21:39:15 +00:00
return -1;
return nbytes;
}
static int
remote_write_bytes (CORE_ADDR memaddr, char *myaddr, int len)
{
gdb_wince_len nbytes;
if (!write_process_memory (current_process_handle,
(LPCVOID) memaddr,
(LPCVOID) myaddr,
len, &nbytes))
2000-02-24 21:39:15 +00:00
return -1;
return nbytes;
}
/* This is not a standard Win32 function. It instructs the stub to
return TRUE if the thread referenced by HANDLE h is alive.
2000-02-24 21:39:15 +00:00
*/
static int
thread_alive (HANDLE h)
{
gdb_wince_result res;
if (s < 0)
return 1;
puthandle ("ThreadAlive handle", GDB_THREADALIVE, h);
return getresult ("ThreadAlive result", GDB_THREADALIVE, &res, NULL);
}
static int
suspend_thread (HANDLE h)
{
if (s < 0)
return 1;
puthandle ("SuspendThread handle", GDB_SUSPENDTHREAD, h);
return (int) getdword ("SuspendThread result", GDB_SUSPENDTHREAD);
}
static int
resume_thread (HANDLE h)
{
if (s < 0)
return 1;
puthandle ("ResumeThread handle", GDB_RESUMETHREAD, h);
return (int) getdword ("SuspendThread result", GDB_RESUMETHREAD);
}
static int
continue_debug_event (DWORD pid, DWORD tid, DWORD status)
{
gdb_wince_result res;
if (s < 0)
return 0;
putdword ("ContinueDebugEvent pid", GDB_CONTINUEDEBUGEVENT, pid);
putdword ("ContinueDebugEvent tid", GDB_CONTINUEDEBUGEVENT, tid);
putdword ("ContinueDebugEvent status", GDB_CONTINUEDEBUGEVENT, status);
return getresult ("ContinueDebugEvent result",
GDB_CONTINUEDEBUGEVENT, &res, NULL);
2000-02-24 21:39:15 +00:00
}
static int
close_handle (HANDLE h)
{
gdb_wince_result res;
if (s < 0)
return 1;
puthandle ("CloseHandle handle", GDB_CLOSEHANDLE, h);
return (int) getresult ("CloseHandle result",
GDB_CLOSEHANDLE, &res, NULL);
2000-02-24 21:39:15 +00:00
}
/* This is not a standard Win32 interface. This function tells the
stub to terminate.
2000-02-24 21:39:15 +00:00
*/
static void
2000-07-30 01:48:28 +00:00
stop_stub (void)
2000-02-24 21:39:15 +00:00
{
if (s < 0)
return;
(void) putdword ("Stopping gdb stub", GDB_STOPSTUB, 0);
s = -1;
}
/******************** End of emulation routines. ********************/
/******************** End of stub interface ********************/
#define check_for_step(a, x) (x)
#ifdef MIPS
static void
undoSStep (thread_info * th)
{
if (th->stepped)
{
gdb/ * breakpoint.c (deprecated_read_memory_nobpt): Update to use shadow_len. (insert_bp_location, reattach_breakpoints, remove_breakpoint) (delete_breakpoint): Update calls to changed methods. (deprecated_insert_raw_breakpoint, deprecated_remove_raw_breakpoint) (single_step_breakpoints, insert_single_step_breakpoint) (remove_single_step_breakpoints): New. * breakpoint.h (struct bp_target_info): New. (struct bp_location): Replace shadow_contents with target_info and overlay_target_info. (deprecated_insert_raw_breakpoint, deprecated_remove_raw_breakpoint) (insert_single_step_breakpoint, remove_single_step_breakpoints): New prototypes. * gdbarch.sh: Forward declare struct bp_target_info in gdbarch.h. (memory_insert_breakpoint, memory_remove_breakpoint): Update second argument. * mem-break.c (default_memory_insert_breakpoint): Update. Set placed_address, placed_size, and shadow_len. (default_memory_remove_breakpoint): Update. Don't use BREAKPOINT_FROM_PC. (memory_insert_breakpoint, memory_remove_breakpoint): Update. * target.c (update_current_target): Update prototypes for changed functions. (debug_to_insert_breakpoint, debug_to_remove_breakpoint) (debug_to_insert_hw_breakpoint, debug_to_remove_hw_breakpoint): Update. * target.h: Forward declare struct bp_target_info. (struct target_ops): Use a bp_target_info argument for to_insert_breakpoint, to_remove_breakpoint, to_insert_hw_breakpoint, and to_remove_hw_breakpoint. (target_insert_breakpoint, target_remove_breakpoint) (target_insert_hw_breakpoint, target_remove_hw_breakpoint) (memory_insert_breakpoint, memory_remove_breakpoint) (default_memory_insert_breakpoint, default_memory_remove_breakpoint): Update. * config/i386/nm-i386.h: Forward declare struct bp_target_info. (i386_insert_hw_breakpoint, i386_remove_hw_breakpoint): Update. (target_insert_hw_breakpoint, target_remove_hw_breakpoint): Likewise. * gdbarch.c, gdbarch.h: Regenerated. * alpha-tdep.c (alpha_software_single_step): Use insert_single_step_breakpoint and remove_single_step_breakpoints. Remove unused statics. * arm-tdep.c (arm_software_single_step): Likewise. Add a note. * cris-tdep.c (cris_software_single_step): Likewise. * mips-tdep.c (mips_software_single_step): Likewise. * rs6000-tdep.c (rs6000_software_single_step): Likewise. * sparc-tdep.c (sparc_software_single_step): Likewise. * wince.c (struct thread_info_struct): Remove step_prev. (undoSStep): Use remove_single_step_breakpoints. (wince_software_single_step): Use insert_single_step_breakpoint. * corelow.c (ignore): Remove unneeded prototype. Update arguments. * exec.c (ignore): Likewise. * sol-thread.c (ignore): Likewise. * procfs.c (dbx_link_shadow_contents): Delete. (dbx_link_bpt): New. (procfs_mourn_inferior): Remove it if necessary. (remove_dbx_link_breakpoint): Use it. (insert_dbx_link_bpt_in_file): Set it. (procfs_init_inferior): Don't update dbx_link_bpt_addr. * rs6000-nat.c (exec_one_dummy_insn): Use deprecated_insert_raw_breakpoint and deprecated_remove_raw_breakpoint. * solib-irix.c (shadow_contents, breakpoint_addr): Delete. (base_breakpoint): New. (disable_break): Use it. (enable_break): Set it. * i386-nat.c (i386_insert_hw_breakpoint, i386_remove_hw_breakpoint): Update. * ia64-tdep.c (ia64_memory_insert_breakpoint) (ia64_memory_remove_breakpoint): Likewise. * m32r-tdep.c (m32r_memory_insert_breakpoint) (m32r_memory_remove_breakpoint): Likewise. * monitor.c (monitor_insert_breakpoint, monitor_remove_breakpoint): Likewise. Remove unnecessary prototypes. Use placed_address and placed_size. Removed useless read from memory. * nto-procfs.c (procfs_insert_breakpoint) (procfs_remove_breakpoint, procfs_insert_hw_breakpoint) (procfs_remove_hw_breakpoint): Update. * ocd.c (ocd_insert_breakpoint, ocd_remove_breakpoint): Likewise. * ocd.h (ocd_insert_breakpoint, ocd_remove_breakpoint): Likewise. * ppc-linux-tdep.c (ppc_linux_memory_remove_breakpoint): Likewise. * ppc-tdep.h (ppc_linux_memory_remove_breakpoint): Likewise. * remote-e7000.c (e7000_insert_breakpoint) (e7000_remove_breakpoint): Likewise. * remote-m32r-sdi.c (m32r_insert_breakpoint) (m32r_remove_breakpoint): Likewise. * remote-mips.c (mips_insert_breakpoint) (mips_remove_breakpoint): Likewise. * remote-rdp.c (remote_rdp_insert_breakpoint) (remote_rdp_remove_breakpoint): Likewise. (rdp_step): Use deprecated_insert_raw_breakpoint and deprecated_remove_raw_breakpoint. * remote-sds.c (sds_insert_breakpoint, sds_remove_breakpoint): Update. * remote-sim.c (gdbsim_insert_breakpoint, gdbsim_remove_breakpoint): Delete. (init_gdbsim_ops): Use memory_insert_breakpoint and memory_remove_breakpoint. * remote-st.c (st2000_insert_breakpoint) (st2000_remove_breakpoint): Update. Remove unused BREAKPOINT_FROM_PC. * remote.c (remote_insert_breakpoint, remote_remove_breakpoint): Update. Use placed_address and placed_size. (remote_insert_hw_breakpoint, remote_remove_hw_breakpoint): Likewise. gdb/doc/ * gdbint.texinfo (x86 Watchpoints, Target Conditionals): Update insert and remove breakpoint prototypes. (Watchpoints): Move description of target_insert_hw_breakpoint and target_remove_hw_breakpoint ... (Breakpoints): ... to here. Document target_insert_breakpoint and target_remove_breakpoint.
2006-04-18 19:20:08 +00:00
remove_single_step_breakpoints ();
th->stepped = 0;
}
}
void
wince_software_single_step (enum target_signal ignore,
int insert_breakpoints_p)
{
unsigned long pc;
/* Info on currently selected thread. */
thread_info *th = current_thread;
CORE_ADDR mips_next_pc (CORE_ADDR pc);
if (!insert_breakpoints_p)
{
undoSStep (th);
return;
}
th->stepped = 1;
pc = read_register (PC_REGNUM);
th->step_pc = mips_next_pc (pc);
gdb/ * breakpoint.c (deprecated_read_memory_nobpt): Update to use shadow_len. (insert_bp_location, reattach_breakpoints, remove_breakpoint) (delete_breakpoint): Update calls to changed methods. (deprecated_insert_raw_breakpoint, deprecated_remove_raw_breakpoint) (single_step_breakpoints, insert_single_step_breakpoint) (remove_single_step_breakpoints): New. * breakpoint.h (struct bp_target_info): New. (struct bp_location): Replace shadow_contents with target_info and overlay_target_info. (deprecated_insert_raw_breakpoint, deprecated_remove_raw_breakpoint) (insert_single_step_breakpoint, remove_single_step_breakpoints): New prototypes. * gdbarch.sh: Forward declare struct bp_target_info in gdbarch.h. (memory_insert_breakpoint, memory_remove_breakpoint): Update second argument. * mem-break.c (default_memory_insert_breakpoint): Update. Set placed_address, placed_size, and shadow_len. (default_memory_remove_breakpoint): Update. Don't use BREAKPOINT_FROM_PC. (memory_insert_breakpoint, memory_remove_breakpoint): Update. * target.c (update_current_target): Update prototypes for changed functions. (debug_to_insert_breakpoint, debug_to_remove_breakpoint) (debug_to_insert_hw_breakpoint, debug_to_remove_hw_breakpoint): Update. * target.h: Forward declare struct bp_target_info. (struct target_ops): Use a bp_target_info argument for to_insert_breakpoint, to_remove_breakpoint, to_insert_hw_breakpoint, and to_remove_hw_breakpoint. (target_insert_breakpoint, target_remove_breakpoint) (target_insert_hw_breakpoint, target_remove_hw_breakpoint) (memory_insert_breakpoint, memory_remove_breakpoint) (default_memory_insert_breakpoint, default_memory_remove_breakpoint): Update. * config/i386/nm-i386.h: Forward declare struct bp_target_info. (i386_insert_hw_breakpoint, i386_remove_hw_breakpoint): Update. (target_insert_hw_breakpoint, target_remove_hw_breakpoint): Likewise. * gdbarch.c, gdbarch.h: Regenerated. * alpha-tdep.c (alpha_software_single_step): Use insert_single_step_breakpoint and remove_single_step_breakpoints. Remove unused statics. * arm-tdep.c (arm_software_single_step): Likewise. Add a note. * cris-tdep.c (cris_software_single_step): Likewise. * mips-tdep.c (mips_software_single_step): Likewise. * rs6000-tdep.c (rs6000_software_single_step): Likewise. * sparc-tdep.c (sparc_software_single_step): Likewise. * wince.c (struct thread_info_struct): Remove step_prev. (undoSStep): Use remove_single_step_breakpoints. (wince_software_single_step): Use insert_single_step_breakpoint. * corelow.c (ignore): Remove unneeded prototype. Update arguments. * exec.c (ignore): Likewise. * sol-thread.c (ignore): Likewise. * procfs.c (dbx_link_shadow_contents): Delete. (dbx_link_bpt): New. (procfs_mourn_inferior): Remove it if necessary. (remove_dbx_link_breakpoint): Use it. (insert_dbx_link_bpt_in_file): Set it. (procfs_init_inferior): Don't update dbx_link_bpt_addr. * rs6000-nat.c (exec_one_dummy_insn): Use deprecated_insert_raw_breakpoint and deprecated_remove_raw_breakpoint. * solib-irix.c (shadow_contents, breakpoint_addr): Delete. (base_breakpoint): New. (disable_break): Use it. (enable_break): Set it. * i386-nat.c (i386_insert_hw_breakpoint, i386_remove_hw_breakpoint): Update. * ia64-tdep.c (ia64_memory_insert_breakpoint) (ia64_memory_remove_breakpoint): Likewise. * m32r-tdep.c (m32r_memory_insert_breakpoint) (m32r_memory_remove_breakpoint): Likewise. * monitor.c (monitor_insert_breakpoint, monitor_remove_breakpoint): Likewise. Remove unnecessary prototypes. Use placed_address and placed_size. Removed useless read from memory. * nto-procfs.c (procfs_insert_breakpoint) (procfs_remove_breakpoint, procfs_insert_hw_breakpoint) (procfs_remove_hw_breakpoint): Update. * ocd.c (ocd_insert_breakpoint, ocd_remove_breakpoint): Likewise. * ocd.h (ocd_insert_breakpoint, ocd_remove_breakpoint): Likewise. * ppc-linux-tdep.c (ppc_linux_memory_remove_breakpoint): Likewise. * ppc-tdep.h (ppc_linux_memory_remove_breakpoint): Likewise. * remote-e7000.c (e7000_insert_breakpoint) (e7000_remove_breakpoint): Likewise. * remote-m32r-sdi.c (m32r_insert_breakpoint) (m32r_remove_breakpoint): Likewise. * remote-mips.c (mips_insert_breakpoint) (mips_remove_breakpoint): Likewise. * remote-rdp.c (remote_rdp_insert_breakpoint) (remote_rdp_remove_breakpoint): Likewise. (rdp_step): Use deprecated_insert_raw_breakpoint and deprecated_remove_raw_breakpoint. * remote-sds.c (sds_insert_breakpoint, sds_remove_breakpoint): Update. * remote-sim.c (gdbsim_insert_breakpoint, gdbsim_remove_breakpoint): Delete. (init_gdbsim_ops): Use memory_insert_breakpoint and memory_remove_breakpoint. * remote-st.c (st2000_insert_breakpoint) (st2000_remove_breakpoint): Update. Remove unused BREAKPOINT_FROM_PC. * remote.c (remote_insert_breakpoint, remote_remove_breakpoint): Update. Use placed_address and placed_size. (remote_insert_hw_breakpoint, remote_remove_hw_breakpoint): Likewise. gdb/doc/ * gdbint.texinfo (x86 Watchpoints, Target Conditionals): Update insert and remove breakpoint prototypes. (Watchpoints): Move description of target_insert_hw_breakpoint and target_remove_hw_breakpoint ... (Breakpoints): ... to here. Document target_insert_breakpoint and target_remove_breakpoint.
2006-04-18 19:20:08 +00:00
insert_single_step_breakpoint (th->step_pc);
return;
}
#elif SHx
/* Renesas SH architecture instruction encoding masks */
#define COND_BR_MASK 0xff00
#define UCOND_DBR_MASK 0xe000
#define UCOND_RBR_MASK 0xf0df
#define TRAPA_MASK 0xff00
#define COND_DISP 0x00ff
#define UCOND_DISP 0x0fff
#define UCOND_REG 0x0f00
/* Renesas SH instruction opcodes */
#define BF_INSTR 0x8b00
#define BT_INSTR 0x8900
#define BRA_INSTR 0xa000
#define BSR_INSTR 0xb000
#define JMP_INSTR 0x402b
#define JSR_INSTR 0x400b
#define RTS_INSTR 0x000b
#define RTE_INSTR 0x002b
#define TRAPA_INSTR 0xc300
#define SSTEP_INSTR 0xc3ff
#define T_BIT_MASK 0x0001
static CORE_ADDR
sh_get_next_pc (CONTEXT *c)
{
short *instrMem;
int displacement;
int reg;
unsigned short opcode;
instrMem = (short *) c->Fir;
opcode = read_memory_integer ((CORE_ADDR) c->Fir, sizeof (opcode));
if ((opcode & COND_BR_MASK) == BT_INSTR)
{
if (c->Psr & T_BIT_MASK)
{
displacement = (opcode & COND_DISP) << 1;
if (displacement & 0x80)
displacement |= 0xffffff00;
/*
* Remember PC points to second instr.
* after PC of branch ... so add 4
*/
instrMem = (short *) (c->Fir + displacement + 4);
}
else
instrMem += 1;
}
else if ((opcode & COND_BR_MASK) == BF_INSTR)
{
if (c->Psr & T_BIT_MASK)
instrMem += 1;
else
{
displacement = (opcode & COND_DISP) << 1;
if (displacement & 0x80)
displacement |= 0xffffff00;
/*
* Remember PC points to second instr.
* after PC of branch ... so add 4
*/
instrMem = (short *) (c->Fir + displacement + 4);
}
}
else if ((opcode & UCOND_DBR_MASK) == BRA_INSTR)
{
displacement = (opcode & UCOND_DISP) << 1;
if (displacement & 0x0800)
displacement |= 0xfffff000;
/*
* Remember PC points to second instr.
* after PC of branch ... so add 4
*/
instrMem = (short *) (c->Fir + displacement + 4);
}
else if ((opcode & UCOND_RBR_MASK) == JSR_INSTR)
{
reg = (char) ((opcode & UCOND_REG) >> 8);
instrMem = (short *) *regptr (c, reg);
}
else if (opcode == RTS_INSTR)
instrMem = (short *) c->PR;
else if (opcode == RTE_INSTR)
instrMem = (short *) *regptr (c, 15);
else if ((opcode & TRAPA_MASK) == TRAPA_INSTR)
instrMem = (short *) ((opcode & ~TRAPA_MASK) << 2);
else
instrMem += 1;
return (CORE_ADDR) instrMem;
}
/* Single step (in a painstaking fashion) by inspecting the current
instruction and setting a breakpoint on the "next" instruction
which would be executed. This code hails from sh-stub.c.
*/
static void
undoSStep (thread_info * th)
{
if (th->stepped)
{
gdb/ * breakpoint.c (deprecated_read_memory_nobpt): Update to use shadow_len. (insert_bp_location, reattach_breakpoints, remove_breakpoint) (delete_breakpoint): Update calls to changed methods. (deprecated_insert_raw_breakpoint, deprecated_remove_raw_breakpoint) (single_step_breakpoints, insert_single_step_breakpoint) (remove_single_step_breakpoints): New. * breakpoint.h (struct bp_target_info): New. (struct bp_location): Replace shadow_contents with target_info and overlay_target_info. (deprecated_insert_raw_breakpoint, deprecated_remove_raw_breakpoint) (insert_single_step_breakpoint, remove_single_step_breakpoints): New prototypes. * gdbarch.sh: Forward declare struct bp_target_info in gdbarch.h. (memory_insert_breakpoint, memory_remove_breakpoint): Update second argument. * mem-break.c (default_memory_insert_breakpoint): Update. Set placed_address, placed_size, and shadow_len. (default_memory_remove_breakpoint): Update. Don't use BREAKPOINT_FROM_PC. (memory_insert_breakpoint, memory_remove_breakpoint): Update. * target.c (update_current_target): Update prototypes for changed functions. (debug_to_insert_breakpoint, debug_to_remove_breakpoint) (debug_to_insert_hw_breakpoint, debug_to_remove_hw_breakpoint): Update. * target.h: Forward declare struct bp_target_info. (struct target_ops): Use a bp_target_info argument for to_insert_breakpoint, to_remove_breakpoint, to_insert_hw_breakpoint, and to_remove_hw_breakpoint. (target_insert_breakpoint, target_remove_breakpoint) (target_insert_hw_breakpoint, target_remove_hw_breakpoint) (memory_insert_breakpoint, memory_remove_breakpoint) (default_memory_insert_breakpoint, default_memory_remove_breakpoint): Update. * config/i386/nm-i386.h: Forward declare struct bp_target_info. (i386_insert_hw_breakpoint, i386_remove_hw_breakpoint): Update. (target_insert_hw_breakpoint, target_remove_hw_breakpoint): Likewise. * gdbarch.c, gdbarch.h: Regenerated. * alpha-tdep.c (alpha_software_single_step): Use insert_single_step_breakpoint and remove_single_step_breakpoints. Remove unused statics. * arm-tdep.c (arm_software_single_step): Likewise. Add a note. * cris-tdep.c (cris_software_single_step): Likewise. * mips-tdep.c (mips_software_single_step): Likewise. * rs6000-tdep.c (rs6000_software_single_step): Likewise. * sparc-tdep.c (sparc_software_single_step): Likewise. * wince.c (struct thread_info_struct): Remove step_prev. (undoSStep): Use remove_single_step_breakpoints. (wince_software_single_step): Use insert_single_step_breakpoint. * corelow.c (ignore): Remove unneeded prototype. Update arguments. * exec.c (ignore): Likewise. * sol-thread.c (ignore): Likewise. * procfs.c (dbx_link_shadow_contents): Delete. (dbx_link_bpt): New. (procfs_mourn_inferior): Remove it if necessary. (remove_dbx_link_breakpoint): Use it. (insert_dbx_link_bpt_in_file): Set it. (procfs_init_inferior): Don't update dbx_link_bpt_addr. * rs6000-nat.c (exec_one_dummy_insn): Use deprecated_insert_raw_breakpoint and deprecated_remove_raw_breakpoint. * solib-irix.c (shadow_contents, breakpoint_addr): Delete. (base_breakpoint): New. (disable_break): Use it. (enable_break): Set it. * i386-nat.c (i386_insert_hw_breakpoint, i386_remove_hw_breakpoint): Update. * ia64-tdep.c (ia64_memory_insert_breakpoint) (ia64_memory_remove_breakpoint): Likewise. * m32r-tdep.c (m32r_memory_insert_breakpoint) (m32r_memory_remove_breakpoint): Likewise. * monitor.c (monitor_insert_breakpoint, monitor_remove_breakpoint): Likewise. Remove unnecessary prototypes. Use placed_address and placed_size. Removed useless read from memory. * nto-procfs.c (procfs_insert_breakpoint) (procfs_remove_breakpoint, procfs_insert_hw_breakpoint) (procfs_remove_hw_breakpoint): Update. * ocd.c (ocd_insert_breakpoint, ocd_remove_breakpoint): Likewise. * ocd.h (ocd_insert_breakpoint, ocd_remove_breakpoint): Likewise. * ppc-linux-tdep.c (ppc_linux_memory_remove_breakpoint): Likewise. * ppc-tdep.h (ppc_linux_memory_remove_breakpoint): Likewise. * remote-e7000.c (e7000_insert_breakpoint) (e7000_remove_breakpoint): Likewise. * remote-m32r-sdi.c (m32r_insert_breakpoint) (m32r_remove_breakpoint): Likewise. * remote-mips.c (mips_insert_breakpoint) (mips_remove_breakpoint): Likewise. * remote-rdp.c (remote_rdp_insert_breakpoint) (remote_rdp_remove_breakpoint): Likewise. (rdp_step): Use deprecated_insert_raw_breakpoint and deprecated_remove_raw_breakpoint. * remote-sds.c (sds_insert_breakpoint, sds_remove_breakpoint): Update. * remote-sim.c (gdbsim_insert_breakpoint, gdbsim_remove_breakpoint): Delete. (init_gdbsim_ops): Use memory_insert_breakpoint and memory_remove_breakpoint. * remote-st.c (st2000_insert_breakpoint) (st2000_remove_breakpoint): Update. Remove unused BREAKPOINT_FROM_PC. * remote.c (remote_insert_breakpoint, remote_remove_breakpoint): Update. Use placed_address and placed_size. (remote_insert_hw_breakpoint, remote_remove_hw_breakpoint): Likewise. gdb/doc/ * gdbint.texinfo (x86 Watchpoints, Target Conditionals): Update insert and remove breakpoint prototypes. (Watchpoints): Move description of target_insert_hw_breakpoint and target_remove_hw_breakpoint ... (Breakpoints): ... to here. Document target_insert_breakpoint and target_remove_breakpoint.
2006-04-18 19:20:08 +00:00
remove_single_step_breakpoints ();
th->stepped = 0;
}
return;
}
/* Single step (in a painstaking fashion) by inspecting the current
instruction and setting a breakpoint on the "next" instruction
which would be executed. This code hails from sh-stub.c.
*/
void
wince_software_single_step (enum target_signal ignore,
int insert_breakpoints_p)
{
/* Info on currently selected thread. */
thread_info *th = current_thread;
if (!insert_breakpoints_p)
{
undoSStep (th);
return;
}
th->stepped = 1;
th->step_pc = sh_get_next_pc (&th->context);
gdb/ * breakpoint.c (deprecated_read_memory_nobpt): Update to use shadow_len. (insert_bp_location, reattach_breakpoints, remove_breakpoint) (delete_breakpoint): Update calls to changed methods. (deprecated_insert_raw_breakpoint, deprecated_remove_raw_breakpoint) (single_step_breakpoints, insert_single_step_breakpoint) (remove_single_step_breakpoints): New. * breakpoint.h (struct bp_target_info): New. (struct bp_location): Replace shadow_contents with target_info and overlay_target_info. (deprecated_insert_raw_breakpoint, deprecated_remove_raw_breakpoint) (insert_single_step_breakpoint, remove_single_step_breakpoints): New prototypes. * gdbarch.sh: Forward declare struct bp_target_info in gdbarch.h. (memory_insert_breakpoint, memory_remove_breakpoint): Update second argument. * mem-break.c (default_memory_insert_breakpoint): Update. Set placed_address, placed_size, and shadow_len. (default_memory_remove_breakpoint): Update. Don't use BREAKPOINT_FROM_PC. (memory_insert_breakpoint, memory_remove_breakpoint): Update. * target.c (update_current_target): Update prototypes for changed functions. (debug_to_insert_breakpoint, debug_to_remove_breakpoint) (debug_to_insert_hw_breakpoint, debug_to_remove_hw_breakpoint): Update. * target.h: Forward declare struct bp_target_info. (struct target_ops): Use a bp_target_info argument for to_insert_breakpoint, to_remove_breakpoint, to_insert_hw_breakpoint, and to_remove_hw_breakpoint. (target_insert_breakpoint, target_remove_breakpoint) (target_insert_hw_breakpoint, target_remove_hw_breakpoint) (memory_insert_breakpoint, memory_remove_breakpoint) (default_memory_insert_breakpoint, default_memory_remove_breakpoint): Update. * config/i386/nm-i386.h: Forward declare struct bp_target_info. (i386_insert_hw_breakpoint, i386_remove_hw_breakpoint): Update. (target_insert_hw_breakpoint, target_remove_hw_breakpoint): Likewise. * gdbarch.c, gdbarch.h: Regenerated. * alpha-tdep.c (alpha_software_single_step): Use insert_single_step_breakpoint and remove_single_step_breakpoints. Remove unused statics. * arm-tdep.c (arm_software_single_step): Likewise. Add a note. * cris-tdep.c (cris_software_single_step): Likewise. * mips-tdep.c (mips_software_single_step): Likewise. * rs6000-tdep.c (rs6000_software_single_step): Likewise. * sparc-tdep.c (sparc_software_single_step): Likewise. * wince.c (struct thread_info_struct): Remove step_prev. (undoSStep): Use remove_single_step_breakpoints. (wince_software_single_step): Use insert_single_step_breakpoint. * corelow.c (ignore): Remove unneeded prototype. Update arguments. * exec.c (ignore): Likewise. * sol-thread.c (ignore): Likewise. * procfs.c (dbx_link_shadow_contents): Delete. (dbx_link_bpt): New. (procfs_mourn_inferior): Remove it if necessary. (remove_dbx_link_breakpoint): Use it. (insert_dbx_link_bpt_in_file): Set it. (procfs_init_inferior): Don't update dbx_link_bpt_addr. * rs6000-nat.c (exec_one_dummy_insn): Use deprecated_insert_raw_breakpoint and deprecated_remove_raw_breakpoint. * solib-irix.c (shadow_contents, breakpoint_addr): Delete. (base_breakpoint): New. (disable_break): Use it. (enable_break): Set it. * i386-nat.c (i386_insert_hw_breakpoint, i386_remove_hw_breakpoint): Update. * ia64-tdep.c (ia64_memory_insert_breakpoint) (ia64_memory_remove_breakpoint): Likewise. * m32r-tdep.c (m32r_memory_insert_breakpoint) (m32r_memory_remove_breakpoint): Likewise. * monitor.c (monitor_insert_breakpoint, monitor_remove_breakpoint): Likewise. Remove unnecessary prototypes. Use placed_address and placed_size. Removed useless read from memory. * nto-procfs.c (procfs_insert_breakpoint) (procfs_remove_breakpoint, procfs_insert_hw_breakpoint) (procfs_remove_hw_breakpoint): Update. * ocd.c (ocd_insert_breakpoint, ocd_remove_breakpoint): Likewise. * ocd.h (ocd_insert_breakpoint, ocd_remove_breakpoint): Likewise. * ppc-linux-tdep.c (ppc_linux_memory_remove_breakpoint): Likewise. * ppc-tdep.h (ppc_linux_memory_remove_breakpoint): Likewise. * remote-e7000.c (e7000_insert_breakpoint) (e7000_remove_breakpoint): Likewise. * remote-m32r-sdi.c (m32r_insert_breakpoint) (m32r_remove_breakpoint): Likewise. * remote-mips.c (mips_insert_breakpoint) (mips_remove_breakpoint): Likewise. * remote-rdp.c (remote_rdp_insert_breakpoint) (remote_rdp_remove_breakpoint): Likewise. (rdp_step): Use deprecated_insert_raw_breakpoint and deprecated_remove_raw_breakpoint. * remote-sds.c (sds_insert_breakpoint, sds_remove_breakpoint): Update. * remote-sim.c (gdbsim_insert_breakpoint, gdbsim_remove_breakpoint): Delete. (init_gdbsim_ops): Use memory_insert_breakpoint and memory_remove_breakpoint. * remote-st.c (st2000_insert_breakpoint) (st2000_remove_breakpoint): Update. Remove unused BREAKPOINT_FROM_PC. * remote.c (remote_insert_breakpoint, remote_remove_breakpoint): Update. Use placed_address and placed_size. (remote_insert_hw_breakpoint, remote_remove_hw_breakpoint): Likewise. gdb/doc/ * gdbint.texinfo (x86 Watchpoints, Target Conditionals): Update insert and remove breakpoint prototypes. (Watchpoints): Move description of target_insert_hw_breakpoint and target_remove_hw_breakpoint ... (Breakpoints): ... to here. Document target_insert_breakpoint and target_remove_breakpoint.
2006-04-18 19:20:08 +00:00
insert_single_step_breakpoint (th->step_pc);
return;
}
#elif defined (ARM)
#undef check_for_step
static enum target_signal
check_for_step (DEBUG_EVENT *ev, enum target_signal x)
{
thread_info *th = thread_rec (ev->dwThreadId, 1);
if (th->stepped &&
th->step_pc == (CORE_ADDR) ev->u.Exception.ExceptionRecord.ExceptionAddress)
return TARGET_SIGNAL_TRAP;
else
return x;
}
/* Single step (in a painstaking fashion) by inspecting the current
instruction and setting a breakpoint on the "next" instruction
which would be executed. This code hails from sh-stub.c.
*/
static void
undoSStep (thread_info * th)
{
if (th->stepped)
{
gdb/ * breakpoint.c (deprecated_read_memory_nobpt): Update to use shadow_len. (insert_bp_location, reattach_breakpoints, remove_breakpoint) (delete_breakpoint): Update calls to changed methods. (deprecated_insert_raw_breakpoint, deprecated_remove_raw_breakpoint) (single_step_breakpoints, insert_single_step_breakpoint) (remove_single_step_breakpoints): New. * breakpoint.h (struct bp_target_info): New. (struct bp_location): Replace shadow_contents with target_info and overlay_target_info. (deprecated_insert_raw_breakpoint, deprecated_remove_raw_breakpoint) (insert_single_step_breakpoint, remove_single_step_breakpoints): New prototypes. * gdbarch.sh: Forward declare struct bp_target_info in gdbarch.h. (memory_insert_breakpoint, memory_remove_breakpoint): Update second argument. * mem-break.c (default_memory_insert_breakpoint): Update. Set placed_address, placed_size, and shadow_len. (default_memory_remove_breakpoint): Update. Don't use BREAKPOINT_FROM_PC. (memory_insert_breakpoint, memory_remove_breakpoint): Update. * target.c (update_current_target): Update prototypes for changed functions. (debug_to_insert_breakpoint, debug_to_remove_breakpoint) (debug_to_insert_hw_breakpoint, debug_to_remove_hw_breakpoint): Update. * target.h: Forward declare struct bp_target_info. (struct target_ops): Use a bp_target_info argument for to_insert_breakpoint, to_remove_breakpoint, to_insert_hw_breakpoint, and to_remove_hw_breakpoint. (target_insert_breakpoint, target_remove_breakpoint) (target_insert_hw_breakpoint, target_remove_hw_breakpoint) (memory_insert_breakpoint, memory_remove_breakpoint) (default_memory_insert_breakpoint, default_memory_remove_breakpoint): Update. * config/i386/nm-i386.h: Forward declare struct bp_target_info. (i386_insert_hw_breakpoint, i386_remove_hw_breakpoint): Update. (target_insert_hw_breakpoint, target_remove_hw_breakpoint): Likewise. * gdbarch.c, gdbarch.h: Regenerated. * alpha-tdep.c (alpha_software_single_step): Use insert_single_step_breakpoint and remove_single_step_breakpoints. Remove unused statics. * arm-tdep.c (arm_software_single_step): Likewise. Add a note. * cris-tdep.c (cris_software_single_step): Likewise. * mips-tdep.c (mips_software_single_step): Likewise. * rs6000-tdep.c (rs6000_software_single_step): Likewise. * sparc-tdep.c (sparc_software_single_step): Likewise. * wince.c (struct thread_info_struct): Remove step_prev. (undoSStep): Use remove_single_step_breakpoints. (wince_software_single_step): Use insert_single_step_breakpoint. * corelow.c (ignore): Remove unneeded prototype. Update arguments. * exec.c (ignore): Likewise. * sol-thread.c (ignore): Likewise. * procfs.c (dbx_link_shadow_contents): Delete. (dbx_link_bpt): New. (procfs_mourn_inferior): Remove it if necessary. (remove_dbx_link_breakpoint): Use it. (insert_dbx_link_bpt_in_file): Set it. (procfs_init_inferior): Don't update dbx_link_bpt_addr. * rs6000-nat.c (exec_one_dummy_insn): Use deprecated_insert_raw_breakpoint and deprecated_remove_raw_breakpoint. * solib-irix.c (shadow_contents, breakpoint_addr): Delete. (base_breakpoint): New. (disable_break): Use it. (enable_break): Set it. * i386-nat.c (i386_insert_hw_breakpoint, i386_remove_hw_breakpoint): Update. * ia64-tdep.c (ia64_memory_insert_breakpoint) (ia64_memory_remove_breakpoint): Likewise. * m32r-tdep.c (m32r_memory_insert_breakpoint) (m32r_memory_remove_breakpoint): Likewise. * monitor.c (monitor_insert_breakpoint, monitor_remove_breakpoint): Likewise. Remove unnecessary prototypes. Use placed_address and placed_size. Removed useless read from memory. * nto-procfs.c (procfs_insert_breakpoint) (procfs_remove_breakpoint, procfs_insert_hw_breakpoint) (procfs_remove_hw_breakpoint): Update. * ocd.c (ocd_insert_breakpoint, ocd_remove_breakpoint): Likewise. * ocd.h (ocd_insert_breakpoint, ocd_remove_breakpoint): Likewise. * ppc-linux-tdep.c (ppc_linux_memory_remove_breakpoint): Likewise. * ppc-tdep.h (ppc_linux_memory_remove_breakpoint): Likewise. * remote-e7000.c (e7000_insert_breakpoint) (e7000_remove_breakpoint): Likewise. * remote-m32r-sdi.c (m32r_insert_breakpoint) (m32r_remove_breakpoint): Likewise. * remote-mips.c (mips_insert_breakpoint) (mips_remove_breakpoint): Likewise. * remote-rdp.c (remote_rdp_insert_breakpoint) (remote_rdp_remove_breakpoint): Likewise. (rdp_step): Use deprecated_insert_raw_breakpoint and deprecated_remove_raw_breakpoint. * remote-sds.c (sds_insert_breakpoint, sds_remove_breakpoint): Update. * remote-sim.c (gdbsim_insert_breakpoint, gdbsim_remove_breakpoint): Delete. (init_gdbsim_ops): Use memory_insert_breakpoint and memory_remove_breakpoint. * remote-st.c (st2000_insert_breakpoint) (st2000_remove_breakpoint): Update. Remove unused BREAKPOINT_FROM_PC. * remote.c (remote_insert_breakpoint, remote_remove_breakpoint): Update. Use placed_address and placed_size. (remote_insert_hw_breakpoint, remote_remove_hw_breakpoint): Likewise. gdb/doc/ * gdbint.texinfo (x86 Watchpoints, Target Conditionals): Update insert and remove breakpoint prototypes. (Watchpoints): Move description of target_insert_hw_breakpoint and target_remove_hw_breakpoint ... (Breakpoints): ... to here. Document target_insert_breakpoint and target_remove_breakpoint.
2006-04-18 19:20:08 +00:00
remove_single_step_breakpoints ();
th->stepped = 0;
}
}
void
wince_software_single_step (enum target_signal ignore,
int insert_breakpoints_p)
{
unsigned long pc;
/* Info on currently selected thread. */
thread_info *th = current_thread;
CORE_ADDR mips_next_pc (CORE_ADDR pc);
if (!insert_breakpoints_p)
{
undoSStep (th);
return;
}
th->stepped = 1;
pc = read_register (PC_REGNUM);
th->step_pc = arm_get_next_pc (pc);
gdb/ * breakpoint.c (deprecated_read_memory_nobpt): Update to use shadow_len. (insert_bp_location, reattach_breakpoints, remove_breakpoint) (delete_breakpoint): Update calls to changed methods. (deprecated_insert_raw_breakpoint, deprecated_remove_raw_breakpoint) (single_step_breakpoints, insert_single_step_breakpoint) (remove_single_step_breakpoints): New. * breakpoint.h (struct bp_target_info): New. (struct bp_location): Replace shadow_contents with target_info and overlay_target_info. (deprecated_insert_raw_breakpoint, deprecated_remove_raw_breakpoint) (insert_single_step_breakpoint, remove_single_step_breakpoints): New prototypes. * gdbarch.sh: Forward declare struct bp_target_info in gdbarch.h. (memory_insert_breakpoint, memory_remove_breakpoint): Update second argument. * mem-break.c (default_memory_insert_breakpoint): Update. Set placed_address, placed_size, and shadow_len. (default_memory_remove_breakpoint): Update. Don't use BREAKPOINT_FROM_PC. (memory_insert_breakpoint, memory_remove_breakpoint): Update. * target.c (update_current_target): Update prototypes for changed functions. (debug_to_insert_breakpoint, debug_to_remove_breakpoint) (debug_to_insert_hw_breakpoint, debug_to_remove_hw_breakpoint): Update. * target.h: Forward declare struct bp_target_info. (struct target_ops): Use a bp_target_info argument for to_insert_breakpoint, to_remove_breakpoint, to_insert_hw_breakpoint, and to_remove_hw_breakpoint. (target_insert_breakpoint, target_remove_breakpoint) (target_insert_hw_breakpoint, target_remove_hw_breakpoint) (memory_insert_breakpoint, memory_remove_breakpoint) (default_memory_insert_breakpoint, default_memory_remove_breakpoint): Update. * config/i386/nm-i386.h: Forward declare struct bp_target_info. (i386_insert_hw_breakpoint, i386_remove_hw_breakpoint): Update. (target_insert_hw_breakpoint, target_remove_hw_breakpoint): Likewise. * gdbarch.c, gdbarch.h: Regenerated. * alpha-tdep.c (alpha_software_single_step): Use insert_single_step_breakpoint and remove_single_step_breakpoints. Remove unused statics. * arm-tdep.c (arm_software_single_step): Likewise. Add a note. * cris-tdep.c (cris_software_single_step): Likewise. * mips-tdep.c (mips_software_single_step): Likewise. * rs6000-tdep.c (rs6000_software_single_step): Likewise. * sparc-tdep.c (sparc_software_single_step): Likewise. * wince.c (struct thread_info_struct): Remove step_prev. (undoSStep): Use remove_single_step_breakpoints. (wince_software_single_step): Use insert_single_step_breakpoint. * corelow.c (ignore): Remove unneeded prototype. Update arguments. * exec.c (ignore): Likewise. * sol-thread.c (ignore): Likewise. * procfs.c (dbx_link_shadow_contents): Delete. (dbx_link_bpt): New. (procfs_mourn_inferior): Remove it if necessary. (remove_dbx_link_breakpoint): Use it. (insert_dbx_link_bpt_in_file): Set it. (procfs_init_inferior): Don't update dbx_link_bpt_addr. * rs6000-nat.c (exec_one_dummy_insn): Use deprecated_insert_raw_breakpoint and deprecated_remove_raw_breakpoint. * solib-irix.c (shadow_contents, breakpoint_addr): Delete. (base_breakpoint): New. (disable_break): Use it. (enable_break): Set it. * i386-nat.c (i386_insert_hw_breakpoint, i386_remove_hw_breakpoint): Update. * ia64-tdep.c (ia64_memory_insert_breakpoint) (ia64_memory_remove_breakpoint): Likewise. * m32r-tdep.c (m32r_memory_insert_breakpoint) (m32r_memory_remove_breakpoint): Likewise. * monitor.c (monitor_insert_breakpoint, monitor_remove_breakpoint): Likewise. Remove unnecessary prototypes. Use placed_address and placed_size. Removed useless read from memory. * nto-procfs.c (procfs_insert_breakpoint) (procfs_remove_breakpoint, procfs_insert_hw_breakpoint) (procfs_remove_hw_breakpoint): Update. * ocd.c (ocd_insert_breakpoint, ocd_remove_breakpoint): Likewise. * ocd.h (ocd_insert_breakpoint, ocd_remove_breakpoint): Likewise. * ppc-linux-tdep.c (ppc_linux_memory_remove_breakpoint): Likewise. * ppc-tdep.h (ppc_linux_memory_remove_breakpoint): Likewise. * remote-e7000.c (e7000_insert_breakpoint) (e7000_remove_breakpoint): Likewise. * remote-m32r-sdi.c (m32r_insert_breakpoint) (m32r_remove_breakpoint): Likewise. * remote-mips.c (mips_insert_breakpoint) (mips_remove_breakpoint): Likewise. * remote-rdp.c (remote_rdp_insert_breakpoint) (remote_rdp_remove_breakpoint): Likewise. (rdp_step): Use deprecated_insert_raw_breakpoint and deprecated_remove_raw_breakpoint. * remote-sds.c (sds_insert_breakpoint, sds_remove_breakpoint): Update. * remote-sim.c (gdbsim_insert_breakpoint, gdbsim_remove_breakpoint): Delete. (init_gdbsim_ops): Use memory_insert_breakpoint and memory_remove_breakpoint. * remote-st.c (st2000_insert_breakpoint) (st2000_remove_breakpoint): Update. Remove unused BREAKPOINT_FROM_PC. * remote.c (remote_insert_breakpoint, remote_remove_breakpoint): Update. Use placed_address and placed_size. (remote_insert_hw_breakpoint, remote_remove_hw_breakpoint): Likewise. gdb/doc/ * gdbint.texinfo (x86 Watchpoints, Target Conditionals): Update insert and remove breakpoint prototypes. (Watchpoints): Move description of target_insert_hw_breakpoint and target_remove_hw_breakpoint ... (Breakpoints): ... to here. Document target_insert_breakpoint and target_remove_breakpoint.
2006-04-18 19:20:08 +00:00
insert_single_step_breakpoint (th->step_pc);
return;
}
#endif
2000-02-24 21:39:15 +00:00
/* Find a thread record given a thread id.
If get_context then also retrieve the context for this thread. */
2000-02-24 21:39:15 +00:00
static thread_info *
thread_rec (DWORD id, int get_context)
{
thread_info *th;
for (th = &thread_head; (th = th->next) != NULL;)
if (th->id == id)
{
if (!th->suspend_count && get_context)
{
if (get_context > 0 && th != this_thread)
th->suspend_count = suspend_thread (th->h) + 1;
else if (get_context < 0)
th->suspend_count = -1;
th->context.ContextFlags = CONTEXT_DEBUGGER;
get_thread_context (th->h, &th->context);
}
return th;
}
return NULL;
}
/* Add a thread to the thread list. */
2000-02-24 21:39:15 +00:00
static thread_info *
child_add_thread (DWORD id, HANDLE h)
{
thread_info *th;
if ((th = thread_rec (id, FALSE)))
return th;
th = (thread_info *) xmalloc (sizeof (*th));
memset (th, 0, sizeof (*th));
th->id = id;
th->h = h;
th->next = thread_head.next;
thread_head.next = th;
add_thread (id);
return th;
}
/* Clear out any old thread list and reintialize it to a
pristine state. */
2000-02-24 21:39:15 +00:00
static void
2000-07-30 01:48:28 +00:00
child_init_thread_list (void)
2000-02-24 21:39:15 +00:00
{
thread_info *th = &thread_head;
DEBUG_EVENTS (("gdb: child_init_thread_list\n"));
init_thread_list ();
while (th->next != NULL)
{
thread_info *here = th->next;
th->next = here->next;
(void) close_handle (here->h);
2000-12-15 01:01:51 +00:00
xfree (here);
2000-02-24 21:39:15 +00:00
}
}
/* Delete a thread from the list of threads. */
2000-02-24 21:39:15 +00:00
static void
child_delete_thread (DWORD id)
{
thread_info *th;
if (info_verbose)
printf_unfiltered ("[Deleting %s]\n", target_pid_to_str (id));
delete_thread (id);
for (th = &thread_head;
th->next != NULL && th->next->id != id;
th = th->next)
continue;
if (th->next != NULL)
{
thread_info *here = th->next;
th->next = here->next;
close_handle (here->h);
2000-12-15 01:01:51 +00:00
xfree (here);
2000-02-24 21:39:15 +00:00
}
}
static void
check (BOOL ok, const char *file, int line)
{
if (!ok)
printf_filtered ("error return %s:%d was %d\n",
file, line, GetLastError ());
2000-02-24 21:39:15 +00:00
}
static void
do_child_fetch_inferior_registers (int r)
{
if (r >= 0)
{
2004-07-21 Andrew Cagney <cagney@gnu.org> Use regcache_raw_supply instead of supply_register. * regcache.h (supply_register): Delete declaration. * regcache.c (supply_register): Delete function. * wince.c (do_child_fetch_inferior_registers): Update. * win32-nat.c (do_child_fetch_inferior_registers) (fetch_elf_core_registers): Update. * v850ice.c (v850ice_fetch_registers): Update. * thread-db.c (thread_db_store_registers): Update. * sol-thread.c (sol_thread_store_registers): Update. * shnbsd-tdep.c (shnbsd_supply_reg): Update. * rs6000-nat.c (fetch_register): Update. * rom68k-rom.c (rom68k_supply_one_register): Update. * remote.c (remote_wait, remote_async_wait): Update. * remote-st.c (get_hex_regs): Update. * remote-sim.c (gdbsim_fetch_register): Update. * remote-sds.c (sds_fetch_registers): Update. * remote-rdp.c (remote_rdp_fetch_register): Update. * remote-rdi.c (arm_rdi_fetch_registers): Update. * remote-mips.c (mips_wait, mips_fetch_registers): Update. * remote-m32r-sdi.c (m32r_fetch_register): Update. * remote-hms.c (init_hms_cmds): Update. * remote-est.c (init_est_cmds): Update. * remote-e7000.c (get_hex_regs, fetch_regs_from_dump) (e7000_fetch_registers, sub2_from_pc, e7000_wait): Update. * ppcnbsd-tdep.c (ppcnbsd_supply_reg, ppcnbsd_supply_fpreg): Update. * ppc-linux-nat.c (fetch_altivec_register, fetch_spe_register) (fetch_register, supply_vrregset, supply_vrregset) (fetch_spe_registers): Update. * ppc-bdm.c (bdm_ppc_fetch_registers): Update. * monitor.c (monitor_supply_register): Update. * mipsv4-nat.c (supply_gregset, supply_fpregset): Update. * mipsnbsd-tdep.c (mipsnbsd_supply_reg) (mipsnbsd_supply_fpreg): Update. * mips-nat.c (fetch_inferior_registers) (fetch_core_registers): Update. * mips-linux-tdep.c (supply_32bit_reg, supply_gregset) (supply_fpregset, mips64_supply_gregset) (mips64_supply_fpregset): Update. * m68klinux-nat.c (fetch_register, supply_gregset) (supply_fpregset): Update. * m68k-tdep.c (supply_gregset, supply_fpregset): Update. * m32r-rom.c (init_m32r_cmds, init_mon2000_cmds): Update. * lynx-nat.c (fetch_inferior_registers, fetch_core_registers): Update. * irix5-nat.c (supply_gregset, supply_fpregset): Update. * infptrace.c (fetch_register): Update. * ia64-linux-nat.c (supply_gregset, supply_fpregset): Update. * ia64-aix-nat.c (supply_gregset, supply_fpregset): Update. * i386gnu-nat.c (fetch_fpregs, supply_gregset) (gnu_fetch_registers, gnu_store_registers): Update. * i386-nto-tdep.c (i386nto_supply_gregset): Update. * i386-linux-nat.c (fetch_register, supply_gregset) (dummy_sse_values): Update. * hpux-thread.c (hpux_thread_fetch_registers): Update. * hppah-nat.c (fetch_register): Update. * hppa-linux-nat.c (fetch_register, supply_gregset) (supply_fpregset): Update. * go32-nat.c (fetch_register): Update. * dve3900-rom.c (fetch_bitmapped_register) (_initialize_r3900_rom): Update. * cris-tdep.c (supply_gregset): Update. * abug-rom.c (init_abug_cmds): Update. * core-aout.c (fetch_core_registers): Update. * armnbsd-nat.c (supply_gregset, supply_fparegset) (fetch_register, fetch_fp_register): Update. * arm-linux-nat.c (fetch_nwfpe_single, fetch_nwfpe_none) (fetch_nwfpe_extended, fetch_fpregister, fetch_fpregs) (fetch_register, fetch_regs, supply_gregset, supply_fpregset): Update. * alphanbsd-tdep.c (fetch_core_registers): Update. * alpha-tdep.c (alpha_supply_int_regs, alpha_supply_fp_regs): Update. * alpha-nat.c (fetch_osf_core_registers) (fetch_osf_core_registers, fetch_osf_core_registers): Update. * aix-thread.c (supply_gprs64, supply_reg32, supply_fprs) (supply_sprs64, supply_sprs32, fetch_regs_kernel_thread): Update.
2004-07-22 01:31:49 +00:00
regcache_raw_supply (current_regcache, r,
(char *) regptr (&current_thread->context, r));
2000-02-24 21:39:15 +00:00
}
else
{
for (r = 0; r < NUM_REGS; r++)
do_child_fetch_inferior_registers (r);
}
}
static void
child_fetch_inferior_registers (int r)
{
2001-05-04 04:15:33 +00:00
current_thread = thread_rec (PIDGET (inferior_ptid), TRUE);
2000-02-24 21:39:15 +00:00
do_child_fetch_inferior_registers (r);
}
static void
do_child_store_inferior_registers (int r)
{
if (r >= 0)
deprecated_read_register_gen (r, ((char *) &current_thread->context) + mappings[r]);
2000-02-24 21:39:15 +00:00
else
{
for (r = 0; r < NUM_REGS; r++)
do_child_store_inferior_registers (r);
}
}
/* Store a new register value into the current thread context. */
2000-02-24 21:39:15 +00:00
static void
child_store_inferior_registers (int r)
{
2001-05-04 04:15:33 +00:00
current_thread = thread_rec (PIDGET (inferior_ptid), TRUE);
2000-02-24 21:39:15 +00:00
do_child_store_inferior_registers (r);
}
/* Wait for child to do something. Return pid of child, or -1 in case
of error; store status through argument pointer OURSTATUS. */
static int
handle_load_dll (void *dummy)
2000-02-24 21:39:15 +00:00
{
LOAD_DLL_DEBUG_INFO *event = &current_event.u.LoadDll;
char dll_buf[MAX_PATH + 1];
char *p, *bufp, *imgp, *dll_name, *dll_basename;
int len;
dll_buf[0] = dll_buf[sizeof (dll_buf) - 1] = '\0';
if (!event->lpImageName)
return 1;
len = 0;
for (bufp = dll_buf, imgp = event->lpImageName;
bufp < dll_buf + sizeof (dll_buf);
bufp += 16, imgp += 16)
{
gdb_wince_len nbytes = 0;
(void) read_process_memory (current_process_handle,
imgp, bufp, 16, &nbytes);
if (!nbytes && bufp == dll_buf)
return 1; /* couldn't read it */
for (p = bufp; p < bufp + nbytes; p++)
{
len++;
if (*p == '\0')
goto out;
if (event->fUnicode)
p++;
}
if (!nbytes)
break;
}
out:
if (!len)
return 1;
#if 0
2000-02-24 21:39:15 +00:00
dll_buf[len] = '\0';
#endif
2000-02-24 21:39:15 +00:00
dll_name = alloca (len);
if (!dll_name)
return 1;
if (!event->fUnicode)
memcpy (dll_name, dll_buf, len);
else
WideCharToMultiByte (CP_ACP, 0, (LPCWSTR) dll_buf,
len, dll_name, len, 0, 0);
2000-02-24 21:39:15 +00:00
while ((p = strchr (dll_name, '\\')))
*p = '/';
/* FIXME!! It would be nice to define one symbol which pointed to
the front of the dll if we can't find any symbols. */
2000-02-24 21:39:15 +00:00
if (!(dll_basename = strrchr (dll_name, '/')))
dll_basename = dll_name;
else
dll_basename++;
/* The symbols in a dll are offset by 0x1000, which is the
the offset from 0 of the first byte in an image - because
of the file header and the section alignment.
FIXME: Is this the real reason that we need the 0x1000 ? */
printf_unfiltered ("%x:%s", event->lpBaseOfDll, dll_name);
printf_unfiltered ("\n");
return 1;
}
/* Handle DEBUG_STRING output from child process. */
2000-02-24 21:39:15 +00:00
static void
handle_output_debug_string (struct target_waitstatus *ourstatus)
{
char p[256];
char s[255];
char *q;
gdb_wince_len nbytes_read;
gdb_wince_len nbytes = current_event.u.DebugString.nDebugStringLength;
if (nbytes > 255)
nbytes = 255;
memset (p, 0, sizeof (p));
if (!read_process_memory (current_process_handle,
current_event.u.DebugString.lpDebugStringData,
&p, nbytes, &nbytes_read)
|| !*p)
return;
memset (s, 0, sizeof (s));
WideCharToMultiByte (CP_ACP, 0, (LPCWSTR) p, (int) nbytes_read,
s, sizeof (s) - 1, NULL, NULL);
2000-02-24 21:39:15 +00:00
q = strchr (s, '\n');
if (q != NULL)
{
*q = '\0';
if (*--q = '\r')
*q = '\0';
}
warning (s);
2000-02-24 21:39:15 +00:00
return;
}
/* Handle target exceptions. */
2000-02-24 21:39:15 +00:00
static int
handle_exception (struct target_waitstatus *ourstatus)
{
#if 0
2000-02-24 21:39:15 +00:00
if (current_event.u.Exception.dwFirstChance)
return 0;
#endif
2000-02-24 21:39:15 +00:00
ourstatus->kind = TARGET_WAITKIND_STOPPED;
switch (current_event.u.Exception.ExceptionRecord.ExceptionCode)
{
case EXCEPTION_ACCESS_VIOLATION:
DEBUG_EXCEPT (("gdb: Target exception ACCESS_VIOLATION at 0x%08x\n",
(unsigned) current_event.u.Exception.ExceptionRecord.ExceptionAddress));
ourstatus->value.sig = TARGET_SIGNAL_SEGV;
break;
case STATUS_STACK_OVERFLOW:
DEBUG_EXCEPT (("gdb: Target exception STACK_OVERFLOW at 0x%08x\n",
(unsigned) current_event.u.Exception.ExceptionRecord.ExceptionAddress));
ourstatus->value.sig = TARGET_SIGNAL_SEGV;
break;
case EXCEPTION_BREAKPOINT:
DEBUG_EXCEPT (("gdb: Target exception BREAKPOINT at 0x%08x\n",
(unsigned) current_event.u.Exception.ExceptionRecord.ExceptionAddress));
ourstatus->value.sig = TARGET_SIGNAL_TRAP;
break;
case DBG_CONTROL_C:
DEBUG_EXCEPT (("gdb: Target exception CONTROL_C at 0x%08x\n",
(unsigned) current_event.u.Exception.ExceptionRecord.ExceptionAddress));
ourstatus->value.sig = TARGET_SIGNAL_INT;
/* User typed CTRL-C. Continue with this status. */
last_sig = SIGINT; /* FIXME - should check pass state. */
2000-02-24 21:39:15 +00:00
break;
case EXCEPTION_SINGLE_STEP:
DEBUG_EXCEPT (("gdb: Target exception SINGLE_STEP at 0x%08x\n",
(unsigned) current_event.u.Exception.ExceptionRecord.ExceptionAddress));
ourstatus->value.sig = TARGET_SIGNAL_TRAP;
break;
case EXCEPTION_ILLEGAL_INSTRUCTION:
DEBUG_EXCEPT (("gdb: Target exception SINGLE_ILL at 0x%08x\n",
/* (unsigned)? */ current_event.u.Exception.ExceptionRecord.ExceptionAddress));
ourstatus->value.sig = check_for_step (&current_event,
TARGET_SIGNAL_ILL);
break;
2000-02-24 21:39:15 +00:00
default:
/* This may be a structured exception handling exception. In
that case, we want to let the program try to handle it, and
only break if we see the exception a second time. */
2000-02-24 21:39:15 +00:00
printf_unfiltered
("gdb: unknown target exception 0x%08x at 0x%08x\n",
current_event.u.Exception.ExceptionRecord.ExceptionCode,
current_event.u.Exception.ExceptionRecord.ExceptionAddress);
2000-02-24 21:39:15 +00:00
ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN;
break;
}
exception_count++;
return 1;
}
/* Resume all artificially suspended threads if we are continuing
execution. */
2000-02-24 21:39:15 +00:00
static BOOL
child_continue (DWORD continue_status, int id)
{
int i;
thread_info *th;
BOOL res;
DEBUG_EVENTS (("ContinueDebugEvent (cpid=%d, ctid=%d, DBG_CONTINUE);\n",
(unsigned) current_event.dwProcessId,
(unsigned) current_event.dwThreadId));
2000-02-24 21:39:15 +00:00
res = continue_debug_event (current_event.dwProcessId,
current_event.dwThreadId,
continue_status);
if (res)
for (th = &thread_head; (th = th->next) != NULL;)
if (((id == -1) || (id == th->id)) && th->suspend_count)
{
for (i = 0; i < th->suspend_count; i++)
(void) resume_thread (th->h);
th->suspend_count = 0;
}
return res;
}
/* Get the next event from the child. Return 1 if the event requires
handling by WFI (or whatever).
*/
static int
get_child_debug_event (int pid, struct target_waitstatus *ourstatus,
DWORD target_event_code, int *retval)
2000-02-24 21:39:15 +00:00
{
int breakout = 0;
2000-02-24 21:39:15 +00:00
BOOL debug_event;
DWORD continue_status, event_code;
thread_info *th = NULL;
static thread_info dummy_thread_info;
2000-02-24 21:39:15 +00:00
if (!(debug_event = wait_for_debug_event (&current_event, 1000)))
{
*retval = 0;
2000-02-24 21:39:15 +00:00
goto out;
}
event_count++;
continue_status = DBG_CONTINUE;
*retval = 0;
event_code = current_event.dwDebugEventCode;
breakout = event_code == target_event_code;
switch (event_code)
2000-02-24 21:39:15 +00:00
{
case CREATE_THREAD_DEBUG_EVENT:
DEBUG_EVENTS (("gdb: kernel event for pid=%d tid=%x code=%s)\n",
(unsigned) current_event.dwProcessId,
(unsigned) current_event.dwThreadId,
"CREATE_THREAD_DEBUG_EVENT"));
/* Record the existence of this thread */
th = child_add_thread (current_event.dwThreadId,
current_event.u.CreateThread.hThread);
2000-02-24 21:39:15 +00:00
if (info_verbose)
printf_unfiltered ("[New %s]\n",
target_pid_to_str (current_event.dwThreadId));
break;
case EXIT_THREAD_DEBUG_EVENT:
DEBUG_EVENTS (("gdb: kernel event for pid=%d tid=%d code=%s)\n",
(unsigned) current_event.dwProcessId,
(unsigned) current_event.dwThreadId,
"EXIT_THREAD_DEBUG_EVENT"));
child_delete_thread (current_event.dwThreadId);
th = &dummy_thread_info;
2000-02-24 21:39:15 +00:00
break;
case CREATE_PROCESS_DEBUG_EVENT:
DEBUG_EVENTS (("gdb: kernel event for pid=%d tid=%d code=%s)\n",
(unsigned) current_event.dwProcessId,
(unsigned) current_event.dwThreadId,
"CREATE_PROCESS_DEBUG_EVENT"));
current_process_handle = current_event.u.CreateProcessInfo.hProcess;
2001-05-04 04:15:33 +00:00
main_thread_id = current_event.dwThreadId;
inferior_ptid = pid_to_ptid (main_thread_id);
2000-02-24 21:39:15 +00:00
/* Add the main thread */
2001-05-04 04:15:33 +00:00
th = child_add_thread (PIDGET (inferior_ptid),
current_event.u.CreateProcessInfo.hThread);
2000-02-24 21:39:15 +00:00
break;
case EXIT_PROCESS_DEBUG_EVENT:
DEBUG_EVENTS (("gdb: kernel event for pid=%d tid=%d code=%s)\n",
(unsigned) current_event.dwProcessId,
(unsigned) current_event.dwThreadId,
"EXIT_PROCESS_DEBUG_EVENT"));
ourstatus->kind = TARGET_WAITKIND_EXITED;
ourstatus->value.integer = current_event.u.ExitProcess.dwExitCode;
close_handle (current_process_handle);
*retval = current_event.dwProcessId;
breakout = 1;
break;
2000-02-24 21:39:15 +00:00
case LOAD_DLL_DEBUG_EVENT:
DEBUG_EVENTS (("gdb: kernel event for pid=%d tid=%d code=%s)\n",
(unsigned) current_event.dwProcessId,
(unsigned) current_event.dwThreadId,
"LOAD_DLL_DEBUG_EVENT"));
catch_errors (handle_load_dll, NULL,
(char *) "", RETURN_MASK_ALL);
2000-02-24 21:39:15 +00:00
registers_changed (); /* mark all regs invalid */
break;
case UNLOAD_DLL_DEBUG_EVENT:
DEBUG_EVENTS (("gdb: kernel event for pid=%d tid=%d code=%s)\n",
(unsigned) current_event.dwProcessId,
(unsigned) current_event.dwThreadId,
"UNLOAD_DLL_DEBUG_EVENT"));
break; /* FIXME: don't know what to do here */
case EXCEPTION_DEBUG_EVENT:
DEBUG_EVENTS (("gdb: kernel event for pid=%d tid=%d code=%s)\n",
(unsigned) current_event.dwProcessId,
(unsigned) current_event.dwThreadId,
"EXCEPTION_DEBUG_EVENT"));
if (handle_exception (ourstatus))
*retval = current_event.dwThreadId;
else
2000-02-24 21:39:15 +00:00
{
continue_status = DBG_EXCEPTION_NOT_HANDLED;
breakout = 0;
2000-02-24 21:39:15 +00:00
}
break;
case OUTPUT_DEBUG_STRING_EVENT: /* message from the kernel */
DEBUG_EVENTS (("gdb: kernel event for pid=%d tid=%d code=%s)\n",
(unsigned) current_event.dwProcessId,
(unsigned) current_event.dwThreadId,
"OUTPUT_DEBUG_STRING_EVENT"));
handle_output_debug_string ( ourstatus);
2000-02-24 21:39:15 +00:00
break;
default:
printf_unfiltered ("gdb: kernel event for pid=%d tid=%d\n",
current_event.dwProcessId,
current_event.dwThreadId);
printf_unfiltered (" unknown event code %d\n",
current_event.dwDebugEventCode);
break;
}
if (breakout)
this_thread = current_thread = th ?: thread_rec (current_event.dwThreadId,
TRUE);
else
CHECK (child_continue (continue_status, -1));
2000-02-24 21:39:15 +00:00
out:
return breakout;
}
/* Wait for interesting events to occur in the target process. */
2001-05-04 04:15:33 +00:00
static ptid_t
child_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
2000-02-24 21:39:15 +00:00
{
DWORD event_code;
int retval;
2001-05-04 04:15:33 +00:00
int pid = PIDGET (ptid);
2000-02-24 21:39:15 +00:00
/* We loop when we get a non-standard exception rather than return
with a SPURIOUS because resume can try and step or modify things,
which needs a current_thread->h. But some of these exceptions mark
the birth or death of threads, which mean that the current thread
isn't necessarily what you think it is. */
2000-02-24 21:39:15 +00:00
while (1)
if (get_child_debug_event (pid, ourstatus,
EXCEPTION_DEBUG_EVENT, &retval))
2001-05-04 04:15:33 +00:00
return pid_to_ptid (retval);
2000-02-24 21:39:15 +00:00
else
{
int detach = 0;
if (deprecated_ui_loop_hook != NULL)
detach = deprecated_ui_loop_hook (0);
2000-02-24 21:39:15 +00:00
if (detach)
child_kill_inferior ();
}
}
/* Print status information about what we're accessing. */
static void
2000-07-30 01:48:28 +00:00
child_files_info (struct target_ops *ignore)
2000-02-24 21:39:15 +00:00
{
printf_unfiltered ("\tUsing the running image of child %s.\n",
2001-05-04 04:15:33 +00:00
target_pid_to_str (inferior_ptid));
2000-02-24 21:39:15 +00:00
}
static void
2000-07-30 01:48:28 +00:00
child_open (char *arg, int from_tty)
2000-02-24 21:39:15 +00:00
{
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
error (_("Use the \"run\" command to start a child process."));
2000-02-24 21:39:15 +00:00
}
#define FACTOR (0x19db1ded53ea710LL)
#define NSPERSEC 10000000
/* Convert a Win32 time to "UNIX" format. */
2000-02-24 21:39:15 +00:00
long
to_time_t (FILETIME * ptr)
{
/* A file time is the number of 100ns since jan 1 1601
stuffed into two long words.
A time_t is the number of seconds since jan 1 1970. */
long rem;
long long x = ((long long) ptr->dwHighDateTime << 32) + ((unsigned) ptr->dwLowDateTime);
x -= FACTOR; /* Number of 100ns between 1601 and 1970. */
2000-02-24 21:39:15 +00:00
rem = x % ((long long) NSPERSEC);
rem += (NSPERSEC / 2);
x /= (long long) NSPERSEC; /* Number of 100ns in a second. */
2000-02-24 21:39:15 +00:00
x += (long long) (rem / NSPERSEC);
return x;
}
/* Upload a file to the remote device depending on the user's
'set remoteupload' specification. */
2000-02-24 21:39:15 +00:00
char *
upload_to_device (const char *to, const char *from)
{
HANDLE h;
const char *dir = remote_directory ?: "\\gdb";
2000-02-24 21:39:15 +00:00
int len;
static char *remotefile = NULL;
LPWSTR wstr;
char *p;
DWORD err;
const char *in_to = to;
FILETIME crtime, actime, wrtime;
time_t utime;
2000-02-24 21:39:15 +00:00
struct stat st;
int fd;
/* Look for a path separator and only use trailing part. */
2000-02-24 21:39:15 +00:00
while ((p = strpbrk (to, "/\\")) != NULL)
to = p + 1;
if (!*to)
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
error (_("no filename found to upload - %s."), in_to);
2000-02-24 21:39:15 +00:00
len = strlen (dir) + strlen (to) + 2;
remotefile = (char *) xrealloc (remotefile, len);
2000-02-24 21:39:15 +00:00
strcpy (remotefile, dir);
strcat (remotefile, "\\");
strcat (remotefile, to);
if (upload_when == UPLOAD_NEVER)
return remotefile; /* Don't bother uploading. */
2000-02-24 21:39:15 +00:00
/* Open the source. */
if ((fd = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST, (char *) from,
O_RDONLY, 0, NULL)) < 0)
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
error (_("couldn't open %s"), from);
2000-02-24 21:39:15 +00:00
/* Get the time for later comparison. */
2000-02-24 21:39:15 +00:00
if (fstat (fd, &st))
st.st_mtime = (time_t) - 1;
/* Always attempt to create the directory on the remote system. */
2000-02-24 21:39:15 +00:00
wstr = towide (dir, NULL);
(void) CeCreateDirectory (wstr, NULL);
/* Attempt to open the remote file, creating it if it doesn't exist. */
2000-02-24 21:39:15 +00:00
wstr = towide (remotefile, NULL);
h = CeCreateFile (wstr, GENERIC_READ | GENERIC_WRITE, 0, NULL,
OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
/* Some kind of problem? */
2000-02-24 21:39:15 +00:00
err = CeGetLastError ();
if (h == NULL || h == INVALID_HANDLE_VALUE)
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
error (_("error opening file \"%s\". Windows error %d."),
2000-02-24 21:39:15 +00:00
remotefile, err);
CeGetFileTime (h, &crtime, &actime, &wrtime);
utime = to_time_t (&wrtime);
#if 0
if (utime < st.st_mtime)
{
char buf[80];
strcpy (buf, ctime(&utime));
printf ("%s < %s\n", buf, ctime(&st.st_mtime));
}
#endif
/* See if we need to upload the file. */
2000-02-24 21:39:15 +00:00
if (upload_when == UPLOAD_ALWAYS ||
err != ERROR_ALREADY_EXISTS ||
!CeGetFileTime (h, &crtime, &actime, &wrtime) ||
to_time_t (&wrtime) < st.st_mtime)
2000-02-24 21:39:15 +00:00
{
DWORD nbytes;
char buf[4096];
int n;
/* Upload the file. */
2000-02-24 21:39:15 +00:00
while ((n = read (fd, buf, sizeof (buf))) > 0)
if (!CeWriteFile (h, buf, (DWORD) n, &nbytes, NULL))
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
error (_("error writing to remote device - %d."),
2000-02-24 21:39:15 +00:00
CeGetLastError ());
}
close (fd);
if (!CeCloseHandle (h))
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
error (_("error closing remote file - %d."), CeGetLastError ());
2000-02-24 21:39:15 +00:00
return remotefile;
}
/* Initialize the connection to the remote device. */
2000-02-24 21:39:15 +00:00
static void
2000-07-30 01:48:28 +00:00
wince_initialize (void)
2000-02-24 21:39:15 +00:00
{
int tmp;
char args[256];
char *hostname;
struct sockaddr_in sin;
char *stub_file_name;
int s0;
PROCESS_INFORMATION pi;
if (!connection_initialized)
switch (CeRapiInit ())
{
case 0:
connection_initialized = 1;
break;
default:
CeRapiUninit ();
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
error (_("Can't initialize connection to remote device."));
2000-02-24 21:39:15 +00:00
}
/* Upload the stub to the handheld device. */
2000-02-24 21:39:15 +00:00
stub_file_name = upload_to_device ("wince-stub.exe", WINCE_STUB);
strcpy (args, stub_file_name);
if (remote_add_host)
{
strcat (args, " ");
hostname = strchr (args, '\0');
if (gethostname (hostname, sizeof (args) - strlen (args)))
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
error (_("couldn't get hostname of this system."));
2000-02-24 21:39:15 +00:00
}
/* Get a socket. */
2000-02-24 21:39:15 +00:00
if ((s0 = socket (AF_INET, SOCK_STREAM, 0)) < 0)
stub_error ("Couldn't connect to host system.");
/* Allow rapid reuse of the port. */
2000-02-24 21:39:15 +00:00
tmp = 1;
(void) setsockopt (s0, SOL_SOCKET, SO_REUSEADDR,
(char *) &tmp, sizeof (tmp));
2000-02-24 21:39:15 +00:00
/* Set up the information for connecting to the host gdb process. */
2000-02-24 21:39:15 +00:00
memset (&sin, 0, sizeof (sin));
sin.sin_family = AF_INET;
sin.sin_port = htons (7000); /* FIXME: This should be configurable. */
2000-02-24 21:39:15 +00:00
if (bind (s0, (struct sockaddr *) &sin, sizeof (sin)))
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
error (_("couldn't bind socket"));
2000-02-24 21:39:15 +00:00
if (listen (s0, 1))
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
error (_("Couldn't open socket for listening."));
2000-02-24 21:39:15 +00:00
/* Start up the stub on the remote device. */
if (!CeCreateProcess (towide (stub_file_name, NULL),
towide (args, NULL),
NULL, NULL, 0, 0,
NULL, NULL, NULL, &pi))
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
error (_("Unable to start remote stub '%s'. Windows CE error %d."),
2000-02-24 21:39:15 +00:00
stub_file_name, CeGetLastError ());
/* Wait for a connection */
if ((s = accept (s0, NULL, NULL)) < 0)
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
error (_("couldn't set up server for connection."));
2000-02-24 21:39:15 +00:00
close (s0);
}
2001-05-04 04:15:33 +00:00
/* Start an inferior win32 child process and sets inferior_ptid to its pid.
2000-02-24 21:39:15 +00:00
EXEC_FILE is the file to run.
ALLARGS is a string containing the arguments to the program.
ENV is the environment vector to pass.
Errors reported with error(). */
2000-02-24 21:39:15 +00:00
static void
child_create_inferior (char *exec_file, char *args, char **env,
int from_tty)
2000-02-24 21:39:15 +00:00
{
PROCESS_INFORMATION pi;
struct target_waitstatus dummy;
int ret;
DWORD flags, event_code;
char *exec_and_args;
if (!exec_file)
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
error (_("No executable specified, use `target exec'."));
2000-02-24 21:39:15 +00:00
flags = DEBUG_PROCESS;
wince_initialize (); /* Make sure we've got a connection. */
2000-02-24 21:39:15 +00:00
exec_file = upload_to_device (exec_file, exec_file);
while (*args == ' ')
args++;
/* Allocate space for "command<sp>args" */
if (*args == '\0')
{
exec_and_args = alloca (strlen (exec_file) + 1);
strcpy (exec_and_args, exec_file);
}
else
{
exec_and_args = alloca (strlen (exec_file + strlen (args) + 2));
sprintf (exec_and_args, "%s %s", exec_file, args);
}
memset (&pi, 0, sizeof (pi));
/* Execute the process. */
2000-02-24 21:39:15 +00:00
if (!create_process (exec_file, exec_and_args, flags, &pi))
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
error (_("Error creating process %s, (error %d)."),
exec_file, GetLastError ());
2000-02-24 21:39:15 +00:00
exception_count = 0;
event_count = 0;
current_process_handle = pi.hProcess;
current_event.dwProcessId = pi.dwProcessId;
memset (&current_event, 0, sizeof (current_event));
2001-05-04 04:15:33 +00:00
current_event.dwThreadId = pi.dwThreadId;
inferior_ptid = pid_to_ptid (current_event.dwThreadId);
push_target (&deprecated_child_ops);
2000-02-24 21:39:15 +00:00
child_init_thread_list ();
child_add_thread (pi.dwThreadId, pi.hThread);
init_wait_for_inferior ();
clear_proceed_status ();
target_terminal_init ();
target_terminal_inferior ();
/* Run until process and threads are loaded */
2001-05-04 04:15:33 +00:00
while (!get_child_debug_event (PIDGET (inferior_ptid), &dummy,
CREATE_PROCESS_DEBUG_EVENT, &ret))
continue;
2000-02-24 21:39:15 +00:00
}
/* Chile has gone bye-bye. */
2000-02-24 21:39:15 +00:00
static void
2000-07-30 01:48:28 +00:00
child_mourn_inferior (void)
2000-02-24 21:39:15 +00:00
{
(void) child_continue (DBG_CONTINUE, -1);
unpush_target (&deprecated_child_ops);
2000-02-24 21:39:15 +00:00
stop_stub ();
CeRapiUninit ();
connection_initialized = 0;
generic_mourn_inferior ();
}
/* Move memory from child to/from gdb. */
2000-02-24 21:39:15 +00:00
int
child_xfer_memory (CORE_ADDR memaddr, gdb_byte *our,
int len, int write,
struct mem_attrib *attrib,
struct target_ops *target)
2000-02-24 21:39:15 +00:00
{
if (len <= 0)
return 0;
* TODO: Note abstraction layer violation where "ocd reset" command must invalidate the dcache, and how this might be fixed. * monitor.c (#include "dcache.h"): Removed. (remote_dcache): Removed. (monitor_open): Removed code that created local dcache. (flush_monitor_dcache): Removed (unused function). (monitor_resume): Removed call to dcache_invd(). (monitor_load): Likewise. (monitor_xfer_memory): Changed to call monitor_write_memory(), monitor_write_memory_block(), and monitor_read_memory() instead of dcache_xfer_memory(). * monitor.h (flush_monitor_dcache): Removed (unused function). * ocd.c (#include "dcache.h"): Removed. (ocd_dcache): Removed. (ocd_open): Removed code that created local dcache. (ocd_resume): Removed call to dcache_invd(). (ocd_xfer_memory): Changed to call ocd_write_bytes() and ocd_read_bytes() instead of dcache_xfer_memory(). (bdm_reset_command): Invalidate target dcache. * remote-bug.c (bug_load): Remove call to dcache_invd(). (bug_resume): Likewise. (bug_settings): Remove dcache, readfunc, and writefunc fields from initializer. (bug_xfer_memory): Changed to call bug_read_memory() and bug_write_memory() instead of dcache_xfer_memory(). * remote-nindy.c (#include "dcache.h"): Removed. (nindy_dcache): Removed. (nindy_open): Removed code that created local dcache. (nindy_resume): Removed call to dcache_invd(). (nindy_load): Likewise. (nindy_xfer_inferior_memory): Changed to call ninMemPut() and ninMemGet() instead of dcache_xfer_memory(). * remote-sds.c (#include "dcache.h"): Removed. (sds_dcache): Removed. (sds_open): Removed code that created local dcache. (sds_resume): Removed call to dcache_invd(). (sds_xfer_memory): Changed to call sds_write_bytes() and sds_read_bytes() instead of dcache_xfer_memory(). * remote-utils.c (gr_open): Removed code that created local dcache. * remote-utils.h (#include "dcache.h"): Removed. (struct gr_settings): Removed dcache, readfunc, and writefunc fields. (gr_get_dcache, gr_set_dcache): Removed macro definitions. * remote.c (#include "dcache.h"): Removed. (remote_dcache): Removed. (remote_open_1): Removed code that created local dcache. (remote_async_open_1): Likewise. (remote_resume): Removed call to dcache_invd(). (remote_async_resume): Likewise. (remote_xfer_memory): Changed to call remote_write_bytes() and remote_read_bytes() instead of dcache_xfer_memory(). * wince.c (#include "dcache.h"): Removed. (remote_dcache): Removed. (child_create_inferior): Removed code that created local dcache. (child_xfer_memory): Changed to call remote_write_bytes() and remote_read_bytes() instead of dcache_xfer_memory(). (child_resume): Removed call to dcache_invd(). * target.c (target_dcache): Added. (target_load): Invalidate target_dcache. (do_xfer_memory): New function. (target_xfer_memory): Reimplement in terms of dcache_xfer_memory(). (target_xfer_memory_partial): Likewise. (initialize_targets): Create target_dcache. * target.h (#include "dcache.h"): Added. (target_open): Invalidate target_dcache. (target_resume): Likewise. (do_xfer_memory): New declaration. * dcache.c (dcache_init): Removed reading and writing arguments. (dcache_struct): Removed read_memory and write_memory fields. (dcache_write_line): Call do_xfer_memory. (dcache_read_line): Likewise. (dcache_xfer_memory): Likewise. (dcache_invalidate): Renamed from dcache_invd. (dcache_init): Updated. (dcache_xfer_memory): Updated. * dcache.h (memxferfunc): Removed definition.
2000-11-03 22:00:56 +00:00
if (write)
res = remote_write_bytes (memaddr, our, len);
else
res = remote_read_bytes (memaddr, our, len);
return res;
2000-02-24 21:39:15 +00:00
}
/* Terminate the process and wait for child to tell us it has
completed. */
2000-02-24 21:39:15 +00:00
void
child_kill_inferior (void)
{
CHECK (terminate_process (current_process_handle));
for (;;)
{
if (!child_continue (DBG_CONTINUE, -1))
break;
if (!wait_for_debug_event (&current_event, INFINITE))
break;
if (current_event.dwDebugEventCode == EXIT_PROCESS_DEBUG_EVENT)
break;
}
CHECK (close_handle (current_process_handle));
close_handle (current_thread->h);
target_mourn_inferior (); /* or just child_mourn_inferior? */
2000-02-24 21:39:15 +00:00
}
/* Resume the child after an exception. */
2000-02-24 21:39:15 +00:00
void
2001-05-04 04:15:33 +00:00
child_resume (ptid_t ptid, int step, enum target_signal sig)
2000-02-24 21:39:15 +00:00
{
thread_info *th;
DWORD continue_status = last_sig > 0 && last_sig < NSIG ?
DBG_EXCEPTION_NOT_HANDLED : DBG_CONTINUE;
2001-05-04 04:15:33 +00:00
int pid = PIDGET (ptid);
2000-02-24 21:39:15 +00:00
DEBUG_EXEC (("gdb: child_resume (pid=%d, step=%d, sig=%d);\n",
pid, step, sig));
/* Get context for currently selected thread */
th = thread_rec (current_event.dwThreadId, FALSE);
if (th->context.ContextFlags)
{
CHECK (set_thread_context (th->h, &th->context));
th->context.ContextFlags = 0;
}
/* Allow continuing with the same signal that interrupted us.
Otherwise complain. */
2000-02-24 21:39:15 +00:00
if (sig && sig != last_sig)
fprintf_unfiltered (gdb_stderr,
"Can't send signals to the child. signal %d\n",
sig);
2000-02-24 21:39:15 +00:00
last_sig = 0;
child_continue (continue_status, pid);
}
static void
2000-07-30 01:48:28 +00:00
child_prepare_to_store (void)
2000-02-24 21:39:15 +00:00
{
/* Do nothing, since we can store individual regs */
}
static int
2000-07-30 01:48:28 +00:00
child_can_run (void)
2000-02-24 21:39:15 +00:00
{
return 1;
}
static void
2000-07-30 01:48:28 +00:00
child_close (void)
2000-02-24 21:39:15 +00:00
{
2001-05-04 04:15:33 +00:00
DEBUG_EVENTS (("gdb: child_close, inferior_ptid=%d\n",
PIDGET (inferior_ptid)));
2000-02-24 21:39:15 +00:00
}
/* Explicitly upload file to remotedir */
static void
child_load (char *file, int from_tty)
{
upload_to_device (file, file);
}
static void
init_child_ops (void)
{
memset (&deprecated_child_ops, 0, sizeof (deprecated_child_ops));
deprecated_child_ops.to_shortname = (char *) "child";
deprecated_child_ops.to_longname = (char *) "Windows CE process";
deprecated_child_ops.to_doc = (char *) "Windows CE process (started by the \"run\" command).";
deprecated_child_ops.to_open = child_open;
deprecated_child_ops.to_close = child_close;
deprecated_child_ops.to_resume = child_resume;
deprecated_child_ops.to_wait = child_wait;
deprecated_child_ops.to_fetch_registers = child_fetch_inferior_registers;
deprecated_child_ops.to_store_registers = child_store_inferior_registers;
deprecated_child_ops.to_prepare_to_store = child_prepare_to_store;
deprecated_child_ops.deprecated_xfer_memory = child_xfer_memory;
deprecated_child_ops.to_files_info = child_files_info;
deprecated_child_ops.to_insert_breakpoint = memory_insert_breakpoint;
deprecated_child_ops.to_remove_breakpoint = memory_remove_breakpoint;
deprecated_child_ops.to_terminal_init = terminal_init_inferior;
deprecated_child_ops.to_terminal_inferior = terminal_inferior;
deprecated_child_ops.to_terminal_ours_for_output = terminal_ours_for_output;
deprecated_child_ops.to_terminal_ours = terminal_ours;
deprecated_child_ops.to_terminal_save_ours = terminal_save_ours;
deprecated_child_ops.to_terminal_info = child_terminal_info;
deprecated_child_ops.to_kill = child_kill_inferior;
deprecated_child_ops.to_load = child_load;
deprecated_child_ops.to_create_inferior = child_create_inferior;
deprecated_child_ops.to_mourn_inferior = child_mourn_inferior;
deprecated_child_ops.to_can_run = child_can_run;
deprecated_child_ops.to_thread_alive = win32_child_thread_alive;
deprecated_child_ops.to_stratum = process_stratum;
deprecated_child_ops.to_has_all_memory = 1;
deprecated_child_ops.to_has_memory = 1;
deprecated_child_ops.to_has_stack = 1;
deprecated_child_ops.to_has_registers = 1;
deprecated_child_ops.to_has_execution = 1;
deprecated_child_ops.to_magic = OPS_MAGIC;
2000-02-24 21:39:15 +00:00
}
/* Handle 'set remoteupload' parameter. */
2000-02-24 21:39:15 +00:00
#define replace_upload(what) \
upload_when = what; \
remote_upload = xrealloc (remote_upload, \
strlen (upload_options[upload_when].name) + 1); \
strcpy (remote_upload, upload_options[upload_when].name);
2000-02-24 21:39:15 +00:00
static void
set_upload_type (char *ignore, int from_tty)
{
int i, len;
char *bad_option;
if (!remote_upload || !remote_upload[0])
{
replace_upload (UPLOAD_NEWER);
if (from_tty)
printf_unfiltered ("Upload upload_options are: always, newer, never.\n");
return;
}
len = strlen (remote_upload);
for (i = 0;
i < (sizeof (upload_options) / sizeof (upload_options[0]));
i++)
2000-02-24 21:39:15 +00:00
if (len >= upload_options[i].abbrev &&
strncasecmp (remote_upload, upload_options[i].name, len) == 0)
{
replace_upload (i);
2000-02-24 21:39:15 +00:00
return;
}
bad_option = remote_upload;
replace_upload (UPLOAD_NEWER);
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 04:06:14 +00:00
error (_("Unknown upload type: %s."), bad_option);
2000-02-24 21:39:15 +00:00
}
void
_initialize_wince (void)
2000-02-24 21:39:15 +00:00
{
struct cmd_list_element *set;
init_child_ops ();
add_setshow_string_noescape_cmd ("remotedirectory", no_class,
&remote_directory, _("\
Set directory for remote upload."), _("\
Show directory for remote upload."), NULL,
NULL, /* FIXME: i18n: */
NULL, NULL,
&setlist, &showlist);
2000-02-24 21:39:15 +00:00
remote_directory = xstrdup (remote_directory);
add_setshow_string_noescape_cmd ("remoteupload", no_class,
&remote_upload, _("\
Set how to upload executables to remote device."), _("\
Show how to upload executables to remote device."), NULL,
NULL, /* FIXME: i18n: */
set_upload_type, NULL,
&setlist, &showlist);
2000-02-24 21:39:15 +00:00
set_upload_type (NULL, 0);
add_setshow_boolean_cmd ("debugexec", class_support, &debug_exec, _("\
Set whether to display execution in child process."), _("\
Show whether to display execution in child process."), NULL,
NULL,
NULL, /* FIXME: i18n: */
&setlist, &showlist);
add_setshow_boolean_cmd ("remoteaddhost", class_support,
&remote_add_host, _("\
Set whether to add this host to remote stub arguments for\n\
debugging over a network."), _("\
Show whether to add this host to remote stub arguments for\n\
debugging over a network."), NULL,
NULL,
NULL, /* FIXME: i18n: */
&setlist, &showlist);
add_setshow_boolean_cmd ("debugevents", class_support, &debug_events, _("\
Set whether to display kernel events in child process."), _("\
Show whether to display kernel events in child process."), NULL,
NULL,
NULL, /* FIXME: i18n: */
&setlist, &showlist);
add_setshow_boolean_cmd ("debugmemory", class_support, &debug_memory, _("\
Set whether to display memory accesses in child process."), _("\
Show whether to display memory accesses in child process."), NULL,
NULL,
NULL, /* FIXME: i18n: */
&setlist, &showlist);
add_setshow_boolean_cmd ("debugexceptions", class_support,
&debug_exceptions, _("\
Set whether to display kernel exceptions in child process."), _("\
Show whether to display kernel exceptions in child process."), NULL,
NULL,
NULL, /* FIXME: i18n: */
&setlist, &showlist);
2000-02-24 21:39:15 +00:00
add_target (&deprecated_child_ops);
2000-02-24 21:39:15 +00:00
}
/* Determine if the thread referenced by "pid" is alive by "polling"
it. If WaitForSingleObject returns WAIT_OBJECT_0 it means that the
pid has died. Otherwise it is assumed to be alive. */
2000-02-24 21:39:15 +00:00
static int
2001-05-04 04:15:33 +00:00
win32_child_thread_alive (ptid_t ptid)
2000-02-24 21:39:15 +00:00
{
2001-05-04 04:15:33 +00:00
int pid = PIDGET (ptid);
2000-02-24 21:39:15 +00:00
return thread_alive (thread_rec (pid, FALSE)->h);
}
/* Convert pid to printable format. */
2000-02-24 21:39:15 +00:00
char *
cygwin_pid_to_str (int pid)
{
static char buf[80];
if (pid == current_event.dwProcessId)
sprintf (buf, "process %d", pid);
else
sprintf (buf, "thread %d.0x%x",
(unsigned) current_event.dwProcessId, pid);
2000-02-24 21:39:15 +00:00
return buf;
}