mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
tools: fix compilation of an instrumented vdbg in v bug hw.v
(module lookup problem due to abs path)
This commit is contained in:
parent
8cc49b5e9e
commit
e108a67952
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,6 +1,11 @@
|
|||||||
# ignore sub-level build binaries and v binary
|
# ignore sub-level build binaries and v binary
|
||||||
*/**/*
|
*/**/*
|
||||||
v
|
v
|
||||||
|
v.exe
|
||||||
|
v2
|
||||||
|
v2.exe
|
||||||
|
vdbg
|
||||||
|
vdbg.exe
|
||||||
!*/
|
!*/
|
||||||
!*.*
|
!*.*
|
||||||
*.exe
|
*.exe
|
||||||
|
@ -3,6 +3,8 @@ import net.urllib
|
|||||||
import os
|
import os
|
||||||
import readline
|
import readline
|
||||||
|
|
||||||
|
const vroot = @VMODROOT
|
||||||
|
|
||||||
// get output from `v doctor`
|
// get output from `v doctor`
|
||||||
fn get_vdoctor_output(is_verbose bool) string {
|
fn get_vdoctor_output(is_verbose bool) string {
|
||||||
vexe := os.getenv('VEXE')
|
vexe := os.getenv('VEXE')
|
||||||
@ -18,15 +20,20 @@ fn get_vdoctor_output(is_verbose bool) string {
|
|||||||
// get ouput from `v -g -o vdbg cmd/v && vdbg file.v`
|
// get ouput from `v -g -o vdbg cmd/v && vdbg file.v`
|
||||||
fn get_v_build_output(is_verbose bool, is_yes bool, file_path string) string {
|
fn get_v_build_output(is_verbose bool, is_yes bool, file_path string) string {
|
||||||
mut vexe := os.getenv('VEXE')
|
mut vexe := os.getenv('VEXE')
|
||||||
v_dir := os.dir(vexe)
|
// prepare a V compiler with -g to have better backtraces if possible
|
||||||
|
wd := os.getwd()
|
||||||
|
os.chdir(vroot)
|
||||||
verbose_flag := if is_verbose { '-v' } else { '' }
|
verbose_flag := if is_verbose { '-v' } else { '' }
|
||||||
vdbg_path := $if windows { '$v_dir/vdbg.exe' } $else { '$v_dir/vdbg' }
|
vdbg_path := $if windows { '$vroot/vdbg.exe' } $else { '$vroot/vdbg' }
|
||||||
vdbg_result := os.execute('"$vexe" $verbose_flag -g -o "$vdbg_path" $v_dir/cmd/v')
|
vdbg_compilation_cmd := '"$vexe" $verbose_flag -g -o "$vdbg_path" cmd/v'
|
||||||
|
vdbg_result := os.execute(vdbg_compilation_cmd)
|
||||||
|
os.chdir(wd)
|
||||||
if vdbg_result.exit_code == 0 {
|
if vdbg_result.exit_code == 0 {
|
||||||
vexe = vdbg_path
|
vexe = vdbg_path
|
||||||
} else {
|
} else {
|
||||||
eprintln('unable to compile V in debug mode: $vdbg_result.output')
|
eprintln('unable to compile V in debug mode: $vdbg_result.output\ncommand: $vdbg_compilation_cmd\n')
|
||||||
}
|
}
|
||||||
|
//
|
||||||
mut result := os.execute('"$vexe" $verbose_flag "$file_path"')
|
mut result := os.execute('"$vexe" $verbose_flag "$file_path"')
|
||||||
defer {
|
defer {
|
||||||
os.rm(vdbg_path) or {
|
os.rm(vdbg_path) or {
|
||||||
|
Loading…
Reference in New Issue
Block a user