- { {"watch-delete", required_argument, NULL, OPTION_WATCH_DELETE },
- '\0', "all|pc|cycles|clock", "Delete a watchpoint",
- watch_option_handler },
- { {"delete-watch", required_argument, NULL, OPTION_WATCH_DELETE },
- '\0', "all|pc|cycles|clock", NULL,
- watch_option_handler },
-
- { {"watch-pc", required_argument, NULL, OPTION_WATCH_PC },
- '\0', "[!] VALUE", "Watch the PC (break)",
- watch_option_handler },
- { {"watch-clock", required_argument, NULL, OPTION_WATCH_CLOCK },
- '\0', "TIME-IN-MS", "Watch the clock (break)",
- watch_option_handler },
- { {"watch-cycles", required_argument, NULL, OPTION_WATCH_CYCLES },
- '\0', "CYCLES", "Watch the cycles (break)",
- watch_option_handler },
-
- { {"action-pc", required_argument, NULL, OPTION_ACTION_PC },
- '\0', "break|int|+int", "Action taken by PC watchpoint",
- watch_option_handler },
- { {"action-clock", required_argument, NULL, OPTION_ACTION_CLOCK },
- '\0', "break|int|+int", "Action taken by CLOCK watchpoint",
- watch_option_handler },
- { {"action-cycles", required_argument, NULL, OPTION_ACTION_CYCLES },
- '\0', "break|int|+int", "Action taken by CYCLES watchpoint",
- watch_option_handler },
+ sim_watchpoints *watch = STATE_WATCHPOINTS (sd);
+ sim_watch_point **point;
+
+ /* create the watchpoint */
+ point = &watch->points;
+ while ((*point) != NULL)
+ point = &(*point)->next;
+ (*point) = ZALLOC (sim_watch_point);
+
+ /* fill in the details */
+ (*point)->ident = ++(watch->last_point_nr);
+ (*point)->type = option_to_type (sd, opt);
+ (*point)->interrupt_nr = option_to_interrupt_nr (sd, opt);
+ /* prefixes to arg - +== periodic, !==not or outside */
+ (*point)->is_within = 1;
+ while (1)
+ {
+ if (arg[0] == '+')
+ (*point)->is_periodic = 1;
+ else if (arg[0] == '!')
+ (*point)->is_within = 0;
+ else
+ break;
+ arg++;
+ }
+
+ (*point)->arg0 = strtoul (arg, &arg, 0);
+ if (arg[0] == ',')
+ (*point)->arg0 = strtoul (arg, NULL, 0);
+ else
+ (*point)->arg1 = (*point)->arg0;