llmp debug added
This commit is contained in:
parent
711b54929a
commit
0ac48c2e0b
@ -35,6 +35,7 @@ std = [] # print, sharedmap, ... support
|
|||||||
anymapdbg = ["serde_json"] # uses serde_json to Debug the anymap trait. Disable for smaller footprint.
|
anymapdbg = ["serde_json"] # uses serde_json to Debug the anymap trait. Disable for smaller footprint.
|
||||||
derive = ["libafl_derive"] # provide derive(SerdeAny) macro.
|
derive = ["libafl_derive"] # provide derive(SerdeAny) macro.
|
||||||
llmp_small_maps = [] # reduces initial map size for llmp
|
llmp_small_maps = [] # reduces initial map size for llmp
|
||||||
|
llmp_debug = [] # Enables debug output for LLMP
|
||||||
|
|
||||||
[[example]]
|
[[example]]
|
||||||
name = "llmp_test"
|
name = "llmp_test"
|
||||||
@ -56,6 +57,8 @@ serde_json = { version = "1.0", optional = true, default-features = false, featu
|
|||||||
#TODO: for llmp brotli = { version = "3.3.0", default-features = false } # brotli compression
|
#TODO: for llmp brotli = { version = "3.3.0", default-features = false } # brotli compression
|
||||||
num_enum = "0.5.1"
|
num_enum = "0.5.1"
|
||||||
|
|
||||||
|
backtrace = "0.3" # for llmp_debug
|
||||||
|
|
||||||
[target.'cfg(unix)'.dependencies]
|
[target.'cfg(unix)'.dependencies]
|
||||||
libc = "0.2" # For (*nix) libc
|
libc = "0.2" # For (*nix) libc
|
||||||
nix = "0.20.0"
|
nix = "0.20.0"
|
||||||
|
@ -86,6 +86,9 @@ use std::os::unix::{
|
|||||||
{io::AsRawFd, prelude::RawFd},
|
{io::AsRawFd, prelude::RawFd},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(feature = "llmp_debug")]
|
||||||
|
use backtrace::Backtrace;
|
||||||
|
|
||||||
#[cfg(all(unix, feature = "std"))]
|
#[cfg(all(unix, feature = "std"))]
|
||||||
use uds::{UnixListenerExt, UnixSocketAddr, UnixStreamExt};
|
use uds::{UnixListenerExt, UnixSocketAddr, UnixStreamExt};
|
||||||
|
|
||||||
@ -785,6 +788,18 @@ where
|
|||||||
|
|
||||||
/// listener about it using a EOP message.
|
/// listener about it using a EOP message.
|
||||||
unsafe fn handle_out_eop(&mut self) -> Result<(), Error> {
|
unsafe fn handle_out_eop(&mut self) -> Result<(), Error> {
|
||||||
|
#[cfg(feature = "llmp_debug")]
|
||||||
|
{
|
||||||
|
let bt = Backtrace::new();
|
||||||
|
let shm = self.out_maps.last().unwrap();
|
||||||
|
println!(
|
||||||
|
"LLMP_DEBUG: End of page reached for map {} with len {}, sending EOP, bt: {:?}",
|
||||||
|
shm.shmem.shm_str(),
|
||||||
|
shm.shmem.map().len(),
|
||||||
|
bt
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
let old_map = self.out_maps.last_mut().unwrap().page_mut();
|
let old_map = self.out_maps.last_mut().unwrap().page_mut();
|
||||||
|
|
||||||
// Create a new shard page.
|
// Create a new shard page.
|
||||||
@ -1024,8 +1039,12 @@ where
|
|||||||
// Mark the new page save to unmap also (it's mapped by us, the broker now)
|
// Mark the new page save to unmap also (it's mapped by us, the broker now)
|
||||||
ptr::write_volatile(&mut (*page).save_to_unmap, 1);
|
ptr::write_volatile(&mut (*page).save_to_unmap, 1);
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "llmp_debug")]
|
||||||
dbg!("Got a new recv map", self.current_recv_map.shmem.shm_str());
|
println!(
|
||||||
|
"LLMP_DEBUG: Got a new recv map {} with len {:?}",
|
||||||
|
self.current_recv_map.shmem.shm_str(),
|
||||||
|
self.current_recv_map.shmem.map().len()
|
||||||
|
);
|
||||||
// After we mapped the new page, return the next message, if available
|
// After we mapped the new page, return the next message, if available
|
||||||
return self.recv();
|
return self.recv();
|
||||||
}
|
}
|
||||||
@ -1135,6 +1154,13 @@ where
|
|||||||
{
|
{
|
||||||
/// Creates a new page, initializing the passed shared mem struct
|
/// Creates a new page, initializing the passed shared mem struct
|
||||||
pub fn new(sender: u32, mut new_map: SH) -> Self {
|
pub fn new(sender: u32, mut new_map: SH) -> Self {
|
||||||
|
#[cfg(feature = "llmp_debug")]
|
||||||
|
println!(
|
||||||
|
"LLMP_DEBUG: Initializing map on {} with size {}",
|
||||||
|
new_map.shm_str(),
|
||||||
|
new_map.map().len()
|
||||||
|
);
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
_llmp_page_init(&mut new_map, sender, false);
|
_llmp_page_init(&mut new_map, sender, false);
|
||||||
}
|
}
|
||||||
@ -1143,6 +1169,17 @@ where
|
|||||||
|
|
||||||
/// Maps and wraps an existing
|
/// Maps and wraps an existing
|
||||||
pub fn existing(existing_map: SH) -> Self {
|
pub fn existing(existing_map: SH) -> Self {
|
||||||
|
#[cfg(feature = "llmp_debug")]
|
||||||
|
{
|
||||||
|
let bt = Backtrace::new();
|
||||||
|
println!(
|
||||||
|
"LLMP_DEBUG: Using existing map {} with size {}, bt: {:?}",
|
||||||
|
existing_map.shm_str(),
|
||||||
|
existing_map.map().len(),
|
||||||
|
bt
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
let ret = Self {
|
let ret = Self {
|
||||||
shmem: existing_map,
|
shmem: existing_map,
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user