diff --git a/docs/box64.pod b/docs/box64.pod index ef0465937d..ee7670e636 100644 --- a/docs/box64.pod +++ b/docs/box64.pod @@ -467,4 +467,17 @@ script. yyyy needs to be a full path to a valid x86_64 version of bash * 1 : Launch `gdb` when a segfault, bus error or illegal instruction signal is trapped, attached to the offending process and go in an endless loop, waiting. When in gdb, you need to find the correct thread yourself (the one with `my_box64signalhandler` in is stack) then probably need to `finish` 1 or 2 functions (inside `usleep(..)`) and then you'll be in `my_box64signalhandler`, just before the printf of the Segfault message. Then simply `set waiting=0` to exit the infinite loop. * 2 : Launch `gdbserver` when a segfault, bus error or illegal instruction signal is trapped, attached to the offending process, and go in an endless loop, waiting. Use `gdb /PATH/TO/box64` and then `target remote 127.0.0.1:1234` to connect to the gdbserver (or use actual IP if not on the machine). After that, the procedure is the same as with ` BOX64_JITGDB=1`. This mode can be usefullwhen programs redirect all console output to a file (like Unity3D Games) +=head1 VARIABLES FOR ENVIRONMENT ONLY + +=over 8 + +=item B + +When set, B will only print its version and then exit. This option is +analogous to B used by C emulation of qemu-user. Its +purpose is the same: provide a way to soft-disable C emulation as +well as for identifying B as the registered C emulator. + +=back + =cut diff --git a/src/main.c b/src/main.c index 62919466e4..316ec2f869 100644 --- a/src/main.c +++ b/src/main.c @@ -1468,6 +1468,11 @@ extern char** environ; int main(int argc, const char **argv, char **env) { init_malloc_hook(); init_auxval(argc, argv, environ?environ:env); + // analogue to QEMU_VERSION in qemu-user-mode emulation + if(getenv("BOX64_VERSION")) { + PrintBox64Version(); + exit(0); + } // trying to open and load 1st arg if(argc==1) { /*PrintBox64Version();