From 9c01317e9c3aebed2dc41e68fc6785e4bee9d12d Mon Sep 17 00:00:00 2001 From: Edd Barrett Date: Fri, 13 Dec 2024 15:08:56 +0000 Subject: [PATCH] Tidy up gdb_c_test. 1) Make gdb_c_test.rs more lean by removing command line arguments that simply set env vars. We can just set the vars directly, e.g.: YKD_LOG_IR=aot bin/gdb_c_test simple.c It's a bit more typing, but it means this tool is smaller and more resilient to env var additions/removals/changes. I note it still referenced the old YKD_LOG_JITSTATE var, which was renamed to YK_LOG. 2) Remove no longer working -b. The JIT code generator broke this, but I haven't missed it to be honest. --- docs/src/dev/debugging.md | 14 +------------- tests/src/bin/gdb_c_test.rs | 35 ----------------------------------- 2 files changed, 1 insertion(+), 48 deletions(-) diff --git a/docs/src/dev/debugging.md b/docs/src/dev/debugging.md index 22894ece9..ff9498403 100644 --- a/docs/src/dev/debugging.md +++ b/docs/src/dev/debugging.md @@ -31,19 +31,7 @@ This will automatically compile and run the `tests/c/simple.c` test under GDB. This would be ideal if you have a crashing trace, as it will dump you into a GDB shell at the time of the crash. -The tool has some other switches which are useful for other situations, e.g.: - -``` -bin/gdb_c_test -j -s -b10 simple.c -``` - -compiles and runs `tests/c/simple.c` test under GDB with [JIT state -debugging](runtime_config.md#ykd_print_jitstate) -enabled, with [compilation -serialised](runtime_config.md#ykd_serialise_compilation), setting a -breakpoint on the first 10 traces compiled. - -For a list of all switches available, run: +To see what else you can do with `gdb_c_test`, run: ``` bin/gdb_c_test --help diff --git a/tests/src/bin/gdb_c_test.rs b/tests/src/bin/gdb_c_test.rs index bd10b5ec5..2883c5128 100644 --- a/tests/src/bin/gdb_c_test.rs +++ b/tests/src/bin/gdb_c_test.rs @@ -13,22 +13,6 @@ struct Args { /// The test to attach gdb to. test_file: PathBuf, - /// Run the test with `YKD_LOG_IR` set to the specified value. - #[arg(short, long)] - log_ir: Option, - - /// Run the test with `YKD_LOG_JITSTATE=-` - #[arg(short = 'j', long)] - log_jitstate: bool, - - /// Run the test with `YKD_SERIALISE_COMPILATION=1` - #[arg(short, long)] - serialise_compilation: bool, - - /// Set breakpoints at the first `N` compiled traces. - #[arg(short = 'b', long)] - num_breaks: Option, - /// Don't immediately run the program. #[arg(short = 'n', long)] wait_at_prompt: bool, @@ -76,25 +60,6 @@ fn main() { let mut gdb = Command::new("gdb"); gdb.arg(&binpath); - if args.serialise_compilation { - gdb.env("YKD_SERIALISE_COMPILATION", "1"); - } - - if args.log_jitstate { - gdb.env("YKD_LOG_JITSTATE", "1"); - } - - if let Some(irs) = args.log_ir { - gdb.env("YKD_LOG_IR", irs); - } - - if let Some(num_breaks) = args.num_breaks { - gdb.args(["-ex", "set breakpoint pending on"]); // don't prompt for pending breaks. - for i in 0..num_breaks { - gdb.args(["-ex", &format!("b __yk_compiled_trace_{i}")]); - } - } - if !args.wait_at_prompt { gdb.args(["-ex", "run"]); }