summaryrefslogtreecommitdiff
path: root/plugins/warp/src/convert
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-08-26 23:59:38 -0400
committerMason Reed <mason@vector35.com>2025-10-01 21:38:39 -0400
commitede39aee7e00c40a43b67ca18dd8ab80ee863d85 (patch)
tree67c5eda347ece2282e3c888f38066b496e06dec8 /plugins/warp/src/convert
parenta1c46813e7f279aa4cfdb9dbb91c45b559ebeacd (diff)
[WARP] Enhanced network support
Diffstat (limited to 'plugins/warp/src/convert')
-rw-r--r--plugins/warp/src/convert/types.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/plugins/warp/src/convert/types.rs b/plugins/warp/src/convert/types.rs
index 1dfe5fa9..2401a039 100644
--- a/plugins/warp/src/convert/types.rs
+++ b/plugins/warp/src/convert/types.rs
@@ -279,9 +279,10 @@ pub fn to_bn_calling_convention<A: BNArchitecture>(
arch.get_default_calling_convention().unwrap()
}
-pub fn to_bn_type<A: BNArchitecture>(arch: &A, ty: &Type) -> BNRef<BNType> {
+// Always pass the architecture unless you know what you're doing!
+pub fn to_bn_type<A: BNArchitecture + Copy>(arch: Option<A>, ty: &Type) -> BNRef<BNType> {
let bits_to_bytes = |val: u64| (val / 8);
- let addr_size = arch.address_size() as u64;
+ let addr_size = arch.map(|a| a.address_size()).unwrap_or(8) as u64;
match &ty.class {
TypeClass::Void => BNType::void(),
TypeClass::Boolean(_) => BNType::bool(),
@@ -438,8 +439,8 @@ pub fn to_bn_type<A: BNArchitecture>(arch: &A, ty: &Type) -> BNRef<BNType> {
// TODO: Variable arguments
let variable_args = false;
// If we have a calling convention we run the extended function type creation.
- match c.calling_convention.as_ref() {
- Some(cc) => {
+ match (c.calling_convention.as_ref(), arch.as_ref()) {
+ (Some(cc), Some(arch)) => {
let calling_convention = to_bn_calling_convention(arch, cc);
BNType::function_with_opts(
&return_type,
@@ -449,7 +450,7 @@ pub fn to_bn_type<A: BNArchitecture>(arch: &A, ty: &Type) -> BNRef<BNType> {
BNConf::new(0, 0),
)
}
- None => BNType::function(&return_type, params, variable_args),
+ (_, _) => BNType::function(&return_type, params, variable_args),
}
}
TypeClass::Referrer(c) => {