Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When BOX64_VERSION is set, just print the version and exit #1238

Merged
merged 1 commit into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/box64.pod
Original file line number Diff line number Diff line change
Expand Up @@ -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<BOX64_VERSION>

When set, B<box64> will only print its version and then exit. This option is
analogous to B<QEMU_VERSION> used by C<binfmt_misc> emulation of qemu-user. Its
purpose is the same: provide a way to soft-disable C<binfmt_misc> emulation as
well as for identifying B<box64> as the registered C<binfmt_misc> emulator.

=back

=cut
5 changes: 5 additions & 0 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Loading