aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHui Zhu <teawater@gmail.com>2011-08-24 09:24:10 +0000
committerHui Zhu <teawater@gmail.com>2011-08-24 09:24:10 +0000
commit4e5c165d88b502d950879d87abadb8e8ac51aab1 (patch)
treed8fc43f707906cd9f2455177b5b2b274eb234489
parent20e757674f4f5d0c16912049d081d61a02346eac (diff)
downloadfsf-binutils-gdb-4e5c165d88b502d950879d87abadb8e8ac51aab1.zip
fsf-binutils-gdb-4e5c165d88b502d950879d87abadb8e8ac51aab1.tar.gz
fsf-binutils-gdb-4e5c165d88b502d950879d87abadb8e8ac51aab1.tar.bz2
2011-08-24 Hui Zhu <teawater@gmail.com>
* tracepoint.c (cond_string_is_same): New function. (find_matching_tracepoint): Add condition check by cond_string_is_same.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/tracepoint.c16
2 files changed, 21 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index eb7b516..5101954 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2011-08-24 Hui Zhu <teawater@gmail.com>
+
+ * tracepoint.c (cond_string_is_same): New function.
+ (find_matching_tracepoint): Add condition check
+ by cond_string_is_same.
+
2011-08-23 Josh Matthews <josh@joshmatthews.net>
Fix build error in Darwin port.
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 351cbb2..fc9a17a 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -3091,6 +3091,19 @@ free_uploaded_tsvs (struct uploaded_tsv **utsvp)
}
}
+/* FIXME this function is heuristic and will miss the cases where the
+ conditional is semantically identical but differs in whitespace,
+ such as "x == 0" vs "x==0". */
+
+static int
+cond_string_is_same (char *str1, char *str2)
+{
+ if (str1 == NULL || str2 == NULL)
+ return (str1 == str2);
+
+ return (strcmp (str1, str2) == 0);
+}
+
/* Look for an existing tracepoint that seems similar enough to the
uploaded one. Enablement isn't compared, because the user can
toggle that freely, and may have done so in anticipation of the
@@ -3111,7 +3124,8 @@ find_matching_tracepoint (struct uploaded_tp *utp)
if (b->type == utp->type
&& t->step_count == utp->step
&& t->pass_count == utp->pass
- /* FIXME also test conditionals and actions. */
+ && cond_string_is_same (t->base.cond_string, utp->cond_string)
+ /* FIXME also test actions. */
)
{
/* Scan the locations for an address match. */