]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
sim: watch: fix range expression processing
authorMike Frysinger <vapier@gentoo.org>
Wed, 13 Jan 2021 06:22:05 +0000 (01:22 -0500)
committerMike Frysinger <vapier@gentoo.org>
Wed, 13 Jan 2021 10:52:51 +0000 (05:52 -0500)
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.

sim/common/ChangeLog
sim/common/sim-watch.c

index 539bab687d46ad58c283d52bdbaff5d2c8814e22..76d86ea55ef832b409ffe2e052fac49b0f5ecba1 100644 (file)
@@ -1,3 +1,7 @@
+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
index d69d42cb9540bbb45ef26282cd58bedf08e9f57f..29ac982b0d2a5a081a06dd39871957b731ba92f8 100644 (file)
@@ -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;