core icon indicating copy to clipboard operation
core copied to clipboard

Feature Request: show stacktrace for native backend

Open bikallem opened this issue 5 months ago • 4 comments

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.

bikallem avatar Sep 08 '25 17:09 bikallem

Yes, we should print stacktrace at least in debug mode. /cc @Guest0x0

hackwaly avatar Sep 08 '25 18:09 hackwaly

For the first step, we will enable the abort println for js and native backend

peter-jerry-ye avatar Sep 12 '25 02:09 peter-jerry-ye

Will abort at least show where it aborted in the source code?

bikallem avatar Sep 13 '25 16:09 bikallem

It would require changing the signature of abort: it would need to take the loc with autofill.

peter-jerry-ye avatar Sep 15 '25 02:09 peter-jerry-ye