pub const fn bytes<const N: usize>(s: &str) -> [u8; N] {
assert!(s.len() == N, "debuggable: entry length mismatch");
#[allow(unsafe_code)]
unsafe {
*(s.as_ptr() as *const [u8; N])
}
}
#[macro_export]
#[doc(hidden)]
macro_rules! __entry {
($ident:literal, $json_tail:literal) => {
const _: () = {
const TEXT: &str = ::core::concat!(
"\x04debuggable-v1-",
::core::module_path!(),
"::",
$ident,
"@",
::core::env!("CARGO_PKG_VERSION"),
"\nimport gdb\ngdb.__dict__.setdefault('_debuggable_q',[]).append((gdb.current_objfile(),r'''{\"v\":1,\"path\":\"",
::core::module_path!(),
"::",
$ident,
"\",",
$json_tail,
"'''))\ngetattr(gdb,'_debuggable_flush',lambda:None)()\n\0",
);
$crate::__entry_static!([u8; TEXT.len()], $crate::__private::bytes(TEXT));
};
};
}
#[cfg(all(not(debuggable_disable), unix, not(target_vendor = "apple"), not(target_os = "aix")))]
#[macro_export]
#[doc(hidden)]
macro_rules! __entry_static {
($ty:ty, $init:expr) => {
$crate::__entry_static_in!(".debug_gdb_scripts", $ty, $init);
};
}
#[cfg(all(not(debuggable_disable), target_vendor = "apple"))]
#[macro_export]
#[doc(hidden)]
macro_rules! __entry_static {
($ty:ty, $init:expr) => {
$crate::__entry_static_in!("__DATA,__debuggable", $ty, $init);
};
}
#[cfg(any(
debuggable_disable,
not(any(all(unix, not(target_os = "aix")), target_vendor = "apple"))
))]
#[macro_export]
#[doc(hidden)]
macro_rules! __entry_static {
($ty:ty, $init:expr) => {};
}
#[macro_export]
#[doc(hidden)]
macro_rules! __entry_static_in {
($section:literal, $ty:ty, $init:expr) => {
#[used]
#[link_section = $section]
static ENTRY: $ty = $init;
};
}
#[cfg(all(not(debuggable_disable), unix, not(target_vendor = "apple"), not(target_os = "aix")))]
mod gdb_runtime {
const TEXT: &str = concat!(
"\x04debuggable-runtime-gdb-v1.6\nimport zlib,base64;exec(zlib.decompress(base64.b64decode('",
include_str!("runtime/gdb.py.zb64"),
"')),{'__name__':'debuggable_runtime'})\n\0",
);
#[used]
#[allow(unsafe_code)] #[link_section = ".debug_gdb_scripts"]
static RUNTIME: [u8; TEXT.len()] = super::bytes(TEXT);
}