Skip to content

Commit

Permalink
Merge pull request #1451 from Pavel-Durov/gdb-c-test-add-command-arg
Browse files Browse the repository at this point in the history
Add support for executing GDB commands.
  • Loading branch information
ltratt authored Nov 10, 2024
2 parents 7409c57 + 9df564e commit 82b2e2d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/src/bin/gdb_c_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ struct Args {
/// Don't immediately run the program.
#[arg(short = 'n', long)]
wait_at_prompt: bool,

/// Pass all arguments after `--` directly to GDB.
#[arg(last = true, required = false)]
gdb_args: Vec<String>,
}

fn main() {
Expand Down Expand Up @@ -95,6 +99,12 @@ fn main() {
gdb.args(["-ex", "run"]);
}

// Pass all GDB-specific arguments after '--'
if !args.gdb_args.is_empty() {
for gdb_arg in &args.gdb_args {
gdb.arg(gdb_arg);
}
}
// Run gdb!
gdb.spawn().expect("failed to spawn gdb").wait().unwrap();
}

0 comments on commit 82b2e2d

Please sign in to comment.