#include "common/selftest.h"
+#define require_running_or_return(BUF) \
+ if (!target_running ()) \
+ { \
+ write_enn (BUF); \
+ return; \
+ }
+
+#define require_running_or_break(BUF) \
+ if (!target_running ()) \
+ { \
+ write_enn (BUF); \
+ break; \
+ }
+
/* The environment to pass to the inferior when creating it. */
static gdb_environ our_environ;
free (pattern);
}
-#define require_running(BUF) \
- if (!target_running ()) \
- { \
- write_enn (BUF); \
- return; \
- }
-
/* Parse options to --debug-format= and "monitor set debug-format".
ARG is the text after "--debug-format=" or "monitor set debug-format".
IS_MONITOR is non-zero if we're invoked via "monitor set debug-format".
if (strcmp ("qC", own_buf) == 0 && !disable_packet_qC)
{
ptid_t gdb_id;
- require_running (own_buf);
+ require_running_or_return (own_buf);
if (!ptid_equal (general_thread, null_ptid)
&& !ptid_equal (general_thread, minus_one_ptid))
{
ptid_t gdb_id;
- require_running (own_buf);
+ require_running_or_return (own_buf);
thread_ptr = get_first_inferior (&all_threads);
*own_buf++ = 'm';
{
ptid_t gdb_id;
- require_running (own_buf);
+ require_running_or_return (own_buf);
if (thread_ptr != NULL)
{
*own_buf++ = 'm';
{
CORE_ADDR text, data;
- require_running (own_buf);
+ require_running_or_return (own_buf);
if (the_target->read_offsets (&text, &data))
sprintf (own_buf, "Text=%lX;Data=%lX;Bss=%lX",
(long)text, (long)data, (long)data);
int i, err;
ptid_t ptid = null_ptid;
- require_running (own_buf);
+ require_running_or_return (own_buf);
for (i = 0; i < 3; i++)
{
if (startswith (own_buf, "qSearch:memory:"))
{
- require_running (own_buf);
+ require_running_or_return (own_buf);
handle_search_memory (own_buf, packet_len);
return;
}
}
else
{
- require_running (own_buf);
+ require_running_or_return (own_buf);
process = current_process ();
}
int len;
unsigned long long crc;
- require_running (own_buf);
+ require_running_or_return (own_buf);
comma = unpack_varlen_hex (own_buf + 5, &base);
if (*comma++ != ',')
{
" threads \tAll of the above\n");
}
-
-#undef require_running
-#define require_running(BUF) \
- if (!target_running ()) \
- { \
- write_enn (BUF); \
- break; \
- }
-
static void
kill_inferior_callback (struct inferior_list_entry *entry)
{
handle_general_set (own_buf);
break;
case 'D':
- require_running (own_buf);
+ require_running_or_break (own_buf);
if (multi_process)
{
ptid_t gdb_id, thread_id;
int pid;
- require_running (own_buf);
+ require_running_or_break (own_buf);
gdb_id = read_ptid (&own_buf[2], NULL);
}
break;
case 'g':
- require_running (own_buf);
+ require_running_or_break (own_buf);
if (current_traceframe >= 0)
{
struct regcache *regcache
}
break;
case 'G':
- require_running (own_buf);
+ require_running_or_break (own_buf);
if (current_traceframe >= 0)
write_enn (own_buf);
else
}
break;
case 'm':
- require_running (own_buf);
+ require_running_or_break (own_buf);
decode_m_packet (&own_buf[1], &mem_addr, &len);
res = gdb_read_memory (mem_addr, mem_buf, len);
if (res < 0)
bin2hex (mem_buf, own_buf, res);
break;
case 'M':
- require_running (own_buf);
+ require_running_or_break (own_buf);
decode_M_packet (&own_buf[1], &mem_addr, &len, &mem_buf);
if (gdb_write_memory (mem_addr, mem_buf, len) == 0)
write_ok (own_buf);
write_enn (own_buf);
break;
case 'X':
- require_running (own_buf);
+ require_running_or_break (own_buf);
if (decode_X_packet (&own_buf[1], packet_len - 1,
&mem_addr, &len, &mem_buf) < 0
|| gdb_write_memory (mem_addr, mem_buf, len) != 0)
write_ok (own_buf);
break;
case 'C':
- require_running (own_buf);
+ require_running_or_break (own_buf);
hex2bin (own_buf + 1, &sig, 1);
if (gdb_signal_to_host_p ((enum gdb_signal) sig))
signal = gdb_signal_to_host ((enum gdb_signal) sig);
myresume (own_buf, 0, signal);
break;
case 'S':
- require_running (own_buf);
+ require_running_or_break (own_buf);
hex2bin (own_buf + 1, &sig, 1);
if (gdb_signal_to_host_p ((enum gdb_signal) sig))
signal = gdb_signal_to_host ((enum gdb_signal) sig);
myresume (own_buf, 1, signal);
break;
case 'c':
- require_running (own_buf);
+ require_running_or_break (own_buf);
signal = 0;
myresume (own_buf, 0, signal);
break;
case 's':
- require_running (own_buf);
+ require_running_or_break (own_buf);
signal = 0;
myresume (own_buf, 1, signal);
break;
{
ptid_t gdb_id, thread_id;
- require_running (own_buf);
+ require_running_or_break (own_buf);
gdb_id = read_ptid (&own_buf[1], NULL);
thread_id = gdb_id_to_thread_id (gdb_id);