enum { REMOTE_ALIGN_WRITES = 16 };
/* Prototypes for local functions. */
-static void cleanup_sigint_signal_handler (void *dummy);
-static void initialize_sigint_signal_handler (void);
+static void async_cleanup_sigint_signal_handler (void *dummy);
static int getpkt_sane (char **buf, long *sizeof_buf, int forever);
static int getpkt_or_notif_sane (char **buf, long *sizeof_buf,
int forever, int *is_notif);
-static void handle_remote_sigint (int);
-static void handle_remote_sigint_twice (int);
-static void async_remote_interrupt (gdb_client_data);
-static void async_remote_interrupt_twice (gdb_client_data);
+static void async_handle_remote_sigint (int);
+static void async_handle_remote_sigint_twice (int);
static void remote_files_info (struct target_ops *ignore);
static void remote_detach (struct target_ops *ops, char *args, int from_tty);
-static void remote_interrupt (int signo);
-
-static void remote_interrupt_twice (int signo);
+static void sync_remote_interrupt_twice (int signo);
static void interrupt_query (void);
static int use_threadextra_query;
/* Tokens for use by the asynchronous signal handlers for SIGINT. */
-static struct async_signal_handler *sigint_remote_twice_token;
-static struct async_signal_handler *sigint_remote_token;
+static struct async_signal_handler *async_sigint_remote_twice_token;
+static struct async_signal_handler *async_sigint_remote_token;
\f
/* Asynchronous signal handle registered as event loop source for
rs->augmented_libraries_svr4_read = (support == PACKET_ENABLE);
}
-static struct protocol_feature remote_protocol_features[] = {
+static const struct protocol_feature remote_protocol_features[] = {
{ "PacketSize", PACKET_DISABLE, remote_packet_size, -1 },
{ "qXfer:auxv:read", PACKET_DISABLE, remote_supported_packet,
PACKET_qXfer_auxv },
/* Set up the signal handler for SIGINT, while the target is
executing, ovewriting the 'regular' SIGINT signal handler. */
static void
-initialize_sigint_signal_handler (void)
+async_initialize_sigint_signal_handler (void)
{
- signal (SIGINT, handle_remote_sigint);
+ signal (SIGINT, async_handle_remote_sigint);
}
/* Signal handler for SIGINT, while the target is executing. */
static void
-handle_remote_sigint (int sig)
+async_handle_remote_sigint (int sig)
{
- signal (sig, handle_remote_sigint_twice);
- mark_async_signal_handler (sigint_remote_token);
+ signal (sig, async_handle_remote_sigint_twice);
+ mark_async_signal_handler (async_sigint_remote_token);
}
/* Signal handler for SIGINT, installed after SIGINT has already been
sent once. It will take effect the second time that the user sends
a ^C. */
static void
-handle_remote_sigint_twice (int sig)
+async_handle_remote_sigint_twice (int sig)
{
- signal (sig, handle_remote_sigint);
- mark_async_signal_handler (sigint_remote_twice_token);
+ signal (sig, async_handle_remote_sigint);
+ mark_async_signal_handler (async_sigint_remote_twice_token);
}
/* Perform the real interruption of the target execution, in response
/* Reinstall the usual SIGINT handlers, after the target has
stopped. */
static void
-cleanup_sigint_signal_handler (void *dummy)
+async_cleanup_sigint_signal_handler (void *dummy)
{
signal (SIGINT, handle_sigint);
}
response from the target (it didn't stop when the user requested it),
we ask the user if he'd like to detach from the target. */
static void
-remote_interrupt (int signo)
+sync_remote_interrupt (int signo)
{
/* If this doesn't work, try more severe steps. */
- signal (signo, remote_interrupt_twice);
+ signal (signo, sync_remote_interrupt_twice);
- gdb_call_async_signal_handler (sigint_remote_token, 1);
+ gdb_call_async_signal_handler (async_sigint_remote_token, 1);
}
/* The user typed ^C twice. */
static void
-remote_interrupt_twice (int signo)
+sync_remote_interrupt_twice (int signo)
{
signal (signo, ofunc);
- gdb_call_async_signal_handler (sigint_remote_twice_token, 1);
- signal (signo, remote_interrupt);
+ gdb_call_async_signal_handler (async_sigint_remote_twice_token, 1);
+ signal (signo, sync_remote_interrupt);
}
/* Non-stop version of target_stop. Uses `vCont;t' to stop a remote
if (target_can_async_p ())
{
signal (SIGINT, handle_sigint);
- deprecated_throw_reason (RETURN_QUIT);
+ quit ();
}
else
{
Give up (and stop debugging it)? ")))
{
remote_unpush_target ();
- deprecated_throw_reason (RETURN_QUIT);
+ quit ();
}
}
return;
delete_file_handler (input_fd);
remote_async_terminal_ours_p = 0;
- initialize_sigint_signal_handler ();
+ async_initialize_sigint_signal_handler ();
/* NOTE: At this point we could also register our selves as the
recipient of all input. Any characters typed could then be
passed on down to the target. */
/* See FIXME in remote_terminal_inferior. */
if (remote_async_terminal_ours_p)
return;
- cleanup_sigint_signal_handler (NULL);
+ async_cleanup_sigint_signal_handler (NULL);
add_file_handler (input_fd, stdin_event_handler, 0);
remote_async_terminal_ours_p = 1;
}
if (!target_is_async_p ())
{
- ofunc = signal (SIGINT, remote_interrupt);
+ ofunc = signal (SIGINT, sync_remote_interrupt);
/* If the user hit C-c before this packet, or between packets,
pretend that it was hit right here. */
if (check_quit_flag ())
{
clear_quit_flag ();
- remote_interrupt (SIGINT);
+ sync_remote_interrupt (SIGINT);
}
}
_("remote_remove_hw_breakpoint: reached end of function"));
}
-/* Table used by the crc32 function to calcuate the checksum. */
-
-static unsigned long crc32_table[256] =
-{0, 0};
-
-static unsigned long
-crc32 (const unsigned char *buf, int len, unsigned int crc)
-{
- if (!crc32_table[1])
- {
- /* Initialize the CRC table and the decoding table. */
- int i, j;
- unsigned int c;
-
- for (i = 0; i < 256; i++)
- {
- for (c = i << 24, j = 8; j > 0; --j)
- c = c & 0x80000000 ? (c << 1) ^ 0x04c11db7 : (c << 1);
- crc32_table[i] = c;
- }
- }
-
- while (len--)
- {
- crc = (crc << 8) ^ crc32_table[((crc >> 24) ^ *buf) & 255];
- buf++;
- }
- return crc;
-}
-
/* Verify memory using the "qCRC:" request. */
static int
/* Be clever; compute the host_crc before waiting for target
reply. */
- host_crc = crc32 (data, size, 0xffffffff);
+ host_crc = xcrc32 (data, size, 0xffffffff);
getpkt (&rs->buf, &rs->buf_size, 0);
if (rs->buf[0] == 'E')
observer_attach_inferior_exit (discard_pending_stop_replies);
/* Set up signal handlers. */
- sigint_remote_token =
+ async_sigint_remote_token =
create_async_signal_handler (async_remote_interrupt, NULL);
- sigint_remote_twice_token =
+ async_sigint_remote_twice_token =
create_async_signal_handler (async_remote_interrupt_twice, NULL);
#if 0