> guide
Command line
The Xur programming language: run and inspect .xur programs. Install it with cargo install xur.
> xur run
Run a program's main function.
$ xur run [OPTIONS] [FILE] [ARGS]... | <FILE> | The root .xur file, a directory (runs main.xur inside it), or - for stdin. Defaults to main.xur in the current directory |
| <ARGS>... | Arguments passed to the program as std::argv() |
| --no-trace | Don't show the ? locations an error passed through when it reaches main |
> xur lsp
Start the language server (LSP), communicating over stdio.
$ xur lsp > xur debug
Inspect the output of individual compiler stages.
$ xur debug <COMMAND> > xur debug tokens
Print the tokens the lexer produces for a source file.
$ xur debug tokens <FILE> | <FILE> | The .xur file to lex |
> xur debug ast
Print the syntax tree the parser produces for a source file.
$ xur debug ast <FILE> | <FILE> | The .xur file to parse |
> xur debug resolve
Print what every name in a program resolves to, following imports.
$ xur debug resolve <FILE> | <FILE> | The root .xur file of the program |
> xur debug bytecode
Print the bytecode of every function in a source file.
$ xur debug bytecode <FILE> | <FILE> | The root .xur file of the program |
> xur stub
Inject the xur-stub into a running process (Linux x86-64).
$ xur stub <COMMAND> See loading the stub for how these fit together.
> xur stub inject
Inject libxur_stub.so into a running process and run a .xur script inside it — the attach-time equivalent of LD_PRELOAD + XUR_STUB_PATH.
$ xur stub inject [OPTIONS] <SCRIPT> | <SCRIPT> | The .xur file (or a directory of *.xur) to run in the target |
| --pid<PID> | Target process by PID not with --name |
| --name<NAME> | Target process by executable name not with --pid |
| --stub<STUB> | Override the libxur_stub.so path instead of auto-resolving it |
| --manual | Map the stub manually (manual ELF map) instead of the default OS loader (dlopen). dlopen resolves IFUNC/versioned symbols and sets up TLS via the target's own linker; the manual map does not set up general-dynamic TLS, so it is unsuitable for TLS-using libraries (e.g. Rust cdylibs). Manual map avoids registering the module with the linker |
> xur stub path
Print the resolved libxur_stub.so path.
$ xur stub path > xur stub generate-proxy
Generate a proxy library that a game loads in place of a real library it depends on: it forwards the real library's exports to a renamed copy and imports the stub so the OS loader auto-loads it (DLL/.so proxying). The stub's ctor then runs a .xur script (via XUR_STUB_PATH or a xur/ directory beside the game). The real library may be a PE .dll or an ELF .so; the output matches its format.
$ xur stub generate-proxy [OPTIONS] --out <OUT> <REAL> | <REAL> | The real library to proxy. Its exports are forwarded/re-exported and its format/machine determine the generated proxy |
| --out<OUT> | Output path for the proxy, named like the library the game loads (e.g. dxgi.dll) required |
| --forward-to<FORWARD_TO> | Module the forwarders point at — your renamed copy of the real library (e.g. dxgi_orig), so the proxy does not forward to itself. Defaults to the real library's name with _orig before its first extension: version.dll -> version_orig (PE forwarders name no extension), libz.so.1 -> libz_orig.so.1 (ELF) |
| --stub<STUB> | Stub module to import / depend on so the loader auto-loads it. Defaults to xur_stub.dll (PE) or libxur_stub.so (ELF) |
| --no-reexport | (ELF only) Skip re-exporting the real symbols; emit a minimal DT_NEEDED-only proxy instead |
> xur stub add-needed
Edit a game's own ELF library in place to add a DT_NEEDED on the stub, so the OS loader auto-loads it when the game loads that library — no proxy file needed (ELF only; like patchelf --add-needed). The stub's ctor then runs a .xur script (via XUR_STUB_PATH or a xur/ directory beside the game).
$ xur stub add-needed [OPTIONS] --out <OUT> <REAL> | <REAL> | The game's ELF library (or executable) to edit |
| --out<OUT> | Output path for the edited library; swap it in for the original required |
| --stub<STUB> | Stub soname to depend on. Defaults to libxur_stub.so |