summaryrefslogtreecommitdiffstats
path: root/library/backtrace/crates/without_debuginfo
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /library/backtrace/crates/without_debuginfo
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/backtrace/crates/without_debuginfo')
-rw-r--r--library/backtrace/crates/without_debuginfo/Cargo.toml20
-rw-r--r--library/backtrace/crates/without_debuginfo/src/lib.rs1
-rw-r--r--library/backtrace/crates/without_debuginfo/tests/smoke.rs44
3 files changed, 65 insertions, 0 deletions
diff --git a/library/backtrace/crates/without_debuginfo/Cargo.toml b/library/backtrace/crates/without_debuginfo/Cargo.toml
new file mode 100644
index 000000000..19d76cbec
--- /dev/null
+++ b/library/backtrace/crates/without_debuginfo/Cargo.toml
@@ -0,0 +1,20 @@
+[package]
+name = "without_debuginfo"
+version = "0.1.0"
+authors = ["Alex Crichton <alex@alexcrichton.com>"]
+edition = "2018"
+
+[dependencies.backtrace]
+path = "../.."
+default-features = false
+features = ['std']
+
+[profile.dev]
+debug = false
+
+[profile.test]
+debug = false
+
+[features]
+libbacktrace = ['backtrace/libbacktrace']
+gimli-symbolize = ['backtrace/gimli-symbolize']
diff --git a/library/backtrace/crates/without_debuginfo/src/lib.rs b/library/backtrace/crates/without_debuginfo/src/lib.rs
new file mode 100644
index 000000000..65e2cc340
--- /dev/null
+++ b/library/backtrace/crates/without_debuginfo/src/lib.rs
@@ -0,0 +1 @@
+// intentionally blank
diff --git a/library/backtrace/crates/without_debuginfo/tests/smoke.rs b/library/backtrace/crates/without_debuginfo/tests/smoke.rs
new file mode 100644
index 000000000..5a0dfea15
--- /dev/null
+++ b/library/backtrace/crates/without_debuginfo/tests/smoke.rs
@@ -0,0 +1,44 @@
+#[test]
+fn all_frames_have_symbols() {
+ println!("{:?}", backtrace::Backtrace::new());
+
+ let mut missing_symbols = 0;
+ let mut has_symbols = 0;
+ backtrace::trace(|frame| {
+ let mut any = false;
+ backtrace::resolve_frame(frame, |sym| {
+ if sym.name().is_some() {
+ any = true;
+ }
+ });
+ if any {
+ has_symbols += 1;
+ } else if !frame.ip().is_null() {
+ missing_symbols += 1;
+ }
+ true
+ });
+
+ // FIXME(#346) currently on MinGW we can't symbolize kernel32.dll and other
+ // system libraries, which means we miss the last few symbols.
+ if cfg!(windows) && cfg!(target_env = "gnu") {
+ assert!(missing_symbols < has_symbols && has_symbols > 4);
+ } else {
+ assert_eq!(missing_symbols, 0);
+ }
+}
+
+#[test]
+fn all_frames_have_module_base_address() {
+ let mut missing_base_addresses = 0;
+ backtrace::trace(|frame| {
+ if frame.module_base_address().is_none() {
+ missing_base_addresses += 1;
+ }
+ true
+ });
+
+ if cfg!(windows) {
+ assert_eq!(missing_base_addresses, 0);
+ }
+}