aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorYao Qi <yao@codesourcery.com>2012-03-15 12:57:13 +0000
committerYao Qi <yao@codesourcery.com>2012-03-15 12:57:13 +0000
commitfc3e51758a16508acb99feaafd0b63487487bd4f (patch)
treefcf9f6509e4ea69addbc95560b540d31b864a627 /gdb
parent27dcf5c00e23e1a3caa73e41a21127581ea3d93b (diff)
downloadgdb-fc3e51758a16508acb99feaafd0b63487487bd4f.zip
gdb-fc3e51758a16508acb99feaafd0b63487487bd4f.tar.gz
gdb-fc3e51758a16508acb99feaafd0b63487487bd4f.tar.bz2
gdb/gdbserver/
* tracepoint.c (install_tracepoint): Move duplicated tracepoint handling to ... (cmd_qtdp): ... here.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/gdbserver/ChangeLog6
-rw-r--r--gdb/gdbserver/tracepoint.c61
2 files changed, 42 insertions, 25 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 44eb39f..61607a6 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,5 +1,11 @@
2012-03-15 Yao Qi <yao@codesourcery.com>
+ * tracepoint.c (install_tracepoint): Move duplicated tracepoint
+ handling to ...
+ (cmd_qtdp): ... here.
+
+2012-03-15 Yao Qi <yao@codesourcery.com>
+
* tracepoint.c (struct tracepoint_action_ops): New.
(struct tracepoint_action) [!IN_PROCESS_AGENT] <ops>: New field.
(m_tracepoint_action_download): New.
diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index 2cce811..33173c6 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -1313,6 +1313,8 @@ static struct tracepoint *fast_tracepoint_from_ipa_tpoint_address (CORE_ADDR);
static void install_tracepoint (struct tracepoint *, char *own_buf);
static void download_tracepoint (struct tracepoint *);
static int install_fast_tracepoint (struct tracepoint *, char *errbuf);
+static void clone_fast_tracepoint (struct tracepoint *to,
+ const struct tracepoint *from);
#endif
static LONGEST get_timestamp (void);
@@ -2502,6 +2504,8 @@ cmd_qtdp (char *own_buf)
trailing hyphen in QTDP packet. */
if (tracing && !trail_hyphen)
{
+ struct tracepoint *tp = NULL;
+
/* Pause all threads temporarily while we patch tracepoints. */
pause_all (0);
@@ -2512,10 +2516,37 @@ cmd_qtdp (char *own_buf)
/* Freeze threads. */
pause_all (1);
+
+ if (tpoint->type != trap_tracepoint)
+ {
+ /* Find another fast or static tracepoint at the same address. */
+ for (tp = tracepoints; tp; tp = tp->next)
+ {
+ if (tp->address == tpoint->address && tp->type == tpoint->type
+ && tp->number != tpoint->number)
+ break;
+ }
+
+ /* TPOINT is installed at the same address as TP. */
+ if (tp)
+ {
+ if (tpoint->type == fast_tracepoint)
+ clone_fast_tracepoint (tpoint, tp);
+ else if (tpoint->type == static_tracepoint)
+ tpoint->handle = (void *) -1;
+ }
+ }
+
download_tracepoint (tpoint);
- install_tracepoint (tpoint, own_buf);
- if (strcmp (own_buf, "OK") != 0)
- remove_tracepoint (tpoint);
+
+ if (tpoint->type == trap_tracepoint || tp == NULL)
+ {
+ install_tracepoint (tpoint, own_buf);
+ if (strcmp (own_buf, "OK") != 0)
+ remove_tracepoint (tpoint);
+ }
+ else
+ write_ok (own_buf);
unpause_all (1);
return;
@@ -3019,8 +3050,6 @@ install_tracepoint (struct tracepoint *tpoint, char *own_buf)
}
else if (tpoint->type == fast_tracepoint || tpoint->type == static_tracepoint)
{
- struct tracepoint *tp;
-
if (!agent_loaded_p ())
{
trace_debug ("Requested a %s tracepoint, but fast "
@@ -3038,30 +3067,12 @@ install_tracepoint (struct tracepoint *tpoint, char *own_buf)
return;
}
- /* Find another fast or static tracepoint at the same address. */
- for (tp = tracepoints; tp; tp = tp->next)
- {
- if (tp->address == tpoint->address && tp->type == tpoint->type
- && tp->number != tpoint->number)
- break;
- }
-
if (tpoint->type == fast_tracepoint)
- {
- if (tp) /* TPOINT is installed at the same address as TP. */
- clone_fast_tracepoint (tpoint, tp);
- else
- install_fast_tracepoint (tpoint, own_buf);
- }
+ install_fast_tracepoint (tpoint, own_buf);
else
{
- if (tp)
+ if (probe_marker_at (tpoint->address, own_buf) == 0)
tpoint->handle = (void *) -1;
- else
- {
- if (probe_marker_at (tpoint->address, own_buf) == 0)
- tpoint->handle = (void *) -1;
- }
}
}