From 9df564e73f07508c863f62ff4b6176f933c15693 Mon Sep 17 00:00:00 2001 From: Pavel Durov Date: Sat, 9 Nov 2024 11:17:44 +0000 Subject: [PATCH] Add gdb_args to gdb_c_test. Allows users to pass custom arguments directly to GDB. --- tests/src/bin/gdb_c_test.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) 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(); }