#include "wince-stub.h"
#include <time.h>
#include "regcache.h"
+#ifdef MIPS
+#include "mips-tdep.h"
+#endif
/* The ui's event loop. */
extern int (*ui_loop_hook) (int signo);
/* Forward declaration */
extern struct target_ops child_ops;
-static int win32_child_thread_alive (int);
+static int win32_child_thread_alive (ptid_t);
void child_kill_inferior (void);
static int last_sig = 0; /* Set if a signal was received from the
return;
}
#elif SHx
-/* Hitachi SH architecture instruction encoding masks */
+/* Renesas SH architecture instruction encoding masks */
#define COND_BR_MASK 0xff00
#define UCOND_DBR_MASK 0xe000
#define UCOND_DISP 0x0fff
#define UCOND_REG 0x0f00
-/* Hitachi SH instruction opcodes */
+/* Renesas SH instruction opcodes */
#define BF_INSTR 0x8b00
#define BT_INSTR 0x8900
static void
child_fetch_inferior_registers (int r)
{
- current_thread = thread_rec (inferior_pid, TRUE);
+ current_thread = thread_rec (PIDGET (inferior_ptid), TRUE);
do_child_fetch_inferior_registers (r);
}
do_child_store_inferior_registers (int r)
{
if (r >= 0)
- read_register_gen (r, ((char *) ¤t_thread->context) + mappings[r]);
+ deprecated_read_register_gen (r, ((char *) ¤t_thread->context) + mappings[r]);
else
{
for (r = 0; r < NUM_REGS; r++)
static void
child_store_inferior_registers (int r)
{
- current_thread = thread_rec (inferior_pid, TRUE);
+ current_thread = thread_rec (PIDGET (inferior_ptid), TRUE);
do_child_store_inferior_registers (r);
}
"CREATE_PROCESS_DEBUG_EVENT"));
current_process_handle = current_event.u.CreateProcessInfo.hProcess;
- main_thread_id = inferior_pid = current_event.dwThreadId;
+ main_thread_id = current_event.dwThreadId;
+ inferior_ptid = pid_to_ptid (main_thread_id);
/* Add the main thread */
- th = child_add_thread (inferior_pid,
+ th = child_add_thread (PIDGET (inferior_ptid),
current_event.u.CreateProcessInfo.hThread);
break;
}
/* Wait for interesting events to occur in the target process. */
-static int
-child_wait (int pid, struct target_waitstatus *ourstatus)
+static ptid_t
+child_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
{
DWORD event_code;
int retval;
+ int pid = PIDGET (ptid);
/* We loop when we get a non-standard exception rather than return
with a SPURIOUS because resume can try and step or modify things,
while (1)
if (get_child_debug_event (pid, ourstatus, EXCEPTION_DEBUG_EVENT, &retval))
- return retval;
+ return pid_to_ptid (retval);
else
{
int detach = 0;
child_files_info (struct target_ops *ignore)
{
printf_unfiltered ("\tUsing the running image of child %s.\n",
- target_pid_to_str (inferior_pid));
+ target_pid_to_str (inferior_ptid));
}
-/* ARGSUSED */
static void
child_open (char *arg, int from_tty)
{
close (s0);
}
-/* Start an inferior win32 child process and sets inferior_pid to its pid.
+/* Start an inferior win32 child process and sets inferior_ptid to its pid.
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(). */
current_process_handle = pi.hProcess;
current_event.dwProcessId = pi.dwProcessId;
memset (¤t_event, 0, sizeof (current_event));
- inferior_pid = current_event.dwThreadId = pi.dwThreadId;
+ current_event.dwThreadId = pi.dwThreadId;
+ inferior_ptid = pid_to_ptid (current_event.dwThreadId);
push_target (&child_ops);
child_init_thread_list ();
child_add_thread (pi.dwThreadId, pi.hThread);
target_terminal_inferior ();
/* Run until process and threads are loaded */
- while (!get_child_debug_event (inferior_pid, &dummy,
+ while (!get_child_debug_event (PIDGET (inferior_ptid), &dummy,
CREATE_PROCESS_DEBUG_EVENT, &ret))
continue;
/* Resume the child after an exception. */
void
-child_resume (int pid, int step, enum target_signal sig)
+child_resume (ptid_t ptid, int step, enum target_signal sig)
{
thread_info *th;
DWORD continue_status = last_sig > 0 && last_sig < NSIG ?
DBG_EXCEPTION_NOT_HANDLED : DBG_CONTINUE;
+ int pid = PIDGET (ptid);
DEBUG_EXEC (("gdb: child_resume (pid=%d, step=%d, sig=%d);\n",
pid, step, sig));
static void
child_close (void)
{
- DEBUG_EVENTS (("gdb: child_close, inferior_pid=%d\n", inferior_pid));
+ DEBUG_EVENTS (("gdb: child_close, inferior_ptid=%d\n",
+ PIDGET (inferior_ptid)));
}
/* Explicitly upload file to remotedir */
child_ops.to_terminal_inferior = terminal_inferior;
child_ops.to_terminal_ours_for_output = terminal_ours_for_output;
child_ops.to_terminal_ours = terminal_ours;
+ child_ops.to_terminal_save_ours = terminal_save_ours;
child_ops.to_terminal_info = child_terminal_info;
child_ops.to_kill = child_kill_inferior;
child_ops.to_load = child_load;
child_ops.to_has_stack = 1;
child_ops.to_has_registers = 1;
child_ops.to_has_execution = 1;
- child_ops.to_sections = 0;
- child_ops.to_sections_end = 0;
child_ops.to_magic = OPS_MAGIC;
}
}
void
-_initialize_inftarg (void)
+_initialize_wince (void)
{
struct cmd_list_element *set;
init_child_ops ();
(char *) "Set how to upload executables to remote device.\n",
&setlist);
add_show_from_set (set, &showlist);
- set->function.cfunc = set_upload_type;
+ set_cmd_cfunc (set, set_upload_type);
set_upload_type (NULL, 0);
add_show_from_set
add_show_from_set
(add_set_cmd ((char *) "remoteaddhost", class_support, var_boolean,
(char *) &remote_add_host,
- (char *) "Set whether to add this host to remote stub arguments for\n
+ (char *) "\
+Set whether to add this host to remote stub arguments for\n\
debugging over a network.", &setlist),
&showlist);
by "polling" it. If WaitForSingleObject returns WAIT_OBJECT_0
it means that the pid has died. Otherwise it is assumed to be alive. */
static int
-win32_child_thread_alive (int pid)
+win32_child_thread_alive (ptid_t ptid)
{
+ int pid = PIDGET (ptid);
return thread_alive (thread_rec (pid, FALSE)->h);
}