Skip to content

Commit

Permalink
Debugger: Allow specification of several breakpoints from cmdline args (
Browse files Browse the repository at this point in the history
  • Loading branch information
zaddach authored Feb 2, 2025
1 parent f2f4310 commit eca1f1c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions debugger/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ struct CliArgs {
grammar_file: Option<PathBuf>,
input_file: Option<PathBuf>,
rule: Option<String>,
breakpoint: Option<String>,
breakpoints: Vec<String>,
session_file: Option<PathBuf>,
no_update: bool,
}
Expand All @@ -233,7 +233,7 @@ impl Default for CliArgs {
grammar_file: None,
input_file: None,
rule: None,
breakpoint: None,
breakpoints: Vec::new(),
session_file: None,
no_update: false,
};
Expand Down Expand Up @@ -268,7 +268,7 @@ impl Default for CliArgs {
}
"-b" | "--breakpoint" => {
if let Some(breakpoint) = iter.next() {
result.breakpoint = Some(breakpoint);
result.breakpoints.push(breakpoint);
} else {
eprintln!("Error: missing breakpoint");
std::process::exit(1);
Expand All @@ -294,7 +294,7 @@ impl Default for CliArgs {
-g, --grammar <grammar file> - load .pest grammar\n\
-i, --input <input file> - load input file\n\
-r, --rule <rule> - run rule\n\
-b, --breakpoint <rule> - breakpoint at rule\n\
-b, --breakpoint <rule> - breakpoint at rule (can be specified multiple times)\n\
-s, --session <session file> - load session history file\n\
-h, --help - print this help menu\n\
"
Expand Down Expand Up @@ -326,8 +326,8 @@ impl CliArgs {
eprintln!("Error: {}", e);
}
}
if let Some(breakpoint) = &self.breakpoint {
context.breakpoint(breakpoint);
for breakpoint in self.breakpoints {
context.breakpoint(&breakpoint);
}
if let Some(rule) = self.rule {
if let Err(e) = context.run(&rule) {
Expand Down

0 comments on commit eca1f1c

Please sign in to comment.