diff --git a/tests/src/bin/gdb_c_test.rs b/tests/src/bin/gdb_c_test.rs index faf09a387..bd10b5ec5 100644 --- a/tests/src/bin/gdb_c_test.rs +++ b/tests/src/bin/gdb_c_test.rs @@ -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, } fn main() { @@ -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(); }