-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
147 additions
and
470 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,17 @@ | ||
use std::collections::HashMap; | ||
|
||
use crate::block::Block; | ||
use crate::symbolic_expression::SymbolicExpression; | ||
|
||
use uuid::Uuid; | ||
|
||
#[derive(Clone, PartialEq)] | ||
pub struct ByteInterval { | ||
pub uuid: Uuid, | ||
pub blocks: Vec<Block>, | ||
pub symbolic_expressions: HashMap<u64, SymbolicExpression>, | ||
pub has_address: bool, | ||
pub address: u64, | ||
pub size: u64, | ||
pub contents: Vec<u8>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +1,32 @@ | ||
#[derive(Clone, Copy, PartialEq)] | ||
pub struct EdgeLabel { | ||
pub conditional: bool, | ||
use uuid::Uuid; | ||
|
||
pub direct: bool, | ||
|
||
pub r#type: i32, | ||
#[derive(Clone, PartialEq)] | ||
pub struct Cfg { | ||
pub vertices: Vec<Vec<u8>>, | ||
pub edges: Vec<Edge>, | ||
} | ||
|
||
#[derive(Clone, PartialEq)] | ||
pub struct Edge { | ||
pub source_uuid: Vec<u8>, | ||
|
||
pub target_uuid: Vec<u8>, | ||
|
||
pub label: ::core::option::Option<EdgeLabel>, | ||
pub source_uuid: Uuid, | ||
pub target_uuid: Uuid, | ||
pub label: Option<EdgeLabel>, | ||
} | ||
#[derive(Clone, PartialEq)] | ||
pub struct Cfg { | ||
pub vertices: Vec<Vec<u8>>, | ||
|
||
pub edges: Vec<Edge>, | ||
#[derive(Clone, Copy, PartialEq)] | ||
pub struct EdgeLabel { | ||
pub conditional: bool, | ||
pub direct: bool, | ||
pub r#type: EdgeType, | ||
} | ||
|
||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)] | ||
#[repr(i32)] | ||
pub enum EdgeType { | ||
TypeBranch = 0, | ||
TypeCall = 1, | ||
TypeFallthrough = 2, | ||
TypeReturn = 3, | ||
TypeSyscall = 4, | ||
TypeSysret = 5, | ||
} | ||
impl EdgeType { | ||
/// String value of the enum field names used in the ProtoBuf definition. | ||
/// | ||
/// The values are not transformed in any way and thus are considered stable | ||
/// (if the ProtoBuf definition does not change) and safe for programmatic use. | ||
pub fn as_str_name(&self) -> &'static str { | ||
match self { | ||
Self::TypeBranch => "Type_Branch", | ||
Self::TypeCall => "Type_Call", | ||
Self::TypeFallthrough => "Type_Fallthrough", | ||
Self::TypeReturn => "Type_Return", | ||
Self::TypeSyscall => "Type_Syscall", | ||
Self::TypeSysret => "Type_Sysret", | ||
} | ||
} | ||
/// Creates an enum from field names used in the ProtoBuf definition. | ||
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> { | ||
match value { | ||
"Type_Branch" => Some(Self::TypeBranch), | ||
"Type_Call" => Some(Self::TypeCall), | ||
"Type_Fallthrough" => Some(Self::TypeFallthrough), | ||
"Type_Return" => Some(Self::TypeReturn), | ||
"Type_Syscall" => Some(Self::TypeSyscall), | ||
"Type_Sysret" => Some(Self::TypeSysret), | ||
_ => None, | ||
} | ||
} | ||
Branch, | ||
Call, | ||
Fallthrough, | ||
Return, | ||
Syscall, | ||
Sysret, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
#[derive(Clone, PartialEq)] | ||
pub struct Ir { | ||
pub uuid: Vec<u8>, | ||
use crate::auxdata::AuxData; | ||
use crate::cfg::Cfg; | ||
use crate::module::Module; | ||
|
||
pub modules: Vec<Module>, | ||
use std::collections::HashMap; | ||
|
||
pub aux_data: ::std::collections::HashMap<String, AuxData>, | ||
use uuid::Uuid; | ||
|
||
#[derive(Clone, PartialEq)] | ||
pub struct Ir { | ||
pub uuid: Uuid, | ||
pub modules: Vec<Module>, | ||
pub aux_data: HashMap<String, AuxData>, | ||
pub version: u32, | ||
|
||
pub cfg: ::core::option::Option<Cfg>, | ||
pub cfg: Option<Cfg>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.