summaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-04-18 16:53:07 -0600
committerTom Tromey <tom@tromey.com>2018-05-04 15:58:08 -0600
commit60b3cef2e49ba72dea55181a8ad0cb8dbf3f8a5b (patch)
tree1fecc6fa000b666ff29bd42d66d80ff1901db6e5 /gdb/breakpoint.c
parent7a2c85f25977ff9b11728ba85b1417538e22c246 (diff)
downloadbinutils-gdb-60b3cef2e49ba72dea55181a8ad0cb8dbf3f8a5b.tar.gz
Use function_view in cli-script.c
This changes some functions in cli-script.c to use function_view rather than a function pointer and closure argument. This simplifies the code a bit and is useful in a subsequent patch. ChangeLog 2018-05-04 Tom Tromey <tom@tromey.com> * tracepoint.c (actions_command): Update. * mi/mi-cmd-break.c (mi_command_line_array) (mi_command_line_array_cnt, mi_command_line_array_ptr) (mi_read_next_line): Remove. (mi_cmd_break_commands): Update. * cli/cli-script.h (read_command_lines, read_command_lines_1): Use function_view. * cli/cli-script.c (get_command_line): Update. (process_next_line): Use function_view. Constify. (recurse_read_control_structure, read_command_lines) (read_command_lines_1): Change argument types to function_view. (do_define_command, document_command): Update. * breakpoint.h (check_tracepoint_command): Don't declare. * breakpoint.c (check_tracepoint_command): Remove. (commands_command_1, create_tracepoint_from_upload): Update.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r--gdb/breakpoint.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 72a3e1608de..d1955ec0538 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -1216,14 +1216,6 @@ breakpoint_set_task (struct breakpoint *b, int task)
gdb::observers::breakpoint_modified.notify (b);
}
-void
-check_tracepoint_command (char *line, void *closure)
-{
- struct breakpoint *b = (struct breakpoint *) closure;
-
- validate_actionline (line, b);
-}
-
static void
commands_command_1 (const char *arg, int from_tty,
struct command_line *control)
@@ -1256,10 +1248,15 @@ commands_command_1 (const char *arg, int from_tty,
"%s, one per line."),
arg);
- cmd = read_command_lines (str.c_str (), from_tty, 1,
- (is_tracepoint (b)
- ? check_tracepoint_command : 0),
- b);
+ auto do_validate = [=] (const char *line)
+ {
+ validate_actionline (line, b);
+ };
+ gdb::function_view<void (const char *)> validator;
+ if (is_tracepoint (b))
+ validator = do_validate;
+
+ cmd = read_command_lines (str.c_str (), from_tty, 1, validator);
}
}
@@ -14783,7 +14780,7 @@ create_tracepoint_from_upload (struct uploaded_tp *utp)
this_utp = utp;
next_cmd = 0;
- cmd_list = read_command_lines_1 (read_uploaded_action, 1, NULL, NULL);
+ cmd_list = read_command_lines_1 (read_uploaded_action, 1, NULL);
breakpoint_set_commands (tp, std::move (cmd_list));
}