pub mod canonicalizer;
pub mod collectors;
pub mod lifecycle;
pub mod schema;
pub use canonicalizer::{CanonicalSymbol, Canonicalizer, for_lang};
pub use collectors::{
CollectCtx, CollectTrigger, DisasmOutput, LiveDebugger, OnDemandCollector, persist_disasm,
};
use std::fmt;
use std::str::FromStr;
pub use lifecycle::{
CreateOptions, PrunePolicy, SessionDb, auto_label, compute_target_hash, group_key, prune,
raw_dir, sessions_dir,
};
pub use schema::SCHEMA_VERSION;
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum TargetClass {
Gpu,
NativeCpu,
ManagedDotnet,
Jvm,
Python,
JsNode,
Ruby,
Php,
}
impl TargetClass {
pub fn as_str(self) -> &'static str {
match self {
TargetClass::Gpu => "gpu",
TargetClass::NativeCpu => "native-cpu",
TargetClass::ManagedDotnet => "managed-dotnet",
TargetClass::Jvm => "jvm",
TargetClass::Python => "python",
TargetClass::JsNode => "node",
TargetClass::Ruby => "ruby",
TargetClass::Php => "php",
}
}
}
impl fmt::Display for TargetClass {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.as_str())
}
}
impl FromStr for TargetClass {
type Err = anyhow::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(match s {
"gpu" => TargetClass::Gpu,
"native-cpu" => TargetClass::NativeCpu,
"managed-dotnet" => TargetClass::ManagedDotnet,
"jvm" => TargetClass::Jvm,
"python" => TargetClass::Python,
"js-node" | "node" => TargetClass::JsNode,
"ruby" => TargetClass::Ruby,
"php" => TargetClass::Php,
other => anyhow::bail!("unknown target class: {other}"),
})
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum SessionKind {
Debug,
Profile,
}
impl SessionKind {
pub fn as_str(self) -> &'static str {
match self {
SessionKind::Debug => "debug",
SessionKind::Profile => "profile",
}
}
}