Feature Request: show stacktrace for native backend
Bug Report
Environment
OS
Operating System: Linux 6.16.4 (Arch Linux)
MoonBit CLI Tools Version
moon 0.1.20250908 (1ace055 2025-09-08) ~/.moon/bin/moon
moonc v0.6.26+da3760aea-nightly (2025-09-07) ~/.moon/bin/moonc
moonrun 0.1.20250908 (1ace055 2025-09-08) ~/.moon/bin/moonrun
moon-pilot 0.0.1-19cfd6b (2025-09-08) ~/.moon/bin/moon-pilot
The issue exists in stable version release too.
Steps to Reproduce
Build and run the following code.
///|
fn main {
let ar : Array[String] = []
println(ar[0])
}
build native.
moon build --target native
./target/native/release/build/cmd/main/main.exe
Expected Behavior
Perhaps a more useful error would be to panic with a stacktrace. As it is quite difficult to pin down the location of the error.
Actual Behavior
The execution results in SIGABRT (Abort)
fish: Job 1, './target/native/releas…' terminated by signal SIGABRT (Abort)
Checklist
- [x ] (Optional) My case is minimal enough to be reproducible.
Yes, we should print stacktrace at least in debug mode. /cc @Guest0x0
For the first step, we will enable the abort println for js and native backend
Will abort at least show where it aborted in the source code?
It would require changing the signature of abort: it would need to take the loc with autofill.