Skip to content

feat: backtraces on panic - #210

Merged
jake-arkinstall merged 13 commits into
0.3-seriesfrom
feat/debug_info_llvm
Sep 4, 2026
Merged

feat: backtraces on panic#210
jake-arkinstall merged 13 commits into
0.3-seriesfrom
feat/debug_info_llvm

Conversation

@jake-arkinstall

@jake-arkinstall jake-arkinstall commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator
  • Logs a backtrace to the results stream when a user program calls panic
  • Bundles llvm-symbolizer for extracting debug information from the (user program + selene) executable, and uses it for extracting function names, lines, columns.
  • In combination with guppylang and hugr-qis-compiler's emit_debug support, provides the guppy call stack that resulted in the panic, to the best of our ability (optimisations and tail calling can hurt somewhat, but we do capture the line and column)
  • Traces are available from within selene-provided exceptions. They are printed as part of __str__ in these exceptions, but the primary intent is for a wrapper (such as guppylang.emulator) to access the trace elements directly.
  • Preserve metrics/traces on a panicking shot

@jake-arkinstall
jake-arkinstall marked this pull request as ready for review August 28, 2026 11:43
Copilot AI lite review requested due to automatic review settings August 28, 2026 11:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds panic backtrace capture to Selene’s results stream and updates the build/test pipeline to support symbolization (via bundled LLVM tools and debug info emission), along with regenerated compiler fixtures/snapshots.

Changes:

  • Emit DEBUG:BACKTRACE:* entries to the results stream after user-program panics, enabling Python-side stack trace symbolization.
  • Add Rust backtrace/module-resolution support (cross-platform) and wire it into panic reporting.
  • Update wheel build environment (hugrenv/LLVM) and refresh test resources/snapshots to match regenerated compiler output.

Reviewed changes

