/* Target-vector operations for controlling Windows CE child processes, for GDB.
- Copyright 1999, 2000 Free Software Foundation, Inc.
+ Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
Contributed by Cygnus Solutions, A Red Hat Company.
This file is part of GDB.
(at your option) any later version.
This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without eve nthe implied warranty of
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
#include "gdbcmd.h"
#include <sys/param.h>
#include "wince-stub.h"
-#include "dcache.h"
#include <time.h>
+#include "regcache.h"
/* The ui's event loop. */
-extern int (*ui_loop_hook) PARAMS ((int signo));
+extern int (*ui_loop_hook) (int signo);
/* If we're not using the old Cygwin header file set, define the
following which never should have been in the generic Win32 API
static int connection_initialized = 0; /* True if we've initialized a RAPI session. */
-static DCACHE *remote_dcache;
-
/* The directory where the stub and executable files are uploaded. */
static const char *remote_directory = "\\gdb";
/* Forward declaration */
extern struct target_ops child_ops;
-static int win32_child_thread_alive PARAMS ((int));
-void child_kill_inferior PARAMS ((void));
+static int win32_child_thread_alive (int);
+void child_kill_inferior (void);
static int last_sig = 0; /* Set if a signal was received from the
debugged process */
n = 0; /* wrap */
/* Allocate space for the converted string, reusing any previously allocated
- space, if applicable. Note that if outs[n] is NULL, realloc will act as
+ space, if applicable. Note that if outs[n] is NULL, xrealloc will act as
a malloc (under cygwin, at least).
*/
- outs[n] = (LPWSTR) realloc (outs[n], *out_len);
+ outs[n] = (LPWSTR) xrealloc (outs[n], *out_len);
memset (outs[n], 0, *out_len);
(void) MultiByteToWideChar (CP_ACP, 0, s, -1, outs[n], *out_len);
return outs[n];
to terminate.
*/
static void
-stop_stub ()
+stop_stub (void)
{
if (s < 0)
return;
}
void
-wince_software_single_step (unsigned int ignore, int insert_breakpoints_p)
+wince_software_single_step (enum target_signal ignore,
+ int insert_breakpoints_p)
{
unsigned long pc;
thread_info *th = current_thread; /* Info on currently selected thread */
which would be executed. This code hails from sh-stub.c.
*/
void
-wince_software_single_step (unsigned int ignore, int insert_breakpoints_p)
+wince_software_single_step (enum target_signal ignore,
+ int insert_breakpoints_p)
{
thread_info *th = current_thread; /* Info on currently selected thread */
}
void
-wince_software_single_step (unsigned int ignore, int insert_breakpoints_p)
+wince_software_single_step (enum target_signal ignore,
+ int insert_breakpoints_p)
{
unsigned long pc;
thread_info *th = current_thread; /* Info on currently selected thread */
/* Clear out any old thread list and reintialize it to a
pristine state. */
static void
-child_init_thread_list ()
+child_init_thread_list (void)
{
thread_info *th = &thread_head;
thread_info *here = th->next;
th->next = here->next;
(void) close_handle (here->h);
- free (here);
+ xfree (here);
}
}
thread_info *here = th->next;
th->next = here->next;
close_handle (here->h);
- free (here);
+ xfree (here);
}
}
of error; store status through argument pointer OURSTATUS. */
static int
-handle_load_dll (PTR dummy)
+handle_load_dll (void *dummy)
{
LOAD_DLL_DEBUG_INFO *event = ¤t_event.u.LoadDll;
char dll_buf[MAX_PATH + 1];
/* Print status information about what we're accessing. */
static void
-child_files_info (ignore)
- struct target_ops *ignore;
+child_files_info (struct target_ops *ignore)
{
printf_unfiltered ("\tUsing the running image of child %s.\n",
target_pid_to_str (inferior_pid));
/* ARGSUSED */
static void
-child_open (arg, from_tty)
- char *arg;
- int from_tty;
+child_open (char *arg, int from_tty)
{
error ("Use the \"run\" command to start a child process.");
}
error ("no filename found to upload - %s.", in_to);
len = strlen (dir) + strlen (to) + 2;
- remotefile = (char *) realloc (remotefile, len);
+ remotefile = (char *) xrealloc (remotefile, len);
strcpy (remotefile, dir);
strcat (remotefile, "\\");
strcat (remotefile, to);
/* Initialize the connection to the remote device. */
static void
-wince_initialize ()
+wince_initialize (void)
{
int tmp;
char args[256];
flags = DEBUG_PROCESS;
wince_initialize (); /* Make sure we've got a connection. */
- if (!remote_dcache)
- remote_dcache = dcache_init (remote_read_bytes, remote_write_bytes);
- else
- dcache_flush (remote_dcache);
exec_file = upload_to_device (exec_file, exec_file);
/* Chile has gone bye-bye. */
static void
-child_mourn_inferior ()
+child_mourn_inferior (void)
{
(void) child_continue (DBG_CONTINUE, -1);
unpush_target (&child_ops);
/* Move memory from child to/from gdb. */
int
-child_xfer_memory (CORE_ADDR memaddr, char *our, int len,
- int write, struct target_ops *target)
+child_xfer_memory (CORE_ADDR memaddr, char *our, int len, int write,
+ struct mem_attrib *attrib,
+ struct target_ops *target)
{
if (len <= 0)
return 0;
- return dcache_xfer_memory (remote_dcache, memaddr, our, len, write);
+
+ if (write)
+ res = remote_write_bytes (memaddr, our, len);
+ else
+ res = remote_read_bytes (memaddr, our, len);
+
+ return res;
}
/* Terminate the process and wait for child to tell us it has completed. */
th->context.ContextFlags = 0;
}
- dcache_flush (remote_dcache);
-
/* Allow continuing with the same signal that interrupted us.
Otherwise complain. */
if (sig && sig != last_sig)
}
static void
-child_prepare_to_store ()
+child_prepare_to_store (void)
{
/* Do nothing, since we can store individual regs */
}
static int
-child_can_run ()
+child_can_run (void)
{
return 1;
}
static void
-child_close ()
+child_close (void)
{
DEBUG_EVENTS (("gdb: child_close, inferior_pid=%d\n", inferior_pid));
}
#define replace_upload(what) \
upload_when = what; \
- remote_upload = realloc (remote_upload, strlen (upload_options[upload_when].name) + 1); \
+ remote_upload = xrealloc (remote_upload, strlen (upload_options[upload_when].name) + 1); \
strcpy (remote_upload, upload_options[upload_when].name);
static void
}
void
-_initialize_inftarg ()
+_initialize_inftarg (void)
{
struct cmd_list_element *set;
init_child_ops ();
add_show_from_set (set, &showlist);
set->function.cfunc = set_upload_type;
set_upload_type (NULL, 0);
- set_dcache_state (1);
add_show_from_set
(add_set_cmd ((char *) "debugexec", class_support, var_boolean,