1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use crate::{CompiledModule, ProfilingAgent};
use anyhow::{bail, Result};

/// Interface for driving the creation of jitdump files
#[derive(Debug)]
pub struct JitDumpAgent {
    _private: (),
}

impl JitDumpAgent {
    /// Intialize a dummy JitDumpAgent that will fail upon instantiation.
    pub fn new() -> Result<Self> {
        if cfg!(feature = "jitdump") {
            bail!("jitdump is not supported on this platform");
        } else {
            bail!("jitdump support disabled at compile time");
        }
    }
}

impl ProfilingAgent for JitDumpAgent {
    fn module_load(&self, _module: &CompiledModule, _dbg_image: Option<&[u8]>) {}
    fn load_single_trampoline(
        &self,
        _name: &str,
        _addr: *const u8,
        _size: usize,
        __pid: u32,
        _tid: u32,
    ) {
    }
}