mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 08:11:33 +11:00
Make backtraces optional (#648)
You probably don't want backtraces if you're doing multiboot and in a few other cases. Also #646 broke the build if you didn't use the `testing` feature, so I've updated the `justfile` so that a CI run checks that agb builds correctly both without the `testing` feature and without the `backtrace` feature. The `backtrace` feature implies the testing feature to make things a bit simpler. - [x] Changelog updated
This commit is contained in:
commit
4243592f63
|
@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
- Added a new crash screen which provides a mechanism for seeing a full stack trace of your program when it panics.
|
- Added a new crash screen which provides a mechanism for seeing a full stack trace of your program when it panics.
|
||||||
This requires a change to your `.cargo/config.toml`. You must add the rust flag `"-Cforce-frame-pointers=yes"` to
|
This requires a change to your `.cargo/config.toml`. You must add the rust flag `"-Cforce-frame-pointers=yes"` to
|
||||||
your rustflags field.
|
your rustflags field. This can also be disabled by removing the `backtrace` feature.
|
||||||
- Initial unicode support for font rendering.
|
- Initial unicode support for font rendering.
|
||||||
- Kerning support for font rendering.
|
- Kerning support for font rendering.
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- Replaced `.show()` and `.hide()` with `.set_visible()`in `RegularMap`, `AffineMap` and `InfiniteScrolledMap`.
|
- Replaced `.show()` and `.hide()` with `.set_visible()`in `RegularMap`, `AffineMap` and `InfiniteScrolledMap`.
|
||||||
- Added `.into_inner()` to `InfiniteScrolledMap` to get the map back once you are done using it in the `InfiniteScrolledMap`.
|
- Added `.into_inner()` to `InfiniteScrolledMap` to get the map back once you are done using it in the `InfiniteScrolledMap`.
|
||||||
- Added `.hflip()`, `.vflip()`, `.priority()`, `.position()` to `ObjectUnmanaged` and `Object`.
|
- Added `.hflip()`, `.vflip()`, `.priority()`, `.position()` to `ObjectUnmanaged` and `Object`.
|
||||||
- An abstraction over hblank DMA to allow for cool effects like gradients and circular windows. See the dma_effect* examples.
|
- An abstraction over hblank DMA to allow for cool effects like gradients and circular windows. See the dma_effect\* examples.
|
||||||
- Expermental and incomplete support for MIDI files with agb-tracker.
|
- Expermental and incomplete support for MIDI files with agb-tracker.
|
||||||
- Fixnum now implements [`num::Num`](https://docs.rs/num/0.4/num/trait.Num.html) from the [`num`](https://crates.io/crates/num) crate.
|
- Fixnum now implements [`num::Num`](https://docs.rs/num/0.4/num/trait.Num.html) from the [`num`](https://crates.io/crates/num) crate.
|
||||||
- `Default` implementations for `RandomNumberGenerator`, `InitOnce` and `RawMutex`.
|
- `Default` implementations for `RandomNumberGenerator`, `InitOnce` and `RawMutex`.
|
||||||
|
|
|
@ -8,7 +8,8 @@ license = "MPL-2.0"
|
||||||
repository = "https://github.com/agbrs/agb"
|
repository = "https://github.com/agbrs/agb"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["testing"]
|
default = ["backtrace", "testing"]
|
||||||
|
backtrace = ["testing", "dep:qrcodegen-no-heap"]
|
||||||
testing = []
|
testing = []
|
||||||
multiboot = []
|
multiboot = []
|
||||||
|
|
||||||
|
@ -20,7 +21,7 @@ agb_macros = { version = "0.19.1", path = "../agb-macros" }
|
||||||
agb_fixnum = { version = "0.19.1", path = "../agb-fixnum" }
|
agb_fixnum = { version = "0.19.1", path = "../agb-fixnum" }
|
||||||
agb_hashmap = { version = "0.19.1", path = "../agb-hashmap" }
|
agb_hashmap = { version = "0.19.1", path = "../agb-hashmap" }
|
||||||
bilge = "0.2"
|
bilge = "0.2"
|
||||||
qrcodegen-no-heap = "1.8"
|
qrcodegen-no-heap = { version = "1.8", optional = true }
|
||||||
portable-atomic = { version = "1.6.0", default-features = false, features = ["unsafe-assume-single-core"] }
|
portable-atomic = { version = "1.6.0", default-features = false, features = ["unsafe-assume-single-core"] }
|
||||||
once_cell = { version = "1.19.0", default-features = false, features = ["critical-section"] }
|
once_cell = { version = "1.19.0", default-features = false, features = ["critical-section"] }
|
||||||
critical-section = { version = "1.1.2", features = ["restore-state-u16"] }
|
critical-section = { version = "1.1.2", features = ["restore-state-u16"] }
|
||||||
|
|
|
@ -150,6 +150,7 @@ extern crate alloc;
|
||||||
mod agb_alloc;
|
mod agb_alloc;
|
||||||
|
|
||||||
mod agbabi;
|
mod agbabi;
|
||||||
|
#[cfg(feature = "backtrace")]
|
||||||
mod backtrace;
|
mod backtrace;
|
||||||
mod bitarray;
|
mod bitarray;
|
||||||
/// Implements everything relating to things that are displayed on screen.
|
/// Implements everything relating to things that are displayed on screen.
|
||||||
|
@ -167,6 +168,7 @@ pub mod mgba;
|
||||||
pub use agb_fixnum as fixnum;
|
pub use agb_fixnum as fixnum;
|
||||||
/// Contains an implementation of a hashmap which suits the gameboy advance's hardware.
|
/// Contains an implementation of a hashmap which suits the gameboy advance's hardware.
|
||||||
pub use agb_hashmap as hash_map;
|
pub use agb_hashmap as hash_map;
|
||||||
|
#[cfg(feature = "backtrace")]
|
||||||
mod panics_render;
|
mod panics_render;
|
||||||
/// Simple random number generator
|
/// Simple random number generator
|
||||||
pub mod rng;
|
pub mod rng;
|
||||||
|
@ -201,10 +203,8 @@ pub use {agb_alloc::ExternalAllocator, agb_alloc::InternalAllocator};
|
||||||
#[panic_handler]
|
#[panic_handler]
|
||||||
#[allow(unused_must_use)]
|
#[allow(unused_must_use)]
|
||||||
fn panic_implementation(info: &core::panic::PanicInfo) -> ! {
|
fn panic_implementation(info: &core::panic::PanicInfo) -> ! {
|
||||||
use core::fmt::Write;
|
|
||||||
if let Some(mut mgba) = mgba::Mgba::new() {
|
if let Some(mut mgba) = mgba::Mgba::new() {
|
||||||
write!(mgba, "{}", info);
|
let _ = mgba.print(format_args!("{info}"), mgba::DebugLevel::Fatal);
|
||||||
mgba.set_level(mgba::DebugLevel::Fatal);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::empty_loop)]
|
#[allow(clippy::empty_loop)]
|
||||||
|
@ -296,8 +296,6 @@ impl Gba {
|
||||||
/// You can run the tests using `cargo test`, but it will work better through `mgba-test-runner` by
|
/// You can run the tests using `cargo test`, but it will work better through `mgba-test-runner` by
|
||||||
/// running something along the lines of `CARGO_TARGET_THUMBV4T_NONE_EABI_RUNNER=mgba-test-runner cargo test`.
|
/// running something along the lines of `CARGO_TARGET_THUMBV4T_NONE_EABI_RUNNER=mgba-test-runner cargo test`.
|
||||||
pub mod test_runner {
|
pub mod test_runner {
|
||||||
use self::panics_render::render_backtrace;
|
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
|
@ -327,13 +325,20 @@ pub mod test_runner {
|
||||||
|
|
||||||
#[panic_handler]
|
#[panic_handler]
|
||||||
fn panic_implementation(info: &core::panic::PanicInfo) -> ! {
|
fn panic_implementation(info: &core::panic::PanicInfo) -> ! {
|
||||||
|
#[cfg(feature = "backtrace")]
|
||||||
let frames = backtrace::unwind_exception();
|
let frames = backtrace::unwind_exception();
|
||||||
|
|
||||||
if let Some(mut mgba) = mgba::Mgba::new() {
|
if let Some(mut mgba) = mgba::Mgba::new() {
|
||||||
let _ = mgba.print(format_args!("[failed]"), mgba::DebugLevel::Error);
|
let _ = mgba.print(format_args!("[failed]"), mgba::DebugLevel::Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
render_backtrace(&frames, info);
|
#[cfg(feature = "backtrace")]
|
||||||
|
crate::panics_render::render_backtrace(&frames, info);
|
||||||
|
|
||||||
|
#[cfg(not(feature = "backtrace"))]
|
||||||
|
loop {
|
||||||
|
syscall::halt();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static mut TEST_GBA: Option<Gba> = None;
|
static mut TEST_GBA: Option<Gba> = None;
|
||||||
|
|
20
justfile
20
justfile
|
@ -4,18 +4,22 @@ CLIPPY_ARGUMENTS := "-Dwarnings -Dclippy::all -Aclippy::empty-loop"
|
||||||
build: build-roms
|
build: build-roms
|
||||||
|
|
||||||
build-debug:
|
build-debug:
|
||||||
just _build-debug agb
|
(cd agb && cargo build --no-default-features)
|
||||||
just _build-debug tracker/agb-tracker
|
(cd agb && cargo build --no-default-features --features=testing)
|
||||||
|
(cd agb && cargo build --examples --tests)
|
||||||
|
|
||||||
|
(cd tracker/agb-tracker && cargo build --examples --tests)
|
||||||
|
|
||||||
build-release:
|
build-release:
|
||||||
just _build-release agb
|
(cd agb && cargo build --examples --tests --release)
|
||||||
just _build-release tracker/agb-tracker
|
|
||||||
clippy:
|
clippy:
|
||||||
just _all-crates _clippy
|
just _all-crates _clippy
|
||||||
|
|
||||||
test:
|
test:
|
||||||
just _test-debug agb
|
just _test-debug agb
|
||||||
just _test-multiboot
|
|
||||||
just _test-debug tracker/agb-tracker
|
just _test-debug tracker/agb-tracker
|
||||||
|
just _test-multiboot
|
||||||
just _test-debug-arm agb
|
just _test-debug-arm agb
|
||||||
|
|
||||||
test-release:
|
test-release:
|
||||||
|
@ -162,17 +166,11 @@ _all-crates target:
|
||||||
just "{{target}}" "$PROJECT_DIR" || exit $?; \
|
just "{{target}}" "$PROJECT_DIR" || exit $?; \
|
||||||
done
|
done
|
||||||
|
|
||||||
_build-debug crate:
|
|
||||||
(cd "{{crate}}" && cargo build --examples --tests)
|
|
||||||
_build-release crate:
|
|
||||||
(cd "{{crate}}" && cargo build --release --examples --tests)
|
|
||||||
_test-release crate:
|
_test-release crate:
|
||||||
just _build-release {{crate}}
|
|
||||||
(cd "{{crate}}" && cargo test --release)
|
(cd "{{crate}}" && cargo test --release)
|
||||||
_test-release-arm crate:
|
_test-release-arm crate:
|
||||||
(cd "{{crate}}" && cargo test --release --target=armv4t-none-eabi)
|
(cd "{{crate}}" && cargo test --release --target=armv4t-none-eabi)
|
||||||
_test-debug crate:
|
_test-debug crate:
|
||||||
just _build-debug {{crate}}
|
|
||||||
(cd "{{crate}}" && cargo test)
|
(cd "{{crate}}" && cargo test)
|
||||||
_test-debug-arm crate:
|
_test-debug-arm crate:
|
||||||
(cd "{{crate}}" && cargo test --target=armv4t-none-eabi)
|
(cd "{{crate}}" && cargo test --target=armv4t-none-eabi)
|
||||||
|
|
Loading…
Reference in a new issue