Exemplo
addr2line 0.25.1: Loader
Amostra verificada para cargo addr2line 0.25.1: Loader. O contrato rodou em rust 1 · linux alpine/x64 · docker e passou: Loader::new loads DWARF and symbol…
sha256:9d5a6a227911fdb5646f3bdd5d6cd4ca2b73ee43d175c3065130d233192636ed
Esta rede oferece uma coisa: uma amostra que compila. Ela a executou em um sandbox e guardou o recibo assinado. Não classifica nem garante nada — se o mesmo código compila onde você está, ela não mediu.
Quantas chaves de assinatura distintas enviaram um recibo de contrato aprovado. Uma é só o autor; mais de uma significa que outra pessoa também o compilou. Uma chave é gerada por conta própria e não tem identidade registrada por trás, então conta chaves, não pessoas.
MIT-0
Evidência de execução
O ambiente declarado e as execuções assinadas ficam separados, para você ver exatamente o que esta amostra executou e onde.
- Base da evidência
- Contrato assinado aprovado
- Recibos de verificação
- 1
- Chaves de assinatura que o compilaram
- 1
Ambiente declarado
linux x64 cargo
Ambientes das execuções de verificação
| Ambiente | Contrato | Etapas | Execução |
|---|---|---|---|
| rust 1 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · cargo@1rust:1-alpine@sha256:a10e64dd139b… |
2026-10-19 |
Caso
HOW- Objetivo
- verify Loader in pkg:cargo/addr2line@0.25.1
- Pacotes
- Símbolos
-
- Loader
- Criado
- 2026-10-19T21:54:25Z
Contrato
- Loader::new loads DWARF and symbol information from an executable path and returns a Loader
- Loader::new_with_sup loads an executable path with an optional supplementary object file path
- Loader::relative_address_base returns the base address used for relative virtual addresses
- Loader::get_section_range returns the virtual address Range of a named section such as b".text"
- Loader::find_symbol and Loader::find_symbol_info resolve symbol names and addresses from the loaded symbol table
- Loader::find_location, Loader::find_location_range, and Loader::find_frames resolve source locations and function frames for probe addresses
Arquivos
- Cargo.lock
- Cargo.toml
- PROMPT.md
- csx.json
- spec.json
- src/main.rs
- tests/contract.rs
Código-fonte
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "addr2line"
version = "0.25.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b"
dependencies = [
"cpp_demangle",
"fallible-iterator",
"gimli",
"memmap2",
"object",
"rustc-demangle",
"smallvec",
"typed-arena",
]
[[package]]
name = "adler2"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa"
[[package]]
name = "cfg-if"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
[[package]]
name = "cpp_demangle"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2bb79cb74d735044c972aae58ed0aaa9a837e85b01106a54c39e42e97f62253"
dependencies = [
"cfg-if",
]
[[package]]
name = "crc32fast"
version = "1.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01a7799fd6b852db0e61728dde9a204c423b44d689dbd432522543614b490e78"
dependencies = [
"cfg-if",
]
[[package]]
name = "fallible-iterator"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649"
[[package]]
name = "flate2"
version = "1.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e634e2e0ebac1ee034020da1ca582e17ffe4e0f5e985823721e168928136dcb"
dependencies = [
"crc32fast",
"miniz_oxide",
"zlib-rs",
]
[[package]]
name = "gimli"
version = "0.32.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7"
dependencies = [
"fallible-iterator",
"stable_deref_trait",
]
[[package]]
name = "libc"
version = "0.2.191"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
[[package]]
name = "memchr"
version = "2.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98"
[[package]]
name = "memmap2"
version = "0.9.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d1219ed1b7f229ee7104d281dd01d6802fe28bb6e95d292942c4daacdeb798c0"
dependencies = [
"libc",
]
[[package]]
name = "miniz_oxide"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c"
dependencies = [
"adler2",
"simd-adler32",
]
[[package]]
name = "object"
version = "0.37.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe"
dependencies = [
"flate2",
"memchr",
"ruzstd",
]
[[package]]
name = "rustc-demangle"
version = "0.1.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b74b56ffa8bb2830709a538c2cbcae9aa062db0d2a42563bfb09bdaae44020eb"
[[package]]
name = "ruzstd"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7c1c839d570d835527c9a5e4db7cb2198683a988cb9d7293fc8674e6bd58fc8"
dependencies = [
"twox-hash",
]
[[package]]
name = "sample"
version = "0.1.0"
dependencies = [
"addr2line",
]
[[package]]
name = "simd-adler32"
version = "0.3.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea"
[[package]]
name = "smallvec"
version = "1.16.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b3dc8af474f516a851ff4bd12db780f948b9250ad37211e4eec0bccea54e01b"
[[package]]
name = "stable_deref_trait"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596"
[[package]]
name = "twox-hash"
version = "2.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86a801b3cea342a06d468c8710662aa29e5e05e4f5c0d62f00bbb7f2ad7941c2"
[[package]]
name = "typed-arena"
version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a"
[[package]]
name = "zlib-rs"
version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112"
[package]
name = "sample"
version = "0.1.0"
edition = "2021"
[dependencies]
addr2line = "=0.25.1"
Clean-room public code sample — generation instructions
Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.
A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.
Goal: verify Loader in pkg:cargo/addr2line@0.25.1
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:cargo/addr2line@0.25.1
Demonstrate these symbols/APIs:
- Loader
Rules:
- One focused purpose; the smallest project that proves the goal.
- Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
- Pin every dependency with a lockfile so resolution is reproducible.
- No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
- No personal names, emails, company names, or project identifiers of any kind.
- No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
- Keep it under 200 files and 256KB packed.
{"case":{"caseId":"case:sha256:0a1a5d4906201966979fa0d0ae41b1cb28c031334ab8c8bb844d90c74fb61309","contract":["Loader::new loads DWARF and symbol information from an executable path and returns a Loader","Loader::new_with_sup loads an executable path with an optional supplementary object file path","Loader::relative_address_base returns the base address used for relative virtual addresses","Loader::get_section_range returns the virtual address Range of a named section such as b\".text\"","Loader::find_symbol and Loader::find_symbol_info resolve symbol names and addresses from the loaded symbol table","Loader::find_location, Loader::find_location_range, and Loader::find_frames resolve source locations and function frames for probe addresses"],"goal":"verify Loader in pkg:cargo/addr2line@0.25.1","kind":"HOW","packages":["pkg:cargo/addr2line@0.25.1"],"schemaVersion":1,"symbols":["Loader"]},"contractCommand":["cargo","run","--offline"],"environment":{"arch":"x64","ecosystem":"cargo","os":"linux","packageManager":"cargo","schemaVersion":1},"license":"MIT-0","packages":["pkg:cargo/addr2line@0.25.1"],"schemaVersion":1,"subject":"pkg:cargo/addr2line@0.25.1","symbols":["Loader"],"verifierAdapter":"cargo@1"}
{
"schemaVersion": 1,
"goal": "verify Loader in pkg:cargo/addr2line@0.25.1",
"kind": "HOW",
"packages": [
"pkg:cargo/addr2line@0.25.1"
],
"symbols": [
"Loader"
]
}
use addr2line::Loader;
#[inline(never)]
pub fn target_probe_function() -> u64 {
std::hint::black_box(42)
}
fn main() {
let exe_path = std::env::current_exe().expect("failed to get current_exe");
let loader = Loader::new(&exe_path).expect("failed to create Loader");
// Verify Loader::new_with_sup with None supplementary file
let loader_sup = Loader::new_with_sup(&exe_path, None::<&std::path::Path>)
.expect("failed to create Loader with new_with_sup");
assert_eq!(
loader.relative_address_base(),
loader_sup.relative_address_base()
);
// Check section range for .text
let text_range = loader
.get_section_range(b".text")
.expect("expected .text section in executable");
assert!(text_range.begin < text_range.end);
// Ensure the function is linked and get a probe address inside .text
let val = target_probe_function();
assert_eq!(val, 42);
// Walk symbols or probe the text range start to verify symbol and location lookups
let probe_addr = text_range.begin;
let _ = loader.find_symbol(probe_addr);
let _ = loader.find_symbol_info(probe_addr);
// Probe a range within .text (capped to a small range for speed)
let range_end = (text_range.begin + 4096).min(text_range.end);
let mut loc_iter = loader
.find_location_range(text_range.begin, range_end)
.expect("find_location_range failed");
// Also find a valid location or frame in .text
let mut found_location = false;
let mut found_symbol = false;
let mut addr = text_range.begin;
while addr < text_range.end {
if let Some(sym) = loader.find_symbol_info(addr) {
if !sym.name().is_empty() && sym.address() <= addr {
found_symbol = true;
}
if sym.name().contains("target_probe_function") {
if let Ok(Some(loc)) = loader.find_location(addr) {
if loc.file.is_some() && loc.line.is_some() {
found_location = true;
}
}
let mut frames = loader.find_frames(addr).expect("find_frames failed");
if let Ok(Some(_frame)) = frames.next() {
found_location = true;
}
break;
}
}
addr += 16;
}
if !found_location {
if let Some((probe, _len, loc)) = loc_iter.next() {
if loc.file.is_some() {
found_location = true;
}
let _ = loader.find_location(probe).expect("find_location failed");
let mut frames = loader.find_frames(probe).expect("find_frames failed");
let _ = frames.next().expect("FrameIter::next failed");
}
}
assert!(found_symbol, "expected to find at least one symbol in .text");
assert!(found_location, "expected to resolve debug location in .text");
// Verify Loader::new returns Err for a non-existent path
assert!(Loader::new("non_existent_binary_file.bin").is_err());
println!("Loader verification passed");
}
use addr2line::Loader;
#[inline(never)]
pub fn target_probe_function() -> u64 {
std::hint::black_box(42)
}
#[test]
fn test_loader_contract() {
let exe_path = std::env::current_exe().expect("failed to get current_exe");
let loader = Loader::new(&exe_path).expect("failed to create Loader");
let loader_sup = Loader::new_with_sup(&exe_path, None::<&std::path::Path>)
.expect("failed to create Loader with new_with_sup");
assert_eq!(
loader.relative_address_base(),
loader_sup.relative_address_base()
);
let text_range = loader
.get_section_range(b".text")
.expect("expected .text section in executable");
assert!(text_range.begin < text_range.end);
assert_eq!(target_probe_function(), 42);
let range_end = (text_range.begin + 4096).min(text_range.end);
let mut loc_iter = loader
.find_location_range(text_range.begin, range_end)
.expect("find_location_range failed");
let _ = loc_iter.next();
let mut found_symbol = false;
let mut addr = text_range.begin;
while addr < text_range.end {
if let Some(sym) = loader.find_symbol_info(addr) {
if !sym.name().is_empty() && sym.address() <= addr {
found_symbol = true;
let _ = loader.find_symbol(addr);
let _ = loader.find_location(addr).expect("find_location failed");
let mut frames = loader.find_frames(addr).expect("find_frames failed");
let _ = frames.next().expect("FrameIter::next failed");
break;
}
}
addr += 16;
}
assert!(found_symbol, "expected to find at least one symbol in .text");
assert!(Loader::new("non_existent_binary_file.bin").is_err());
}
Seeder de origem
anônimo