Copilot reviewed 104 out of 840 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
selene-sim/rust/selene_instance/print.rs Emits backtrace entries into the output stream after reporting a panic.
selene-sim/rust/lib.rs Exposes the new backtrace module from the crate root.
selene-sim/rust/backtrace.rs New platform-specific module/address resolution used for symbolization.
selene-sim/python/tests/test_unparsed.py Extends panic assertions to require stack trace presence/metadata.
selene-sim/python/tests/snapshots/test_guppy/test_rng/rng Updated snapshot output for RNG test.
selene-sim/python/tests/snapshots/test_depolarising_error_model/test_2q_error/counts_p2q_50pc Updated depolarising error model snapshot (2q, 50%).
selene-sim/python/tests/snapshots/test_depolarising_error_model/test_2q_error/counts_p2q_25pc Updated depolarising error model snapshot (2q, 25%).
selene-sim/python/tests/snapshots/test_depolarising_error_model/test_2q_error/counts_p2q_1pc Updated depolarising error model snapshot (2q, 1%).
selene-sim/python/tests/snapshots/test_depolarising_error_model/test_2q_error/counts_p2q_100pc Updated depolarising error model snapshot (2q, 100%).
selene-sim/python/tests/snapshots/test_depolarising_error_model/test_1q_error/counts_p1q_50pc Updated depolarising error model snapshot (1q, 50%).
selene-sim/python/tests/snapshots/test_depolarising_error_model/test_1q_error/counts_p1q_25pc Updated depolarising error model snapshot (1q, 25%).
selene-sim/python/tests/snapshots/test_depolarising_error_model/test_1q_error/counts_p1q_1pc Updated depolarising error model snapshot (1q, 1%).
selene-sim/python/tests/snapshots/test_depolarising_error_model/test_1q_error/counts_p1q_100pc Updated depolarising error model snapshot (1q, 100%).
selene-sim/python/tests/resources/from_guppy/test_unparsed/test_panic_unparsed/panic_unparsed-sol-x86_64-windows-gnu.ll Regenerated LLVM IR fixture (panic_unparsed, sol, win x86_64).
selene-sim/python/tests/resources/from_guppy/test_unparsed/test_panic_unparsed/panic_unparsed-sol-x86_64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (panic_unparsed, sol, linux x86_64).
selene-sim/python/tests/resources/from_guppy/test_unparsed/test_panic_unparsed/panic_unparsed-sol-x86_64-apple-darwin.ll Regenerated LLVM IR fixture (panic_unparsed, sol, mac x86_64).
selene-sim/python/tests/resources/from_guppy/test_unparsed/test_panic_unparsed/panic_unparsed-sol-aarch64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (panic_unparsed, sol, linux aarch64).
selene-sim/python/tests/resources/from_guppy/test_unparsed/test_panic_unparsed/panic_unparsed-sol-aarch64-apple-darwin.ll Regenerated LLVM IR fixture (panic_unparsed, sol, mac aarch64).
selene-sim/python/tests/resources/from_guppy/test_unparsed/test_exit_unparsed/exit_unparsed-sol-x86_64-windows-gnu.ll Regenerated LLVM IR fixture (exit_unparsed, sol, win x86_64).
selene-sim/python/tests/resources/from_guppy/test_unparsed/test_exit_unparsed/exit_unparsed-sol-x86_64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (exit_unparsed, sol, linux x86_64).
selene-sim/python/tests/resources/from_guppy/test_unparsed/test_exit_unparsed/exit_unparsed-sol-x86_64-apple-darwin.ll Regenerated LLVM IR fixture (exit_unparsed, sol, mac x86_64).
selene-sim/python/tests/resources/from_guppy/test_unparsed/test_exit_unparsed/exit_unparsed-sol-aarch64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (exit_unparsed, sol, linux aarch64).
selene-sim/python/tests/resources/from_guppy/test_unparsed/test_exit_unparsed/exit_unparsed-sol-aarch64-apple-darwin.ll Regenerated LLVM IR fixture (exit_unparsed, sol, mac aarch64).
selene-sim/python/tests/resources/from_guppy/test_unparsed/test_corrupted_plugin_unparsed/corrupted_plugin-sol-x86_64-windows-gnu.ll Regenerated LLVM IR fixture (corrupted_plugin_unparsed, sol, win x86_64).
selene-sim/python/tests/resources/from_guppy/test_unparsed/test_corrupted_plugin_unparsed/corrupted_plugin-sol-x86_64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (corrupted_plugin_unparsed, sol, linux x86_64).
selene-sim/python/tests/resources/from_guppy/test_unparsed/test_corrupted_plugin_unparsed/corrupted_plugin-sol-x86_64-apple-darwin.ll Regenerated LLVM IR fixture (corrupted_plugin_unparsed, sol, mac x86_64).
selene-sim/python/tests/resources/from_guppy/test_unparsed/test_corrupted_plugin_unparsed/corrupted_plugin-sol-aarch64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (corrupted_plugin_unparsed, sol, linux aarch64).
selene-sim/python/tests/resources/from_guppy/test_unparsed/test_corrupted_plugin_unparsed/corrupted_plugin-sol-aarch64-apple-darwin.ll Regenerated LLVM IR fixture (corrupted_plugin_unparsed, sol, mac aarch64).
selene-sim/python/tests/resources/from_guppy/test_unparsed/test_corrupted_plugin_unparsed/corrupted_plugin-helios-x86_64-windows-gnu.ll Regenerated LLVM IR fixture (corrupted_plugin_unparsed, helios, win x86_64).
selene-sim/python/tests/resources/from_guppy/test_unparsed/test_corrupted_plugin_unparsed/corrupted_plugin-helios-x86_64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (corrupted_plugin_unparsed, helios, linux x86_64).
selene-sim/python/tests/resources/from_guppy/test_unparsed/test_corrupted_plugin_unparsed/corrupted_plugin-helios-x86_64-apple-darwin.ll Regenerated LLVM IR fixture (corrupted_plugin_unparsed, helios, mac x86_64).
selene-sim/python/tests/resources/from_guppy/test_unparsed/test_corrupted_plugin_unparsed/corrupted_plugin-helios-aarch64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (corrupted_plugin_unparsed, helios, linux aarch64).
selene-sim/python/tests/resources/from_guppy/test_unparsed/test_corrupted_plugin_unparsed/corrupted_plugin-helios-aarch64-apple-darwin.ll Regenerated LLVM IR fixture (corrupted_plugin_unparsed, helios, mac aarch64).
selene-sim/python/tests/resources/from_guppy/test_quantum_state/test_stim_gate_implementations_single_qubit[rz-sol]/stim_gate_implementation_rz.sha256 New/updated compiled-artifact hash fixture (stim gate impl, rz, sol).
selene-sim/python/tests/resources/from_guppy/test_quantum_state/test_stim_gate_implementations_single_qubit[rz-helios]/stim_gate_implementation_rz.sha256 New/updated compiled-artifact hash fixture (stim gate impl, rz, helios).
selene-sim/python/tests/resources/from_guppy/test_quantum_state/test_stim_gate_implementations_single_qubit[ry-sol]/stim_gate_implementation_ry.sha256 New/updated compiled-artifact hash fixture (stim gate impl, ry, sol).
selene-sim/python/tests/resources/from_guppy/test_quantum_state/test_stim_gate_implementations_single_qubit[ry-helios]/stim_gate_implementation_ry.sha256 New/updated compiled-artifact hash fixture (stim gate impl, ry, helios).
selene-sim/python/tests/resources/from_guppy/test_quantum_state/test_stim_gate_implementations_single_qubit[rx-sol]/stim_gate_implementation_rx.sha256 New/updated compiled-artifact hash fixture (stim gate impl, rx, sol).
selene-sim/python/tests/resources/from_guppy/test_quantum_state/test_stim_gate_implementations_single_qubit[rx-helios]/stim_gate_implementation_rx.sha256 New/updated compiled-artifact hash fixture (stim gate impl, rx, helios).
selene-sim/python/tests/resources/from_guppy/test_quantum_state/test_stim_gate_implementations_single_qubit_triples[sol]/stim_gate_implementation_triples.sha256 New/updated compiled-artifact hash fixture (triples, sol).
selene-sim/python/tests/resources/from_guppy/test_quantum_state/test_stim_gate_implementations_single_qubit_triples[helios]/stim_gate_implementation_triples.sha256 New/updated compiled-artifact hash fixture (triples, helios).
selene-sim/python/tests/resources/from_guppy/test_quantum_state/test_state_cleanup[True-StimPlugin]/array_state_cleanup.sha256 New/updated compiled-artifact hash fixture (state cleanup).
selene-sim/python/tests/resources/from_guppy/test_quantum_state/test_state_cleanup[True-QuestPlugin]/array_state_cleanup.sha256 New/updated compiled-artifact hash fixture (state cleanup).
selene-sim/python/tests/resources/from_guppy/test_quantum_state/test_state_cleanup[None-StimPlugin]/array_state_cleanup.sha256 New/updated compiled-artifact hash fixture (state cleanup).
selene-sim/python/tests/resources/from_guppy/test_quantum_state/test_state_cleanup[None-QuestPlugin]/array_state_cleanup.sha256 New/updated compiled-artifact hash fixture (state cleanup).
selene-sim/python/tests/resources/from_guppy/test_quantum_state/test_state_cleanup[False-StimPlugin]/array_state_cleanup.sha256 New/updated compiled-artifact hash fixture (state cleanup).
selene-sim/python/tests/resources/from_guppy/test_quantum_state/test_state_cleanup[False-QuestPlugin]/array_state_cleanup.sha256 New/updated compiled-artifact hash fixture (state cleanup).
selene-sim/python/tests/resources/from_guppy/test_quantum_state/test_qubit_ordering_state[StimPlugin]/qubit_ordering_state.sha256 New/updated compiled-artifact hash fixture (qubit ordering).
selene-sim/python/tests/resources/from_guppy/test_quantum_state/test_qubit_ordering_state[QuestPlugin]/qubit_ordering_state.sha256 New/updated compiled-artifact hash fixture (qubit ordering).
selene-sim/python/tests/resources/from_guppy/test_quantum_state/test_quantum_replay_state[1-StimPlugin]/quantum_replay_state.sha256 New/updated compiled-artifact hash fixture (quantum replay).
selene-sim/python/tests/resources/from_guppy/test_quantum_state/test_quantum_replay_state[1-QuestPlugin]/quantum_replay_state.sha256 New/updated compiled-artifact hash fixture (quantum replay).
selene-sim/python/tests/resources/from_guppy/test_quantum_state/test_quantum_replay_state[0-StimPlugin]/quantum_replay_state.sha256 New/updated compiled-artifact hash fixture (quantum replay).
selene-sim/python/tests/resources/from_guppy/test_quantum_state/test_quantum_replay_state[0-QuestPlugin]/quantum_replay_state.sha256 New/updated compiled-artifact hash fixture (quantum replay).
selene-sim/python/tests/resources/from_guppy/test_quantum_state/test_initial_state[StimPlugin]/initial_state.sha256 New/updated compiled-artifact hash fixture (initial state).
selene-sim/python/tests/resources/from_guppy/test_quantum_state/test_initial_state[QuestPlugin]/initial_state.sha256 New/updated compiled-artifact hash fixture (initial state).
selene-sim/python/tests/resources/from_guppy/test_quantum_state/test_array_subscript_state[StimPlugin]/array_subscript_state.sha256 New/updated compiled-artifact hash fixture (array subscript).
selene-sim/python/tests/resources/from_guppy/test_quantum_state/test_array_subscript_state[QuestPlugin]/array_subscript_state.sha256 New/updated compiled-artifact hash fixture (array subscript).
selene-sim/python/tests/resources/from_guppy/test_quantum_state/test_array_state[StimPlugin]/array_state.sha256 New/updated compiled-artifact hash fixture (array state).
selene-sim/python/tests/resources/from_guppy/test_quantum_state/test_array_state[QuestPlugin]/array_state.sha256 New/updated compiled-artifact hash fixture (array state).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_rng_advance/rng_advance-sol-x86_64-windows-gnu.ll Regenerated LLVM IR fixture (rng_advance, sol, win x86_64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_rng_advance/rng_advance-sol-x86_64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (rng_advance, sol, linux x86_64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_rng_advance/rng_advance-sol-x86_64-apple-darwin.ll Regenerated LLVM IR fixture (rng_advance, sol, mac x86_64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_rng_advance/rng_advance-sol-aarch64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (rng_advance, sol, linux aarch64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_rng_advance/rng_advance-sol-aarch64-apple-darwin.ll Regenerated LLVM IR fixture (rng_advance, sol, mac aarch64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_rng_advance/rng_advance-helios-x86_64-windows-gnu.ll Regenerated LLVM IR fixture (rng_advance, helios, win x86_64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_rng_advance/rng_advance-helios-x86_64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (rng_advance, helios, linux x86_64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_rng_advance/rng_advance-helios-x86_64-apple-darwin.ll Regenerated LLVM IR fixture (rng_advance, helios, mac x86_64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_rng_advance/rng_advance-helios-aarch64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (rng_advance, helios, linux aarch64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_rng_advance/rng_advance-helios-aarch64-apple-darwin.ll Regenerated LLVM IR fixture (rng_advance, helios, mac aarch64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_panic/panic-sol-x86_64-windows-gnu.ll Regenerated LLVM IR fixture (panic, sol, win x86_64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_panic/panic-sol-x86_64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (panic, sol, linux x86_64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_panic/panic-sol-x86_64-apple-darwin.ll Regenerated LLVM IR fixture (panic, sol, mac x86_64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_panic/panic-sol-aarch64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (panic, sol, linux aarch64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_panic/panic-sol-aarch64-apple-darwin.ll Regenerated LLVM IR fixture (panic, sol, mac aarch64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_panic/panic-helios-x86_64-windows-gnu.ll Regenerated LLVM IR fixture (panic, helios, win x86_64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_panic/panic-helios-aarch64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (panic, helios, linux aarch64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_panic/panic-helios-aarch64-apple-darwin.ll Regenerated LLVM IR fixture (panic, helios, mac aarch64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_no_results/no_results-sol-x86_64-windows-gnu.ll Regenerated LLVM IR fixture (no_results, sol, win x86_64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_no_results/no_results-sol-x86_64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (no_results, sol, linux x86_64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_no_results/no_results-sol-x86_64-apple-darwin.ll Regenerated LLVM IR fixture (no_results, sol, mac x86_64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_no_results/no_results-sol-aarch64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (no_results, sol, linux aarch64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_no_results/no_results-sol-aarch64-apple-darwin.ll Regenerated LLVM IR fixture (no_results, sol, mac aarch64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_no_results/no_results-helios-x86_64-windows-gnu.ll Regenerated LLVM IR fixture (no_results, helios, win x86_64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_no_results/no_results-helios-x86_64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (no_results, helios, linux x86_64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_no_results/no_results-helios-x86_64-apple-darwin.ll Regenerated LLVM IR fixture (no_results, helios, mac x86_64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_no_results/no_results-helios-aarch64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (no_results, helios, linux aarch64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_no_results/no_results-helios-aarch64-apple-darwin.ll Regenerated LLVM IR fixture (no_results, helios, mac aarch64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_exit/exit-sol-x86_64-windows-gnu.ll Regenerated LLVM IR fixture (exit, sol, win x86_64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_exit/exit-sol-x86_64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (exit, sol, linux x86_64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_exit/exit-sol-x86_64-apple-darwin.ll Regenerated LLVM IR fixture (exit, sol, mac x86_64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_exit/exit-sol-aarch64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (exit, sol, linux aarch64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_exit/exit-sol-aarch64-apple-darwin.ll Regenerated LLVM IR fixture (exit, sol, mac aarch64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_exit/exit-helios-x86_64-windows-gnu.ll Regenerated LLVM IR fixture (exit, helios, win x86_64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_exit/exit-helios-x86_64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (exit, helios, linux x86_64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_exit/exit-helios-x86_64-apple-darwin.ll Regenerated LLVM IR fixture (exit, helios, mac x86_64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_exit/exit-helios-aarch64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (exit, helios, linux aarch64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_exit/exit-helios-aarch64-apple-darwin.ll Regenerated LLVM IR fixture (exit, helios, mac aarch64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_corrupted_plugin/broken_plugin-sol-x86_64-windows-gnu.ll Regenerated LLVM IR fixture (broken_plugin, sol, win x86_64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_corrupted_plugin/broken_plugin-sol-x86_64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (broken_plugin, sol, linux x86_64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_corrupted_plugin/broken_plugin-sol-x86_64-apple-darwin.ll Regenerated LLVM IR fixture (broken_plugin, sol, mac x86_64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_corrupted_plugin/broken_plugin-sol-aarch64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (broken_plugin, sol, linux aarch64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_corrupted_plugin/broken_plugin-sol-aarch64-apple-darwin.ll Regenerated LLVM IR fixture (broken_plugin, sol, mac aarch64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_corrupted_plugin/broken_plugin-helios-x86_64-windows-gnu.ll Regenerated LLVM IR fixture (broken_plugin, helios, win x86_64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_corrupted_plugin/broken_plugin-helios-x86_64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (broken_plugin, helios, linux x86_64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_corrupted_plugin/broken_plugin-helios-x86_64-apple-darwin.ll Regenerated LLVM IR fixture (broken_plugin, helios, mac x86_64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_corrupted_plugin/broken_plugin-helios-aarch64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (broken_plugin, helios, linux aarch64).
selene-sim/python/tests/resources/from_guppy/test_guppy/test_corrupted_plugin/broken_plugin-helios-aarch64-apple-darwin.ll Regenerated LLVM IR fixture (broken_plugin, helios, mac aarch64).
selene-sim/python/tests/resources/from_guppy/test_debug/test_stim_gate_implementations_single_qubit[rz]/stim_gate_implementation_rz.sha256 Removed old debug hash fixture (rz).
selene-sim/python/tests/resources/from_guppy/test_debug/test_stim_gate_implementations_single_qubit[ry]/stim_gate_implementation_ry.sha256 Removed old debug hash fixture (ry).
selene-sim/python/tests/resources/from_guppy/test_debug/test_stim_gate_implementations_single_qubit[rx]/stim_gate_implementation_rx.sha256 Removed old debug hash fixture (rx).
selene-sim/python/tests/resources/from_guppy/test_debug/test_stim_gate_implementations_single_qubit_triples[sol]/stim_gate_implementation_triples.sha256 Removed old debug hash fixture (triples).
selene-sim/python/tests/resources/from_guppy/test_cleanup/test_file_deletion/file_deletion-sol-x86_64-windows-gnu.ll Regenerated LLVM IR fixture (file_deletion, sol, win x86_64).
selene-sim/python/tests/resources/from_guppy/test_cleanup/test_file_deletion/file_deletion-sol-x86_64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (file_deletion, sol, linux x86_64).
selene-sim/python/tests/resources/from_guppy/test_cleanup/test_file_deletion/file_deletion-sol-x86_64-apple-darwin.ll Regenerated LLVM IR fixture (file_deletion, sol, mac x86_64).
selene-sim/python/tests/resources/from_guppy/test_cleanup/test_file_deletion/file_deletion-sol-aarch64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (file_deletion, sol, linux aarch64).
selene-sim/python/tests/resources/from_guppy/test_cleanup/test_file_deletion/file_deletion-sol-aarch64-apple-darwin.ll Regenerated LLVM IR fixture (file_deletion, sol, mac aarch64).
selene-sim/python/tests/resources/from_guppy/test_cleanup/test_file_deletion/file_deletion-helios-x86_64-windows-gnu.ll Regenerated LLVM IR fixture (file_deletion, helios, win x86_64).
selene-sim/python/tests/resources/from_guppy/test_cleanup/test_file_deletion/file_deletion-helios-x86_64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (file_deletion, helios, linux x86_64).
selene-sim/python/tests/resources/from_guppy/test_cleanup/test_file_deletion/file_deletion-helios-x86_64-apple-darwin.ll Regenerated LLVM IR fixture (file_deletion, helios, mac x86_64).
selene-sim/python/tests/resources/from_guppy/test_cleanup/test_file_deletion/file_deletion-helios-aarch64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (file_deletion, helios, linux aarch64).
selene-sim/python/tests/resources/from_guppy/test_cleanup/test_file_deletion/file_deletion-helios-aarch64-apple-darwin.ll Regenerated LLVM IR fixture (file_deletion, helios, mac aarch64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config2]/strict_build_llvm_bc-sol-x86_64-windows-gnu.ll Regenerated LLVM IR fixture (strict build bc, sol, win x86_64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config2]/strict_build_llvm_bc-sol-x86_64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (strict build bc, sol, linux x86_64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config2]/strict_build_llvm_bc-sol-x86_64-apple-darwin.ll Regenerated LLVM IR fixture (strict build bc, sol, mac x86_64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config2]/strict_build_llvm_bc-sol-aarch64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (strict build bc, sol, linux aarch64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config2]/strict_build_llvm_bc-sol-aarch64-apple-darwin.ll Regenerated LLVM IR fixture (strict build bc, sol, mac aarch64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config2]/strict_build_llvm_bc-helios-x86_64-windows-gnu.ll Regenerated LLVM IR fixture (strict build bc, helios, win x86_64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config2]/strict_build_llvm_bc-helios-x86_64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (strict build bc, helios, linux x86_64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config2]/strict_build_llvm_bc-helios-x86_64-apple-darwin.ll Regenerated LLVM IR fixture (strict build bc, helios, mac x86_64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config2]/strict_build_llvm_bc-helios-aarch64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (strict build bc, helios, linux aarch64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config2]/strict_build_llvm_bc-helios-aarch64-apple-darwin.ll Regenerated LLVM IR fixture (strict build bc, helios, mac aarch64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config1]/strict_build_llvm_ir-sol-x86_64-windows-gnu.ll Regenerated LLVM IR fixture (strict build ir, sol, win x86_64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config1]/strict_build_llvm_ir-sol-x86_64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (strict build ir, sol, linux x86_64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config1]/strict_build_llvm_ir-sol-x86_64-apple-darwin.ll Regenerated LLVM IR fixture (strict build ir, sol, mac x86_64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config1]/strict_build_llvm_ir-sol-aarch64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (strict build ir, sol, linux aarch64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config1]/strict_build_llvm_ir-sol-aarch64-apple-darwin.ll Regenerated LLVM IR fixture (strict build ir, sol, mac aarch64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config1]/strict_build_llvm_ir-helios-x86_64-windows-gnu.ll Regenerated LLVM IR fixture (strict build ir, helios, win x86_64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config1]/strict_build_llvm_ir-helios-x86_64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (strict build ir, helios, linux x86_64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config1]/strict_build_llvm_ir-helios-x86_64-apple-darwin.ll Regenerated LLVM IR fixture (strict build ir, helios, mac x86_64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config1]/strict_build_llvm_ir-helios-aarch64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (strict build ir, helios, linux aarch64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config1]/strict_build_llvm_ir-helios-aarch64-apple-darwin.ll Regenerated LLVM IR fixture (strict build ir, helios, mac aarch64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config0]/strict_build_default-sol-x86_64-windows-gnu.ll Regenerated LLVM IR fixture (strict build default, sol, win x86_64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config0]/strict_build_default-sol-x86_64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (strict build default, sol, linux x86_64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config0]/strict_build_default-sol-x86_64-apple-darwin.ll Regenerated LLVM IR fixture (strict build default, sol, mac x86_64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config0]/strict_build_default-sol-aarch64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (strict build default, sol, linux aarch64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config0]/strict_build_default-sol-aarch64-apple-darwin.ll Regenerated LLVM IR fixture (strict build default, sol, mac aarch64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config0]/strict_build_default-helios-x86_64-windows-gnu.ll Regenerated LLVM IR fixture (strict build default, helios, win x86_64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config0]/strict_build_default-helios-x86_64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (strict build default, helios, linux x86_64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config0]/strict_build_default-helios-x86_64-apple-darwin.ll Regenerated LLVM IR fixture (strict build default, helios, mac x86_64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config0]/strict_build_default-helios-aarch64-unknown-linux-gnu.ll Regenerated LLVM IR fixture (strict build default, helios, linux aarch64).
selene-sim/python/tests/resources/from_guppy/test_build_validation/test_strict_builds_guppy[build_config0]/strict_build_default-helios-aarch64-apple-darwin.ll Regenerated LLVM IR fixture (strict build default, helios, mac aarch64).
selene-sim/python/tests/resources/from_guppy/test_backtrace/test_backtrace_sometimes_panic/panic.sha256 Added backtrace-related compiled-artifact hash fixture.
selene-sim/python/tests/resources/from_guppy/test_backtrace/test_backtrace_qalloc/panic.sha256 Added backtrace-related compiled-artifact hash fixture.
selene-sim/python/tests/resources/from_guppy/test_backtrace/test_backtrace_always_panic/panic.sha256 Added backtrace-related compiled-artifact hash fixture.
selene-sim/Cargo.toml Adds backtrace plus platform deps (libc/windows-sys) for module resolution.
selene-ext/interfaces/sol_qis/python/selene_sol_qis_plugin/build.py Passes emit_debug through to the HUGR→LLVM compiler based on build config.
selene-ext/interfaces/helios_qis/python/selene_helios_qis_plugin/build.py Passes emit_debug through to the HUGR→LLVM compiler based on build config.
pyproject.toml Updates cibuildwheel environment handling to incorporate hugrenv/LLVM paths.
hugrenv.nix Adds Nix helper for fetching/assembling hugrenv packages (e.g., LLVM).
hugrenv.lock Locks hugrenv version/hashes for fetched tool bundles.
devenv.nix Wires hugrenv into the dev shell PATH and environment variables.
.github/workflows/build_wheels.yml Installs hugrenv (LLVM) during wheel builds via a GitHub Action.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread selene-sim/rust/lib.rs
@@ -1,3 +1,4 @@
pub mod backtrace;
Comment on lines +32 to +47
let mut status = Ok(());
backtrace::trace(|frame| {
let ip = frame.ip() as u64;
if ip != 0 {
let pc = ip - 1;
let Some(module) = Module::from_program_counter(pc) else {
return true;
};
let tag = format!("DEBUG:BACKTRACE:{}", module.path.display());
if let Err(e) = self.print(&tag, module.address) {
status = Err(anyhow::anyhow!("Failed to emit debug trace: {:?}", e));
return false;
}
}
true
});

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not concerned about this at this point in time.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In particular, I have tried it with 10000-deep recursion and didn't notice any significant issue. It may be worthwhile doing in future, though we could equally handle it on the python side.

Comment thread pyproject.toml
Comment on lines +197 to +201
[tool.cibuildwheel.linux.environment]
PATH = "$PATH:$HOME/.cargo/bin:/host$HUGRENV_PATH"
HUGRENV_PATH = "/host$HUGRENV_PATH"
[tool.cibuildwheel.linux]
environment = { PATH = "$PATH:$HOME/.cargo/bin" }
environment-pass = ["HUGRENV_PATH"]
Comment on lines +113 to +116
- uses: quantinuum/hugrverse-env/install-hugrenv-action@main
with:
packages: "llvm"

@tatiana-s tatiana-s left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good to me, or at least I can't see any major issues just based on looking on code and so far haven't found further issues when testing with guppy. Mainly see comment on test on trying it without optimisation (I guess when using the selene interface directly instead of the guppy emulator interface it is on the user to make sure they are not optimising the HUGR before using debug mode).

# preserved in the stack trace.
#
# if this is every changed, run pytest --compile-guppy and change
# this test to assert the function_name is "always_panic".

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you compile guppy with_minimal_opt for this test and see if this makes you able to assert that the function_name is "always_panic" (it should)?

Comment thread conftest.py
""
if not emit_debug
else """
from guppylang_internals.debug_mode import turn_on_debug_mode

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once 1.1 is released you should be able to just pass debug_mode = True wherever you actually call compile instead of doing this but I guess for now this can't be changed

" is required for building. Please install it via pip."
)
ir = compile_to_llvm_ir(input_artifact.resource, platform="helios")
emit_debug = build_ctx.cfg.get("debug", False)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any particular reason one argument is debug and the other emit_debug?

@jake-arkinstall
jake-arkinstall merged commit 9f89a02 into 0.3-series Sep 4, 2026
11 checks passed
@jake-arkinstall
jake-arkinstall deleted the feat/debug_info_llvm branch September 4, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants