static long read_frame (char *buf, long sizeof_buf);
-static int remote_insert_breakpoint (CORE_ADDR, char *);
+static int remote_insert_breakpoint (CORE_ADDR, bfd_byte *);
-static int remote_remove_breakpoint (CORE_ADDR, char *);
+static int remote_remove_breakpoint (CORE_ADDR, bfd_byte *);
static int hexnumlen (ULONGEST num);
int regnum;
struct remote_state *rs = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct remote_state);
- if (deprecated_register_bytes () != 0)
- rs->sizeof_g_packet = deprecated_register_bytes ();
- else
- rs->sizeof_g_packet = 0;
+ rs->sizeof_g_packet = 0;
/* Assume a 1:1 regnum<->pnum table. */
rs->regs = GDBARCH_OBSTACK_CALLOC (gdbarch, NUM_REGS + NUM_PSEUDO_REGS,
/* ...name = REGISTER_NAME (regnum); */
/* Compute packet size by accumulating the size of all registers. */
- if (deprecated_register_bytes () == 0)
- rs->sizeof_g_packet += register_size (current_gdbarch, regnum);
+ if (regnum < NUM_REGS)
+ rs->sizeof_g_packet += register_size (current_gdbarch, regnum);
}
/* Default maximum number of characters in a packet body. Many
show_packet_config_cmd (&remote_protocol_qPart_auxv);
}
+/* Should we try the 'qGetTLSAddr' (Get Thread Local Storage Address) request? */
+static struct packet_config remote_protocol_qGetTLSAddr;
+
+static void
+set_remote_protocol_qGetTLSAddr_packet_cmd (char *args, int from_tty,
+ struct cmd_list_element *c)
+{
+ update_packet_config (&remote_protocol_qGetTLSAddr);
+}
+
+static void
+show_remote_protocol_qGetTLSAddr_packet_cmd (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c,
+ const char *value)
+{
+ show_packet_config_cmd (&remote_protocol_qGetTLSAddr);
+}
+
static struct packet_config remote_protocol_p;
static void
downloading. */
update_packet_config (&remote_protocol_binary_download);
update_packet_config (&remote_protocol_qPart_auxv);
+ update_packet_config (&remote_protocol_qGetTLSAddr);
}
/* Symbol look-up. */
remote_open_1 (char *name, int from_tty, struct target_ops *target,
int extended_p, int async_p)
{
- struct exception ex;
struct remote_state *rs = get_remote_state ();
if (name == 0)
error (_("To open a remote debug connection, you need to specify what\n"
been fixed - the function set_cmd_context() makes it possible for
all the ``target ....'' commands to share a common callback
function. See cli-dump.c. */
- ex = catch_exception (uiout, remote_start_remote, NULL, RETURN_MASK_ALL);
- if (ex.reason < 0)
- {
- pop_target ();
- if (async_p)
- wait_forever_enabled_p = 1;
- throw_exception (ex);
- }
+ {
+ struct gdb_exception ex
+ = catch_exception (uiout, remote_start_remote, NULL, RETURN_MASK_ALL);
+ if (ex.reason < 0)
+ {
+ pop_target ();
+ if (async_p)
+ wait_forever_enabled_p = 1;
+ throw_exception (ex);
+ }
+ }
if (async_p)
wait_forever_enabled_p = 1;
static void
remote_disconnect (char *args, int from_tty)
{
- struct remote_state *rs = get_remote_state ();
- char *buf = alloca (rs->remote_packet_size);
-
if (args)
error (_("Argument given to \"detach\" when remotely debugging."));
struct remote_state *rs = get_remote_state ();
char *buf = alloca (rs->remote_packet_size);
int pid = PIDGET (ptid);
- char *p;
last_sent_signal = siggnal;
last_sent_step = step;
continue;
case 'T': /* Status with PC, SP, FP, ... */
{
- int i;
char regs[MAX_REGISTER_SIZE];
/* Expedited reply, containing Signal, {regno, reg} repeat. */
continue;
case 'T': /* Status with PC, SP, FP, ... */
{
- int i;
char regs[MAX_REGISTER_SIZE];
/* Expedited reply, containing Signal, {regno, reg} repeat. */
char *buf = alloca (rs->remote_packet_size);
char regp[MAX_REGISTER_SIZE];
char *p;
- int i;
sprintf (buf, "P%s=", phex_nz (reg->pnum, 0));
p = buf + strlen (buf);
struct remote_state *rs = get_remote_state ();
char *buf;
char *regs;
- int i;
char *p;
set_thread (PIDGET (inferior_ptid), 1);
of bytes returned by BREAKPOINT_FROM_PC. */
static int
-remote_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
+remote_insert_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
{
struct remote_state *rs = get_remote_state ();
#ifdef DEPRECATED_REMOTE_BREAKPOINT
}
static int
-remote_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
+remote_remove_breakpoint (CORE_ADDR addr, bfd_byte *contents_cache)
{
struct remote_state *rs = get_remote_state ();
int bp_size;
struct ui_file *outbuf)
{
struct remote_state *rs = get_remote_state ();
- int i;
char *buf = alloca (rs->remote_packet_size);
char *p = buf;
return buf;
}
+/* Get the address of the thread local variable in OBJFILE which is
+ stored at OFFSET within the thread local storage for thread PTID. */
+
+static CORE_ADDR
+remote_get_thread_local_address (ptid_t ptid, CORE_ADDR lm, CORE_ADDR offset)
+{
+ if (remote_protocol_qGetTLSAddr.support != PACKET_DISABLE)
+ {
+ struct remote_state *rs = get_remote_state ();
+ char *buf = alloca (rs->remote_packet_size);
+ char *p = buf;
+ enum packet_result result;
+
+ strcpy (p, "qGetTLSAddr:");
+ p += strlen (p);
+ p += hexnumstr (p, PIDGET (ptid));
+ *p++ = ',';
+ p += hexnumstr (p, offset);
+ *p++ = ',';
+ p += hexnumstr (p, lm);
+ *p++ = '\0';
+
+ putpkt (buf);
+ getpkt (buf, rs->remote_packet_size, 0);
+ result = packet_ok (buf, &remote_protocol_qGetTLSAddr);
+ if (result == PACKET_OK)
+ {
+ ULONGEST result;
+
+ unpack_varlen_hex (buf, &result);
+ return result;
+ }
+ else if (result == PACKET_UNKNOWN)
+ throw_error (TLS_GENERIC_ERROR,
+ _("Remote target doesn't support qGetTLSAddr packet"));
+ else
+ throw_error (TLS_GENERIC_ERROR,
+ _("Remote target failed to process qGetTLSAddr request"));
+ }
+ else
+ throw_error (TLS_GENERIC_ERROR,
+ _("TLS not supported or disabled on this target"));
+ /* Not reached. */
+ return 0;
+}
+
static void
init_remote_ops (void)
{
remote_ops.to_stop = remote_stop;
remote_ops.to_xfer_partial = remote_xfer_partial;
remote_ops.to_rcmd = remote_rcmd;
+ remote_ops.to_get_thread_local_address = remote_get_thread_local_address;
remote_ops.to_stratum = process_stratum;
remote_ops.to_has_all_memory = 1;
remote_ops.to_has_memory = 1;
show_remote_protocol_vcont_packet_cmd (gdb_stdout, from_tty, NULL, NULL);
show_remote_protocol_binary_download_cmd (gdb_stdout, from_tty, NULL, NULL);
show_remote_protocol_qPart_auxv_packet_cmd (gdb_stdout, from_tty, NULL, NULL);
+ show_remote_protocol_qGetTLSAddr_packet_cmd (gdb_stdout, from_tty, NULL, NULL);
}
static void
{
static struct cmd_list_element *remote_set_cmdlist;
static struct cmd_list_element *remote_show_cmdlist;
- struct cmd_list_element *tmpcmd;
/* architecture specific data */
remote_gdbarch_data_handle =
&remote_set_cmdlist, &remote_show_cmdlist,
0);
+ add_packet_config_cmd (&remote_protocol_qGetTLSAddr,
+ "qGetTLSAddr", "get-thread-local-storage-address",
+ set_remote_protocol_qGetTLSAddr_packet_cmd,
+ show_remote_protocol_qGetTLSAddr_packet_cmd,
+ &remote_set_cmdlist, &remote_show_cmdlist,
+ 0);
+
/* Keep the old ``set remote Z-packet ...'' working. */
add_setshow_auto_boolean_cmd ("Z-packet", class_obscure,
&remote_Z_packet_detect, _("\