Skip to content

Commit eca1f1c

Browse files
authored
Debugger: Allow specification of several breakpoints from cmdline args (#1075)
1 parent f2f4310 commit eca1f1c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

debugger/src/main.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ struct CliArgs {
222222
grammar_file: Option<PathBuf>,
223223
input_file: Option<PathBuf>,
224224
rule: Option<String>,
225-
breakpoint: Option<String>,
225+
breakpoints: Vec<String>,
226226
session_file: Option<PathBuf>,
227227
no_update: bool,
228228
}
@@ -233,7 +233,7 @@ impl Default for CliArgs {
233233
grammar_file: None,
234234
input_file: None,
235235
rule: None,
236-
breakpoint: None,
236+
breakpoints: Vec::new(),
237237
session_file: None,
238238
no_update: false,
239239
};
@@ -268,7 +268,7 @@ impl Default for CliArgs {
268268
}
269269
"-b" | "--breakpoint" => {
270270
if let Some(breakpoint) = iter.next() {
271-
result.breakpoint = Some(breakpoint);
271+
result.breakpoints.push(breakpoint);
272272
} else {
273273
eprintln!("Error: missing breakpoint");
274274
std::process::exit(1);
@@ -294,7 +294,7 @@ impl Default for CliArgs {
294294
-g, --grammar <grammar file> - load .pest grammar\n\
295295
-i, --input <input file> - load input file\n\
296296
-r, --rule <rule> - run rule\n\
297-
-b, --breakpoint <rule> - breakpoint at rule\n\
297+
-b, --breakpoint <rule> - breakpoint at rule (can be specified multiple times)\n\
298298
-s, --session <session file> - load session history file\n\
299299
-h, --help - print this help menu\n\
300300
"
@@ -326,8 +326,8 @@ impl CliArgs {
326326
eprintln!("Error: {}", e);
327327
}
328328
}
329-
if let Some(breakpoint) = &self.breakpoint {
330-
context.breakpoint(breakpoint);
329+
for breakpoint in self.breakpoints {
330+
context.breakpoint(&breakpoint);
331331
}
332332
if let Some(rule) = self.rule {
333333
if let Err(e) = context.run(&rule) {

0 commit comments

Comments
 (0)