aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2021-01-13 01:22:05 -0500
committerMike Frysinger <vapier@gentoo.org>2021-01-13 05:52:51 -0500
commitc54f3efdc2f85554a1604c68d5e9d0f55edfd330 (patch)
treebca6fe89d5844c5d898209359c9fa7a48eab56fd
parent62fe7512a78962a9eda0db7fde0c8a76cf535714 (diff)
downloadgdb-c54f3efdc2f85554a1604c68d5e9d0f55edfd330.zip
gdb-c54f3efdc2f85554a1604c68d5e9d0f55edfd330.tar.gz
gdb-c54f3efdc2f85554a1604c68d5e9d0f55edfd330.tar.bz2
sim: watch: fix range expression processing
The code supports a <start>[,<end>] syntax, but the logic for handling the <end> check was broken: it would detect the first byte was ",", but then include that in the strtoul call meaning the result is always 0. Further, it (re)assigned to arg0 when it meant arg1 which means this code always processed a range expression as 0,0. Oops.
-rw-r--r--sim/common/ChangeLog4
-rw-r--r--sim/common/sim-watch.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 539bab6..76d86ea 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,5 +1,9 @@
2021-01-13 Mike Frysinger <vapier@gentoo.org>
+ * sim-watch.c (do_watchpoint_create): Parse arg+1 and assign to arg1.
+
+2021-01-13 Mike Frysinger <vapier@gentoo.org>
+
* sim-events.c (sim_events_watch_sim): Change byte_order type to
enum bfd_endian.
(sim_events_watch_core): Likewise.
diff --git a/sim/common/sim-watch.c b/sim/common/sim-watch.c
index d69d42c..29ac982 100644
--- a/sim/common/sim-watch.c
+++ b/sim/common/sim-watch.c
@@ -255,7 +255,7 @@ do_watchpoint_create (SIM_DESC sd,
(*point)->arg0 = strtoul (arg, &arg, 0);
if (arg[0] == ',')
- (*point)->arg0 = strtoul (arg, NULL, 0);
+ (*point)->arg1 = strtoul (arg + 1, NULL, 0);
else
(*point)->arg1 = (*point)->arg0;