summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXusheng <xusheng@vector35.com>2021-09-21 19:17:35 +0800
committerXusheng <xusheng@vector35.com>2021-09-27 11:52:18 +0800
commitc7e33d35b4adef40e53619662c7a6cfc198efd4a (patch)
tree668f61f855615c1207eb48bb1b0e23a507e56a5a
parentf6d43d5eda8a1bbc95fc5467beb4cc9723b85682 (diff)
Better support for change type in linear view
-rw-r--r--basicblock.cpp1
-rw-r--r--binaryninjaapi.h4
-rw-r--r--binaryninjacore.h1
-rw-r--r--linearviewobject.cpp2
-rw-r--r--rust/src/disassembly.rs3
-rw-r--r--ui/linearview.h3
6 files changed, 11 insertions, 3 deletions
diff --git a/basicblock.cpp b/basicblock.cpp
index 1675afdf..6045f6ef 100644
--- a/basicblock.cpp
+++ b/basicblock.cpp
@@ -99,6 +99,7 @@ DisassemblyTextLine::DisassemblyTextLine()
typeInfo.hasTypeInfo = false;
typeInfo.fieldIndex = -1;
typeInfo.parentType = nullptr;
+ typeInfo.offset = 0;
}
diff --git a/binaryninjaapi.h b/binaryninjaapi.h
index bb104ef3..f3bea556 100644
--- a/binaryninjaapi.h
+++ b/binaryninjaapi.h
@@ -1364,6 +1364,10 @@ __attribute__ ((format (printf, 1, 2)))
bool hasTypeInfo;
BinaryNinja::Ref<BinaryNinja::Type> parentType;
size_t fieldIndex;
+ uint64_t offset;
+
+ DisassemblyTextLineTypeInfo(): hasTypeInfo(false), parentType(nullptr), fieldIndex(-1), offset(0)
+ {}
};
struct DisassemblyTextLine
diff --git a/binaryninjacore.h b/binaryninjacore.h
index 2b24423f..11120259 100644
--- a/binaryninjacore.h
+++ b/binaryninjacore.h
@@ -1734,6 +1734,7 @@ extern "C"
bool hasTypeInfo;
BNType* parentType;
size_t fieldIndex;
+ uint64_t offset;
};
struct BNDisassemblyTextLine
diff --git a/linearviewobject.cpp b/linearviewobject.cpp
index afd6d0c8..7bd41064 100644
--- a/linearviewobject.cpp
+++ b/linearviewobject.cpp
@@ -39,7 +39,7 @@ LinearDisassemblyLine LinearDisassemblyLine::FromAPIObject(BNLinearDisassemblyLi
result.contents.typeInfo.fieldIndex = line->contents.typeInfo.fieldIndex;
result.contents.typeInfo.parentType = line->contents.typeInfo.parentType ?
new Type(BNNewTypeReference(line->contents.typeInfo.parentType)) : nullptr;
-
+ result.contents.typeInfo.offset = line->contents.typeInfo.offset;
return result;
}
diff --git a/rust/src/disassembly.rs b/rust/src/disassembly.rs
index 2eb96680..c4ca2b33 100644
--- a/rust/src/disassembly.rs
+++ b/rust/src/disassembly.rs
@@ -128,6 +128,7 @@ impl From<Vec<InstructionTextToken>> for DisassemblyTextLine {
hasTypeInfo: false,
parentType: ptr::null_mut(),
fieldIndex: usize::MAX,
+ offset: 0
},
})
}
@@ -167,6 +168,7 @@ impl From<&Vec<&str>> for DisassemblyTextLine {
hasTypeInfo: false,
parentType: ptr::null_mut(),
fieldIndex: usize::MAX,
+ offset: 0
},
})
}
@@ -195,6 +197,7 @@ impl Default for DisassemblyTextLine {
hasTypeInfo: false,
parentType: ptr::null_mut(),
fieldIndex: usize::MAX,
+ offset: 0
},
})
}
diff --git a/ui/linearview.h b/ui/linearview.h
index f6191862..02f14b88 100644
--- a/ui/linearview.h
+++ b/ui/linearview.h
@@ -192,7 +192,6 @@ class BINARYNINJAUIAPI LinearView: public QAbstractScrollArea, public View, publ
StructureRef defineInnerStruct(TypeRef type, uint64_t offset, uint64_t size, std::set<TypeRef>& seen);
StructureRef defineInnerArray(TypeRef type, uint64_t offset, uint64_t size, std::set<TypeRef>& seen);
StructureRef defineInnerName(TypeRef type, uint64_t offset, uint64_t size, std::set<TypeRef>& seen);
- StructureRef defineInnerUnknownType(QWidget* parent, TypeRef type, uint64_t offset, uint64_t size, std::set<TypeRef>& seen);
StructureRef defineInnerIntegerSize(TypeRef type, uint64_t offset, uint64_t size, std::set<TypeRef>& seen);
StructureRef defineInnerSign(TypeRef type, uint64_t offset, uint64_t size, std::set<TypeRef>& seen);
TypeRef getPointerTypeAndName(ArchitectureRef arch, uint64_t addr, std::string& name);
@@ -266,7 +265,7 @@ private Q_SLOTS:
void toggleFloatSize();
void makePtr();
void makeString();
- void changeType();
+ void changeType(const UIActionContext& context);
void undefineVariable();
void displayAs(const UIActionContext& context, BNIntegerDisplayType displayType) override;
void createStructOrInferStructureType();