Change "Commit Locals" to just commit names

This commit is contained in:
caheckman 2020-03-18 11:38:59 -04:00
parent 7dcc3447cc
commit b17957b176
2 changed files with 6 additions and 18 deletions

View file

@ -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);

View file

@ -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 " +