1mod debuginfo;
2
3use clap::{Subcommand, ValueEnum};
4
5#[derive(Debug, Subcommand)]
7#[command(name = "debuginfo", rename_all = "kebab-case")]
8pub enum Dump {
9 DebugInfo(debuginfo::Config),
11}
12
13#[derive(Debug, Clone, Copy, ValueEnum)]
15pub enum Section {
16 Strings,
18 Types,
20 Files,
22 Functions,
24 Variables,
26 Locations,
28}
29
30#[derive(Debug, thiserror::Error)]
31pub enum DumpError {
32 #[error("failed to read file: {0}")]
33 Io(#[from] std::io::Error),
34 #[error("failed to parse package: {0}")]
35 Parse(String),
36 #[error("no debug_info section found in package")]
37 NoDebugInfo,
38}
39
40impl From<miden_core::serde::DeserializationError> for DumpError {
41 #[inline]
42 fn from(err: miden_core::serde::DeserializationError) -> Self {
43 Self::Parse(err.to_string())
44 }
45}
46
47pub fn run(command: &Dump) -> Result<(), DumpError> {
48 match command {
49 Dump::DebugInfo(config) => debuginfo::dump(config),
50 }
51}