Skip to content

Ghidra is a software reverse engineering (SRE) framework

Corrected stack frame editor test issues and default favorite action enablement

ghidra146d267309daa
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/FavoritesAction.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/FavoritesAction.java
index a4d4f24c7b..c686e0b2b4 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/FavoritesAction.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/FavoritesAction.java
@@ -60,7 +60,8 @@ public class FavoritesAction extends CompositeEditorTableAction {
@Override
public void adjustEnablement() {
- // Do nothing since we always want it enabled so the user gets a "doesn't fit" message.
+ // we always want it enabled so the user gets a "doesn't fit" message.
+ setEnabled(true);
}
@Override
@@ -75,6 +76,6 @@ public class FavoritesAction extends CompositeEditorTableAction {
@Override
public boolean isAddToPopup(ActionContext context) {
- return super.isEnabledForContext(context);
+ return isEnabledForContext(context);
}
}
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/stackeditor/StackEditorModel.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/stackeditor/StackEditorModel.java
index 1cd7b7f990..d4417e963d 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/stackeditor/StackEditorModel.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/stackeditor/StackEditorModel.java
@@ -633,17 +633,18 @@ class StackEditorModel extends CompositeEditorModel {
newLength = compDt.getLength();
}
int offset = comp.getOffset();
- if (((StackFrameDataType) viewComposite).growsNegative()) {
- if (offset >= 0 && offset < getParameterOffset()) {
- return false;
- }
- }
- else {
- if (offset < 0 && offset > getParameterOffset()) {
- return false;
- }
-
- }
+// TODO: not sure we need to prevent creating local variables in 'save' area,
+// since doing so just leads to confusion when using stack frame editor
+// if (((StackFrameDataType) viewComposite).growsNegative()) {
+// if (offset >= 0 && offset < getParameterOffset()) {
+// return false;
+// }
+// }
+// else {
+// if (offset < 0 && offset > getParameterOffset()) {
+// return false;
+// }
+// }
int maxBytes = ((StackFrameDataType) viewComposite).getMaxLength(offset);
if (newLength > maxBytes) {
return false;
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/stackeditor/StackEditorActions4Test.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/stackeditor/StackEditorActions4Test.java
index 4475ebd414..a695cb8d14 100644
--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/stackeditor/StackEditorActions4Test.java
+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/stackeditor/StackEditorActions4Test.java
@@ -315,7 +315,7 @@ public class StackEditorActions4Test extends AbstractStackEditorTest {
assertEquals(0xa, getOffset(model.getNumComponents() - 1));
FavoritesAction fav = getFavorite("word");
- assertTrue(fav.isEnabled());
+ assertTrue(fav.isEnabledForContext(null)); // context not utilized
assertEquals("", model.getStatus());
invoke(fav);
assertEquals("", model.getStatus());