From 30ececc2a3d44034a7077cc5f536592c62d17df3 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Thu, 19 Dec 2024 21:45:56 +0200 Subject: [PATCH] v.pref: support `-debug` and `-cdebug`, as more explicit alternative names for `-g` and `-cg` (#23208) --- vlib/v/help/build/build-c.txt | 4 ++-- vlib/v/help/default.txt | 2 +- vlib/v/pref/pref.v | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/vlib/v/help/build/build-c.txt b/vlib/v/help/build/build-c.txt index 9ddc4048029516..87c13952063dd8 100644 --- a/vlib/v/help/build/build-c.txt +++ b/vlib/v/help/build/build-c.txt @@ -262,7 +262,7 @@ see also `v help build`. your custom one loaded from specified . # Debugging: - -g + -g, -debug Generate more debug information in the compiled executable. This makes program backtraces more useful. Using debuggers like gdb/lldb with such executables is easier too. @@ -270,7 +270,7 @@ see also `v help build`. so that your debugger and the stacktraces will show you directly what .v file is responsible for each call/panic. - -cg + -cg, -cdebug Like -g, but do not use V source line numbers. When debugging code that wraps C libraries, this option may be more useful than -g, since it will reduce the amount of context diff --git a/vlib/v/help/default.txt b/vlib/v/help/default.txt index 321f179230da8c..62bd01c1d2f23d 100644 --- a/vlib/v/help/default.txt +++ b/vlib/v/help/default.txt @@ -8,7 +8,7 @@ Examples: `hello` or `hello.exe`. v run hello.v Same as above but also run the produced executable immediately after compilation. - v -cg run hello.v Same as above, but make debugging easier + v -g run hello.v Same as above, but make debugging easier (in case your program crashes). v crun hello.v Same as above, but do not recompile, if the executable already exists, and is newer than the diff --git a/vlib/v/pref/pref.v b/vlib/v/pref/pref.v index 2fd0391ca733ac..12103746ceb85f 100644 --- a/vlib/v/pref/pref.v +++ b/vlib/v/pref/pref.v @@ -110,7 +110,7 @@ pub mut: is_eval_argument bool // true for `v -e 'println(2+2)'`. `println(2+2)` will be in pref.eval_argument . is_run bool // compile and run a v program, passing arguments to it, and deleting the executable afterwards is_crun bool // similar to run, but does not recompile the executable, if there were no changes to the sources - is_debug bool // turned on by -g or -cg, it tells v to pass -g to the C backend compiler. + is_debug bool // turned on by -g/-debug or -cg/-cdebug, it tells v to pass -g to the C backend compiler. is_vlines bool // turned on by -g (it slows down .tmp.c generation slightly). is_stats bool // `v -stats file.v` will produce more detailed statistics for the file that is compiled show_asserts bool // `VTEST_SHOW_ASSERTS=1 v file_test.v` will show details about the asserts done by a test file. Also activated for `-stats` and `-show-asserts`. @@ -516,12 +516,12 @@ pub fn parse_args_and_show_errors(known_external_commands []string, args []strin } i++ } - '-g' { + '-g', '-debug' { res.is_debug = true res.is_vlines = true res.build_options << arg } - '-cg' { + '-cg', '-cdebug' { res.is_debug = true res.is_vlines = false res.build_options << arg