dbg_cli/session_db/
mod.rs1pub mod canonicalizer;
15pub mod collectors;
16pub mod lifecycle;
17pub mod schema;
18
19pub use canonicalizer::{CanonicalSymbol, Canonicalizer, for_lang};
20pub use collectors::{
21 CollectCtx, CollectTrigger, DisasmOutput, LiveDebugger, OnDemandCollector, persist_disasm,
22};
23
24use std::fmt;
25use std::str::FromStr;
26
27pub use lifecycle::{
28 CreateOptions, PrunePolicy, SessionDb, auto_label, compute_target_hash, group_key, prune,
29 raw_dir, sessions_dir,
30};
31pub use schema::SCHEMA_VERSION;
32
33#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
36pub enum TargetClass {
37 Gpu,
39 NativeCpu,
41 ManagedDotnet,
43 Jvm,
45 Python,
47 JsNode,
49 Ruby,
51 Php,
53}
54
55impl TargetClass {
56 pub fn as_str(self) -> &'static str {
57 match self {
58 TargetClass::Gpu => "gpu",
59 TargetClass::NativeCpu => "native-cpu",
60 TargetClass::ManagedDotnet => "managed-dotnet",
61 TargetClass::Jvm => "jvm",
62 TargetClass::Python => "python",
63 TargetClass::JsNode => "node",
64 TargetClass::Ruby => "ruby",
65 TargetClass::Php => "php",
66 }
67 }
68}
69
70impl fmt::Display for TargetClass {
71 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
72 f.write_str(self.as_str())
73 }
74}
75
76impl FromStr for TargetClass {
77 type Err = anyhow::Error;
78 fn from_str(s: &str) -> Result<Self, Self::Err> {
79 Ok(match s {
80 "gpu" => TargetClass::Gpu,
81 "native-cpu" => TargetClass::NativeCpu,
82 "managed-dotnet" => TargetClass::ManagedDotnet,
83 "jvm" => TargetClass::Jvm,
84 "python" => TargetClass::Python,
85 "js-node" | "node" => TargetClass::JsNode,
87 "ruby" => TargetClass::Ruby,
88 "php" => TargetClass::Php,
89 other => anyhow::bail!("unknown target class: {other}"),
90 })
91 }
92}
93
94#[derive(Clone, Copy, Debug, PartialEq, Eq)]
97pub enum SessionKind {
98 Debug,
99 Profile,
100}
101
102impl SessionKind {
103 pub fn as_str(self) -> &'static str {
104 match self {
105 SessionKind::Debug => "debug",
106 SessionKind::Profile => "profile",
107 }
108 }
109}