projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
2002-10-01 Andrew Cagney <ac131313@redhat.com>
[deliverable/binutils-gdb.git]
/
gdb
/
wince.c
diff --git
a/gdb/wince.c
b/gdb/wince.c
index 91ac5cff1378149763182fc28450ff7252958509..92c115820b4f57403ec93a682d03e6f5feaa1cf9 100644
(file)
--- a/
gdb/wince.c
+++ b/
gdb/wince.c
@@
-1,5
+1,5
@@
/* Target-vector operations for controlling Windows CE child processes, for GDB.
/* 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.
Contributed by Cygnus Solutions, A Red Hat Company.
This file is part of GDB.
@@
-54,8
+54,8
@@
#include "gdbcmd.h"
#include <sys/param.h>
#include "wince-stub.h"
#include "gdbcmd.h"
#include <sys/param.h>
#include "wince-stub.h"
-#include "dcache.h"
#include <time.h>
#include <time.h>
+#include "regcache.h"
/* The ui's event loop. */
extern int (*ui_loop_hook) (int signo);
/* The ui's event loop. */
extern int (*ui_loop_hook) (int signo);
@@
-89,8
+89,6
@@
extern int (*ui_loop_hook) (int signo);
static int connection_initialized = 0; /* True if we've initialized a RAPI session. */
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";
/* The directory where the stub and executable files are uploaded. */
static const char *remote_directory = "\\gdb";
@@
-131,7
+129,7
@@
static int remote_add_host = 0;
/* Forward declaration */
extern struct target_ops child_ops;
/* Forward declaration */
extern struct target_ops child_ops;
-static int win32_child_thread_alive (
in
t);
+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
void child_kill_inferior (void);
static int last_sig = 0; /* Set if a signal was received from the
@@
-604,10
+602,10
@@
towide (const char *s, gdb_wince_len * out_len)
n = 0; /* wrap */
/* Allocate space for the converted string, reusing any previously allocated
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,
x
realloc will act as
a malloc (under cygwin, at least).
*/
a malloc (under cygwin, at least).
*/
- outs[n] = (LPWSTR) realloc (outs[n], *out_len);
+ outs[n] = (LPWSTR)
x
realloc (outs[n], *out_len);
memset (outs[n], 0, *out_len);
(void) MultiByteToWideChar (CP_ACP, 0, s, -1, outs[n], *out_len);
return outs[n];
memset (outs[n], 0, *out_len);
(void) MultiByteToWideChar (CP_ACP, 0, s, -1, outs[n], *out_len);
return outs[n];
@@
-786,7
+784,7
@@
close_handle (HANDLE h)
to terminate.
*/
static void
to terminate.
*/
static void
-stop_stub ()
+stop_stub (
void
)
{
if (s < 0)
return;
{
if (s < 0)
return;
@@
-811,7
+809,8
@@
undoSStep (thread_info * th)
}
void
}
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 */
{
unsigned long pc;
thread_info *th = current_thread; /* Info on currently selected thread */
@@
-951,7
+950,8
@@
undoSStep (thread_info * th)
which would be executed. This code hails from sh-stub.c.
*/
void
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 */
{
thread_info *th = current_thread; /* Info on currently selected thread */
@@
-997,7
+997,8
@@
undoSStep (thread_info * th)
}
void
}
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 */
{
unsigned long pc;
thread_info *th = current_thread; /* Info on currently selected thread */
@@
-1067,7
+1068,7
@@
child_add_thread (DWORD id, HANDLE h)
/* Clear out any old thread list and reintialize it to a
pristine state. */
static void
/* 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 *th = &thread_head;
@@
-1078,7
+1079,7
@@
child_init_thread_list ()
thread_info *here = th->next;
th->next = here->next;
(void) close_handle (here->h);
thread_info *here = th->next;
th->next = here->next;
(void) close_handle (here->h);
- free (here);
+
x
free (here);
}
}
}
}
@@
-1102,7
+1103,7
@@
child_delete_thread (DWORD id)
thread_info *here = th->next;
th->next = here->next;
close_handle (here->h);
thread_info *here = th->next;
th->next = here->next;
close_handle (here->h);
- free (here);
+
x
free (here);
}
}
}
}
@@
-1130,7
+1131,7
@@
do_child_fetch_inferior_registers (int r)
static void
child_fetch_inferior_registers (int r)
{
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_fetch_inferior_registers (r);
}
@@
-1150,7
+1151,7
@@
do_child_store_inferior_registers (int r)
static void
child_store_inferior_registers (int 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);
}
do_child_store_inferior_registers (r);
}
@@
-1158,7
+1159,7
@@
child_store_inferior_registers (int r)
of error; store status through argument pointer OURSTATUS. */
static int
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];
{
LOAD_DLL_DEBUG_INFO *event = ¤t_event.u.LoadDll;
char dll_buf[MAX_PATH + 1];
@@
-1411,9
+1412,10
@@
get_child_debug_event (int pid, struct target_waitstatus *ourstatus,
"CREATE_PROCESS_DEBUG_EVENT"));
current_process_handle = current_event.u.CreateProcessInfo.hProcess;
"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 */
/* Add the main thread */
- th = child_add_thread (
inferior_pid
,
+ th = child_add_thread (
PIDGET (inferior_ptid)
,
current_event.u.CreateProcessInfo.hThread);
break;
current_event.u.CreateProcessInfo.hThread);
break;
@@
-1485,11
+1487,12
@@
out:
}
/* Wait for interesting events to occur in the target process. */
}
/* Wait for interesting events to occur in the target process. */
-static
in
t
-child_wait (
int p
id, struct target_waitstatus *ourstatus)
+static
ptid_
t
+child_wait (
ptid_t pt
id, struct target_waitstatus *ourstatus)
{
DWORD event_code;
int retval;
{
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,
/* We loop when we get a non-standard exception rather than return
with a SPURIOUS because resume can try and step or modify things,
@@
-1499,7
+1502,7
@@
child_wait (int pid, struct target_waitstatus *ourstatus)
while (1)
if (get_child_debug_event (pid, ourstatus, EXCEPTION_DEBUG_EVENT, &retval))
while (1)
if (get_child_debug_event (pid, ourstatus, EXCEPTION_DEBUG_EVENT, &retval))
- return
retval
;
+ return
pid_to_ptid (retval)
;
else
{
int detach = 0;
else
{
int detach = 0;
@@
-1515,18
+1518,15
@@
child_wait (int pid, struct target_waitstatus *ourstatus)
/* Print status information about what we're accessing. */
static void
/* 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",
{
printf_unfiltered ("\tUsing the running image of child %s.\n",
- target_pid_to_str (inferior_pid));
+ target_pid_to_str (inferior_p
t
id));
}
/* ARGSUSED */
static void
}
/* 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 ("Use the \"run\" command to start a child process.");
}
@@
-1578,7
+1578,7
@@
upload_to_device (const char *to, const char *from)
error ("no filename found to upload - %s.", in_to);
len = strlen (dir) + strlen (to) + 2;
error ("no filename found to upload - %s.", in_to);
len = strlen (dir) + strlen (to) + 2;
- remotefile = (char *) realloc (remotefile, len);
+ remotefile = (char *)
x
realloc (remotefile, len);
strcpy (remotefile, dir);
strcat (remotefile, "\\");
strcat (remotefile, to);
strcpy (remotefile, dir);
strcat (remotefile, "\\");
strcat (remotefile, to);
@@
-1645,7
+1645,7
@@
upload_to_device (const char *to, const char *from)
/* Initialize the connection to the remote device. */
static void
/* Initialize the connection to the remote device. */
static void
-wince_initialize ()
+wince_initialize (
void
)
{
int tmp;
char args[256];
{
int tmp;
char args[256];
@@
-1713,7
+1713,7
@@
wince_initialize ()
close (s0);
}
close (s0);
}
-/* Start an inferior win32 child process and sets inferior_pid to its pid.
+/* Start an inferior win32 child process and sets inferior_p
t
id 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(). */
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(). */
@@
-1732,10
+1732,6
@@
child_create_inferior (char *exec_file, char *args, char **env)
flags = DEBUG_PROCESS;
wince_initialize (); /* Make sure we've got a connection. */
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);
exec_file = upload_to_device (exec_file, exec_file);
@@
-1765,7
+1761,8
@@
child_create_inferior (char *exec_file, char *args, char **env)
current_process_handle = pi.hProcess;
current_event.dwProcessId = pi.dwProcessId;
memset (¤t_event, 0, sizeof (current_event));
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);
push_target (&child_ops);
child_init_thread_list ();
child_add_thread (pi.dwThreadId, pi.hThread);
@@
-1775,7
+1772,7
@@
child_create_inferior (char *exec_file, char *args, char **env)
target_terminal_inferior ();
/* Run until process and threads are loaded */
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;
CREATE_PROCESS_DEBUG_EVENT, &ret))
continue;
@@
-1784,7
+1781,7
@@
child_create_inferior (char *exec_file, char *args, char **env)
/* Chile has gone bye-bye. */
static void
/* Chile has gone bye-bye. */
static void
-child_mourn_inferior ()
+child_mourn_inferior (
void
)
{
(void) child_continue (DBG_CONTINUE, -1);
unpush_target (&child_ops);
{
(void) child_continue (DBG_CONTINUE, -1);
unpush_target (&child_ops);
@@
-1796,12
+1793,19
@@
child_mourn_inferior ()
/* Move memory from child to/from gdb. */
int
/* 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;
{
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. */
}
/* Terminate the process and wait for child to tell us it has completed. */
@@
-1827,11
+1831,12
@@
child_kill_inferior (void)
/* Resume the child after an exception. */
void
/* Resume the child after an exception. */
void
-child_resume (
int p
id, int step, enum target_signal sig)
+child_resume (
ptid_t pt
id, int step, enum target_signal sig)
{
thread_info *th;
DWORD continue_status = last_sig > 0 && last_sig < NSIG ?
DBG_EXCEPTION_NOT_HANDLED : DBG_CONTINUE;
{
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));
DEBUG_EXEC (("gdb: child_resume (pid=%d, step=%d, sig=%d);\n",
pid, step, sig));
@@
-1845,8
+1850,6
@@
child_resume (int pid, int step, enum target_signal sig)
th->context.ContextFlags = 0;
}
th->context.ContextFlags = 0;
}
- dcache_flush (remote_dcache);
-
/* Allow continuing with the same signal that interrupted us.
Otherwise complain. */
if (sig && sig != last_sig)
/* Allow continuing with the same signal that interrupted us.
Otherwise complain. */
if (sig && sig != last_sig)
@@
-1857,21
+1860,22
@@
child_resume (int pid, int step, enum target_signal sig)
}
static void
}
static void
-child_prepare_to_store ()
+child_prepare_to_store (
void
)
{
/* Do nothing, since we can store individual regs */
}
static int
{
/* Do nothing, since we can store individual regs */
}
static int
-child_can_run ()
+child_can_run (
void
)
{
return 1;
}
static void
{
return 1;
}
static void
-child_close ()
+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 */
}
/* Explicitly upload file to remotedir */
@@
-1906,6
+1910,7
@@
init_child_ops (void)
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_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_terminal_info = child_terminal_info;
child_ops.to_kill = child_kill_inferior;
child_ops.to_load = child_load;
@@
-1929,7
+1934,7
@@
init_child_ops (void)
#define replace_upload(what) \
upload_when = what; \
#define replace_upload(what) \
upload_when = what; \
- remote_upload = realloc (remote_upload, strlen (upload_options[upload_when].name) + 1); \
+ remote_upload =
x
realloc (remote_upload, strlen (upload_options[upload_when].name) + 1); \
strcpy (remote_upload, upload_options[upload_when].name);
static void
strcpy (remote_upload, upload_options[upload_when].name);
static void
@@
-1961,7
+1966,7
@@
set_upload_type (char *ignore, int from_tty)
}
void
}
void
-_initialize_
inftarg (
)
+_initialize_
wince (void
)
{
struct cmd_list_element *set;
init_child_ops ();
{
struct cmd_list_element *set;
init_child_ops ();
@@
-1979,9
+1984,8
@@
_initialize_inftarg ()
(char *) "Set how to upload executables to remote device.\n",
&setlist);
add_show_from_set (set, &showlist);
(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);
set_upload_type (NULL, 0);
- set_dcache_state (1);
add_show_from_set
(add_set_cmd ((char *) "debugexec", class_support, var_boolean,
add_show_from_set
(add_set_cmd ((char *) "debugexec", class_support, var_boolean,
@@
-2025,8
+2029,9
@@
debugging over a network.", &setlist),
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
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 p
id)
+win32_child_thread_alive (
ptid_t pt
id)
{
{
+ int pid = PIDGET (ptid);
return thread_alive (thread_rec (pid, FALSE)->h);
}
return thread_alive (thread_rec (pid, FALSE)->h);
}
This page took
0.029155 seconds
and
4
git commands to generate.