From 8b3ed4b11f22d2a735825b29048d02441e098774 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Tue, 5 Nov 2019 13:23:55 +0200 Subject: [PATCH] Update troubleshooting instructions with the new option names -g, -cg, -cc and so on. --- Troubleshooting.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Troubleshooting.md b/Troubleshooting.md index 2595852..b668a0b 100644 --- a/Troubleshooting.md +++ b/Troubleshooting.md @@ -3,15 +3,17 @@ You can see how V invokes the C backend compiler with `v -show_c_cmd file.v` . You can produce a .c file, *without* compiling it further with `v -o file.c file.v` . That is useful, if you want to integrate v as a transpiler into the build system (probably using a Makefile) of an existing large C code base, or if you just want to read the produced C code. -You can prevent V from deleting the intermediate .c file (which is useful if you want to use a debugger like gdb or msvc) by: `v -debug file.v` . +You can prevent V from deleting the intermediate .c file (which is useful if you want to use a debugger like gdb or msvc) by: `v -keep_c file.v` . -You can pass `-g`, which has the effect of -debug, and in addition will make the debugger information to have V line numbers, instead of C ones (NB: this will make the intermediate .c file harder to read). +You can pass `-g`, which will generate debugging symbols in your executable. The debugging symbols have V line numbers, instead of C ones (NB: this will make the intermediate .c file harder to read). + +You can pass `-cg`, which will generate debugging symbols in your executable just like -g. The debugging symbols have C line numbers. NB: this will make the intermediate .c file easier to read, but in effect you will be debugging an ordinary generated C program, without a mapping to the underlying V source code. You can also set the VFLAGS environment variable to pass one or more flags to v, so that you do not have to type them manually everytime. -Windows (cmd): `set VFLAGS=-debug -show_c_cmd` -Windows (PowerShell): `$env:VFLAGS="-debug -show_c_cmd"` -Unix (bash): export VFLAGS="-debug -show_c_cmd" +Windows (cmd): `set VFLAGS=-keep_c -g -cc msvc -show_c_cmd` +Windows (PowerShell): `$env:VFLAGS="-keep_c -g -cc msvc -show_c_cmd"` +Unix (bash): export VFLAGS="-keep_c -g -cc gcc -show_c_cmd" Windows: If you get this error while running the V REPL, and you are using msvc: @@ -19,7 +21,7 @@ If you get this error while running the V REPL, and you are using msvc: ... please try: ```shell -set VFLAGS=-os msvc +set VFLAGS=-cc msvc v.exe runrepl ``` \ No newline at end of file