libafl_derive proc macro crate
This commit is contained in:
parent
868d408799
commit
f18af45d09
@ -8,7 +8,8 @@ debug = true
|
|||||||
[workspace]
|
[workspace]
|
||||||
members = [
|
members = [
|
||||||
"libafl",
|
"libafl",
|
||||||
|
"libafl_derive",
|
||||||
|
|
||||||
#example fuzzers
|
#example fuzzers
|
||||||
"fuzzers/libfuzzer_libpng",
|
"fuzzers/libfuzzer_libpng",
|
||||||
]
|
]
|
||||||
|
@ -30,10 +30,11 @@ harness = false
|
|||||||
#debug = true
|
#debug = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["std", "anymapdbg"]
|
default = ["std", "anymapdbg", "derive"]
|
||||||
std = [] # print, sharedmap, ... support
|
std = [] # print, sharedmap, ... support
|
||||||
runtime = [] # a runtime for clang inmem-executor
|
runtime = [] # a runtime for clang inmem-executor
|
||||||
anymapdbg = [] # 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.
|
||||||
|
|
||||||
[[example]]
|
[[example]]
|
||||||
name = "llmp_test"
|
name = "llmp_test"
|
||||||
@ -49,8 +50,9 @@ serde = { version = "1.0", default-features = false, features = ["alloc"] } # se
|
|||||||
erased-serde = "0.3.12"
|
erased-serde = "0.3.12"
|
||||||
postcard = { version = "0.5.1", features = ["alloc"] } # no_std compatible serde serialization fromat
|
postcard = { version = "0.5.1", features = ["alloc"] } # no_std compatible serde serialization fromat
|
||||||
static_assertions = "1.1.0"
|
static_assertions = "1.1.0"
|
||||||
serde_json = { version = "1.0", default-features = false, features = ["alloc"] } # an easy way to debug print SerdeAnyMap
|
ctor = "*"
|
||||||
ctor = "0.1.3"
|
libafl_derive = { version = "*", optional = true, path = "../libafl_derive" }
|
||||||
|
serde_json = { version = "1.0", optional = true, default-features = false, features = ["alloc"] } # an easy way to debug print SerdeAnyMap
|
||||||
#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
|
||||||
|
|
||||||
[target.'cfg(unix)'.dependencies]
|
[target.'cfg(unix)'.dependencies]
|
||||||
|
@ -12,6 +12,15 @@ extern crate static_assertions;
|
|||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate ctor;
|
extern crate ctor;
|
||||||
|
|
||||||
|
// Re-export derive(SerdeAny)
|
||||||
|
#[cfg(feature = "libafl_derive")]
|
||||||
|
#[allow(unused_imports)]
|
||||||
|
#[macro_use]
|
||||||
|
extern crate libafl_derive;
|
||||||
|
#[cfg(feature = "libafl_derive")]
|
||||||
|
#[doc(hidden)]
|
||||||
|
pub use libafl_derive::*;
|
||||||
|
|
||||||
pub mod bolts;
|
pub mod bolts;
|
||||||
pub mod corpus;
|
pub mod corpus;
|
||||||
pub mod events;
|
pub mod events;
|
||||||
|
12
libafl_derive/Cargo.toml
Normal file
12
libafl_derive/Cargo.toml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[package]
|
||||||
|
name = "libafl_derive"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Andrea Fioraldi <andreafioraldi@gmail.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
proc-macro = true
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
syn = { version = "1", features = ["full", "extra-traits"] }
|
||||||
|
quote = "1"
|
12
libafl_derive/src/lib.rs
Normal file
12
libafl_derive/src/lib.rs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
extern crate proc_macro;
|
||||||
|
use proc_macro::TokenStream;
|
||||||
|
use quote::quote;
|
||||||
|
use syn::{parse_macro_input, DeriveInput};
|
||||||
|
|
||||||
|
#[proc_macro_derive(SerdeAny)]
|
||||||
|
pub fn libafl_serdeany_derive(input: TokenStream) -> TokenStream {
|
||||||
|
let name = parse_macro_input!(input as DeriveInput).ident;
|
||||||
|
TokenStream::from(quote! {
|
||||||
|
libafl::impl_serdeany!(#name);
|
||||||
|
})
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user