mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
cgen: add support for -d trace_cgen_stmt
, document it in CONTRIBUTING.md
This commit is contained in:
parent
4d8b2e9995
commit
5d1f87c5aa
2 changed files with 35 additions and 13 deletions
|
@ -192,20 +192,25 @@ which tests have failed and then fix them by making more changes. Just use
|
|||
run with your updated code. Use `hub ci-status --verbose` to monitor
|
||||
their status.
|
||||
|
||||
## Flags
|
||||
## Compiler flags, useful while debugging the compiler itself:
|
||||
|
||||
V allows you to pass custom flags using `-d my_flag` that can then be checked
|
||||
at compile time (see the documentation about
|
||||
[compile-time if](https://github.com/vlang/v/blob/master/doc/docs.md#compile-time-if)).
|
||||
There are numerous flags that can be passed when building the compiler
|
||||
with `v self` or when creating a copy of the compiler, that will help
|
||||
you when debugging.
|
||||
|
||||
Beware that the flags must be passed when building the compiler,
|
||||
not the program, so do for example: `v -d time_parsing cmd/v` or
|
||||
`v -d trace_checker self`.
|
||||
Some flags can make the compiler very verbose, so it is recommended
|
||||
to create a copy of the compiler rather than replacing it with `v self`.
|
||||
Since the compiler is *also* an ordinary V program, there are numerous flags that can be
|
||||
passed when building the compiler itself with `v self`, or when creating a copy of the
|
||||
compiler, that will help you when debugging the compiler.
|
||||
|
||||
Note: beware that the flags below must be passed, when building the compiler, *not the program*,
|
||||
so do for example:
|
||||
`./v -o w -d time_parsing cmd/v`
|
||||
or
|
||||
`./v -o w -d trace_checker self`
|
||||
... then use `./w file.v`, instead of `./v file.v`, to compile your program.
|
||||
|
||||
Note: some of the flags can make the compiler *very verbose*, so it is recommended to create
|
||||
a copy of the compiler rather than replacing it with `v self`.
|
||||
|
||||
| Flag | Usage |
|
||||
|-----------------------------------|---------------------------------------------------------------------------------------------------------------------|
|
||||
|
@ -216,12 +221,21 @@ to create a copy of the compiler rather than replacing it with `v self`.
|
|||
| `print_vweb_template_expansions` | Prints vweb compiled HTML files |
|
||||
| `time_checking` | Prints the time spent checking files and other related information |
|
||||
| `time_parsing` | Prints the time spent parsing files and other related information |
|
||||
| | |
|
||||
| `trace_parser` | Prints details about parsed statements and expressions. Very verbose. Use it for panics in the parser. |
|
||||
| `trace_ccoptions` | Prints options passed down to the C compiler |
|
||||
| | |
|
||||
| `trace_checker` | Prints details about the statements being checked. Very verbose. Use it for panics in the checker. |
|
||||
| | |
|
||||
| `trace_gen` | Prints all the strings written to the generated C file. Very verbose. |
|
||||
| `trace_cgen_stmt` | Prints details about the statements that are being processed by cgen. |
|
||||
| | Use it for panics in cgen, to see the closest input V source line, that caused the panic. |
|
||||
| | Note: you need `v -no-parallel -d trace_cgen_stmt -o w cmd/v` to make sense of the output of that, |
|
||||
| | otherwise by default cgen uses several threads, and the lines that are printed are out of order. |
|
||||
| | |
|
||||
| `trace_autofree` | Prints details about how/when -autofree puts free() calls |
|
||||
| `trace_autostr` | Prints details about `.str()` method auto-generated by the compiler during C generation |
|
||||
| `trace_ccoptions` | Prints options passed down to the C compiler |
|
||||
| `trace_checker` | Prints details about the statements being checked |
|
||||
| `trace_gen` | Prints strings written to the generated C file. Beware, this flag is very verbose |
|
||||
| `trace_parser` | Prints details about parsed statements and expressions |
|
||||
| | |
|
||||
| `trace_thirdparty_obj_files` | Prints details about built thirdparty obj files |
|
||||
| `trace_usecache` | Prints details when -usecache is used |
|
||||
| `trace_embed_file` | Prints details when $embed_file is used |
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue