From eef445508f2185ece048d77c79c308c81d4207f5 Mon Sep 17 00:00:00 2001 From: Andreas Heissenberger Date: Mon, 7 Jun 2021 10:09:07 +0200 Subject: [PATCH] docs: document recompiling V itself with debug info, debugging tests, and a tip for vscode (#10358) --- doc/docs.md | 5 +++++ doc/vscode.md | 3 +++ 2 files changed, 8 insertions(+) diff --git a/doc/docs.md b/doc/docs.md index 68f2596970..79bd4fc837 100644 --- a/doc/docs.md +++ b/doc/docs.md @@ -3860,6 +3860,11 @@ This will make V produce the `file.c` then stop. If you want to see the generated C source code for *just* a single C function, for example `main`, you can use: `-printfn main -o file.c`. +To debug the V executable itself you need to compile from src with `./v -g -o v cmd/v`. + +You can debug tests with for example `v -g -keepc prog_test.v`. The `-keepc` flag is needed, +so that the executable is not deleted, after it was created and ran. + To see a detailed list of all flags that V supports, use `v help`, `v help build` and `v help build-c`. diff --git a/doc/vscode.md b/doc/vscode.md index d43900ce8b..c7a0d85550 100644 --- a/doc/vscode.md +++ b/doc/vscode.md @@ -81,6 +81,9 @@ or create the file `.vscode/launch.json`: } ``` +**Optional:** use `"program": "${fileDirname}/${fileBasenameNoExtension}"` to debug +any current open source file with an existing binary with the same name but without any extention. + ### Usage To allow your compiled application to be debugged.