blazesym_c/
inspect.rs

1use std::alloc::alloc;
2use std::alloc::dealloc;
3use std::alloc::Layout;
4use std::ffi::CStr;
5use std::ffi::CString;
6use std::ffi::OsStr;
7use std::ffi::OsString;
8use std::fmt::Debug;
9use std::mem;
10use std::mem::ManuallyDrop;
11use std::ops::Deref as _;
12use std::os::raw::c_char;
13use std::os::unix::ffi::OsStrExt as _;
14use std::os::unix::ffi::OsStringExt as _;
15use std::path::PathBuf;
16use std::ptr;
17
18#[cfg(doc)]
19use blazesym::inspect;
20use blazesym::inspect::source::Elf;
21use blazesym::inspect::source::Source;
22use blazesym::inspect::Inspector;
23use blazesym::inspect::SymInfo;
24use blazesym::Addr;
25use blazesym::SymType;
26
27use crate::blaze_err;
28#[cfg(doc)]
29use crate::blaze_err_last;
30use crate::from_cstr;
31use crate::set_last_err;
32use crate::util::slice_from_user_array;
33use crate::util::DynSize as _;
34
35
36/// C ABI compatible version of [`blazesym::inspect::Inspector`].
37pub type blaze_inspector = Inspector;
38
39
40/// An object representing an ELF inspection source.
41///
42/// C ABI compatible version of [`inspect::source::Elf`].
43#[repr(C)]
44#[derive(Debug)]
45pub struct blaze_inspect_elf_src {
46    /// The size of this object's type.
47    ///
48    /// Make sure to initialize it to `sizeof(<type>)`. This member is used to
49    /// ensure compatibility in the presence of member additions.
50    pub type_size: usize,
51    /// The path to the ELF file. This member is always present.
52    pub path: *const c_char,
53    /// Whether or not to consult debug symbols to satisfy the request
54    /// (if present).
55    pub debug_syms: bool,
56    /// Unused member available for future expansion. Must be initialized
57    /// to zero.
58    pub reserved: [u8; 23],
59}
60
61impl Default for blaze_inspect_elf_src {
62    fn default() -> Self {
63        Self {
64            type_size: mem::size_of::<Self>(),
65            path: ptr::null(),
66            debug_syms: false,
67            reserved: [0; 23],
68        }
69    }
70}
71
72#[cfg_attr(not(test), allow(unused))]
73impl blaze_inspect_elf_src {
74    fn from(other: Elf) -> ManuallyDrop<Self> {
75        let Elf {
76            path,
77            debug_syms,
78            _non_exhaustive: (),
79        } = other;
80
81        let slf = Self {
82            path: CString::new(path.into_os_string().into_vec())
83                .expect("encountered path with NUL bytes")
84                .into_raw(),
85            debug_syms,
86            ..Default::default()
87        };
88        ManuallyDrop::new(slf)
89    }
90
91    unsafe fn free(self) {
92        let Self {
93            type_size: _,
94            path,
95            debug_syms,
96            reserved: _,
97        } = self;
98
99        let _elf = Elf {
100            path: PathBuf::from(OsString::from_vec(
101                unsafe { CString::from_raw(path as *mut _) }.into_bytes(),
102            )),
103            debug_syms,
104            _non_exhaustive: (),
105        };
106    }
107}
108
109impl From<blaze_inspect_elf_src> for Elf {
110    fn from(other: blaze_inspect_elf_src) -> Self {
111        let blaze_inspect_elf_src {
112            type_size: _,
113            path,
114            debug_syms,
115            reserved: _,
116        } = other;
117
118        Self {
119            path: unsafe { from_cstr(path) },
120            debug_syms,
121            _non_exhaustive: (),
122        }
123    }
124}
125
126
127/// The type of a symbol.
128#[repr(transparent)]
129#[derive(Copy, Clone, Debug, PartialEq)]
130pub struct blaze_sym_type(u8);
131
132impl blaze_sym_type {
133    /// The symbol type is unspecified or unknown.
134    ///
135    /// In input contexts this variant can be used to encompass all
136    /// other variants (functions and variables), whereas in output
137    /// contexts it means that the type is not known.
138    pub const UNDEF: blaze_sym_type = blaze_sym_type(0);
139    /// The symbol is a function.
140    pub const FUNC: blaze_sym_type = blaze_sym_type(1);
141    /// The symbol is a variable.
142    pub const VAR: blaze_sym_type = blaze_sym_type(2);
143}
144
145impl From<SymType> for blaze_sym_type {
146    fn from(other: SymType) -> Self {
147        match other {
148            SymType::Undefined => blaze_sym_type::UNDEF,
149            SymType::Function => blaze_sym_type::FUNC,
150            SymType::Variable => blaze_sym_type::VAR,
151            _ => unreachable!(),
152        }
153    }
154}
155
156
157/// Information about a looked up symbol.
158#[repr(C)]
159#[derive(Debug)]
160pub struct blaze_sym_info {
161    /// See [`inspect::SymInfo::name`].
162    pub name: *const c_char,
163    /// See [`inspect::SymInfo::addr`].
164    pub addr: Addr,
165    /// See [`inspect::SymInfo::size`].
166    ///
167    /// If the symbol's size is not available, this member will be `-1`.
168    /// Note that some symbol sources may not distinguish between
169    /// "unknown" size and `0`. In that case the size will be reported
170    /// as `0` here as well.
171    pub size: isize,
172    /// See [`inspect::SymInfo::file_offset`].
173    pub file_offset: u64,
174    /// See [`inspect::SymInfo::module`].
175    pub module: *const c_char,
176    /// See [`inspect::SymInfo::sym_type`].
177    pub sym_type: blaze_sym_type,
178    /// Unused member available for future expansion.
179    pub reserved: [u8; 23],
180}
181
182
183/// Convert [`SymInfo`] objects to a C array.
184fn convert_syms_list_to_c(syms_list: Vec<Vec<SymInfo>>) -> *const *const blaze_sym_info {
185    let sym_cnt = syms_list.iter().map(|syms| syms.len() + 1).sum::<usize>();
186    let str_buf_sz = syms_list.c_str_size();
187
188    let array_sz = (mem::size_of::<*const u64>() * syms_list.len()).div_ceil(mem::size_of::<u64>())
189        * mem::size_of::<u64>();
190    let sym_buf_sz = mem::size_of::<blaze_sym_info>() * sym_cnt;
191    let buf_size = mem::size_of::<u64>() + array_sz + sym_buf_sz + str_buf_sz;
192    let buf = unsafe { alloc(Layout::from_size_align(buf_size, 8).unwrap()) };
193    if buf.is_null() {
194        return ptr::null()
195    }
196
197    unsafe { *buf.cast::<u64>() = buf_size as u64 };
198
199    let raw_buf = unsafe { buf.add(mem::size_of::<u64>()) };
200    let mut syms_ptr = raw_buf as *mut *mut blaze_sym_info;
201    let mut sym_ptr = unsafe { raw_buf.add(array_sz) } as *mut blaze_sym_info;
202    let mut str_ptr = unsafe { raw_buf.add(array_sz + sym_buf_sz) } as *mut c_char;
203
204    for syms in syms_list {
205        unsafe { *syms_ptr = sym_ptr };
206        for SymInfo {
207            name,
208            addr,
209            size,
210            sym_type,
211            file_offset,
212            module,
213            _non_exhaustive: (),
214        } in syms
215        {
216            let name_ptr = str_ptr.cast();
217            unsafe { ptr::copy_nonoverlapping(name.as_ptr().cast(), str_ptr, name.len()) };
218            str_ptr = unsafe { str_ptr.add(name.len()) };
219            unsafe { *str_ptr = 0 };
220            str_ptr = unsafe { str_ptr.add(1) };
221            let module = if let Some(fname) = module.as_ref() {
222                let fname = AsRef::<OsStr>::as_ref(fname.deref()).as_bytes();
223                let obj_fname_ptr = str_ptr;
224                unsafe { ptr::copy_nonoverlapping(fname.as_ptr().cast(), str_ptr, fname.len()) };
225                str_ptr = unsafe { str_ptr.add(fname.len()) };
226                unsafe { *str_ptr = 0 };
227                str_ptr = unsafe { str_ptr.add(1) };
228                obj_fname_ptr
229            } else {
230                ptr::null()
231            };
232
233            unsafe {
234                (*sym_ptr) = blaze_sym_info {
235                    name: name_ptr,
236                    addr,
237                    size: size
238                        .map(|size| isize::try_from(size).unwrap_or(isize::MAX))
239                        .unwrap_or(-1),
240                    sym_type: sym_type.into(),
241                    file_offset: file_offset.unwrap_or(0),
242                    module,
243                    reserved: [0; 23],
244                }
245            };
246            sym_ptr = unsafe { sym_ptr.add(1) };
247        }
248        unsafe {
249            (*sym_ptr) = blaze_sym_info {
250                name: ptr::null(),
251                addr: 0,
252                size: 0,
253                sym_type: blaze_sym_type::UNDEF,
254                file_offset: 0,
255                module: ptr::null(),
256                reserved: [0; 23],
257            }
258        };
259        sym_ptr = unsafe { sym_ptr.add(1) };
260
261        syms_ptr = unsafe { syms_ptr.add(1) };
262    }
263
264    raw_buf as *const *const blaze_sym_info
265}
266
267
268/// Lookup symbol information in an ELF file.
269///
270/// On success, returns an array with `name_cnt` elements. Each such element, in
271/// turn, is NULL terminated array comprised of each symbol found. The returned
272/// object should be released using [`blaze_inspect_syms_free`] once it is no
273/// longer needed.
274///
275/// On error, the function returns `NULL` and sets the thread's last error to
276/// indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
277/// error.
278///
279/// # Safety
280/// - `inspector` needs to point to an initialized [`blaze_inspector`] object
281/// - `src` needs to point to an initialized [`blaze_inspect_syms_elf`] object
282/// - `names` needs to be a valid pointer to `name_cnt` NUL terminated strings
283#[no_mangle]
284pub unsafe extern "C" fn blaze_inspect_syms_elf(
285    inspector: *const blaze_inspector,
286    src: *const blaze_inspect_elf_src,
287    names: *const *const c_char,
288    name_cnt: usize,
289) -> *const *const blaze_sym_info {
290    if !input_zeroed!(src, blaze_inspect_elf_src) {
291        let () = set_last_err(blaze_err::INVALID_INPUT);
292        return ptr::null()
293    }
294    let src = input_sanitize!(src, blaze_inspect_elf_src);
295
296    // SAFETY: The caller ensures that the pointer is valid.
297    let inspector = unsafe { &*inspector };
298    // SAFETY: The caller ensures that the pointer is valid.
299    let src = Source::Elf(Elf::from(src));
300    // SAFETY: The caller ensures that the pointer is valid and the count
301    //         matches.
302    let names = unsafe { slice_from_user_array(names, name_cnt) };
303    let names = names
304        .iter()
305        .map(|&p| {
306            // SAFETY: The caller ensures that the pointer is valid.
307            unsafe { CStr::from_ptr(p) }.to_str().unwrap()
308        })
309        .collect::<Vec<_>>();
310    let result = inspector.lookup(&src, &names);
311    match result {
312        Ok(syms) => {
313            let result = convert_syms_list_to_c(syms);
314            if result.is_null() {
315                let () = set_last_err(blaze_err::OUT_OF_MEMORY);
316            } else {
317                let () = set_last_err(blaze_err::OK);
318            }
319            result
320        }
321        Err(err) => {
322            let () = set_last_err(err.kind().into());
323            ptr::null()
324        }
325    }
326}
327
328
329/// Free an array returned by [`blaze_inspect_syms_elf`].
330///
331/// # Safety
332///
333/// The pointer must be returned by [`blaze_inspect_syms_elf`].
334#[no_mangle]
335pub unsafe extern "C" fn blaze_inspect_syms_free(syms: *const *const blaze_sym_info) {
336    if syms.is_null() {
337        return
338    }
339
340    let buf = unsafe { syms.byte_sub(mem::size_of::<u64>()).cast::<u8>().cast_mut() };
341    let size = unsafe { *buf.cast::<u64>() } as usize;
342    unsafe { dealloc(buf, Layout::from_size_align(size, 8).unwrap()) };
343}
344
345
346/// Create an instance of a blazesym inspector.
347///
348/// C ABI compatible version of [`blazesym::inspect::Inspector::new()`].
349/// Please refer to its documentation for the default configuration in
350/// use.
351///
352/// On success, the function creates a new [`blaze_inspector`] object
353/// and returns it. The resulting object should be released using
354/// [`blaze_inspector_free`] once it is no longer needed.
355///
356/// On error, the function returns `NULL` and sets the thread's last error to
357/// indicate the problem encountered. Use [`blaze_err_last`] to retrieve this
358/// error.
359#[no_mangle]
360pub extern "C" fn blaze_inspector_new() -> *mut blaze_inspector {
361    let inspector = Inspector::new();
362    let inspector_box = Box::new(inspector);
363    let () = set_last_err(blaze_err::OK);
364    Box::into_raw(inspector_box)
365}
366
367
368/// Free a blazesym inspector.
369///
370/// Release resources associated with a inspector as created by
371/// [`blaze_inspector_new`], for example.
372///
373/// # Safety
374/// The provided inspector should have been created by
375/// [`blaze_inspector_new`].
376#[no_mangle]
377pub unsafe extern "C" fn blaze_inspector_free(inspector: *mut blaze_inspector) {
378    if !inspector.is_null() {
379        // SAFETY: The caller needs to ensure that `inspector` is a
380        //         valid pointer.
381        drop(unsafe { Box::from_raw(inspector) });
382    }
383}
384
385
386#[cfg(test)]
387mod tests {
388    use super::*;
389
390    use std::mem::MaybeUninit;
391    use std::path::Path;
392    use std::ptr::addr_of;
393    use std::slice;
394
395    use test_log::test;
396    use test_tag::tag;
397
398    use crate::blaze_err_last;
399
400
401    /// Check that various types have expected sizes.
402    #[tag(miri)]
403    #[test]
404    #[cfg(target_pointer_width = "64")]
405    fn type_sizes() {
406        assert_eq!(mem::size_of::<blaze_inspect_elf_src>(), 40);
407        assert_eq!(mem::size_of::<blaze_sym_info>(), 64);
408    }
409
410    /// Exercise the `Debug` representation of various types.
411    #[tag(miri)]
412    #[test]
413    fn debug_repr() {
414        let elf = blaze_inspect_elf_src {
415            type_size: 24,
416            path: ptr::null(),
417            debug_syms: true,
418            reserved: [0; 23],
419        };
420        assert_eq!(
421            format!("{elf:?}"),
422            "blaze_inspect_elf_src { type_size: 24, path: 0x0, debug_syms: true, reserved: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }"
423        );
424
425        let info = blaze_sym_info {
426            name: ptr::null(),
427            addr: 42,
428            size: 1337,
429            file_offset: 31,
430            module: ptr::null(),
431            sym_type: blaze_sym_type::VAR,
432            reserved: [0; 23],
433        };
434        assert_eq!(
435            format!("{info:?}"),
436            "blaze_sym_info { name: 0x0, addr: 42, size: 1337, file_offset: 31, module: 0x0, sym_type: blaze_sym_type(2), reserved: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }"
437        );
438    }
439
440    /// Test that we can correctly validate zeroed "extensions" of a
441    /// struct.
442    #[tag(miri)]
443    #[test]
444    fn elf_src_validity() {
445        #[repr(C)]
446        struct elf_src_with_ext {
447            type_size: usize,
448            _path: *const c_char,
449            debug_syms: bool,
450            reserved: [u8; 23],
451            foobar: bool,
452            reserved2: [u8; 7],
453        }
454
455        assert!(mem::size_of::<blaze_inspect_elf_src>() < mem::size_of::<elf_src_with_ext>());
456
457        let mut src = MaybeUninit::<elf_src_with_ext>::uninit();
458        let () = unsafe {
459            ptr::write_bytes(
460                src.as_mut_ptr().cast::<u8>(),
461                0,
462                mem::size_of::<elf_src_with_ext>(),
463            )
464        };
465
466        let mut src = unsafe { src.assume_init() };
467        src.type_size = mem::size_of::<elf_src_with_ext>();
468        src.debug_syms = true;
469
470        let src_ptr = addr_of!(src).cast::<blaze_inspect_elf_src>();
471        assert!(input_zeroed!(src_ptr, blaze_inspect_elf_src));
472
473        src.reserved[0] = 1;
474        let src_ptr = addr_of!(src).cast::<blaze_inspect_elf_src>();
475        assert!(!input_zeroed!(src_ptr, blaze_inspect_elf_src));
476        src.reserved[0] = 0;
477
478        src.type_size = mem::size_of::<usize>() - 1;
479        let src_ptr = addr_of!(src).cast::<blaze_inspect_elf_src>();
480        assert!(!input_zeroed!(src_ptr, blaze_inspect_elf_src));
481        src.type_size = mem::size_of::<elf_src_with_ext>();
482
483        src.foobar = true;
484        let src_ptr = addr_of!(src).cast::<blaze_inspect_elf_src>();
485        assert!(!input_zeroed!(src_ptr, blaze_inspect_elf_src));
486    }
487
488    /// Check that we can properly convert a "syms list" into the corresponding
489    /// C representation.
490    #[tag(miri)]
491    #[test]
492    fn syms_list_conversion() {
493        fn test(syms: Vec<Vec<SymInfo>>) {
494            let copy = syms.clone();
495            let ptr = convert_syms_list_to_c(syms);
496            assert!(!ptr.is_null());
497
498            for (i, list) in copy.into_iter().enumerate() {
499                for (j, sym) in list.into_iter().enumerate() {
500                    let c_sym = unsafe { &(*(*ptr.add(i)).add(j)) };
501                    assert_eq!(
502                        unsafe { CStr::from_ptr(c_sym.name) }.to_bytes(),
503                        CString::new(sym.name.deref()).unwrap().to_bytes()
504                    );
505                    assert_eq!(c_sym.addr, sym.addr);
506                    assert_eq!(
507                        c_sym.size,
508                        sym.size
509                            .map(|size| isize::try_from(size).unwrap_or(isize::MAX))
510                            .unwrap_or(-1)
511                    );
512                    assert_eq!(c_sym.sym_type, blaze_sym_type::from(sym.sym_type));
513                    assert_eq!(Some(c_sym.file_offset), sym.file_offset);
514                    assert_eq!(
515                        unsafe { CStr::from_ptr(c_sym.module) }.to_bytes(),
516                        CString::new(sym.module.as_deref().unwrap().to_os_string().into_vec())
517                            .unwrap()
518                            .to_bytes()
519                    );
520                }
521            }
522
523            let () = unsafe { blaze_inspect_syms_free(ptr) };
524        }
525
526        // Test conversion of no symbols.
527        let syms = vec![];
528        test(syms);
529
530        // Test conversion with a single symbol.
531        let syms = vec![vec![SymInfo {
532            name: "sym1".into(),
533            addr: 0xdeadbeef,
534            size: Some(42),
535            sym_type: SymType::Function,
536            file_offset: Some(1337),
537            module: Some(OsStr::new("/tmp/foobar.so").into()),
538            _non_exhaustive: (),
539        }]];
540        test(syms);
541
542        // Test conversion of two symbols in one result.
543        let syms = vec![vec![
544            SymInfo {
545                name: "sym1".into(),
546                addr: 0xdeadbeef,
547                size: Some(42),
548                sym_type: SymType::Function,
549                file_offset: Some(1337),
550                module: Some(OsStr::new("/tmp/foobar.so").into()),
551                _non_exhaustive: (),
552            },
553            SymInfo {
554                name: "sym2".into(),
555                addr: 0xdeadbeef + 52,
556                size: Some(45),
557                sym_type: SymType::Undefined,
558                file_offset: Some(1338),
559                module: Some(OsStr::new("other.so").into()),
560                _non_exhaustive: (),
561            },
562        ]];
563        test(syms);
564
565        // Test conversion of two symbols spread over two results.
566        let syms = vec![
567            vec![SymInfo {
568                name: "sym1".into(),
569                addr: 0xdeadbeef,
570                size: Some(42),
571                sym_type: SymType::Function,
572                file_offset: Some(1337),
573                module: Some(OsStr::new("/tmp/foobar.so").into()),
574                _non_exhaustive: (),
575            }],
576            vec![SymInfo {
577                name: "sym2".into(),
578                addr: 0xdeadbeef + 52,
579                size: Some(45),
580                sym_type: SymType::Undefined,
581                file_offset: Some(1338),
582                module: Some(OsStr::new("other.so").into()),
583                _non_exhaustive: (),
584            }],
585        ];
586        test(syms);
587
588        // Test conversion of a `SymInfo` vector with many elements.
589        let sym = SymInfo {
590            name: "sym1".into(),
591            addr: 0xdeadbeef,
592            size: Some(42),
593            sym_type: SymType::Function,
594            file_offset: Some(1337),
595            module: Some(OsStr::new("/tmp/foobar.so").into()),
596            _non_exhaustive: (),
597        };
598        let syms = vec![(0..200).map(|_| sym.clone()).collect()];
599        test(syms);
600
601        // Test conversion of many `SymInfo` vectors.
602        let syms = (0..200).map(|_| vec![sym.clone()]).collect();
603        test(syms);
604    }
605
606    /// Make sure that we can create and free an inspector instance.
607    #[tag(miri)]
608    #[test]
609    fn inspector_creation() {
610        let inspector = blaze_inspector_new();
611        let () = unsafe { blaze_inspector_free(inspector) };
612    }
613
614    /// Check that `blaze_inspect_syms_elf` fails if the input source
615    /// does not have reserved fields set to zero.
616    #[test]
617    fn non_zero_reserved() {
618        let path = Path::new(&env!("CARGO_MANIFEST_DIR"))
619            .join("..")
620            .join("data")
621            .join("test-stable-addrs.bin");
622
623        let mut src = blaze_inspect_elf_src::from(Elf::new(path));
624        src.reserved[1] = 1;
625
626        let factorial = CString::new("factorial").unwrap();
627        let names = [factorial.as_ptr()];
628        let inspector = blaze_inspector_new();
629
630        let result =
631            unsafe { blaze_inspect_syms_elf(inspector, &*src, names.as_ptr(), names.len()) };
632        let () = unsafe { ManuallyDrop::into_inner(src).free() };
633        assert_eq!(result, ptr::null());
634        assert_eq!(blaze_err_last(), blaze_err::INVALID_INPUT);
635
636        let () = unsafe { blaze_inspector_free(inspector) };
637    }
638
639    /// Check that we see the expected error being reported when a source file
640    /// does not exist.
641    #[test]
642    fn non_present_file() {
643        let path = Path::new(&env!("CARGO_MANIFEST_DIR"))
644            .join("..")
645            .join("data")
646            .join("does-not-exist");
647
648        let src = blaze_inspect_elf_src::from(Elf::new(path));
649        let factorial = CString::new("factorial").unwrap();
650        let names = [factorial.as_ptr()];
651        let inspector = blaze_inspector_new();
652
653        let result =
654            unsafe { blaze_inspect_syms_elf(inspector, &*src, names.as_ptr(), names.len()) };
655        let () = unsafe { ManuallyDrop::into_inner(src).free() };
656        assert_eq!(result, ptr::null());
657        assert_eq!(blaze_err_last(), blaze_err::NOT_FOUND);
658
659        let () = unsafe { blaze_inspector_free(inspector) };
660    }
661
662    /// Make sure that we can lookup a function's address using DWARF
663    /// information.
664    #[test]
665    fn lookup_dwarf() {
666        let test_dwarf = Path::new(&env!("CARGO_MANIFEST_DIR"))
667            .join("..")
668            .join("data")
669            .join("test-stable-addrs-stripped-elf-with-dwarf.bin");
670
671        let src = blaze_inspect_elf_src::from(Elf::new(test_dwarf));
672        let factorial = CString::new("factorial").unwrap();
673        let names = [factorial.as_ptr()];
674
675        let inspector = blaze_inspector_new();
676        let result =
677            unsafe { blaze_inspect_syms_elf(inspector, &*src, names.as_ptr(), names.len()) };
678        let () = unsafe { ManuallyDrop::into_inner(src).free() };
679        assert!(!result.is_null());
680
681        let sym_infos = unsafe { slice::from_raw_parts(result, names.len()) };
682        let sym_info = unsafe { &*sym_infos[0] };
683        assert_eq!(
684            unsafe { CStr::from_ptr(sym_info.name) },
685            CStr::from_bytes_with_nul(b"factorial\0").unwrap()
686        );
687        assert_eq!(sym_info.addr, 0x2000200);
688
689        let () = unsafe { blaze_inspect_syms_free(result) };
690        let () = unsafe { blaze_inspector_free(inspector) };
691    }
692}