aboutsummaryrefslogtreecommitdiff
path: root/gdb/remote.c
diff options
context:
space:
mode:
authorYao Qi <yao@codesourcery.com>2012-03-03 03:32:46 +0000
committerYao Qi <yao@codesourcery.com>2012-03-03 03:32:46 +0000
commitd1feda864e0b17c5757197ba1b421e25dac6afd1 (patch)
tree6756fdf97eb2d1aeabf2bbf05fa495960c04f061 /gdb/remote.c
parent2fa291aca43cb851ba4e108cb64c7844a257df4f (diff)
downloadgdb-d1feda864e0b17c5757197ba1b421e25dac6afd1.zip
gdb-d1feda864e0b17c5757197ba1b421e25dac6afd1.tar.gz
gdb-d1feda864e0b17c5757197ba1b421e25dac6afd1.tar.bz2
gdb:
* target.h (struct target_ops) <to_use_agent>: New field. (struct target_ops) <to_can_use_agent>: New field. (target_use_agent, target_can_use_agent): New macro. * target.c (update_current_target): Update. * remote.c: New enum `PACKET_QAgent'. (remote_protocol_features): Add a new element. (remote_use_agent, remote_can_use_agent): New. (init_remote_ops): Initialize field `can_use_agent' with remote_can_use_agent. Intiailize field `use_agent' with remote_use_agent. * common/agent.c (use_agent): New global. * common/agent.h: Declare it. * tracepoint.c (info_static_tracepoint_markers_command): Add comment. * Makefile.in (SFILES): Add common/agent.c and agent.c. (COMMON_OBS): Add common/agent.o and agent.o (common-agent.o): New rule. * agent.c: New. gdb/doc: * gdb.texinfo (In-Process Agent): New node. Document new commands. (General Query Packets): Add packet `QAgent'. gdb/gdbserver: * linux-low.c (linux_supports_agent): New. (linux_target_ops): Initialize field `supports_agent' with linux_supports_agent. * target.h (struct target_ops) <supports_agent>: New. (target_supports_agent): New macro. * server.c (handle_general_set): Handle packet 'QAgent'. (handle_query): Send `QAgent+'. * Makefile.in (server.o): Depends on agent.h.
Diffstat (limited to 'gdb/remote.c')
-rw-r--r--gdb/remote.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/gdb/remote.c b/gdb/remote.c
index 09bf18e..8eb975f 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -65,6 +65,7 @@
#include "tracepoint.h"
#include "ax.h"
#include "ax-gdb.h"
+#include "agent.h"
/* Temp hacks for tracepoint encoding migration. */
static char *target_buf;
@@ -1276,6 +1277,7 @@ enum {
PACKET_QAllow,
PACKET_qXfer_fdpic,
PACKET_QDisableRandomization,
+ PACKET_QAgent,
PACKET_MAX
};
@@ -3848,6 +3850,7 @@ static struct protocol_feature remote_protocol_features[] = {
PACKET_qXfer_fdpic },
{ "QDisableRandomization", PACKET_DISABLE, remote_supported_packet,
PACKET_QDisableRandomization },
+ { "QAgent", PACKET_DISABLE, remote_supported_packet, PACKET_QAgent},
{ "tracenz", PACKET_DISABLE,
remote_string_tracing_feature, -1 },
};
@@ -10757,6 +10760,34 @@ remote_set_trace_notes (char *user, char *notes, char *stop_notes)
return 1;
}
+static int
+remote_use_agent (int use)
+{
+ if (remote_protocol_packets[PACKET_QAgent].support != PACKET_DISABLE)
+ {
+ struct remote_state *rs = get_remote_state ();
+
+ /* If the stub supports QAgent. */
+ sprintf (rs->buf, "QAgent:%d", use);
+ putpkt (rs->buf);
+ getpkt (&rs->buf, &rs->buf_size, 0);
+
+ if (strcmp (rs->buf, "OK") == 0)
+ {
+ use_agent = use;
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+static int
+remote_can_use_agent (void)
+{
+ return (remote_protocol_packets[PACKET_QAgent].support != PACKET_DISABLE);
+}
+
static void
init_remote_ops (void)
{
@@ -10869,6 +10900,8 @@ Specify the serial device it is connected to\n\
remote_ops.to_static_tracepoint_markers_by_strid
= remote_static_tracepoint_markers_by_strid;
remote_ops.to_traceframe_info = remote_traceframe_info;
+ remote_ops.to_use_agent = remote_use_agent;
+ remote_ops.to_can_use_agent = remote_can_use_agent;
}
/* Set up the extended remote vector by making a copy of the standard
@@ -11382,6 +11415,9 @@ Show the maximum size of the address (in bits) in a memory packet."), NULL,
add_packet_config_cmd (&remote_protocol_packets[PACKET_QDisableRandomization],
"QDisableRandomization", "disable-randomization", 0);
+ add_packet_config_cmd (&remote_protocol_packets[PACKET_QAgent],
+ "QAgent", "agent", 0);
+
/* Keep the old ``set remote Z-packet ...'' working. Each individual
Z sub-packet has its own set and show commands, but users may
have sets to this variable in their .gdbinit files (or in their