mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-06-02 07:19:38 +08:00
GP-1645 Added relative pointer action in the decompiler
This commit is contained in:
+4
@@ -812,6 +812,9 @@ public class DecompilerProvider extends NavigatableComponentProviderAdapter
|
|||||||
RetypeLocalAction retypeLocalAction = new RetypeLocalAction();
|
RetypeLocalAction retypeLocalAction = new RetypeLocalAction();
|
||||||
setGroupInfo(retypeLocalAction, variableGroup, subGroupPosition++);
|
setGroupInfo(retypeLocalAction, variableGroup, subGroupPosition++);
|
||||||
|
|
||||||
|
CreatePointerRelative createRelativeAction = new CreatePointerRelative();
|
||||||
|
setGroupInfo(createRelativeAction, variableGroup, subGroupPosition++);
|
||||||
|
|
||||||
RetypeGlobalAction retypeGlobalAction = new RetypeGlobalAction();
|
RetypeGlobalAction retypeGlobalAction = new RetypeGlobalAction();
|
||||||
setGroupInfo(retypeGlobalAction, variableGroup, subGroupPosition++);
|
setGroupInfo(retypeGlobalAction, variableGroup, subGroupPosition++);
|
||||||
|
|
||||||
@@ -991,6 +994,7 @@ public class DecompilerProvider extends NavigatableComponentProviderAdapter
|
|||||||
addLocalAction(setEquateAction);
|
addLocalAction(setEquateAction);
|
||||||
addLocalAction(removeEquateAction);
|
addLocalAction(removeEquateAction);
|
||||||
addLocalAction(retypeLocalAction);
|
addLocalAction(retypeLocalAction);
|
||||||
|
addLocalAction(createRelativeAction);
|
||||||
addLocalAction(retypeGlobalAction);
|
addLocalAction(retypeGlobalAction);
|
||||||
addLocalAction(retypeReturnAction);
|
addLocalAction(retypeReturnAction);
|
||||||
addLocalAction(retypeFieldAction);
|
addLocalAction(retypeFieldAction);
|
||||||
|
|||||||
+529
File diff suppressed because it is too large
Load Diff
+5
-1
@@ -59,7 +59,11 @@ public class RetypeLocalAction extends AbstractDecompilerAction {
|
|||||||
setKeyBindingData(new KeyBindingData(KeyEvent.VK_L, InputEvent.CTRL_DOWN_MASK));
|
setKeyBindingData(new KeyBindingData(KeyEvent.VK_L, InputEvent.CTRL_DOWN_MASK));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void retypeSymbol(Program program, HighSymbol highSymbol, Varnode exactSpot,
|
protected RetypeLocalAction(String name) {
|
||||||
|
super(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void retypeSymbol(Program program, HighSymbol highSymbol, Varnode exactSpot,
|
||||||
DataType dt, PluginTool tool) {
|
DataType dt, PluginTool tool) {
|
||||||
HighFunction hfunction = highSymbol.getHighFunction();
|
HighFunction hfunction = highSymbol.getHighFunction();
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -260,7 +260,7 @@ public class PcodeDataTypeManager {
|
|||||||
* @param offset is the offset into the base data-type
|
* @param offset is the offset into the base data-type
|
||||||
* @return the inner data-type
|
* @return the inner data-type
|
||||||
*/
|
*/
|
||||||
private DataType findSubType(DataType base, int offset) {
|
public static DataType findPointerRelativeInner(DataType base, int offset) {
|
||||||
if (base instanceof TypeDef) {
|
if (base instanceof TypeDef) {
|
||||||
base = ((TypeDef) base).getBaseDataType();
|
base = ((TypeDef) base).getBaseDataType();
|
||||||
}
|
}
|
||||||
@@ -297,7 +297,7 @@ public class PcodeDataTypeManager {
|
|||||||
}
|
}
|
||||||
resBuf.append(">\n");
|
resBuf.append(">\n");
|
||||||
DataType parent = pointer.getDataType();
|
DataType parent = pointer.getDataType();
|
||||||
DataType ptrto = findSubType(parent, (int) offset);
|
DataType ptrto = findPointerRelativeInner(parent, (int) offset);
|
||||||
buildTypeRef(resBuf, ptrto, 1);
|
buildTypeRef(resBuf, ptrto, 1);
|
||||||
buildTypeRef(resBuf, parent, 1);
|
buildTypeRef(resBuf, parent, 1);
|
||||||
resBuf.append("\n<off>").append(offset).append("</off>\n");
|
resBuf.append("\n<off>").append(offset).append("</off>\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user