vlang / v

Simple, fast, safe, compiled language for developing maintainable software. Compiles itself in <1s with zero library dependencies. Supports automatic C => V translation. https://vlang.io
MIT License
35.68k stars 2.15k forks source link

termux: hot reload example segmentation fault #18135

Open 7underlines opened 1 year ago

7underlines commented 1 year ago

Describe the bug

Execution of the command v -live run examples/hot_reload/message.v prints segmentation fault.

Expected Behavior

The example works.

Current Behavior

v -live run examples/hot_reload/message.v
OK reloads:    0 | Total reloads:    0 | Hello! Modify this message while the program is running.
signal 11: segmentation fault

Reproduction Steps

v -live run examples/hot_reload/message.v

Possible Solution

I found that it works with the -cg parameter.

v -cg -live run examples/hot_reload/message.v
OK reloads:    1 | Total reloads:    1 | Hello! Modify this message while the program is running.
OK reloads:    1 | Total reloads:    1 | Hello! Modify this message while the program is running.
OK2 reloads:    2 | Total reloads:    2 | Hello! Modify this message while the program is running.
OK2 reloads:    2 | Total reloads:    2 | Hello! Modify this message while the program is running.
OK reloads:    3 | Total reloads:    3 | Hello! Modify this message while the program is running.

Additional Information/Context

No response

V version

V 0.3.4 5454562.b50dac5

Environment details (OS name and version, etc.)

V full version: V 0.3.4 5454562.b50dac5 OS: termux, 4.14.190-perf+, #1 SMP PREEMPT Fri Mar 24 23:36:11 CST 2023 Processor: 8 cpus, 64bit, little endian

getwd: /data/data/com.termux/files/home/v vexe: /data/data/com.termux/files/home/v/v vexe mtime: 2023-05-07 19:39:38

vroot: OK, value: /data/data/com.termux/files/home/v VMODULES: OK, value: /data/data/com.termux/files/home/.vmodules VTMP: OK, value: /data/data/com.termux/files/usr/tmp/v_10214

Git version: git version 2.40.1 Git vroot status: weekly.2022.47-899-gb50dac5e (1 commit(s) behind V master) .git/config present: true

CC version: clang version 16.0.2 thirdparty/tcc status: thirdparty-unknown-unknown de82a130

andorxornot commented 1 year ago

It's been two years and hot reboot still doesn't work on windows

7underlines commented 1 year ago

@andorxornot I'm sorry to hear this because I think hot reload is one of V's best features. Have you tried the -cg parameter? Because with this workaround it works under Termux.

andorxornot commented 9 months ago

@thomaspeissl just tested on the latest master, the problem remains, with or without cg parameter v output:


C:/Users/User/AppData/Local/Temp/v_0/message.17609892509590806748.tmp.c:8368: at print_backtrace_skipping_top_frames_tcc: Backtrace
C:/Users/User/AppData/Local/Temp/v_0/message.17609892509590806748.tmp.c:8335: by print_backtrace_skipping_top_frames
C:/Users/User/AppData/Local/Temp/v_0/message.17609892509590806748.tmp.c:9145: by unhandled_exception_handler
7ffcffdc8b1c : by ???
RUNTIME ERROR: invalid memory access```
andorxornot commented 9 months ago

could you also check the graphical examples of hot-reload? for example v -live run examples/hot_reload/bounce.v

7underlines commented 9 months ago

@andorxornot I recommend you create a separate issue for Windows.