mi-cmd-break.c revision 1.10 1 1.1 christos /* MI Command Set - breakpoint and watchpoint commands.
2 1.10 christos Copyright (C) 2000-2023 Free Software Foundation, Inc.
3 1.1 christos Contributed by Cygnus Solutions (a Red Hat company).
4 1.1 christos
5 1.1 christos This file is part of GDB.
6 1.1 christos
7 1.1 christos This program is free software; you can redistribute it and/or modify
8 1.1 christos it under the terms of the GNU General Public License as published by
9 1.1 christos the Free Software Foundation; either version 3 of the License, or
10 1.1 christos (at your option) any later version.
11 1.1 christos
12 1.1 christos This program is distributed in the hope that it will be useful,
13 1.1 christos but WITHOUT ANY WARRANTY; without even the implied warranty of
14 1.1 christos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 1.1 christos GNU General Public License for more details.
16 1.1 christos
17 1.1 christos You should have received a copy of the GNU General Public License
18 1.1 christos along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 1.1 christos
20 1.1 christos #include "defs.h"
21 1.1 christos #include "arch-utils.h"
22 1.1 christos #include "mi-cmds.h"
23 1.1 christos #include "ui-out.h"
24 1.1 christos #include "mi-out.h"
25 1.1 christos #include "breakpoint.h"
26 1.1 christos #include "mi-getopt.h"
27 1.8 christos #include "observable.h"
28 1.1 christos #include "mi-main.h"
29 1.1 christos #include "mi-cmd-break.h"
30 1.6 christos #include "language.h"
31 1.6 christos #include "location.h"
32 1.6 christos #include "linespec.h"
33 1.10 christos #include "gdbsupport/gdb_obstack.h"
34 1.1 christos #include <ctype.h>
35 1.8 christos #include "tracepoint.h"
36 1.1 christos
37 1.1 christos enum
38 1.1 christos {
39 1.1 christos FROM_TTY = 0
40 1.1 christos };
41 1.1 christos
42 1.1 christos /* True if MI breakpoint observers have been registered. */
43 1.1 christos
44 1.1 christos static int mi_breakpoint_observers_installed;
45 1.1 christos
46 1.1 christos /* Control whether breakpoint_notify may act. */
47 1.1 christos
48 1.1 christos static int mi_can_breakpoint_notify;
49 1.1 christos
50 1.1 christos /* Output a single breakpoint, when allowed. */
51 1.1 christos
52 1.1 christos static void
53 1.1 christos breakpoint_notify (struct breakpoint *b)
54 1.1 christos {
55 1.1 christos if (mi_can_breakpoint_notify)
56 1.8 christos {
57 1.9 christos try
58 1.8 christos {
59 1.8 christos print_breakpoint (b);
60 1.8 christos }
61 1.9 christos catch (const gdb_exception &ex)
62 1.8 christos {
63 1.8 christos exception_print (gdb_stderr, ex);
64 1.8 christos }
65 1.8 christos }
66 1.1 christos }
67 1.1 christos
68 1.1 christos enum bp_type
69 1.1 christos {
70 1.1 christos REG_BP,
71 1.1 christos HW_BP,
72 1.1 christos REGEXP_BP
73 1.1 christos };
74 1.1 christos
75 1.1 christos /* Arrange for all new breakpoints and catchpoints to be reported to
76 1.8 christos CURRENT_UIOUT until the destructor of the returned scoped_restore
77 1.8 christos is run.
78 1.1 christos
79 1.1 christos Note that MI output will be probably invalid if more than one
80 1.1 christos breakpoint is created inside one MI command. */
81 1.1 christos
82 1.8 christos scoped_restore_tmpl<int>
83 1.1 christos setup_breakpoint_reporting (void)
84 1.1 christos {
85 1.1 christos if (! mi_breakpoint_observers_installed)
86 1.1 christos {
87 1.10 christos gdb::observers::breakpoint_created.attach (breakpoint_notify,
88 1.10 christos "mi-cmd-break");
89 1.1 christos mi_breakpoint_observers_installed = 1;
90 1.1 christos }
91 1.1 christos
92 1.8 christos return make_scoped_restore (&mi_can_breakpoint_notify, 1);
93 1.1 christos }
94 1.1 christos
95 1.1 christos
96 1.1 christos /* Convert arguments in ARGV to the string in "format",argv,argv...
97 1.1 christos and return it. */
98 1.1 christos
99 1.8 christos static std::string
100 1.1 christos mi_argv_to_format (char **argv, int argc)
101 1.1 christos {
102 1.1 christos int i;
103 1.8 christos std::string result;
104 1.1 christos
105 1.1 christos /* Convert ARGV[OIND + 1] to format string and save to FORMAT. */
106 1.8 christos result += '\"';
107 1.1 christos for (i = 0; i < strlen (argv[0]); i++)
108 1.1 christos {
109 1.1 christos switch (argv[0][i])
110 1.1 christos {
111 1.1 christos case '\\':
112 1.8 christos result += "\\\\";
113 1.1 christos break;
114 1.1 christos case '\a':
115 1.8 christos result += "\\a";
116 1.1 christos break;
117 1.1 christos case '\b':
118 1.8 christos result += "\\b";
119 1.1 christos break;
120 1.1 christos case '\f':
121 1.8 christos result += "\\f";
122 1.1 christos break;
123 1.1 christos case '\n':
124 1.8 christos result += "\\n";
125 1.1 christos break;
126 1.1 christos case '\r':
127 1.8 christos result += "\\r";
128 1.1 christos break;
129 1.1 christos case '\t':
130 1.8 christos result += "\\t";
131 1.1 christos break;
132 1.1 christos case '\v':
133 1.8 christos result += "\\v";
134 1.1 christos break;
135 1.1 christos case '"':
136 1.8 christos result += "\\\"";
137 1.1 christos break;
138 1.1 christos default:
139 1.1 christos if (isprint (argv[0][i]))
140 1.8 christos result += argv[0][i];
141 1.1 christos else
142 1.1 christos {
143 1.1 christos char tmp[5];
144 1.1 christos
145 1.1 christos xsnprintf (tmp, sizeof (tmp), "\\%o",
146 1.1 christos (unsigned char) argv[0][i]);
147 1.8 christos result += tmp;
148 1.1 christos }
149 1.1 christos break;
150 1.1 christos }
151 1.1 christos }
152 1.8 christos result += '\"';
153 1.1 christos
154 1.1 christos /* Apply other argv to FORMAT. */
155 1.1 christos for (i = 1; i < argc; i++)
156 1.1 christos {
157 1.8 christos result += ',';
158 1.8 christos result += argv[i];
159 1.1 christos }
160 1.1 christos
161 1.8 christos return result;
162 1.1 christos }
163 1.1 christos
164 1.1 christos /* Insert breakpoint.
165 1.1 christos If dprintf is true, it will insert dprintf.
166 1.1 christos If not, it will insert other type breakpoint. */
167 1.1 christos
168 1.1 christos static void
169 1.7 christos mi_cmd_break_insert_1 (int dprintf, const char *command, char **argv, int argc)
170 1.1 christos {
171 1.8 christos const char *address = NULL;
172 1.1 christos int hardware = 0;
173 1.1 christos int temp_p = 0;
174 1.1 christos int thread = -1;
175 1.1 christos int ignore_count = 0;
176 1.1 christos char *condition = NULL;
177 1.1 christos int pending = 0;
178 1.1 christos int enabled = 1;
179 1.1 christos int tracepoint = 0;
180 1.9 christos symbol_name_match_type match_type = symbol_name_match_type::WILD;
181 1.1 christos enum bptype type_wanted;
182 1.10 christos location_spec_up locspec;
183 1.10 christos const struct breakpoint_ops *ops;
184 1.6 christos int is_explicit = 0;
185 1.10 christos std::unique_ptr<explicit_location_spec> explicit_loc
186 1.10 christos (new explicit_location_spec ());
187 1.8 christos std::string extra_string;
188 1.10 christos bool force_condition = false;
189 1.1 christos
190 1.1 christos enum opt
191 1.1 christos {
192 1.1 christos HARDWARE_OPT, TEMP_OPT, CONDITION_OPT,
193 1.1 christos IGNORE_COUNT_OPT, THREAD_OPT, PENDING_OPT, DISABLE_OPT,
194 1.1 christos TRACEPOINT_OPT,
195 1.10 christos FORCE_CONDITION_OPT,
196 1.9 christos QUALIFIED_OPT,
197 1.6 christos EXPLICIT_SOURCE_OPT, EXPLICIT_FUNC_OPT,
198 1.6 christos EXPLICIT_LABEL_OPT, EXPLICIT_LINE_OPT
199 1.1 christos };
200 1.1 christos static const struct mi_opt opts[] =
201 1.1 christos {
202 1.1 christos {"h", HARDWARE_OPT, 0},
203 1.1 christos {"t", TEMP_OPT, 0},
204 1.1 christos {"c", CONDITION_OPT, 1},
205 1.1 christos {"i", IGNORE_COUNT_OPT, 1},
206 1.1 christos {"p", THREAD_OPT, 1},
207 1.1 christos {"f", PENDING_OPT, 0},
208 1.1 christos {"d", DISABLE_OPT, 0},
209 1.1 christos {"a", TRACEPOINT_OPT, 0},
210 1.10 christos {"-force-condition", FORCE_CONDITION_OPT, 0},
211 1.9 christos {"-qualified", QUALIFIED_OPT, 0},
212 1.6 christos {"-source" , EXPLICIT_SOURCE_OPT, 1},
213 1.6 christos {"-function", EXPLICIT_FUNC_OPT, 1},
214 1.6 christos {"-label", EXPLICIT_LABEL_OPT, 1},
215 1.6 christos {"-line", EXPLICIT_LINE_OPT, 1},
216 1.1 christos { 0, 0, 0 }
217 1.1 christos };
218 1.1 christos
219 1.1 christos /* Parse arguments. It could be -r or -h or -t, <location> or ``--''
220 1.1 christos to denote the end of the option list. */
221 1.1 christos int oind = 0;
222 1.1 christos char *oarg;
223 1.1 christos
224 1.1 christos while (1)
225 1.1 christos {
226 1.1 christos int opt = mi_getopt ("-break-insert", argc, argv,
227 1.1 christos opts, &oind, &oarg);
228 1.1 christos if (opt < 0)
229 1.1 christos break;
230 1.1 christos switch ((enum opt) opt)
231 1.1 christos {
232 1.1 christos case TEMP_OPT:
233 1.1 christos temp_p = 1;
234 1.1 christos break;
235 1.1 christos case HARDWARE_OPT:
236 1.1 christos hardware = 1;
237 1.1 christos break;
238 1.1 christos case CONDITION_OPT:
239 1.1 christos condition = oarg;
240 1.1 christos break;
241 1.1 christos case IGNORE_COUNT_OPT:
242 1.1 christos ignore_count = atol (oarg);
243 1.1 christos break;
244 1.1 christos case THREAD_OPT:
245 1.1 christos thread = atol (oarg);
246 1.1 christos break;
247 1.1 christos case PENDING_OPT:
248 1.1 christos pending = 1;
249 1.1 christos break;
250 1.1 christos case DISABLE_OPT:
251 1.1 christos enabled = 0;
252 1.1 christos break;
253 1.1 christos case TRACEPOINT_OPT:
254 1.1 christos tracepoint = 1;
255 1.1 christos break;
256 1.9 christos case QUALIFIED_OPT:
257 1.9 christos match_type = symbol_name_match_type::FULL;
258 1.9 christos break;
259 1.6 christos case EXPLICIT_SOURCE_OPT:
260 1.6 christos is_explicit = 1;
261 1.10 christos explicit_loc->source_filename = xstrdup (oarg);
262 1.6 christos break;
263 1.6 christos case EXPLICIT_FUNC_OPT:
264 1.6 christos is_explicit = 1;
265 1.10 christos explicit_loc->function_name = xstrdup (oarg);
266 1.6 christos break;
267 1.6 christos case EXPLICIT_LABEL_OPT:
268 1.6 christos is_explicit = 1;
269 1.10 christos explicit_loc->label_name = xstrdup (oarg);
270 1.6 christos break;
271 1.6 christos case EXPLICIT_LINE_OPT:
272 1.6 christos is_explicit = 1;
273 1.10 christos explicit_loc->line_offset = linespec_parse_line_offset (oarg);
274 1.10 christos break;
275 1.10 christos case FORCE_CONDITION_OPT:
276 1.10 christos force_condition = true;
277 1.6 christos break;
278 1.1 christos }
279 1.1 christos }
280 1.1 christos
281 1.6 christos if (oind >= argc && !is_explicit)
282 1.1 christos error (_("-%s-insert: Missing <location>"),
283 1.1 christos dprintf ? "dprintf" : "break");
284 1.1 christos if (dprintf)
285 1.1 christos {
286 1.6 christos int format_num = is_explicit ? oind : oind + 1;
287 1.1 christos
288 1.1 christos if (hardware || tracepoint)
289 1.1 christos error (_("-dprintf-insert: does not support -h or -a"));
290 1.1 christos if (format_num >= argc)
291 1.1 christos error (_("-dprintf-insert: Missing <format>"));
292 1.1 christos
293 1.1 christos extra_string = mi_argv_to_format (argv + format_num, argc - format_num);
294 1.6 christos address = argv[oind];
295 1.1 christos }
296 1.1 christos else
297 1.1 christos {
298 1.6 christos if (is_explicit)
299 1.6 christos {
300 1.6 christos if (oind < argc)
301 1.6 christos error (_("-break-insert: Garbage following explicit location"));
302 1.6 christos }
303 1.6 christos else
304 1.6 christos {
305 1.6 christos if (oind < argc - 1)
306 1.6 christos error (_("-break-insert: Garbage following <location>"));
307 1.6 christos address = argv[oind];
308 1.6 christos }
309 1.1 christos }
310 1.1 christos
311 1.1 christos /* Now we have what we need, let's insert the breakpoint! */
312 1.8 christos scoped_restore restore_breakpoint_reporting = setup_breakpoint_reporting ();
313 1.1 christos
314 1.1 christos if (tracepoint)
315 1.1 christos {
316 1.1 christos /* Note that to request a fast tracepoint, the client uses the
317 1.1 christos "hardware" flag, although there's nothing of hardware related to
318 1.1 christos fast tracepoints -- one can implement slow tracepoints with
319 1.1 christos hardware breakpoints, but fast tracepoints are always software.
320 1.1 christos "fast" is a misnomer, actually, "jump" would be more appropriate.
321 1.1 christos A simulator or an emulator could conceivably implement fast
322 1.1 christos regular non-jump based tracepoints. */
323 1.1 christos type_wanted = hardware ? bp_fast_tracepoint : bp_tracepoint;
324 1.10 christos ops = breakpoint_ops_for_location_spec (nullptr, true);
325 1.1 christos }
326 1.1 christos else if (dprintf)
327 1.1 christos {
328 1.1 christos type_wanted = bp_dprintf;
329 1.10 christos ops = &code_breakpoint_ops;
330 1.1 christos }
331 1.1 christos else
332 1.1 christos {
333 1.1 christos type_wanted = hardware ? bp_hardware_breakpoint : bp_breakpoint;
334 1.10 christos ops = &code_breakpoint_ops;
335 1.1 christos }
336 1.1 christos
337 1.6 christos if (is_explicit)
338 1.6 christos {
339 1.6 christos /* Error check -- we must have one of the other
340 1.6 christos parameters specified. */
341 1.10 christos if (explicit_loc->source_filename != NULL
342 1.10 christos && explicit_loc->function_name == NULL
343 1.10 christos && explicit_loc->label_name == NULL
344 1.10 christos && explicit_loc->line_offset.sign == LINE_OFFSET_UNKNOWN)
345 1.6 christos error (_("-%s-insert: --source option requires --function, --label,"
346 1.6 christos " or --line"), dprintf ? "dprintf" : "break");
347 1.6 christos
348 1.10 christos explicit_loc->func_name_match_type = match_type;
349 1.9 christos
350 1.10 christos locspec = std::move (explicit_loc);
351 1.6 christos }
352 1.6 christos else
353 1.6 christos {
354 1.10 christos locspec = string_to_location_spec_basic (&address, current_language,
355 1.10 christos match_type);
356 1.6 christos if (*address)
357 1.7 christos error (_("Garbage '%s' at end of location"), address);
358 1.6 christos }
359 1.6 christos
360 1.10 christos create_breakpoint (get_current_arch (), locspec.get (), condition, thread,
361 1.8 christos extra_string.c_str (),
362 1.10 christos force_condition,
363 1.1 christos 0 /* condition and thread are valid. */,
364 1.1 christos temp_p, type_wanted,
365 1.1 christos ignore_count,
366 1.1 christos pending ? AUTO_BOOLEAN_TRUE : AUTO_BOOLEAN_FALSE,
367 1.1 christos ops, 0, enabled, 0, 0);
368 1.1 christos }
369 1.1 christos
370 1.1 christos /* Implements the -break-insert command.
371 1.1 christos See the MI manual for the list of possible options. */
372 1.1 christos
373 1.1 christos void
374 1.7 christos mi_cmd_break_insert (const char *command, char **argv, int argc)
375 1.1 christos {
376 1.1 christos mi_cmd_break_insert_1 (0, command, argv, argc);
377 1.1 christos }
378 1.1 christos
379 1.1 christos /* Implements the -dprintf-insert command.
380 1.1 christos See the MI manual for the list of possible options. */
381 1.1 christos
382 1.1 christos void
383 1.7 christos mi_cmd_dprintf_insert (const char *command, char **argv, int argc)
384 1.1 christos {
385 1.1 christos mi_cmd_break_insert_1 (1, command, argv, argc);
386 1.1 christos }
387 1.1 christos
388 1.10 christos /* Implements the -break-condition command.
389 1.10 christos See the MI manual for the list of options. */
390 1.10 christos
391 1.10 christos void
392 1.10 christos mi_cmd_break_condition (const char *command, char **argv, int argc)
393 1.10 christos {
394 1.10 christos enum option
395 1.10 christos {
396 1.10 christos FORCE_CONDITION_OPT,
397 1.10 christos };
398 1.10 christos
399 1.10 christos static const struct mi_opt opts[] =
400 1.10 christos {
401 1.10 christos {"-force", FORCE_CONDITION_OPT, 0},
402 1.10 christos { 0, 0, 0 }
403 1.10 christos };
404 1.10 christos
405 1.10 christos /* Parse arguments. */
406 1.10 christos int oind = 0;
407 1.10 christos char *oarg;
408 1.10 christos bool force_condition = false;
409 1.10 christos
410 1.10 christos while (true)
411 1.10 christos {
412 1.10 christos int opt = mi_getopt ("-break-condition", argc, argv,
413 1.10 christos opts, &oind, &oarg);
414 1.10 christos if (opt < 0)
415 1.10 christos break;
416 1.10 christos
417 1.10 christos switch (opt)
418 1.10 christos {
419 1.10 christos case FORCE_CONDITION_OPT:
420 1.10 christos force_condition = true;
421 1.10 christos break;
422 1.10 christos }
423 1.10 christos }
424 1.10 christos
425 1.10 christos /* There must be at least one more arg: a bpnum. */
426 1.10 christos if (oind >= argc)
427 1.10 christos error (_("-break-condition: Missing the <number> argument"));
428 1.10 christos
429 1.10 christos int bpnum = atoi (argv[oind]);
430 1.10 christos
431 1.10 christos /* The rest form the condition expr. */
432 1.10 christos std::string expr = "";
433 1.10 christos for (int i = oind + 1; i < argc; ++i)
434 1.10 christos {
435 1.10 christos expr += argv[i];
436 1.10 christos if (i + 1 < argc)
437 1.10 christos expr += " ";
438 1.10 christos }
439 1.10 christos
440 1.10 christos set_breakpoint_condition (bpnum, expr.c_str (), 0 /* from_tty */,
441 1.10 christos force_condition);
442 1.10 christos }
443 1.10 christos
444 1.1 christos enum wp_type
445 1.1 christos {
446 1.1 christos REG_WP,
447 1.1 christos READ_WP,
448 1.1 christos ACCESS_WP
449 1.1 christos };
450 1.1 christos
451 1.1 christos void
452 1.7 christos mi_cmd_break_passcount (const char *command, char **argv, int argc)
453 1.1 christos {
454 1.1 christos int n;
455 1.1 christos int p;
456 1.1 christos struct tracepoint *t;
457 1.1 christos
458 1.1 christos if (argc != 2)
459 1.1 christos error (_("Usage: tracepoint-number passcount"));
460 1.1 christos
461 1.1 christos n = atoi (argv[0]);
462 1.1 christos p = atoi (argv[1]);
463 1.1 christos t = get_tracepoint (n);
464 1.1 christos
465 1.1 christos if (t)
466 1.1 christos {
467 1.1 christos t->pass_count = p;
468 1.8 christos gdb::observers::breakpoint_modified.notify (t);
469 1.1 christos }
470 1.1 christos else
471 1.1 christos {
472 1.1 christos error (_("Could not find tracepoint %d"), n);
473 1.1 christos }
474 1.1 christos }
475 1.1 christos
476 1.1 christos /* Insert a watchpoint. The type of watchpoint is specified by the
477 1.1 christos first argument:
478 1.1 christos -break-watch <expr> --> insert a regular wp.
479 1.1 christos -break-watch -r <expr> --> insert a read watchpoint.
480 1.1 christos -break-watch -a <expr> --> insert an access wp. */
481 1.1 christos
482 1.1 christos void
483 1.7 christos mi_cmd_break_watch (const char *command, char **argv, int argc)
484 1.1 christos {
485 1.1 christos char *expr = NULL;
486 1.1 christos enum wp_type type = REG_WP;
487 1.1 christos enum opt
488 1.1 christos {
489 1.1 christos READ_OPT, ACCESS_OPT
490 1.1 christos };
491 1.1 christos static const struct mi_opt opts[] =
492 1.1 christos {
493 1.1 christos {"r", READ_OPT, 0},
494 1.1 christos {"a", ACCESS_OPT, 0},
495 1.1 christos { 0, 0, 0 }
496 1.1 christos };
497 1.1 christos
498 1.1 christos /* Parse arguments. */
499 1.1 christos int oind = 0;
500 1.1 christos char *oarg;
501 1.1 christos
502 1.1 christos while (1)
503 1.1 christos {
504 1.1 christos int opt = mi_getopt ("-break-watch", argc, argv,
505 1.1 christos opts, &oind, &oarg);
506 1.1 christos
507 1.1 christos if (opt < 0)
508 1.1 christos break;
509 1.1 christos switch ((enum opt) opt)
510 1.1 christos {
511 1.1 christos case READ_OPT:
512 1.1 christos type = READ_WP;
513 1.1 christos break;
514 1.1 christos case ACCESS_OPT:
515 1.1 christos type = ACCESS_WP;
516 1.1 christos break;
517 1.1 christos }
518 1.1 christos }
519 1.1 christos if (oind >= argc)
520 1.1 christos error (_("-break-watch: Missing <expression>"));
521 1.1 christos if (oind < argc - 1)
522 1.1 christos error (_("-break-watch: Garbage following <expression>"));
523 1.1 christos expr = argv[oind];
524 1.1 christos
525 1.1 christos /* Now we have what we need, let's insert the watchpoint! */
526 1.1 christos switch (type)
527 1.1 christos {
528 1.1 christos case REG_WP:
529 1.10 christos watch_command_wrapper (expr, FROM_TTY, false);
530 1.1 christos break;
531 1.1 christos case READ_WP:
532 1.10 christos rwatch_command_wrapper (expr, FROM_TTY, false);
533 1.1 christos break;
534 1.1 christos case ACCESS_WP:
535 1.10 christos awatch_command_wrapper (expr, FROM_TTY, false);
536 1.1 christos break;
537 1.1 christos default:
538 1.1 christos error (_("-break-watch: Unknown watchpoint type."));
539 1.1 christos }
540 1.1 christos }
541 1.1 christos
542 1.1 christos void
543 1.7 christos mi_cmd_break_commands (const char *command, char **argv, int argc)
544 1.1 christos {
545 1.8 christos counted_command_line break_command;
546 1.1 christos char *endptr;
547 1.1 christos int bnum;
548 1.1 christos struct breakpoint *b;
549 1.1 christos
550 1.1 christos if (argc < 1)
551 1.1 christos error (_("USAGE: %s <BKPT> [<COMMAND> [<COMMAND>...]]"), command);
552 1.1 christos
553 1.1 christos bnum = strtol (argv[0], &endptr, 0);
554 1.1 christos if (endptr == argv[0])
555 1.1 christos error (_("breakpoint number argument \"%s\" is not a number."),
556 1.1 christos argv[0]);
557 1.1 christos else if (*endptr != '\0')
558 1.1 christos error (_("junk at the end of breakpoint number argument \"%s\"."),
559 1.1 christos argv[0]);
560 1.1 christos
561 1.1 christos b = get_breakpoint (bnum);
562 1.1 christos if (b == NULL)
563 1.1 christos error (_("breakpoint %d not found."), bnum);
564 1.1 christos
565 1.8 christos int count = 1;
566 1.8 christos auto reader
567 1.10 christos = [&] (std::string &buffer)
568 1.8 christos {
569 1.8 christos const char *result = nullptr;
570 1.8 christos if (count < argc)
571 1.8 christos result = argv[count++];
572 1.8 christos return result;
573 1.8 christos };
574 1.1 christos
575 1.1 christos if (is_tracepoint (b))
576 1.8 christos break_command = read_command_lines_1 (reader, 1,
577 1.8 christos [=] (const char *line)
578 1.8 christos {
579 1.8 christos validate_actionline (line, b);
580 1.8 christos });
581 1.1 christos else
582 1.8 christos break_command = read_command_lines_1 (reader, 1, 0);
583 1.1 christos
584 1.7 christos breakpoint_set_commands (b, std::move (break_command));
585 1.1 christos }
586 1.1 christos
587