-
Notifications
You must be signed in to change notification settings - Fork 59
Troubleshooting
For common missing-library, binfmt, AVX, floating-point, TSO, or page-size issues, start with the FAQ. Before changing configuration or source, ordinary users should first:
- save the LATX version, host details, guest file type, complete command, and error output;
- use the static-program check in Build, installation, and runtime
to distinguish a translator issue from a runtime issue, and use
-runtime-infoto confirm the guest runtime; - change one runtime option at a time; current semantics and defaults are in Configuration and environment variables.
This page describes how to systematically locate functional and compatibility problems when using the LAT binary translator. It focuses on version comparison, LAT-TCG/QEMU-TCG comparison, TSO settings, page-size changes, and runtime alignment to determine whether a problem is caused by:
- a false positive from environmental factors such as missing guest runtime
dependencies under
/usr/gnemul; - an LAT instruction-translation error;
- a missing upstream QEMU linux-user backport; or
- a bug in another LAT component.
The aim is to find the real owner of a LAT issue by the shortest path.
When locating a problem, follow these principles:
- Rule out environment issues before investigating the translator.
- First check whether adjusting relevant LAT environment variables changes the behavior.
- First determine whether it is a version regression, then investigate the specific code defect.
- For particular guest software, check the recommended memory-ordering setup.
- For particular errors such as SIGSEGV, use a different system page size as a compatibility check.
- Compare with other translators such as LAT-TCG and QEMU-TCG to validate instruction semantics and correctness.
- ABI 1.0 (old world) and ABI 2.0 (new world) use different implementations in
some code guarded by
CONFIG_LOONGARCH_NEW_WORLD; test the other ABI to see whether that implementation difference is involved. - If these steps do not identify the issue, investigate it directly.
These steps are suggestions rather than a strict sequence.
Although the first principle is to rule out environment issues, replacing the translator is usually inexpensive. Test translators from different tags to see whether the problem is:
- a long-standing issue; or
- a regression introduced in a particular version.
You can replace the translator in /usr/bin/, but that can create package
manager risks. Alternatively, temporarily change the binfmt path to point to
the translator under test.
For a newly introduced regression, use Git bisection:
git bisect start
git bisect bad commit-id
git bisect good commit-idBuild and test iteratively to identify the introducing commit.
Current option semantics, defaults, and configuration precedence are maintained in Configuration and environment variables. Use one-shot environment variables for comparison and change one option at a time, for example:
LATX_AOT=0 latx-x86_64 /path/to/program
LATX_SOFTFPU=1 latx-x86_64 /path/to/program
LATX_ANONYM=1 latx-x86_64 /path/to/programWrite the option to a guest-specific configuration section only after confirming that it has the intended effect.
For large closed-source programs, you can run a guest-architecture Docker
environment through LAT to get the program running first. This can determine
which libraries the program needs and whether they exist in the guest runtime
under /usr/gnemul.
Use latx-x86_64 -runtime-info or latx-i386 -runtime-info to confirm the
runtime directory LATX actually selected. If a static program works but a
dynamically linked program fails, check the dynamic linker and shared libraries
in that directory first.
See memory-model-config for the procedure.
For some SIGSEGV errors, try a 4K-page kernel. For example, if si_code is 2
and the corresponding siaddr has the expected permission in the guest, the
4K/16K shadow-page compatibility mechanism may be involved.
Comparing with LAT-TCG can show whether an instruction translation is wrong. LAT does not ensure that every upstream QEMU linux-user patch is backported, so compare with QEMU-TCG as well to see whether backporting an upstream patch could resolve the issue.
For ABI 1.0 (old world) and ABI 2.0 (new world), LAT uses different
implementations in some code guarded by CONFIG_LOONGARCH_NEW_WORLD. Test the
other ABI to determine whether that implementation difference is involved.
If the preceding experiments still cannot run the program, begin direct debugging.
Besides AOT and library pass-through, LAT has other optimizations that can be
disabled. optimize-config.h has common build-time switches; for example,
comment out the following lines to disable flag-reduction optimization:
#undef CONFIG_LATX_FLAG_REDUCTION
#define CONFIG_LATX_FLAG_REDUCTION /* flag reduction */
For these cases, inspect information in the signal context. As in QEMU, LAT's
first signal entry point is host_signal_handler(), which is a useful place to
start the analysis.
Capture an strace log for the translated run and compare it with a log from a
native-architecture run to identify obvious errors.
Document version: v1.0
Intended audience: anyone beginning to debug LAT
Maintainer: Hanlu Li heuleehanlu@gmail.com
📘 LAT Project
🔗 主页:https://github.com/lat-opensource/lat
💬 讨论区:https://github.com/lat-opensource/lat/discussions
🐞 报告问题:https://github.com/lat-opensource/lat/issues