mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 10:49:34 +02:00
Change "Commit Locals" to just commit names
This commit is contained in:
parent
7dcc3447cc
commit
b17957b176
2 changed files with 6 additions and 18 deletions
|
@ -26,9 +26,9 @@ public class CommitLocalsAction extends AbstractDecompilerAction {
|
||||||
|
|
||||||
public CommitLocalsAction() {
|
public CommitLocalsAction() {
|
||||||
super("Commit Locals");
|
super("Commit Locals");
|
||||||
setPopupMenuData(new MenuData(new String[] { "Commit Locals" }, "Commit"));
|
setPopupMenuData(new MenuData(new String[] { "Commit Local Names" }, "Commit"));
|
||||||
setDescription(
|
setDescription(
|
||||||
"Save Local variable definitions to Program, locking them into their current type definitions");
|
"Save Local variable names from Decompiler window to Program");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -42,10 +42,10 @@ public class CommitLocalsAction extends AbstractDecompilerAction {
|
||||||
@Override
|
@Override
|
||||||
protected void decompilerActionPerformed(DecompilerActionContext context) {
|
protected void decompilerActionPerformed(DecompilerActionContext context) {
|
||||||
Program program = context.getProgram();
|
Program program = context.getProgram();
|
||||||
int transaction = program.startTransaction("Commit Params/Return");
|
int transaction = program.startTransaction("Commit Local Names");
|
||||||
try {
|
try {
|
||||||
HighFunction hfunc = context.getHighFunction();
|
HighFunction hfunc = context.getHighFunction();
|
||||||
HighFunctionDBUtil.commitLocalsToDatabase(hfunc, SourceType.USER_DEFINED);
|
HighFunctionDBUtil.commitLocalNamesToDatabase(hfunc, SourceType.USER_DEFINED);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
program.endTransaction(transaction, true);
|
program.endTransaction(transaction, true);
|
||||||
|
|
|
@ -202,7 +202,7 @@ public class HighFunctionDBUtil {
|
||||||
* @param highFunction is the decompiler's model of the function
|
* @param highFunction is the decompiler's model of the function
|
||||||
* @param source is the desired SourceType for the commit
|
* @param source is the desired SourceType for the commit
|
||||||
*/
|
*/
|
||||||
public static void commitLocalsToDatabase(HighFunction highFunction, SourceType source) {
|
public static void commitLocalNamesToDatabase(HighFunction highFunction, SourceType source) {
|
||||||
|
|
||||||
Function function = highFunction.getFunction();
|
Function function = highFunction.getFunction();
|
||||||
|
|
||||||
|
@ -216,19 +216,7 @@ public class HighFunctionDBUtil {
|
||||||
}
|
}
|
||||||
String name = sym.getName();
|
String name = sym.getName();
|
||||||
try {
|
try {
|
||||||
Variable var =
|
HighFunctionDBUtil.updateDBVariable(sym, null, null, source);
|
||||||
clearConflictingLocalVariables(function, sym.getStorage(), sym.getPCAddress());
|
|
||||||
if (var == null) {
|
|
||||||
var = createLocalVariable(function, sym.getDataType(), sym.getStorage(),
|
|
||||||
sym.getPCAddress(), source);
|
|
||||||
if (name != null) {
|
|
||||||
var.setName(name, source);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var.setDataType(sym.getDataType(), sym.getStorage(), false, source);
|
|
||||||
var.setName(name, source);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (UsrException e) {
|
catch (UsrException e) {
|
||||||
Msg.error(HighFunctionDBUtil.class, "Local variable commit failed for " +
|
Msg.error(HighFunctionDBUtil.class, "Local variable commit failed for " +
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue