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.
This commit is contained in:
Mike Frysinger 2021-01-13 01:22:05 -05:00
parent 62fe7512a7
commit c54f3efdc2
2 changed files with 5 additions and 1 deletions

View 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

View 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;