aboutsummaryrefslogtreecommitdiff
path: root/vendor/backtrace/examples/raw.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2024-07-19 15:37:58 +0300
committerValentin Popov <valentin@popov.link>2024-07-19 15:37:58 +0300
commita990de90fe41456a23e58bd087d2f107d321f3a1 (patch)
tree15afc392522a9e85dc3332235e311b7d39352ea9 /vendor/backtrace/examples/raw.rs
parent3d48cd3f81164bbfc1a755dc1d4a9a02f98c8ddd (diff)
downloadfparkan-a990de90fe41456a23e58bd087d2f107d321f3a1.tar.xz
fparkan-a990de90fe41456a23e58bd087d2f107d321f3a1.zip
Deleted vendor folder
Diffstat (limited to 'vendor/backtrace/examples/raw.rs')
-rw-r--r--vendor/backtrace/examples/raw.rs52
1 files changed, 0 insertions, 52 deletions
diff --git a/vendor/backtrace/examples/raw.rs b/vendor/backtrace/examples/raw.rs
deleted file mode 100644
index d96a127..0000000
--- a/vendor/backtrace/examples/raw.rs
+++ /dev/null
@@ -1,52 +0,0 @@
-fn main() {
- foo();
-}
-
-fn foo() {
- bar()
-}
-fn bar() {
- baz()
-}
-fn baz() {
- print()
-}
-
-#[cfg(target_pointer_width = "32")]
-const HEX_WIDTH: usize = 10;
-#[cfg(target_pointer_width = "64")]
-const HEX_WIDTH: usize = 20;
-
-fn print() {
- let mut cnt = 0;
- backtrace::trace(|frame| {
- let ip = frame.ip();
- print!("frame #{:<2} - {:#02$x}", cnt, ip as usize, HEX_WIDTH);
- cnt += 1;
-
- let mut resolved = false;
- backtrace::resolve(frame.ip(), |symbol| {
- if !resolved {
- resolved = true;
- } else {
- print!("{}", vec![" "; 7 + 2 + 3 + HEX_WIDTH].join(""));
- }
-
- if let Some(name) = symbol.name() {
- print!(" - {}", name);
- } else {
- print!(" - <unknown>");
- }
- if let Some(file) = symbol.filename() {
- if let Some(l) = symbol.lineno() {
- print!("\n{:13}{:4$}@ {}:{}", "", "", file.display(), l, HEX_WIDTH);
- }
- }
- println!("");
- });
- if !resolved {
- println!(" - <no info>");
- }
- true // keep going
- });
-}